diff --git a/.gitignore b/.gitignore index 4f0152028d..c2773bb5ad 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,9 @@ _infrastructure/tests/build *.iml *.js.map !*.js/ +!scripts/new-package.js +!scripts/not-needed.js +!scripts/lint.js node_modules @@ -37,3 +40,4 @@ node_modules .settings/launch.json .vscode +yarn.lock diff --git a/.travis.yml b/.travis.yml index 48704282ad..c8c468a417 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - 4 + - 6.9.2 sudo: false diff --git a/3d-bin-packing/3d-bin-packing.d.ts b/3d-bin-packing/index.d.ts similarity index 100% rename from 3d-bin-packing/3d-bin-packing.d.ts rename to 3d-bin-packing/index.d.ts diff --git a/3d-bin-packing/tsconfig.json b/3d-bin-packing/tsconfig.json index ddad71a1fe..21d0f342af 100644 --- a/3d-bin-packing/tsconfig.json +++ b/3d-bin-packing/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "3d-bin-packing.d.ts", + "index.d.ts", "3d-bin-packing-tests.ts" ] } \ No newline at end of file diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 44f0d8e9a0..1036be548d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -401,6 +401,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii) * [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000) * [:link:](ejs/ejs.d.ts) [ejs.js](http://ejs.co) by [Ben Liddicott](https://github.com/benliddicott/DefinitelyTyped) +* [:link:](ejson/ejson.d.ts) [ejson](https://www.npmjs.com/package/ejson) by [Shantanu Bhadoria](https://github.com/shantanubhadoria) * [:link:](elasticsearch/elasticsearch.d.ts) [elasticsearch](https://www.elastic.co) by [Casper Skydt](https://github.com/CasperSkydt/DefinitelyTyped), [Blake Smith](https://github.com/bfsmith/DefinitelyTyped) * [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan) * [:link:](github-electron/github-electron.d.ts) [Electron](http://electron.atom.io) by [jedmao](https://github.com/jedmao), [rhysd](https://rhysd.github.io), [Milan Burda](https://github.com/miniak) @@ -1189,7 +1190,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ng-stomp/ng-stomp.d.ts) [ngStomp](https://github.com/beevelop/ng-stomp) by [Lukasz Potapczuk](https://github.com/lpotapczuk) * [:link:](ngstorage/ngstorage.d.ts) [ngstorage](https://github.com/gsklee/ngStorage) by [Jakub Pistek](https://github.com/kubiq) * [:link:](nightmare/nightmare.d.ts) [Nightmare](https://github.com/segmentio/nightmare) by [horiuchi](https://github.com/horiuchi) -* [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook), [Hans Bakker](https://github.com/wind-rider) +* [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook), [Hans Bakker](https://github.com/wind-rider), [Shantanu Bhadoria](https://github.com/shantanubhadoria) * [:link:](nock/nock.d.ts) [nock](https://github.com/pgte/nock) by [bonnici](https://github.com/bonnici) * [:link:](node-imap/imap.d.ts) [node imap](https://github.com/mscdex/node-imap) by [Steve Fenton](https://github.com/Steve-Fenton) * [:link:](oauth2-server/oauth2-server.d.ts) [Node OAuth2 Server](https://github.com/thomseddon/node-oauth2-server) by [Robbie Van Gorkom](https://github.com/vangorra) @@ -1664,7 +1665,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](supertest/supertest.d.ts) [SuperTest](https://github.com/visionmedia/supertest) by [Alex Varju](https://github.com/varju) * [:link:](supertest-as-promised/supertest-as-promised.d.ts) [SuperTest as Promised](https://github.com/WhoopInc/supertest-as-promised) by [Tanguy Krotoff](https://github.com/tkrotoff) * [:link:](svg-injector/svg-injector.d.ts) [SVG Injector](https://github.com/iconic/SVGInjector) by [Patrick Westerhoff](https://github.com/poke) -* [:link:](svg-pan-zoom/svg-pan-zoom.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [Chintan Shah](https://github.com/Promact) +* [:link:](svg-pan-zoom/svg-pan-zoom-2.3.9.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [Chintan Shah](https://github.com/Promact) +* [:link:](svg-pan-zoom/svg-pan-zoom.d.ts) [svg-pan-zoom](https://github.com/ariutta/svg-pan-zoom) by [César Vidril](https://github.com/Yimiprod) * [:link:](svg-sprite/svg-sprite.d.ts) [svg-sprite](https://github.com/jkphl/svg-sprite) by [Qubo](https://github.com/tkqubo) * [:link:](svgjs/svgjs.d.ts) [svg.js](http://www.svgjs.com) by [Sean Hess](https://seanhess.github.io) * [:link:](svg2png/svg2png.d.ts) [svg2png node package](https://github.com/domenic/svg2png) by [hans windhoff](https://github.com/hansrwindhoff) diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 730bd78af2..a14a6df5db 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,8 +1,18 @@ -case 1. Add a new type definition. -- [ ] checked compilation succeeds with `--target es6` and `--noImplicitAny` options. -- [ ] has correct [naming convention](http://definitelytyped.org/guides/contributing.html#naming-the-file) -- [ ] has a [test file](http://definitelytyped.org/guides/contributing.html#tests) with the suffix of `-tests.ts` or `-tests.tsx`. +Please fill in this template. -case 2. Improvement to existing type definition. -- documentation or source code reference which provides context for the suggested changes. url http://api.jquery.com/html . - - it has been reviewed by a DefinitelyTyped member. +- [ ] Make your PR against the `master` branch. +- [ ] Use a meaningful title for the pull request. Include the name of the package modified. +- [ ] Test the change in your own code. +- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped#make-a-pull-request). +- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes). +- [ ] Run `npm run lint -- package-name` if a `tslint.json` is present. + +If adding a new definition: +- [ ] The package does not provide its own types, and you can not add them. +- [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package. +- [ ] Run `tsc` without errors. +- [ ] Include the required [files](https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package) and header. Base these on the README, *not* on an existing project. + +If changing an existing definition: +- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <> +- [ ] Increase the version number in the header if appropriate. diff --git a/README.md b/README.md index 7da7d1530b..e088b2fcc7 100644 --- a/README.md +++ b/README.md @@ -52,34 +52,33 @@ DefinitelyTyped only works because of contributions by users like you! Before you share your improvement with the world, use it yourself. -#### Test editing an exiting package +#### Test editing an existing package To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html). -You can also directly edit the types in `node_modules/@types/foo/index.d.ts`, -or copy them from there and paste inside of `declarations.d.ts` and follow the steps below. +You can also directly edit the types in `node_modules/@types/foo/index.d.ts`, or copy them from there and follow the steps below. #### Test a new package -* Add a new file `declarations.d.ts` to your project. -* Add it to the compilation, through `"includes"` or `"files"` in your [tsconfig](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html), -or through a `/// ` declaration in your code. -* Inside `declarations.d.ts`, write `declare module "foo" { }`, then write the module declaration inside. -* Test that your code works. -* *Then*, once you've tested your definitions, make a PR contributing the definition. +Add to your `tsconfig.json`: + +```json +"baseUrl": "types", +"typeRoots": ["types"], +``` + +(You can also use `src/types`.) +Create `types/foo/index.d.ts` containing declarations for the module "foo". +You should now be able import from `"foo"` in your code and it will route to the new type definition. +Then build *and* run the code to make sure your type definition actually corresponds to what happens at runtime. +Once you've tested your definitions with real code, make a PR contributing the definition by copying `types/foo` to `DefinitelyTyped/foo` and adding a `tsconfig.json` and `foo-tests.ts`. ### Make a pull request Once you've tested your package, you can share it on DefinitelyTyped. -First, [fork](https://guides.github.com/activities/forking/) this repository. -Then inside your repository: - -* `git checkout types-2.0` - -New work should generally be done on the `types-2.0` branch. -If you want your changes to be available to `typings` users, then you may edit `master` instead. +First, [fork](https://guides.github.com/activities/forking/) this repository, install [node](https://nodejs.org/), and run `npm install`. #### Edit an existing package @@ -95,7 +94,7 @@ If it doesn't, you can do so yourself in the comment associated with the PR. #### Create a new package -If you are the library author, or can make a pull request to the library, [bundle](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) types instead of publishing to DefinitelyTyped. +If you are the library author, or can make a pull request to the library, [bundle types](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) instead of publishing to DefinitelyTyped. If you are adding typings for an NPM package, create a directory with the same name. If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM. @@ -108,55 +107,27 @@ Your package should have this structure: | index.d.ts | This contains the typings for the package. | | foo-tests.ts | This contains sample code which tests the typings. This code does *not* run, but it is type-checked. | | tsconfig.json | This allows you to run `tsc` within the package. | +| tslint.json | Enables linting. | -`index.d.ts` should start with a header looking like: +Generate these by running `npm run new-package -- new-package-name`. -```ts -// Type definitions for foo 1.2 -// Project: https://github.com/baz/foo -// Definitions by: My Self -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -``` - -The `Project` link does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website. - -`tsconfig.json` should look like this: - -```json -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "foo-tests.ts" - ] -} -``` - -These should be identical accross projects except that `foo-tests` will be replaced with the name of your test file, -and you may also add the `"jsx"` compiler option if your library needs it. +You may edit the `tsconfig.json` to add new files or to add the `"jsx"` compiler option. DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down. +For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/base64-js). + #### Common mistakes * First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html). * Formatting: Either use all tabs, or always use 4 spaces. Also, always use semicolons, and use egyptian braces. * `interface X {}`: An empty interface is essentially the `{}` type: it places no constraints on an object. -* `interface Foo { new(): Foo }`: - This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); } +* `interface IFoo {}`: Don't add `I` to the front of an interface name. +* `interface Foo { new(): Foo; }`: + This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }`. +* `const Class: { new(): IClass; }`: + Prefer to use a class declaration `class Class { constructor(); }` instead of a new-able constant. * `namespace foo {}`: Do not add a namespace just so that the `import * as foo` syntax will work. If it is commonJs module with a single export, you should use the `import foo = require("foo")` syntax. @@ -172,30 +143,50 @@ DefinitelyTyped members routinely monitor for new PRs, though keep in mind that #### Removing a package When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from DefinitelyTyped to avoid confusion. -Make a PR doing the following: -* Delete the directory. -* Add a new entry to `notNeededPackages.json`. - - `libraryName`: Descriptive name of the library, e.g. "Angular 2" instead of "angular2". (May be identical to "typingsPackageName".) - - `typingsPackageName`: This is the name of the directory you just deleted. - - `sourceRepoURL`: This should point to the repository that contains the typings. - - `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version. -* Any other packages in DefinitelyTyped that referenced the deleted package should be updated to reference the bundled types. - To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`. + +You can remove it by running `npm run not-needed -- typingsPackageName asOfVersion sourceRepoURL [libraryName]`. +- `typingsPackageName`: This is the name of the directory to delete. +- `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version. +- `sourceRepoURL`: This should point to the repository that contains the typings. +- `libraryName`: Descriptive name of the library, e.g. "Angular 2" instead of "angular2". (If ommitted, will be identical to "typingsPackageName".) + +Any other packages in DefinitelyTyped that referenced the deleted package should be updated to reference the bundled types. To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`. + +If a package was never on DefinitelyTyped, it does not need to be added to `notNeededPackages.json`. + + +#### Lint + +To lint a package, just add a `tslint.json` to that package containing `{ "extends": "../tslint.json" }`. All new packages must be linted. +If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example: + +```json +{ + "extends": "../tslint.json", + "rules": { + // This package uses the Function type, and it will take effort to fix. + "forbidden-types": false + } +} +``` + +(To indicate that a lint rule truly does not apply, use `// tslint:disable:rule-name` or better, `//tslint:disable-next-line:rule-name`.) + +Only `.d.ts` files are linted. +Test the linter by running `npm run lint -- package-name`. Do not use a globally installed tslint. ## FAQ #### What exactly is the relationship between this repository and the `@types` packages on NPM? -The `types-2.0` branch is automatically published to the `@types` scope on NPM thanks to [types-publisher](https://github.com/Microsoft/types-publisher). +The `master` branch is automatically published to the `@types` scope on NPM thanks to [types-publisher](https://github.com/Microsoft/types-publisher). This usually happens within an hour of changes being merged. -Changes to the `master` branch are also manually merged into the `types-2.0` branch, but this takes longer. - #### I'm writing a definition that depends on another definition. Should I use `` or an import? -If the module you're referencing is an written as an external module (uses `export`), use an import. -If the module you're referenceing is an ambient module (uses `declare module`, or just declares globals), use ``. +If the module you're referencing is an external module (uses `export`), use an import. +If the module you're referencing is an ambient module (uses `declare module`, or just declares globals), use ``. #### What do I do about older versions of typings? @@ -205,19 +196,22 @@ If you're adding a new major version of a library, you can copy `index.d.ts` to #### I notice some packages having a `package.json` here. Usually you won't need this. When publishing a package we will normally automatically create a `package.json` for it. -A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/types-2.0/pikaday/package.json). +A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/pikaday/package.json). We do not allow other fields, such as `"description"`, to be defined manually. Also, if you need to reference an older version of typings, you must do that by adding `"dependencies": { "@types/foo": "x.y.z" }` to the package.json. -#### Definitions in types-2.0 seem written differently than in master. +#### I notice some `tsconfig.json` are missing `"noImplicitAny": true`, `"noImplicitThis": true`, or `"strictNullChecks": true`. -If you're targeting types-2.0, write it like the types-2.0 definitions. -If you're targeting master, we may change it to the new style when merging from master to types-2.0. +Then they are wrong. You can help by submitting a pull request to fix them. #### Can I request a definition? Here are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest). +#### What about type definitions for the DOM? + +If types are part of a web standard, they should be contributed to [TSJS-lib-generator](https://github.com/Microsoft/TSJS-lib-generator) so that they can become part of the default `lib.dom.d.ts`. + ## License diff --git a/_debugger/tsconfig.json b/_debugger/tsconfig.json index 0eb19db3db..4b628b9166 100644 --- a/_debugger/tsconfig.json +++ b/_debugger/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/abs/tsconfig.json b/abs/tsconfig.json index 1beb445ff9..1bcb5cf414 100644 --- a/abs/tsconfig.json +++ b/abs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/absolute/tsconfig.json b/absolute/tsconfig.json index aec5c724be..78082718ae 100644 --- a/absolute/tsconfig.json +++ b/absolute/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/acc-wizard/tsconfig.json b/acc-wizard/tsconfig.json index 2a655c4852..a0334835e4 100644 --- a/acc-wizard/tsconfig.json +++ b/acc-wizard/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/accepts/accepts-tests.ts b/accepts/accepts-tests.ts new file mode 100644 index 0000000000..7d9c5a8240 --- /dev/null +++ b/accepts/accepts-tests.ts @@ -0,0 +1,25 @@ +import accepts = require("accepts"); + +const req: any = {}; + +const accept = accepts(req); + +const charsets = accept.charsets(); +const charsetFromEmpty = accept.charset(); +const charsetFromParams = accept.charset("json", "text"); +const charsetFromArray = accept.charset(["json", "text"]); + +const encodings = accept.encodings(); +const encodingFromEmpty = accept.encoding(); +const encodingFromParams = accept.encoding("json", "text"); +const encodingFromArray = accept.encoding(["json", "text"]); + +const languages = accept.languages(); +const languageFromEmpty = accept.language(); +const languageFromParams = accept.language("json", "text"); +const languageFromArray = accept.language(["json", "text"]); + +const types = accept.types(); +const typeFromEmpty = accept.type(); +const typeFromParams = accept.type("json", "text"); +const typeFromArray = accept.type(["json", "text"]); diff --git a/accepts/index.d.ts b/accepts/index.d.ts new file mode 100644 index 0000000000..ff6a9d0995 --- /dev/null +++ b/accepts/index.d.ts @@ -0,0 +1,31 @@ +// Type definitions for accepts 1.3 +// Project: https://github.com/jshttp/accepts +// Definitions by: Stefan Reichel +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +import { IncomingMessage } from "http"; + +declare namespace accepts { + export interface Accepts { + charset(charsets: string[]): string | string[] | boolean; + charset(...charsets: string[]): string | string[] | boolean; + charsets(): string[]; + + encoding(encodings: string[]): string | string[] | boolean; + encoding(...encodings: string[]): string | string[] | boolean; + encodings(): string[]; + + language(languages: string[]): string | string[] | boolean; + language(...languages: string[]): string | string[] | boolean; + languages(): string[]; + + type(types: string[]): string | string[] | boolean; + type(...types: string[]): string | string[] | boolean; + types(): string[]; + } +} + +declare function accepts(req: IncomingMessage): accepts.Accepts; + +export = accepts; diff --git a/accepts/tsconfig.json b/accepts/tsconfig.json new file mode 100644 index 0000000000..28a7f4c4af --- /dev/null +++ b/accepts/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "accepts-tests.ts" + ] +} \ No newline at end of file diff --git a/accepts/tslint.json b/accepts/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/accepts/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/accounting/index.d.ts b/accounting/index.d.ts index b8187e41c4..ef8991999f 100644 --- a/accounting/index.d.ts +++ b/accounting/index.d.ts @@ -1,79 +1,74 @@ -// Type definitions for accounting.js 0.3.2 +// Type definitions for accounting.js 0.3 // Project: http://josscrowcroft.github.io/accounting.js/ // Definitions by: Sergey Gerasimov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface IAccountingCurrencyFormat { - pos: string; // for positive values, eg. "$ 1.00" - neg?: string; // for negative values, eg. "$ (1.00)" - zero?: string; // for zero values, eg. "$ --" +declare namespace accounting { + interface CurrencyFormat { + pos: string; // for positive values, eg. "$ 1.00" + neg?: string; // for negative values, eg. "$ (1.00)" + zero?: string; // for zero values, eg. "$ --" + } + + interface CurrencySettings { + symbol?: string; // default currency symbol is '$' + format?: TFormat; // controls output: %s = symbol, %v = value/number + decimal?: string; // decimal point separator + thousand?: string; // thousands separator + precision?: number; // decimal places + } + + interface NumberSettings { + precision?: number; // default precision on numbers is 0 + thousand?: string; + decimal?: string; + } + + interface Settings { + currency: CurrencySettings; // IAccountingCurrencySettings or IAccountingCurrencySettings + number: NumberSettings; + } + + interface Static { + // format any number into currency + formatMoney(number: number, symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string; + formatMoney(number: number, options: CurrencySettings | CurrencySettings): string; + + formatMoney(numbers: number[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[]; + formatMoney(numbers: number[], options: CurrencySettings | CurrencySettings): string[]; + + // generic case (any array of numbers) + formatMoney(numbers: any[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): any[]; + formatMoney(numbers: any[], options: CurrencySettings | CurrencySettings): any[]; + + // format a list of values for column-display + formatColumn(numbers: number[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[]; + formatColumn(numbers: number[], options: CurrencySettings | CurrencySettings): string[]; + + formatColumn(numbers: number[][], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[][]; + formatColumn(numbers: number[][], options: CurrencySettings | CurrencySettings): string[][]; + + // format a number with custom precision and localisation + formatNumber(number: number, precision?: number, thousand?: string, decimal?: string): string; + formatNumber(number: number, options: NumberSettings): string; + + formatNumber(number: number[], precision?: number, thousand?: string, decimal?: string): string[]; + formatNumber(number: number[], options: NumberSettings): string[]; + + formatNumber(number: any[], precision?: number, thousand?: string, decimal?: string): any[]; + formatNumber(number: any[], options: NumberSettings): any[]; + + // better rounding for floating point numbers + toFixed(number: number, precision?: number): string; + + // get a value from any formatted number/currency string + unformat(string: string, decimal?: string): number; + + // settings object that controls default parameters for library methods + settings: Settings; + } } -interface IAccountingCurrencySettings { - symbol?: string; // default currency symbol is '$' - format?: TFormat; // controls output: %s = symbol, %v = value/number - decimal?: string; // decimal point separator - thousand?: string; // thousands separator - precision?: number // decimal places -} - -interface IAccountingNumberSettings { - precision?: number; // default precision on numbers is 0 - thousand?: string; - decimal?: string; -} - -interface IAccountingSettings { - currency: IAccountingCurrencySettings; // IAccountingCurrencySettings or IAccountingCurrencySettings - number: IAccountingNumberSettings; -} - -interface IAccountingStatic { - // format any number into currency - formatMoney(number: number, symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string; - formatMoney(number: number, options: IAccountingCurrencySettings): string; - formatMoney(number: number, options: IAccountingCurrencySettings): string; - - formatMoney(numbers: number[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[]; - formatMoney(numbers: number[], options: IAccountingCurrencySettings): string[]; - formatMoney(numbers: number[], options: IAccountingCurrencySettings): string[]; - - // generic case (any array of numbers) - formatMoney(numbers: any[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): any[]; - formatMoney(numbers: any[], options: IAccountingCurrencySettings): any[]; - formatMoney(numbers: any[], options: IAccountingCurrencySettings): any[]; - - // format a list of values for column-display - formatColumn(numbers: number[], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[]; - formatColumn(numbers: number[], options: IAccountingCurrencySettings): string[]; - formatColumn(numbers: number[], options: IAccountingCurrencySettings): string[]; - - formatColumn(numbers: number[][], symbol?: string, precision?: number, thousand?: string, decimal?: string, format?: string): string[][]; - formatColumn(numbers: number[][], options: IAccountingCurrencySettings): string[][]; - formatColumn(numbers: number[][], options: IAccountingCurrencySettings): string[][]; - - // format a number with custom precision and localisation - formatNumber(number: number, precision?: number, thousand?: string, decimal?: string): string; - formatNumber(number: number, options: IAccountingNumberSettings): string; - - formatNumber(number: number[], precision?: number, thousand?: string, decimal?: string): string[]; - formatNumber(number: number[], options: IAccountingNumberSettings): string[]; - - formatNumber(number: any[], precision?: number, thousand?: string, decimal?: string): any[]; - formatNumber(number: any[], options: IAccountingNumberSettings): any[]; - - // better rounding for floating point numbers - toFixed(number: number, precision?: number): string; - - // get a value from any formatted number/currency string - unformat(string: string, decimal?: string): number; - - // settings object that controls default parameters for library methods - settings: IAccountingSettings; -} - -declare var accounting: IAccountingStatic; - -declare module "accounting" { - export = accounting; -} +declare var accounting: accounting.Static; +export = accounting; +export as namespace accounting; diff --git a/accounting/tsconfig.json b/accounting/tsconfig.json index 21e53e537e..ca14419628 100644 --- a/accounting/tsconfig.json +++ b/accounting/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/accounting/tslint.json b/accounting/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/accounting/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file diff --git a/ace/tsconfig.json b/ace/tsconfig.json index 22087c4674..bde471bd60 100644 --- a/ace/tsconfig.json +++ b/ace/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/acl/tsconfig.json b/acl/tsconfig.json index aa96150bff..96724a58aa 100644 --- a/acl/tsconfig.json +++ b/acl/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/acorn/README.md b/acorn/README.md new file mode 100644 index 0000000000..c9c372a9ce --- /dev/null +++ b/acorn/README.md @@ -0,0 +1,9 @@ +This file exists for reminding contributors that this definition is **WIP**. + +### Note + +There are a **large** number of methods of class `Parser` and `LooseParser` haven't been declared. + +However, these methods may not be useful for common users. So, I hang the job util it worth continuing. + +Of course, volunteers are welcomed to spend time extracting these things. diff --git a/acorn/acorn-tests.ts b/acorn/acorn-tests.ts index c51ba151f8..fb79d23718 100644 --- a/acorn/acorn-tests.ts +++ b/acorn/acorn-tests.ts @@ -14,7 +14,7 @@ var string: string; // acorn string = acorn.version; program = acorn.parse('code'); -program = acorn.parse('code', {ranges: true, onToken: tokens, onComment: comments}); +program = acorn.parse('code', { ranges: true, onToken: tokens, onComment: comments }); program = acorn.parse('code', { ranges: true, onToken: (token) => tokens.push(token), @@ -28,3 +28,42 @@ any = token.value; // Comment string = comment.value; + +const parser = new acorn.Parser({}, 'export default ""', 0); + +const node = new acorn.Node(parser, 1, 1); + +class LooseParser { + constructor(input: string, options = {}) { + + } + + // this means you can extend LooseParser + test() { + + } +} +acorn.addLooseExports(function () { + return { + type: 'Program', + sourceType: 'script', + body: [ + { + type: 'EmptyStatement' + } + ] + } +}, LooseParser, {}); + +acorn.parseExpressionAt('string', 2); + +acorn.isNewLine(56); + +acorn.isIdentifierStart(56); + +acorn.isIdentifierChar(56); + +acorn.getLineInfo('string', 56); + +acorn.plugins['test'] = function (p: acorn.Parser, config: any) { +} diff --git a/acorn/index.d.ts b/acorn/index.d.ts index 982abb4f54..1944abc257 100644 --- a/acorn/index.d.ts +++ b/acorn/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Acorn v1.0.1 +// Type definitions for Acorn v4.0.3 // Project: https://github.com/marijnh/acorn -// Definitions by: RReverser +// Definitions by: RReverser , e-cloud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -10,13 +10,89 @@ export = acorn; import * as ESTree from 'estree'; declare namespace acorn { - var version: string; - function parse(input: string, options?: Options): ESTree.Program; - function parseExpressionAt(input: string, pos: number, options?: Options): ESTree.Expression; - function getLineInfo(input: string, offset: number): ESTree.Position; - var defaultOptions: Options; + interface PlainObject { + [name: string]: any; + } - interface TokenType { + interface PluginsObject { + [name: string]: (p: Parser, config: any) => void; + } + + interface Options { + ecmaVersion?: 3 | 5 | 6 | 7 | 8 | 2015 | 2016 | 2017; + sourceType?: 'script' | 'module'; + onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => void; + onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => void; + allowReserved?: boolean; + allowReturnOutsideFunction?: boolean; + allowImportExportEverywhere?: boolean; + allowHashBang?: boolean; + locations?: boolean; + onToken?: ((token: Token) => any) | Token[]; + onComment?: (( + isBlock: boolean, text: string, start: number, end: number, startLoc?: ESTree.Position, + endLoc?: ESTree.Position + ) => void) | Comment[]; + ranges?: boolean; + program?: ESTree.Program; + sourceFile?: string; + directSourceFile?: string; + preserveParens?: boolean; + plugins?: PlainObject; + } + + class Parser { + constructor(options: Options, input: string, startPos?: number); + + parse(): ESTree.Program; + } + + const plugins: PluginsObject; + + const defaultOptions: Options; + + class Position implements ESTree.Position { + line: number; + column: number; + + constructor(line: number, col: number); + + offset(n: number): Position; + } + + class SourceLocation implements ESTree.SourceLocation { + start: Position; + end: Position; + source?: string; + + constructor(p: Parser, start: Position, end: Position); + } + + function getLineInfo(input: string, offset: number): ESTree.Position; + + class Node { + type: string; + start: number; + end: number; + loc?: ESTree.SourceLocation; + sourceFile?: string; + range?: [number, number]; + + constructor(parser: Parser, pos: number, loc: number); + } + + interface TokeTypeConfig { + keyword: string; + beforeExpr?: boolean; + startsExpr?: boolean; + isLoop?: boolean; + isAssign?: boolean; + prefix?: boolean; + postfix?: boolean; + binop?: number; + } + + class TokenType { label: string; keyword: string; beforeExpr: boolean; @@ -26,19 +102,110 @@ declare namespace acorn { prefix: boolean; postfix: boolean; binop: number; - updateContext: (prevType: TokenType) => any; + updateContext: (prevType: TokenType) => void; + + constructor(label: string, conf?: TokeTypeConfig); } + const tokTypes: { + num: TokenType; + regexp: TokenType; + string: TokenType; + name: TokenType; + eof: TokenType; + bracketL: TokenType; + bracketR: TokenType; + braceL: TokenType; + braceR: TokenType; + parenL: TokenType; + parenR: TokenType; + comma: TokenType; + semi: TokenType; + colon: TokenType; + dot: TokenType; + question: TokenType; + arrow: TokenType; + template: TokenType; + ellipsis: TokenType; + backQuote: TokenType; + dollarBraceL: TokenType; + eq: TokenType; + assign: TokenType; + incDec: TokenType; + prefix: TokenType; + logicalOR: TokenType; + logicalAND: TokenType; + bitwiseOR: TokenType; + bitwiseXOR: TokenType; + bitwiseAND: TokenType; + equality: TokenType; + relational: TokenType; + bitShift: TokenType; + plusMin: TokenType; + modulo: TokenType; + star: TokenType; + slash: TokenType; + starstar: TokenType; + _break: TokenType; + _case: TokenType; + _catch: TokenType; + _continue: TokenType; + _debugger: TokenType; + _default: TokenType; + _do: TokenType; + _else: TokenType; + _finally: TokenType; + _for: TokenType; + _function: TokenType; + _if: TokenType; + _return: TokenType; + _switch: TokenType; + _throw: TokenType; + _try: TokenType; + _var: TokenType; + _const: TokenType; + _while: TokenType; + _with: TokenType; + _new: TokenType; + _this: TokenType; + _super: TokenType; + _class: TokenType; + _extends: TokenType; + _export: TokenType; + _import: TokenType; + _null: TokenType; + _true: TokenType; + _false: TokenType; + _in: TokenType; + _instanceof: TokenType; + _typeof: TokenType; + _void: TokenType; + _delete: TokenType; + } + + class TokContext { + constructor(token: string, isExpr: boolean, preserveSpace: boolean, override: (p: Parser) => void); + } + + const tokContexts: { + b_stat: TokContext; + b_expr: TokContext; + b_tmpl: TokContext; + p_stat: TokContext; + p_expr: TokContext; + q_tmpl: TokContext; + f_expr: TokContext; + }; + + function isIdentifierStart(code: number, astral?: boolean): boolean; + + function isIdentifierChar(code: number, astral?: boolean): boolean; + interface AbstractToken { start: number; end: number; - loc: ESTree.SourceLocation; - range: [number, number]; - } - - interface Token extends AbstractToken { - type: TokenType; - value: any; + loc?: SourceLocation; + range?: [number, number]; } interface Comment extends AbstractToken { @@ -46,23 +213,46 @@ declare namespace acorn { value: string; } - interface Options { - ecmaVersion?: number; - sourceType?: string; - onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => any; - onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => any; - allowReserved?: boolean; - allowReturnOutsideFunction?: boolean; - allowImportExportEverywhere?: boolean; - allowHashBang?: boolean; - locations?: boolean; - onToken?: ((token: Token) => any) | Token[]; - onComment?: ((isBlock: boolean, text: string, start: number, end: number, startLoc?: ESTree.Position, endLoc?: ESTree.Position) => any) | Comment[]; - ranges?: boolean; - program?: ESTree.Program; - sourceFile?: string; - directSourceFile?: string; - preserveParens?: boolean; - plugins?: { [name: string]: Function; }; + class Token { + constructor(p: Parser); } + + interface Token extends AbstractToken { + type: TokenType; + value: any; + } + + function isNewLine(code: number): boolean; + + const lineBreak: RegExp; + + const lineBreakG: RegExp; + + const version: string; + + interface IParse { + (input: string, options?: Options): ESTree.Program; + } + + const parse: IParse; + + function parseExpressionAt(input: string, pos?: number, options?: Options): ESTree.Expression; + + // todo: here the tokenizer function returns a Parser instance, that is targeting the detail of + // Parser prototype. Someone need this please reade README.md first. + // function tokenizer(options: Options, input: string): Parser; + + let parse_dammit: IParse | undefined; + let LooseParser: ILooseParserClass | undefined; + let pluginsLoose: PluginsObject | undefined; + + interface ILooseParserClass { + new (input: string, options?: Options): ILooseParser + } + + interface ILooseParser { + + } + + function addLooseExports(parse: IParse, parser: ILooseParserClass, plugins: PluginsObject): void; } diff --git a/acorn/tsconfig.json b/acorn/tsconfig.json index 08bd3702ce..d85e0fedb0 100644 --- a/acorn/tsconfig.json +++ b/acorn/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/rails-actioncable/rails-actioncable-tests.ts b/actioncable/actioncable-tests.ts similarity index 100% rename from rails-actioncable/rails-actioncable-tests.ts rename to actioncable/actioncable-tests.ts diff --git a/rails-actioncable/index.d.ts b/actioncable/index.d.ts similarity index 100% rename from rails-actioncable/index.d.ts rename to actioncable/index.d.ts diff --git a/actioncable/tsconfig.json b/actioncable/tsconfig.json new file mode 100644 index 0000000000..fa0376b143 --- /dev/null +++ b/actioncable/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "actioncable-tests.ts" + ] +} \ No newline at end of file diff --git a/activex-data-objects/tsconfig.json b/activex-data-objects/tsconfig.json index 5fb09cb648..c272f71ecb 100644 --- a/activex-data-objects/tsconfig.json +++ b/activex-data-objects/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/activex-scripting-runtime/tsconfig.json b/activex-scripting-runtime/tsconfig.json index 8845470e70..bae3467f9d 100644 --- a/activex-scripting-runtime/tsconfig.json +++ b/activex-scripting-runtime/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/activex-windows-image-acquisition/tsconfig.json b/activex-windows-image-acquisition/tsconfig.json index d06b9b3b35..d280e07763 100644 --- a/activex-windows-image-acquisition/tsconfig.json +++ b/activex-windows-image-acquisition/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/adal/tsconfig.json b/adal/tsconfig.json index 6979994fca..6afc0c793f 100644 --- a/adal/tsconfig.json +++ b/adal/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/add2home/tsconfig.json b/add2home/tsconfig.json index 8074984e3c..e9738e2267 100644 --- a/add2home/tsconfig.json +++ b/add2home/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/adm-zip/index.d.ts b/adm-zip/index.d.ts index f22b929b76..9a723dc152 100644 --- a/adm-zip/index.d.ts +++ b/adm-zip/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for adm-zip v0.4.4 +// Type definitions for adm-zip v0.4.4 // Project: https://github.com/cthackers/adm-zip // Definitions by: John Vilk , Abner Oliveira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/adm-zip/tsconfig.json b/adm-zip/tsconfig.json index 4120ceef53..1814ca1311 100644 --- a/adm-zip/tsconfig.json +++ b/adm-zip/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ag-grid/tsconfig.json b/ag-grid/tsconfig.json index aa4fc8156f..d74a60fe23 100644 --- a/ag-grid/tsconfig.json +++ b/ag-grid/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/agenda/tsconfig.json b/agenda/tsconfig.json index 4f48508fda..0e8e491f1e 100644 --- a/agenda/tsconfig.json +++ b/agenda/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ajv/index.d.ts b/ajv/index.d.ts index 691b6b6ad0..94d0055551 100644 --- a/ajv/index.d.ts +++ b/ajv/index.d.ts @@ -66,22 +66,24 @@ declare namespace Ajv { unicode?: boolean; format?: string; formats?: any; + unknownFormats?: true | string[] | "ignore"; schemas?: any; - missingRefs?: boolean; + missingRefs?: true | "ignore" | "fail"; + extendRefs?: true | "ignore" | "fail"; loadSchema?(uri: string, callback: (error: Error, body: any) => void): void; - removeAdditional?: boolean; - useDefaults?: boolean; - coerceTypes?: boolean; + removeAdditional?: boolean | "all" | "failing"; + useDefaults?: boolean | "shared"; + coerceTypes?: boolean | "array"; async?: any; transpile?: string; meta?: boolean; - validateSchema?: boolean; + validateSchema?: boolean | "log"; addUsedSchema?: boolean; - inlineRefs?: boolean; + inlineRefs?: boolean | number; passContext?: boolean; loopRequired?: number; ownProperties?: boolean; - multipleOfPrecision?: boolean; + multipleOfPrecision?: boolean | number; errorDataPath?: string, messages?: boolean; beautify?: boolean; diff --git a/ajv/tsconfig.json b/ajv/tsconfig.json index 01bf5ed1da..fd4da48b59 100644 --- a/ajv/tsconfig.json +++ b/ajv/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/alertify/index.d.ts b/alertify/index.d.ts index aa9219282a..fa71118381 100644 --- a/alertify/index.d.ts +++ b/alertify/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for alertify 0.3.11 +// Type definitions for alertify 0.3.11 // Project: http://fabien-d.github.io/alertify.js/ // Definitions by: John Jeffery // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/alertify/tsconfig.json b/alertify/tsconfig.json index adfc78de2c..e0a41bca1a 100644 --- a/alertify/tsconfig.json +++ b/alertify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/alexa-sdk/tsconfig.json b/alexa-sdk/tsconfig.json index 834836e163..209269af60 100644 --- a/alexa-sdk/tsconfig.json +++ b/alexa-sdk/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/algoliasearch-client-js/index.d.ts b/algoliasearch-client-js/index.d.ts deleted file mode 100644 index b0eeb9968b..0000000000 --- a/algoliasearch-client-js/index.d.ts +++ /dev/null @@ -1,1571 +0,0 @@ -// Type definitions for algoliasearch-client-js 3.18.1 -// Project: https://github.com/algolia/algoliasearch-client-js -// Definitions by: Baptiste Coquelle -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface AlgoliaResponse { - /** - * Contains all the hits matching the query - * https://github.com/algolia/algoliasearch-client-js#response-format - */ - hits: any[]; - /** - * Current page - * https://github.com/algolia/algoliasearch-client-js#response-format - */ - page: number; - /** - * Number of total hits matching the query - * https://github.com/algolia/algoliasearch-client-js#response-format - */ - nbHits: number; - /** - * Number of pages - * https://github.com/algolia/algoliasearch-client-js#response-format - */ - nbPage: number; - /** - * Number of hits per pages - * https://github.com/algolia/algoliasearch-client-js#response-format - */ - hitsPerPage: number; - /** - * Engine processing time (excluding network transfer) - * https://github.com/algolia/algoliasearch-client-js#response-format - */ - processingTimeMS: number; - /** - * Query used to perform the search - * https://github.com/algolia/algoliasearch-client-js#response-format - */ - query: string; - /** - * GET parameters used to perform the search - * https://github.com/algolia/algoliasearch-client-js#response-format - */ - params: string; -} -/* - Interface for the algolia client object - */ -interface AlgoliaClient { - /** - * Initialization of the index - * @param name: index name - * return algolia index object - * https://github.com/algolia/algoliasearch-client-js#init-index---initindex - */ - initIndex(name: string): AlgoliaIndex; - /** - * Query on multiple index - * @param queries index name, query and query parameters - * @param cb callback(err, res) - * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries - */ - search(queries: { indexName: string, query: string, options: AlgoliaQueryParameters }, cb: (err: Error, res: any) => void): void; - /** - * Query on multiple index - * @param queries index name, query and query parameters - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries - */ - search(queries: { indexName: string, query: string, options: AlgoliaQueryParameters }): Promise; - /** - * clear browser cache - * https://github.com/algolia/algoliasearch-client-js#cache - */ - clearCache(): void; - /** - * kill alive connections - * https://github.com/algolia/algoliasearch-client-js#keep-alive - */ - destroy(): void; - /** - * List all your indices along with their associated information (number of entries, disk size, etc.) - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#list-indices---listindexes - */ - listIndexes(cb: (err: Error, res: any) => void): void; - /** - * List all your indices along with their associated information (number of entries, disk size, etc.) - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#list-indices---listindexes - */ - listIndexes(): Promise; - /** - * Delete a specific index - * @param name - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#delete-index---deleteindex - */ - deleteIndex(name: string, cb: (err: Error, res: any) => void): void; - /** - * Delete a specific index - * @param name - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#delete-index---deleteindex - */ - deleteIndex(name: string): Promise; - /** - * Copy an index from a specific index to a new one - * @param from origin index - * @param to destination index - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex - */ - copyIndex(from: string, to: string, cb: (err: Error, res: any) => void): void; - /** - * Copy an index from a specific index to a new one - * @param from origin index - * @param to destination index - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex - */ - copyIndex(from: string, to: string): Promise; - /** - * Move index to a new one (and will overwrite the original one) - * @param from origin index - * @param to destination index - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#move-index---moveindex - */ - moveIndex(from: string, to: string, cb: (err: Error, res: any) => void): void; - /** - * Move index to a new one (and will overwrite the original one) - * @param from origin index - * @param to destination index - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#move-index---moveindex - */ - moveIndex(from: string, to: string): Promise; - /** - * Generate a public API key - * @param key api key - * @param filters - * https://github.com/algolia/algoliasearch-client-js#generate-key---generatesecuredapikey - */ - generateSecuredApiKey(key: string, filters: AlgoliaSecuredApiOptions): void; - /** - * Perform multiple operations with one API call to reduce latency - * @param action - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#custom-batch---batch - */ - batch(action: AlgoliaAction, cb: (err: Error, res: any) => void): void; - /** - * Perform multiple operations with one API call to reduce latency - * @param action - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#custom-batch---batch - */ - batch(action: AlgoliaAction): Promise; - /** - * Lists global API Keys - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse - */ - listUserKeys(cb: (err: Error, res: any) => void): void; - /** - * Lists global API Keys - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse - */ - listUserKeys(): Promise; - /** - * Add global API Keys - * @param scopes - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - addUserKey(scopes: string[], cb: (err: Error, res: any) => void): void; - /** - * Add global API Keys - * @param scopes - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - addUserKey(scopes: string[]): Promise; - /** - * Add global API Key - * @param scopes - * @param options - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - addUserKey(scopes: string[], options: AlgoliaUserKeyOptions, cb: (err: Error, res: any) => void): void; - /** - * Add global API Key - * @param scopes - * @param options - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - addUserKey(scopes: string[], options: AlgoliaUserKeyOptions): Promise; - /** - * Update global API key - * @param key - * @param scopes - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey - */ - updateUserKey(key: string, scopes: string[], cb: (err: Error, res: any) => void): void; - /** - * Update global API key - * @param key - * @param scopes - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey - */ - updateUserKey(key: string, scopes: string[]): Promise; - /** - * Update global API key - * @param key - * @param scopes - * @param options - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey - */ - updateUserKey(key: string, scopes: string[], options: AlgoliaUserKeyOptions, cb: (err: Error, res: any) => void): void; - /** - * Update global API key - * @param key - * @param scopes - * @param options - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey - */ - updateUserKey(key: string, scopes: string[], options: AlgoliaUserKeyOptions): Promise; - /** - * Gets the rights of a global key - * @param key - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey - */ - getUserKeyACL(key: string, cb: (err: Error, res: any) => void): void; - /** - * Gets the rights of a global key - * @param key - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey - */ - getUserKeyACL(key: string): Promise; - /** - * Deletes a global key - * @param key - * @param cb(err,res) - * https://github.com/algolia/algoliasearch-client-js#delete-user-key---deleteuserkey - */ - deleteUserKey(key: string, cb: (err: Error, res: any) => void): void; - /** - * Deletes a global key - * @param key - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#delete-user-key---deleteuserkey - */ - deleteUserKey(key: string): Promise; - /** - * Get 1000 last events - * @param options - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs - */ - getLogs(options: LogsOptions, cb: (err: Error, res: any) => void): void; - /** - * Get 1000 last events - * @param options - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs - */ - getLogs(options: LogsOptions): Promise; -} -/** - * Interface for the index algolia object - */ -interface AlgoliaIndex { - /** - * Gets a specific object - * @param objectID - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects - */ - getObject(objectID: string, cb: (err: Error, res: any) => void): void; - /** - * Gets specific attributes from an object - * @param objectID - * @param attributes - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects - */ - getObject(objectID: string, attributes: string[], cb: (err: Error, res: any) => void): void; - /** - * Gets a list of objects - * @param objectIDs - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects - */ - getObjects(objectIDs: string[], cb: (err: Error, res: any) => void): void; - /** - * Add a specific object - * @param object without objectID - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects - */ - addObject(object: {}, cb: (err: Error, res: any) => void): void; - /** - * Add a list of objects - * @param object with objectID - * @param objectID - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects - */ - addObject(object: {}, objectID: string, cb: (err: Error, res: any) => void): void; - /** - * Add list of objects - * @param objects - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects - */ - addObjects(objects: [{}], cb: (err: Error, res: any) => void): void; - /** - * Add or replace a specific object - * @param object - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects - */ - saveObject(object: {}, cb: (err: Error, res: any) => void): void; - /** - * Add or replace several objects - * @param objects - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects - */ - saveObjects(objects: [{}], cb: (err: Error, res: any) => void): void; - /** - * Update parameters of a specific object - * @param object - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects - */ - partialUpdateObject(object: {}, cb: (err: Error, res: any) => void): void; - /** - * Update parameters of a list of objects - * @param objects - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects - */ - partialUpdateObjects(objects: [{}], cb: (err: Error, res: any) => void): void; - /** - * Delete a specific object - * @param objectID - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#delete-objects---deleteobjects - */ - deleteObject(objectID: string, cb: (err: Error, res: any) => void): void; - /** - * Delete a list of objects - * @param objectIDs - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#delete-objects---deleteobjects - */ - deleteObjects(objectIDs: string[], cb: (err: Error, res: any) => void): void; - /** - * Delete objects that matches the query - * @param query - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#delete-by-query---deletebyquery - */ - deleteByQuery(query: string, cb: (err: Error, res: any) => void): void; - /** - * Delete objects that matches the query - * @param query - * @param params of the object - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#delete-by-query---deletebyquery - */ - deleteByQuery(query: string, params: {}, cb: (err: Error, res: any) => void): void; - /** - * Wait for an indexing task to be compete - * @param taskID - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#wait-for-operations---waittask - */ - waitTask(taskID: number, cb: (err: Error, res: any) => void): void; - /** - * Get an index settings - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#get-settings---getsettings - */ - getSettings(cb: (err: Error, res: any) => void): void; - /** - * Set an index settings - * @param settings - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#set-settings---setsettings - */ - setSettings(settings: AlgoliaIndexSettings, cb: (err: Error, res: any) => void): void; - /** - * Clear cache of an index - * https://github.com/algolia/algoliasearch-client-js#cache - */ - clearCache(): void; - /** - * Clear an index content - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#clear-index---clearindex - */ - clearIndex(cb: (err: Error, res: any) => void): void; - /** - * Save a synonym object - * @param synonym - * @param options - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym - */ - saveSynonym(synonym: AlgoliaSynonym, option: SynonymOption, cb: (err: Error, res: any) => void): void; - /** - * Save a synonym object - * @param synonyms - * @param options - * @param cb(err, res) - */ - batchSynonyms(synonyms: AlgoliaSynonym[], options: SynonymOption, cb: (err: Error, res: any) => void): void; - /** - * Delete a specific synonym - * @param identifier - * @param options - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#batch-synonyms---batchsynonyms - */ - deleteSynonym(identifier: string, options: SynonymOption, cb: (err: Error, res: any) => void): void; - /** - * Clear all synonyms of an index - * @param options - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#clear-all-synonyms---clearsynonyms - */ - clearSynonyms(options: SynonymOption, cb: (err: Error, res: any) => void): void; - /** - * Get a specific synonym - * @param identifier - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#get-synonym---getsynonym - */ - getSynonym(identifier: string, cb: (err: Error, res: any) => void): void; - /** - * Search a synonyms - * @param options - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms - */ - searchSynonyms(options: SearchSynonymOptions, cb: (err: Error, res: any) => void): void; - /** - * List index user keys - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#list-api-keys---listapikeys - */ - listUserKeys(cb: (err: Error, res: any) => void): void; - /** - * Add key for this index - * @param scopes - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - addUserKey(scopes: string[], cb: (err: Error, res: any) => void): void; - /** - * Add key for this index - * @param scopes - * @param options - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - addUserKey(scopes: string[], options: AlgoliaUserKeyOptions, cb: (err: Error, res: any) => void): void; - /** - * Update a key for this index - * @param key - * @param scopes - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey - */ - updateUserKey(key: string, scopes: string[], cb: (err: Error, res: any) => void): void; - /** - * Update a key for this index - * @param key - * @param scopes - * @param options - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey - */ - updateUserKey(key: string, scopes: string[], options: AlgoliaUserKeyOptions, cb: (err: Error, res: any) => void): void; - /** - * Gets the rights of an index specific key - * @param key - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#get-key-permissions---getuserkeyacl - */ - getUserKeyACL(key: string, cb: (err: Error, res: any) => void): void; - /** - * Deletes an index specific key - * @param key - * @param cb(err, res) - * https://github.com/algolia/algoliasearch-client-js#delete-user-key---deleteuserkey - */ - deleteUserKey(key: string, cb: (err: Error, res: any) => void): void; - /** - * Gets a specific object - * @param objectID - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects - */ - getObject(objectID: string): Promise ; - /** - * Gets specific attributes from an object - * @param objectID - * @param attributes - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects - */ - getObject(objectID: string, attributes: string[]): Promise ; - /** - * Gets a list of objects - * @param objectIDs - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects - */ - getObjects(objectIDs: string[]): Promise ; - /** - * Add a specific object - * @param object without objectID - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects - */ - addObject(object: {}): Promise ; - /** - * Add a list of objects - * @param object with objectID - * @param objectID - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects - */ - addObject(object: {}, objectID: string): Promise ; - /** - * Add list of objects - * @param objects - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects - */ - addObjects(objects: [{}]): Promise ; - /** - * Add or replace a specific object - * @param object - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects - */ - saveObject(object: {}): Promise ; - /** - * Add or replace several objects - * @param objects - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects - */ - saveObjects(objects: [{}]): Promise ; - /** - * Update parameters of a specific object - * @param object - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects - */ - partialUpdateObject(object: {}): Promise ; - /** - * Update parameters of a list of objects - * @param objects - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects - */ - partialUpdateObjects(objects: [{}]): Promise ; - /** - * Delete a specific object - * @param objectID - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#delete-objects---deleteobjects - */ - deleteObject(objectID: string): Promise ; - /** - * Delete a list of objects - * @param objectIDs - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#delete-objects---deleteobjects - */ - deleteObjects(objectIDs: string[]): Promise ; - /** - * Delete objects that matches the query - * @param query - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#delete-by-query---deletebyquery - */ - deleteByQuery(query: string): Promise ; - /** - * Delete objects that matches the query - * @param query - * @param params of the object - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#delete-by-query---deletebyquery - */ - deleteByQuery(query: string, params: {}): Promise ; - /** - * Wait for an indexing task to be compete - * @param taskID - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#wait-for-operations---waittask - */ - waitTask(taskID: number): Promise ; - /** - * Get an index settings - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#get-settings---getsettings - */ - getSettings(): Promise ; - /** - * Set an index settings - * @param settings - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#set-settings---setsettings - */ - setSettings(settings: AlgoliaIndexSettings): Promise ; - /** - * Search in an index - * @param params query parameter - * return {Promise} - * @param err() error callback - * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search - */ - search(params: AlgoliaQueryParameters): Promise ; - /** - * Search in an index - * @param params query parameter - * @param cb(err, res) - * @param err() error callback - * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search - */ - search(params: AlgoliaQueryParameters, cb: (err: Error, res: any) => void): void; - /** - * Browse an index - * @param query - * @param cb(err, content) - * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse - */ - browse(query: string, cb: (err: Error, res: any) => void): void; - /** - * Browse an index - * @param query - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse - */ - browse(query: string): Promise; - /** - * Browse an index from a cursor - * @param cursor - * @param cb(err, content) - * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse - */ - browseFrom(cursor: string, cb: (err: Error, res: any) => void): void; - /** - * Browse an index from a cursor - * @param cursor - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse - */ - browseFrom(cursor: string): Promise; - /** - * Browse an entire index - * return Promise - * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse - */ - browseAll(): Promise; - /** - * Clear an index content - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#clear-index---clearindex - */ - clearIndex(): Promise ; - /** - * Save a synonym object - * @param synonym - * @param options - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym - */ - saveSynonym(synonym: AlgoliaSynonym, option: SynonymOption): Promise ; - /** - * Save a synonym object - * @param synonyms - * @param options - * return {Promise} - */ - batchSynonyms(synonyms: AlgoliaSynonym[], options: SynonymOption): Promise ; - /** - * Delete a specific synonym - * @param identifier - * @param options - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#batch-synonyms---batchsynonyms - */ - deleteSynonym(identifier: string, options: SynonymOption): Promise ; - /** - * Clear all synonyms of an index - * @param options - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#clear-all-synonyms---clearsynonyms - */ - clearSynonyms(options: SynonymOption): Promise ; - /** - * Get a specific synonym - * @param identifier - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#get-synonym---getsynonym - */ - getSynonym(identifier: string): Promise ; - /** - * Search a synonyms - * @param options - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms - */ - searchSynonyms(options: SearchSynonymOptions): Promise ; - /** - * List index user keys - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#list-api-keys---listapikeys - */ - listUserKeys(): Promise ; - /** - * Add key for this index - * @param scopes - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - addUserKey(scopes: string[]): Promise ; - /** - * Add key for this index - * @param scopes - * @param options - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - addUserKey(scopes: string[], options: AlgoliaUserKeyOptions): Promise ; - /** - * Update a key for this index - * @param key - * @param scopes - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey - */ - updateUserKey(key: string, scopes: string[]): Promise ; - /** - * Update a key for this index - * @param key - * @param scopes - * @param options - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey - */ - updateUserKey(key: string, scopes: string[], options: AlgoliaUserKeyOptions): Promise ; - /** - * Gets the rights of an index specific key - * @param key - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#get-key-permissions---getuserkeyacl - */ - getUserKeyACL(key: string): Promise ; - /** - * Deletes an index specific key - * @param key - * return {Promise} - * https://github.com/algolia/algoliasearch-client-js#delete-user-key---deleteuserkey - */ - deleteUserKey(key: string): Promise ; -} -/* - Interface describing available options when initializing a client - */ -interface ClientOptions { - /** - * Timeout for requests to our servers, in milliseconds - * default: 15s (node), 2s (browser) - * https://github.com/algolia/algoliasearch-client-js#client-options - */ - timeout?: number; - /** - * Protocol to use when communicating with algolia - * default: current protocol(browser), https(node) - * https://github.com/algolia/algoliasearch-client-js#client-options - */ - protocol?: string; - /** - * (node only) httpAgent instance to use when communicating with Algolia servers. - * https://github.com/algolia/algoliasearch-client-js#client-options - */ - httpAgent?: any; - /** - * read: array of read hosts to use to call Algolia servers, computed automatically - * write: array of read hosts to use to call Algolia servers, computed automatically - * https://github.com/algolia/algoliasearch-client-js#client-options - */ - hosts?: { read?: string[], write?: string[] }; -} -/* - Interface describing options available for gettings the logs - */ -interface LogsOptions { - /** - * Specify the first entry to retrieve (0-based, 0 is the most recent log entry). - * default: 0 - * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs - */ - offset?: number; - /** - * Specify the maximum number of entries to retrieve starting at the offset. - * default: 10 - * maximum: 1000 - * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs - */ - length?: number; - /** - * @deprecated - * Retrieve only logs with an HTTP code different than 200 or 201 - * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs - */ - onlyErrors?: boolean; - /** - * Specify the type of logs to retrieve - * 'query' Retrieve only the queries - * 'build' Retrieve only the build operations - * 'error' Retrieve only the errors (same as onlyErrors parameters) - * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs - */ - type?: string; -} -/** - * Describe the action object used for batch operation - */ -interface AlgoliaAction { - /** - * Type of the batch action - * values: addObject, updateObject, partialUpdateObject, partialUpdateObjectNoCreate, deleteObject - * https://github.com/algolia/algoliasearch-client-js#custom-batch---batch - */ - action: string; - /** - * Name of the index where the bact will be performed - * https://github.com/algolia/algoliasearch-client-js#custom-batch---batch - */ - indexName: string; - /** - * Object - * https://github.com/algolia/algoliasearch-client-js#custom-batch---batch - */ - body: {}; -} -/** - * Describes the option used when creating user key - */ -interface AlgoliaUserKeyOptions { - /** - * Add a validity period. The key will be valid for a specific period of time (in seconds). - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - validity?: number; - /** - * Specify the maximum number of API calls allowed from an IP address per hour - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - maxQueriesPerIPPerHour?: number; - /** - * Specify the maximum number of hits this API key can retrieve in one call - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - maxHitsPerQuery?: boolean; - /** - * Specify the list of targeted indices - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - indexes?: string[]; - /** - * Specify the list of referers - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - referers?: string[]; - /** - * Specify the list of query parameters - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - queryParameters?: AlgoliaQueryParameters; - /** - * Specify a description to describe where the key is used. - * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey - */ - description?: string; -} -/** - * Describes option used when making operation on synonyms - */ -interface SynonymOption { - /** - * You can forward all settings updates to the slaves of an index - * https://github.com/algolia/algoliasearch-client-js#slave-settings - */ - forwardToSlaves?: boolean; - /** - * Replace all existing synonyms on the index with the content of the batch - * https://github.com/algolia/algoliasearch-client-js#batch-synonyms---batchsynonyms - */ - replaceExistingSynonyms?: boolean; -} -/** - * Describes options used when searching for synonyms - */ -interface SearchSynonymOptions { - /** - * The actual search query to find synonyms - * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms - */ - query?: string; - /** - * The page to fetch when browsing through several pages of results - * default: 100 - * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms - */ - page?: number; - /** - * Restrict the search to a specific type of synonym - * Use an empty string to search all types (default behavior) - * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms - */ - type?: string; - /** - * Number of hits per page - * default: 100 - * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms - */ - hitsPerPage?: number -} -interface AlgoliaBrowseResponse { - cursor?: string, - hits: any[], - params: string, - query: string, - processingTimeMS: number -} -/** - * Describes a synonym object - */ -interface AlgoliaSynonym { - /** - * ObjectID of the synonym - * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym - */ - objectID: string; - /** - * Type of synonym - * values: synonym,oneWaySynonym - * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym - */ - type: string; - /** - * Values used for the synonym - * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym - */ - synonyms: string[]; -} -/** - * Describes the options used when generating new api keys - */ -interface AlgoliaSecuredApiOptions { - /** - * Filter the query with numeric, facet or/and tag filters - * default: "" - * https://github.com/algolia/algoliasearch-client-js#filters-1 - */ - filters?: string; - /** - * Defines the expiration date of the API key - * https://github.com/algolia/algoliasearch-client-js#valid-until - */ - validUntil?: number; - /** - * Restricts the key to a list of index names allowed for the secured API key - * https://github.com/algolia/algoliasearch-client-js#index-restriction - */ - restrictIndices?: string; - /** - * Allows you to restrict a single user to performing a maximum of N API calls per hour - * https://github.com/algolia/algoliasearch-client-js#user-rate-limiting - */ - userToken?: string; -} - -/** - * Describes the settings available for configure your index - */ -interface AlgoliaIndexSettings { - /** - * The list of attributes you want index - * default: * - * https://github.com/algolia/algoliasearch-client-js#attributestoindex - */ - attributesToIndex?: string[]; - /** - * The list of attributes you want to use for faceting - * default: null - * https://github.com/algolia/algoliasearch-client-js#attributesforfaceting - */ - attributesforFaceting?: string[]; - /** - * The list of attributes that cannot be retrieved at query time - * default: null - * https://github.com/algolia/algoliasearch-client-js#unretrievableattributes - */ - unretrievableAttributes?: string[]; - /** - * A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer - * default: * - * https://github.com/algolia/algoliasearch-client-js#attributestoretrieve - */ - attributesToRetrieve?: string[]; - /** - * Controls the way results are sorted - * default: ['typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'] - * https://github.com/algolia/algoliasearch-client-js#ranking - */ - ranking?: string[]; - /** - * Lets you specify part of the ranking - * default: [] - * https://github.com/algolia/algoliasearch-client-js#customranking - */ - customRanking?: string[]; - /** - * The list of indices on which you want to replicate all write operations - * default: [] - * https://github.com/algolia/algoliasearch-client-js#slaves - */ - slaves?: string[]; - /** - * Limit the number of facet values returned for each facet - * default: "" - * https://github.com/algolia/algoliasearch-client-js#maxvaluesperfacet - */ - maxValuesPerFacet?: string; - /** - * Default list of attributes to highlight. If set to null, all indexed attributes are highlighted. - * default: null - * https://github.com/algolia/algoliasearch-client-js#attributestohighlight - */ - attributesToHighlight?: string[]; - /** - * Default list of attributes to snippet alongside the number of words to return - * default: null - * https://github.com/algolia/algoliasearch-client-js#attributestosnippet - */ - attributesToSnippet?: string[]; - /** - * Specify the string that is inserted before the highlighted parts in the query result - * default: - * https://github.com/algolia/algoliasearch-client-js#highlightpretag - */ - highlightPreTag?: string; - /** - * Specify the string that is inserted after the highlighted parts in the query result - * default: - * https://github.com/algolia/algoliasearch-client-js#highlightposttag - */ - highlightPostTag?: string; - /** - * String used as an ellipsis indicator when a snippet is truncated. - * default: … - * https://github.com/algolia/algoliasearch-client-js#snippetellipsistext - */ - snippetEllipsisText?: string; - /** - * If set to true, restrict arrays in highlights and snippets to items that matched the query at least partially else return all array items in highlights and snippets - * default: false - * https://github.com/algolia/algoliasearch-client-js#restricthighlightandsnippetarrays - */ - restrictHighlightAndSnippetArrays?: boolean; - /** - * Pagination parameter used to select the number of hits per page - * default: 20 - * https://github.com/algolia/algoliasearch-client-js#hitsperpage - */ - hitsPerPage?: number; - /** - * The minimum number of characters needed to accept one typo - * default: 4 - * https://github.com/algolia/algoliasearch-client-js#minwordsizefor1typo - */ - minWordSizefor1Typo?: number; - /** - * The minimum number of characters needed to accept two typos. - * default: 8 - * https://github.com/algolia/algoliasearch-client-js#highlightposttag - */ - minWordSizefor2Typos?: number; - /** - * This option allows you to control the number of typos allowed in the result set - * default: true - * 'true' The typo tolerance is enabled and all matching hits are retrieved (default behavior). - * 'false' The typo tolerance is disabled. All results with typos will be hidden. - * 'min' Only keep results with the minimum number of typos. For example, if one result matches without typos, then all results with typos will be hidden. - * 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos. - * https://github.com/algolia/algoliasearch-client-js#typotolerance - */ - typoTolerance?: any; - /** - * If set to false, disables typo tolerance on numeric tokens (numbers). - * default: true - * https://github.com/algolia/algoliasearch-client-js#allowtyposonnumerictokens - */ - allowTyposOnNumericTokens?: boolean; - /** - * If set to true, plural won't be considered as a typo - * default: false - * https://github.com/algolia/algoliasearch-client-js#ignoreplurals - */ - ignorePlurals?: boolean; - /** - * List of attributes on which you want to disable typo tolerance - * default: "" - * https://github.com/algolia/algoliasearch-client-js#disabletypotoleranceonattributes - */ - disableTypoToleranceOnAttributes?: string; - /** - * Specify the separators (punctuation characters) to index. - * default: "" - * https://github.com/algolia/algoliasearch-client-js#separatorstoindex - */ - separatorsToIndex?: string; - /** - * Selects how the query words are interpreted - * default: 'prefixLast' - * 'prefixAll' All query words are interpreted as prefixes. This option is not recommended. - * 'prefixLast' Only the last word is interpreted as a prefix (default behavior). - * 'prefixNone' No query word is interpreted as a prefix. This option is not recommended. - * https://github.com/algolia/algoliasearch-client-js#querytype - */ - queryType?: any; - /** - * This option is used to select a strategy in order to avoid having an empty result page - * default: 'none' - * 'lastWords' When a query does not return any results, the last word will be added as optional - * 'firstWords' When a query does not return any results, the first word will be added as optional - * 'allOptional' When a query does not return any results, a second trial will be made with all words as optional - * 'none' No specific processing is done when a query does not return any results - * https://github.com/algolia/algoliasearch-client-js#removewordsifnoresults - */ - removeWordsIfNoResults?: string; - /** - * Enables the advanced query syntax - * default: false - * https://github.com/algolia/algoliasearch-client-js#advancedsyntax - */ - advancedSyntax?: boolean; - /** - * A string that contains the comma separated list of words that should be considered as optional when found in the query - * default: [] - * https://github.com/algolia/algoliasearch-client-js#optionalwords - */ - optionalWords?: string[]; - /** - * Remove stop words from the query before executing it - * default: false - * true|false: enable or disable stop words for all 41 supported languages; or - * a list of language ISO codes (as a comma-separated string) for which stop words should be enable - * https://github.com/algolia/algoliasearch-client-js#removestopwords - */ - removeStopWords?: string[]; - /** - * List of attributes on which you want to disable prefix matching - * default: [] - * https://github.com/algolia/algoliasearch-client-js#disableprefixonattributes - */ - disablePrefixOnAttributes?: string[]; - /** - * List of attributes on which you want to disable the computation of exact criteria - * default: [] - * https://github.com/algolia/algoliasearch-client-js#disableexactonattributes - */ - disableExactOnAttributes?: string[]; - /** - * This parameter control how the exact ranking criterion is computed when the query contains one word - * default: attribute - * 'none': no exact on single word query - * 'word': exact set to 1 if the query word is found in the record - * 'attribute': exact set to 1 if there is an attribute containing a string equals to the query - * https://github.com/algolia/algoliasearch-client-js#exactonsinglewordquery - */ - exactOnSingleWordQuery?: string; - /** - * Specify the list of approximation that should be considered as an exact match in the ranking formula - * default: ['ignorePlurals', 'singleWordSynonym'] - * 'ignorePlurals': alternative words added by the ignorePlurals feature - * 'singleWordSynonym': single-word synonym (For example "NY" = "NYC") - * 'multiWordsSynonym': multiple-words synonym - * https://github.com/algolia/algoliasearch-client-js#alternativesasexact - */ - alternativesAsExact?: any; - /** - * The name of the attribute used for the Distinct feature - * default: null - * https://github.com/algolia/algoliasearch-client-js#attributefordistinct - */ - attributeForDistinct?: string; - /** - * If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set. - * https://github.com/algolia/algoliasearch-client-js#distinct - */ - distinct?: any; - /** - * All numerical attributes are automatically indexed as numerical filters - * default '' - * https://github.com/algolia/algoliasearch-client-js#numericattributestoindex - */ - numericAttributesToIndex?: string[]; - /** - * Allows compression of big integer arrays. - * default: false - * https://github.com/algolia/algoliasearch-client-js#allowcompressionofintegerarray - */ - allowCompressionOfIntegerArray?: boolean; - /** - * Specify alternative corrections that you want to consider. - * default: [] - * https://github.com/algolia/algoliasearch-client-js#altcorrections - */ - altCorrections?: [{}]; - /** - * Configure the precision of the proximity ranking criterion - * default: 1 - * https://github.com/algolia/algoliasearch-client-js#minproximity - */ - minProximity?: number; - /** - * This is an advanced use-case to define a token substitutable by a list of words without having the original token searchable - * default: '' - * https://github.com/algolia/algoliasearch-client-js#placeholders - */ - placeholders?: any; -} - -interface AlgoliaQueryParameters { - /** - * Query string used to perform the search - * default: '' - * https://github.com/algolia/algoliasearch-client-js#query - */ - query?: string; - /** - * Filter the query with numeric, facet or/and tag filters - * default: "" - * https://github.com/algolia/algoliasearch-client-js#filters - */ - filters?: string; - /** - * A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer. - * default: * - * https://github.com/algolia/algoliasearch-client-js#attributestoretrieve - */ - attributesToRetrieve?: string[]; - /** - * List of attributes you want to use for textual search - * default: attributeToIndex - * https://github.com/algolia/algoliasearch-client-js#restrictsearchableattributes - */ - restrictSearchableAttributes?: string[]; - /** - * You can use facets to retrieve only a part of your attributes declared in attributesForFaceting attributes - * default: "" - * https://github.com/algolia/algoliasearch-client-js#facets - */ - facets?: string; - /** - * Limit the number of facet values returned for each facet. - * default: "" - * https://github.com/algolia/algoliasearch-client-js#maxvaluesperfacet - */ - maxValuesPerFacet?: string; - /** - * Default list of attributes to highlight. If set to null, all indexed attributes are highlighted. - * default: null - * https://github.com/algolia/algoliasearch-client-js#attributestohighlight - */ - attributesToHighlight?: string[]; - /** - * Default list of attributes to snippet alongside the number of words to return - * default: null - * https://github.com/algolia/algoliasearch-client-js#attributestosnippet - */ - attributesToSnippet?: string[]; - /** - * Specify the string that is inserted before the highlighted parts in the query result - * default: - * https://github.com/algolia/algoliasearch-client-js#highlightpretag - */ - highlightPreTag?: string; - /** - * Specify the string that is inserted after the highlighted parts in the query result - * default: - * https://github.com/algolia/algoliasearch-client-js#highlightposttag - */ - highlightPostTag?: string; - /** - * String used as an ellipsis indicator when a snippet is truncated. - * default: … - * https://github.com/algolia/algoliasearch-client-js#snippetellipsistext - */ - snippetEllipsisText?: string; - /** - * If set to true, restrict arrays in highlights and snippets to items that matched the query at least partially else return all array items in highlights and snippets - * default: false - * https://github.com/algolia/algoliasearch-client-js#restricthighlightandsnippetarrays - */ - restrictHighlightAndSnippetArrays?: boolean; - /** - * Pagination parameter used to select the number of hits per page - * default: 20 - * https://github.com/algolia/algoliasearch-client-js#hitsperpage - */ - hitsPerPage?: number; - /** - * Pagination parameter used to select the page to retrieve. - * default: 0 - * https://github.com/algolia/algoliasearch-client-js#page - */ - page?: number; - /** - * Offset of the first hit to return - * default: null - * https://github.com/algolia/algoliasearch-client-js#offset - */ - offset?: number; - /** - * Number of hits to return. - * default: null - * https://github.com/algolia/algoliasearch-client-js#length - */ - length?: number; - /** - * The minimum number of characters needed to accept one typo. - * default: 4 - * https://github.com/algolia/algoliasearch-client-js#minwordsizefor1typo - */ - minWordSizefor1Typo?: number; - /** - * The minimum number of characters needed to accept two typo. - * fault: 8 - * https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos - */ - minWordSizefor2Typos?: number; - /** - * This option allows you to control the number of typos allowed in the result set: - * default: true - * 'true' The typo tolerance is enabled and all matching hits are retrieved - * 'false' The typo tolerance is disabled. All results with typos will be hidden. - * 'min' Only keep results with the minimum number of typos - * 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos. - * https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos - */ - typoTolerance?: boolean; - /** - * If set to false, disables typo tolerance on numeric tokens (numbers). - * default: - * https://github.com/algolia/algoliasearch-client-js#allowtyposonnumerictokens - */ - allowTyposOnNumericTokens?: boolean; - /** - * If set to true, plural won't be considered as a typo - * default: false - * https://github.com/algolia/algoliasearch-client-js#ignoreplurals - */ - ignorePlurals?: boolean; - /** - * List of attributes on which you want to disable typo tolerance - * default: "" - * https://github.com/algolia/algoliasearch-client-js#disabletypotoleranceonattributes - */ - disableTypoToleranceOnAttributes?: string; - /** - * Search for entries around a given location - * default: "" - * https://github.com/algolia/algoliasearch-client-js#aroundlatlng - */ - aroundLatLng?: string; - /** - * Search for entries around a given latitude/longitude automatically computed from user IP address. - * default: "" - * https://github.com/algolia/algoliasearch-client-js#aroundlatlngviaip - */ - aroundLatLngViaIP?: string; - /** - * Control the radius associated with a geo search. Defined in meters. - * default: null - * You can specify aroundRadius=all if you want to compute the geo distance without filtering in a geo area - * https://github.com/algolia/algoliasearch-client-js#aroundradius - */ - aroundRadius?: any; - /** - * Control the precision of a geo search - * default: null - * https://github.com/algolia/algoliasearch-client-js#aroundprecision - */ - aroundPrecision?: number; - /** - * Define the minimum radius used for a geo search when aroundRadius is not set. - * default: null - * https://github.com/algolia/algoliasearch-client-js#minimumaroundradius - */ - minimumAroundRadius?: number; - /** - * Search entries inside a given area defined by the two extreme points of a rectangle - * default: null - * https://github.com/algolia/algoliasearch-client-js#insideboundingbox - */ - insideBoundingBox?: string; - /** - * Selects how the query words are interpreted - * default: 'prefixLast' - * 'prefixAll' All query words are interpreted as prefixes. This option is not recommended. - * 'prefixLast' Only the last word is interpreted as a prefix (default behavior). - * 'prefixNone' No query word is interpreted as a prefix. This option is not recommended. - * https://github.com/algolia/algoliasearch-client-js#querytype - */ - queryType?: any; - /** - * Search entries inside a given area defined by a set of points - * defauly: '' - * https://github.com/algolia/algoliasearch-client-js#insidepolygon - */ - insidePolygon?: string; - /** - * This option is used to select a strategy in order to avoid having an empty result page - * default: 'none' - * 'lastWords' When a query does not return any results, the last word will be added as optional - * 'firstWords' When a query does not return any results, the first word will be added as optional - * 'allOptional' When a query does not return any results, a second trial will be made with all words as optional - * 'none' No specific processing is done when a query does not return any results - * https://github.com/algolia/algoliasearch-client-js#removewordsifnoresults - */ - removeWordsIfNoResults?: string; - /** - * Enables the advanced query syntax - * default: false - * https://github.com/algolia/algoliasearch-client-js#advancedsyntax - */ - advancedSyntax?: boolean; - /** - * A string that contains the comma separated list of words that should be considered as optional when found in the query - * default: [] - * https://github.com/algolia/algoliasearch-client-js#optionalwords - */ - optionalWords?: string[]; - /** - * Remove stop words from the query before executing it - * default: false - * true|false: enable or disable stop words for all 41 supported languages; or - * a list of language ISO codes (as a comma-separated string) for which stop words should be enable - * https://github.com/algolia/algoliasearch-client-js#removestopwords - */ - removeStopWords?: string[]; - /** - * List of attributes on which you want to disable the computation of exact criteria - * default: [] - * https://github.com/algolia/algoliasearch-client-js#disableexactonattributes - */ - disableExactOnAttributes?: string[]; - /** - * This parameter control how the exact ranking criterion is computed when the query contains one word - * default: attribute - * 'none': no exact on single word query - * 'word': exact set to 1 if the query word is found in the record - * 'attribute': exact set to 1 if there is an attribute containing a string equals to the query - * https://github.com/algolia/algoliasearch-client-js#exactonsinglewordquery - */ - exactOnSingleWordQuery?: string; - /** - * Specify the list of approximation that should be considered as an exact match in the ranking formula - * default: ['ignorePlurals', 'singleWordSynonym'] - * 'ignorePlurals': alternative words added by the ignorePlurals feature - * 'singleWordSynonym': single-word synonym (For example "NY" = "NYC") - * 'multiWordsSynonym': multiple-words synonym - * https://github.com/algolia/algoliasearch-client-js#alternativesasexact - */ - alternativesAsExact?: any; - /** - * If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set. - * https://github.com/algolia/algoliasearch-client-js#distinct - */ - distinct?: any; - /** - * If set to true, the result hits will contain ranking information in the _rankingInfo attribute. - * default: false - * https://github.com/algolia/algoliasearch-client-js#getrankinginfo - */ - getRankingInfo?: boolean; - /** - * All numerical attributes are automatically indexed as numerical filters - * default: '' - * https://github.com/algolia/algoliasearch-client-js#numericattributestoindex - */ - numericAttributesToIndex?: string[]; - /** - * @deprecated please use filters instead - * A string that contains the comma separated list of numeric filters you want to apply. - * https://github.com/algolia/algoliasearch-client-js#numericfilters-deprecated - */ - numericFilters?: string[]; - /** - * @deprecated - * Filter the query by a set of tags. - * https://github.com/algolia/algoliasearch-client-js#tagfilters-deprecated - */ - tagFilters?: string; - /** - * @deprecated - * Filter the query by a set of facets. - * https://github.com/algolia/algoliasearch-client-js#facetfilters-deprecated - */ - facetFilters?: string; - /** - * If set to false, this query will not be taken into account in the analytics feature. - * default true - * https://github.com/algolia/algoliasearch-client-js#analytics - */ - analytics?: boolean; - /** - * If set, tag your query with the specified identifiers - * default: null - * https://github.com/algolia/algoliasearch-client-js#analyticstags - */ - analyticsTags?: string[]; - /** - * If set to false, the search will not use the synonyms defined for the targeted index. - * default: true - * https://github.com/algolia/algoliasearch-client-js#synonyms - */ - synonyms?: boolean; - /** - * If set to false, words matched via synonym expansion will not be replaced by the matched synonym in the highlighted result. - * default: true - * https://github.com/algolia/algoliasearch-client-js#replacesynonymsinhighlight - */ - replaceSynonymsInHighlight?: boolean; - /** - * Configure the precision of the proximity ranking criterion - * default: 1 - * https://github.com/algolia/algoliasearch-client-js#minproximity - */ - minProximity?: number; -} - -declare module "algoliasearch" { - function algoliasearch(applicationId: string, apiKey: string, options?: ClientOptions) : AlgoliaClient; - export = algoliasearch; -} diff --git a/algoliasearch-client-js/algoliasearch-client-js-tests.ts b/algoliasearch/algoliasearch-tests.ts similarity index 94% rename from algoliasearch-client-js/algoliasearch-client-js-tests.ts rename to algoliasearch/algoliasearch-tests.ts index 82d57c55e0..a3a04aadc2 100644 --- a/algoliasearch-client-js/algoliasearch-client-js-tests.ts +++ b/algoliasearch/algoliasearch-tests.ts @@ -1,5 +1,6 @@ - import algoliasearch = require('algoliasearch'); +import { ClientOptions, SynonymOption, AlgoliaUserKeyOptions, SearchSynonymOptions, + AlgoliaSecuredApiOptions, AlgoliaIndexSettings, AlgoliaQueryParameters, AlgoliaIndex } from "algoliasearch"; var _clientOptions: ClientOptions = { timeout : 12, diff --git a/algoliasearch/index.d.ts b/algoliasearch/index.d.ts new file mode 100644 index 0000000000..582e91999b --- /dev/null +++ b/algoliasearch/index.d.ts @@ -0,0 +1,1528 @@ +// Type definitions for algoliasearch-client-js 3.18.1 +// Project: https://github.com/algolia/algoliasearch-client-js +// Definitions by: Baptiste Coquelle +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace algoliasearch { + interface AlgoliaResponse { + /** + * Contains all the hits matching the query + * https://github.com/algolia/algoliasearch-client-js#response-format + */ + hits: any[]; + /** + * Current page + * https://github.com/algolia/algoliasearch-client-js#response-format + */ + page: number; + /** + * Number of total hits matching the query + * https://github.com/algolia/algoliasearch-client-js#response-format + */ + nbHits: number; + /** + * Number of pages + * https://github.com/algolia/algoliasearch-client-js#response-format + */ + nbPage: number; + /** + * Number of hits per pages + * https://github.com/algolia/algoliasearch-client-js#response-format + */ + hitsPerPage: number; + /** + * Engine processing time (excluding network transfer) + * https://github.com/algolia/algoliasearch-client-js#response-format + */ + processingTimeMS: number; + /** + * Query used to perform the search + * https://github.com/algolia/algoliasearch-client-js#response-format + */ + query: string; + /** + * GET parameters used to perform the search + * https://github.com/algolia/algoliasearch-client-js#response-format + */ + params: string; + } + /* + Interface for the algolia client object + */ + interface AlgoliaClient { + /** + * Initialization of the index + * @param name: index name + * return algolia index object + * https://github.com/algolia/algoliasearch-client-js#init-index---initindex + */ + initIndex(name: string): AlgoliaIndex; + /** + * Query on multiple index + * @param queries index name, query and query parameters + * @param cb callback(err, res) + * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries + */ + search(queries: { indexName: string, query: string, options: AlgoliaQueryParameters }, cb: (err: Error, res: any) => void): void; + /** + * Query on multiple index + * @param queries index name, query and query parameters + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries + */ + search(queries: { indexName: string, query: string, options: AlgoliaQueryParameters }): Promise; + /** + * clear browser cache + * https://github.com/algolia/algoliasearch-client-js#cache + */ + clearCache(): void; + /** + * kill alive connections + * https://github.com/algolia/algoliasearch-client-js#keep-alive + */ + destroy(): void; + /** + * List all your indices along with their associated information (number of entries, disk size, etc.) + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#list-indices---listindexes + */ + listIndexes(cb: (err: Error, res: any) => void): void; + /** + * List all your indices along with their associated information (number of entries, disk size, etc.) + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#list-indices---listindexes + */ + listIndexes(): Promise; + /** + * Delete a specific index + * @param name + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#delete-index---deleteindex + */ + deleteIndex(name: string, cb: (err: Error, res: any) => void): void; + /** + * Delete a specific index + * @param name + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#delete-index---deleteindex + */ + deleteIndex(name: string): Promise; + /** + * Copy an index from a specific index to a new one + * @param from origin index + * @param to destination index + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex + */ + copyIndex(from: string, to: string, cb: (err: Error, res: any) => void): void; + /** + * Copy an index from a specific index to a new one + * @param from origin index + * @param to destination index + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#copy-index---copyindex + */ + copyIndex(from: string, to: string): Promise; + /** + * Move index to a new one (and will overwrite the original one) + * @param from origin index + * @param to destination index + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#move-index---moveindex + */ + moveIndex(from: string, to: string, cb: (err: Error, res: any) => void): void; + /** + * Move index to a new one (and will overwrite the original one) + * @param from origin index + * @param to destination index + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#move-index---moveindex + */ + moveIndex(from: string, to: string): Promise; + /** + * Generate a public API key + * @param key api key + * @param filters + * https://github.com/algolia/algoliasearch-client-js#generate-key---generatesecuredapikey + */ + generateSecuredApiKey(key: string, filters: AlgoliaSecuredApiOptions): void; + /** + * Perform multiple operations with one API call to reduce latency + * @param action + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#custom-batch---batch + */ + batch(action: AlgoliaAction, cb: (err: Error, res: any) => void): void; + /** + * Perform multiple operations with one API call to reduce latency + * @param action + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#custom-batch---batch + */ + batch(action: AlgoliaAction): Promise; + /** + * Lists global API Keys + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse + */ + listUserKeys(cb: (err: Error, res: any) => void): void; + /** + * Lists global API Keys + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse + */ + listUserKeys(): Promise; + /** + * Add global API Keys + * @param scopes + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + addUserKey(scopes: string[], cb: (err: Error, res: any) => void): void; + /** + * Add global API Key + * @param scopes + * @param options + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + addUserKey(scopes: string[], options: AlgoliaUserKeyOptions, cb: (err: Error, res: any) => void): void; + /** + * Add global API Keys + * @param scopes + * @param options + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + addUserKey(scopes: string[], options?: AlgoliaUserKeyOptions): Promise; + /** + * Update global API key + * @param key + * @param scopes + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey + */ + updateUserKey(key: string, scopes: string[], cb: (err: Error, res: any) => void): void; + /** + * Update global API key + * @param key + * @param scopes + * @param options + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey + */ + updateUserKey(key: string, scopes: string[], options: AlgoliaUserKeyOptions, cb: (err: Error, res: any) => void): void; + /** + * Update global API key + * @param key + * @param scopes + * @param options + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey + */ + updateUserKey(key: string, scopes: string[], options?: AlgoliaUserKeyOptions): Promise; + /** + * Gets the rights of a global key + * @param key + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey + */ + getUserKeyACL(key: string, cb: (err: Error, res: any) => void): void; + /** + * Gets the rights of a global key + * @param key + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey + */ + getUserKeyACL(key: string): Promise; + /** + * Deletes a global key + * @param key + * @param cb(err,res) + * https://github.com/algolia/algoliasearch-client-js#delete-user-key---deleteuserkey + */ + deleteUserKey(key: string, cb: (err: Error, res: any) => void): void; + /** + * Deletes a global key + * @param key + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#delete-user-key---deleteuserkey + */ + deleteUserKey(key: string): Promise; + /** + * Get 1000 last events + * @param options + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs + */ + getLogs(options: LogsOptions, cb: (err: Error, res: any) => void): void; + /** + * Get 1000 last events + * @param options + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs + */ + getLogs(options: LogsOptions): Promise; + } + /** + * Interface for the index algolia object + */ + interface AlgoliaIndex { + /** + * Gets a specific object + * @param objectID + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects + */ + getObject(objectID: string, cb: (err: Error, res: any) => void): void; + /** + * Gets specific attributes from an object + * @param objectID + * @param attributes + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects + */ + getObject(objectID: string, attributes: string[], cb: (err: Error, res: any) => void): void; + /** + * Gets a list of objects + * @param objectIDs + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects + */ + getObjects(objectIDs: string[], cb: (err: Error, res: any) => void): void; + /** + * Add a specific object + * @param object without objectID + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects + */ + addObject(object: {}, cb: (err: Error, res: any) => void): void; + /** + * Add a list of objects + * @param object with objectID + * @param objectID + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects + */ + addObject(object: {}, objectID: string, cb: (err: Error, res: any) => void): void; + /** + * Add list of objects + * @param objects + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects + */ + addObjects(objects: [{}], cb: (err: Error, res: any) => void): void; + /** + * Add or replace a specific object + * @param object + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects + */ + saveObject(object: {}, cb: (err: Error, res: any) => void): void; + /** + * Add or replace several objects + * @param objects + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects + */ + saveObjects(objects: [{}], cb: (err: Error, res: any) => void): void; + /** + * Update parameters of a specific object + * @param object + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects + */ + partialUpdateObject(object: {}, cb: (err: Error, res: any) => void): void; + /** + * Update parameters of a list of objects + * @param objects + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects + */ + partialUpdateObjects(objects: [{}], cb: (err: Error, res: any) => void): void; + /** + * Delete a specific object + * @param objectID + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#delete-objects---deleteobjects + */ + deleteObject(objectID: string, cb: (err: Error, res: any) => void): void; + /** + * Delete a list of objects + * @param objectIDs + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#delete-objects---deleteobjects + */ + deleteObjects(objectIDs: string[], cb: (err: Error, res: any) => void): void; + /** + * Delete objects that matches the query + * @param query + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#delete-by-query---deletebyquery + */ + deleteByQuery(query: string, cb: (err: Error, res: any) => void): void; + /** + * Delete objects that matches the query + * @param query + * @param params of the object + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#delete-by-query---deletebyquery + */ + deleteByQuery(query: string, params: {}, cb: (err: Error, res: any) => void): void; + /** + * Wait for an indexing task to be compete + * @param taskID + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#wait-for-operations---waittask + */ + waitTask(taskID: number, cb: (err: Error, res: any) => void): void; + /** + * Get an index settings + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#get-settings---getsettings + */ + getSettings(cb: (err: Error, res: any) => void): void; + /** + * Set an index settings + * @param settings + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#set-settings---setsettings + */ + setSettings(settings: AlgoliaIndexSettings, cb: (err: Error, res: any) => void): void; + /** + * Clear cache of an index + * https://github.com/algolia/algoliasearch-client-js#cache + */ + clearCache(): void; + /** + * Clear an index content + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#clear-index---clearindex + */ + clearIndex(cb: (err: Error, res: any) => void): void; + /** + * Save a synonym object + * @param synonym + * @param options + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym + */ + saveSynonym(synonym: AlgoliaSynonym, option: SynonymOption, cb: (err: Error, res: any) => void): void; + /** + * Save a synonym object + * @param synonyms + * @param options + * @param cb(err, res) + */ + batchSynonyms(synonyms: AlgoliaSynonym[], options: SynonymOption, cb: (err: Error, res: any) => void): void; + /** + * Delete a specific synonym + * @param identifier + * @param options + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#batch-synonyms---batchsynonyms + */ + deleteSynonym(identifier: string, options: SynonymOption, cb: (err: Error, res: any) => void): void; + /** + * Clear all synonyms of an index + * @param options + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#clear-all-synonyms---clearsynonyms + */ + clearSynonyms(options: SynonymOption, cb: (err: Error, res: any) => void): void; + /** + * Get a specific synonym + * @param identifier + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#get-synonym---getsynonym + */ + getSynonym(identifier: string, cb: (err: Error, res: any) => void): void; + /** + * Search a synonyms + * @param options + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms + */ + searchSynonyms(options: SearchSynonymOptions, cb: (err: Error, res: any) => void): void; + /** + * List index user keys + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#list-api-keys---listapikeys + */ + listUserKeys(cb: (err: Error, res: any) => void): void; + /** + * Add key for this index + * @param scopes + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + addUserKey(scopes: string[], cb: (err: Error, res: any) => void): void; + /** + * Add key for this index + * @param scopes + * @param options + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + addUserKey(scopes: string[], options: AlgoliaUserKeyOptions, cb: (err: Error, res: any) => void): void; + /** + * Update a key for this index + * @param key + * @param scopes + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey + */ + updateUserKey(key: string, scopes: string[], cb: (err: Error, res: any) => void): void; + /** + * Update a key for this index + * @param key + * @param scopes + * @param options + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey + */ + updateUserKey(key: string, scopes: string[], options: AlgoliaUserKeyOptions, cb: (err: Error, res: any) => void): void; + /** + * Gets the rights of an index specific key + * @param key + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#get-key-permissions---getuserkeyacl + */ + getUserKeyACL(key: string, cb: (err: Error, res: any) => void): void; + /** + * Deletes an index specific key + * @param key + * @param cb(err, res) + * https://github.com/algolia/algoliasearch-client-js#delete-user-key---deleteuserkey + */ + deleteUserKey(key: string, cb: (err: Error, res: any) => void): void; + /** + * Gets specific attributes from an object + * @param objectID + * @param attributes + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects + */ + getObject(objectID: string, attributes?: string[]): Promise ; + /** + * Gets a list of objects + * @param objectIDs + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects + */ + getObjects(objectIDs: string[]): Promise ; + /** + * Add a list of objects + * @param object with objectID + * @param objectID + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects + */ + addObject(object: {}, objectID?: string): Promise ; + /** + * Add list of objects + * @param objects + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects + */ + addObjects(objects: [{}]): Promise ; + /** + * Add or replace a specific object + * @param object + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects + */ + saveObject(object: {}): Promise ; + /** + * Add or replace several objects + * @param objects + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects + */ + saveObjects(objects: [{}]): Promise ; + /** + * Update parameters of a specific object + * @param object + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects + */ + partialUpdateObject(object: {}): Promise ; + /** + * Update parameters of a list of objects + * @param objects + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects + */ + partialUpdateObjects(objects: [{}]): Promise ; + /** + * Delete a specific object + * @param objectID + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#delete-objects---deleteobjects + */ + deleteObject(objectID: string): Promise ; + /** + * Delete a list of objects + * @param objectIDs + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#delete-objects---deleteobjects + */ + deleteObjects(objectIDs: string[]): Promise ; + /** + * Delete objects that matches the query + * @param query + * @param params of the object + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#delete-by-query---deletebyquery + */ + deleteByQuery(query: string, params?: {}): Promise ; + /** + * Wait for an indexing task to be compete + * @param taskID + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#wait-for-operations---waittask + */ + waitTask(taskID: number): Promise ; + /** + * Get an index settings + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#get-settings---getsettings + */ + getSettings(): Promise ; + /** + * Set an index settings + * @param settings + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#set-settings---setsettings + */ + setSettings(settings: AlgoliaIndexSettings): Promise ; + /** + * Search in an index + * @param params query parameter + * return {Promise} + * @param err() error callback + * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search + */ + search(params: AlgoliaQueryParameters): Promise ; + /** + * Search in an index + * @param params query parameter + * @param cb(err, res) + * @param err() error callback + * https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search + */ + search(params: AlgoliaQueryParameters, cb: (err: Error, res: any) => void): void; + /** + * Browse an index + * @param query + * @param cb(err, content) + * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse + */ + browse(query: string, cb: (err: Error, res: any) => void): void; + /** + * Browse an index + * @param query + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse + */ + browse(query: string): Promise; + /** + * Browse an index from a cursor + * @param cursor + * @param cb(err, content) + * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse + */ + browseFrom(cursor: string, cb: (err: Error, res: any) => void): void; + /** + * Browse an index from a cursor + * @param cursor + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse + */ + browseFrom(cursor: string): Promise; + /** + * Browse an entire index + * return Promise + * https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse + */ + browseAll(): Promise; + /** + * Clear an index content + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#clear-index---clearindex + */ + clearIndex(): Promise ; + /** + * Save a synonym object + * @param synonym + * @param options + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym + */ + saveSynonym(synonym: AlgoliaSynonym, option: SynonymOption): Promise ; + /** + * Save a synonym object + * @param synonyms + * @param options + * return {Promise} + */ + batchSynonyms(synonyms: AlgoliaSynonym[], options: SynonymOption): Promise ; + /** + * Delete a specific synonym + * @param identifier + * @param options + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#batch-synonyms---batchsynonyms + */ + deleteSynonym(identifier: string, options: SynonymOption): Promise ; + /** + * Clear all synonyms of an index + * @param options + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#clear-all-synonyms---clearsynonyms + */ + clearSynonyms(options: SynonymOption): Promise ; + /** + * Get a specific synonym + * @param identifier + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#get-synonym---getsynonym + */ + getSynonym(identifier: string): Promise ; + /** + * Search a synonyms + * @param options + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms + */ + searchSynonyms(options: SearchSynonymOptions): Promise ; + /** + * List index user keys + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#list-api-keys---listapikeys + */ + listUserKeys(): Promise ; + /** + * Add key for this index + * @param scopes + * @param options + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + addUserKey(scopes: string[], options?: AlgoliaUserKeyOptions): Promise ; + /** + * Update a key for this index + * @param key + * @param scopes + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey + */ + updateUserKey(key: string, scopes: string[]): Promise ; + /** + * Update a key for this index + * @param key + * @param scopes + * @param options + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#update-user-key---updateuserkey + */ + updateUserKey(key: string, scopes: string[], options: AlgoliaUserKeyOptions): Promise ; + /** + * Gets the rights of an index specific key + * @param key + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#get-key-permissions---getuserkeyacl + */ + getUserKeyACL(key: string): Promise ; + /** + * Deletes an index specific key + * @param key + * return {Promise} + * https://github.com/algolia/algoliasearch-client-js#delete-user-key---deleteuserkey + */ + deleteUserKey(key: string): Promise ; + } + /* + Interface describing available options when initializing a client + */ + interface ClientOptions { + /** + * Timeout for requests to our servers, in milliseconds + * default: 15s (node), 2s (browser) + * https://github.com/algolia/algoliasearch-client-js#client-options + */ + timeout?: number; + /** + * Protocol to use when communicating with algolia + * default: current protocol(browser), https(node) + * https://github.com/algolia/algoliasearch-client-js#client-options + */ + protocol?: string; + /** + * (node only) httpAgent instance to use when communicating with Algolia servers. + * https://github.com/algolia/algoliasearch-client-js#client-options + */ + httpAgent?: any; + /** + * read: array of read hosts to use to call Algolia servers, computed automatically + * write: array of read hosts to use to call Algolia servers, computed automatically + * https://github.com/algolia/algoliasearch-client-js#client-options + */ + hosts?: { read?: string[], write?: string[] }; + } + /* + Interface describing options available for gettings the logs + */ + interface LogsOptions { + /** + * Specify the first entry to retrieve (0-based, 0 is the most recent log entry). + * default: 0 + * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs + */ + offset?: number; + /** + * Specify the maximum number of entries to retrieve starting at the offset. + * default: 10 + * maximum: 1000 + * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs + */ + length?: number; + /** + * @deprecated + * Retrieve only logs with an HTTP code different than 200 or 201 + * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs + */ + onlyErrors?: boolean; + /** + * Specify the type of logs to retrieve + * 'query' Retrieve only the queries + * 'build' Retrieve only the build operations + * 'error' Retrieve only the errors (same as onlyErrors parameters) + * https://github.com/algolia/algoliasearch-client-js#get-logs---getlogs + */ + type?: string; + } + /** + * Describe the action object used for batch operation + */ + interface AlgoliaAction { + /** + * Type of the batch action + * values: addObject, updateObject, partialUpdateObject, partialUpdateObjectNoCreate, deleteObject + * https://github.com/algolia/algoliasearch-client-js#custom-batch---batch + */ + action: string; + /** + * Name of the index where the bact will be performed + * https://github.com/algolia/algoliasearch-client-js#custom-batch---batch + */ + indexName: string; + /** + * Object + * https://github.com/algolia/algoliasearch-client-js#custom-batch---batch + */ + body: {}; + } + /** + * Describes the option used when creating user key + */ + interface AlgoliaUserKeyOptions { + /** + * Add a validity period. The key will be valid for a specific period of time (in seconds). + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + validity?: number; + /** + * Specify the maximum number of API calls allowed from an IP address per hour + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + maxQueriesPerIPPerHour?: number; + /** + * Specify the maximum number of hits this API key can retrieve in one call + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + maxHitsPerQuery?: boolean; + /** + * Specify the list of targeted indices + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + indexes?: string[]; + /** + * Specify the list of referers + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + referers?: string[]; + /** + * Specify the list of query parameters + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + queryParameters?: AlgoliaQueryParameters; + /** + * Specify a description to describe where the key is used. + * https://github.com/algolia/algoliasearch-client-js#add-user-key---adduserkey + */ + description?: string; + } + /** + * Describes option used when making operation on synonyms + */ + interface SynonymOption { + /** + * You can forward all settings updates to the slaves of an index + * https://github.com/algolia/algoliasearch-client-js#slave-settings + */ + forwardToSlaves?: boolean; + /** + * Replace all existing synonyms on the index with the content of the batch + * https://github.com/algolia/algoliasearch-client-js#batch-synonyms---batchsynonyms + */ + replaceExistingSynonyms?: boolean; + } + /** + * Describes options used when searching for synonyms + */ + interface SearchSynonymOptions { + /** + * The actual search query to find synonyms + * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms + */ + query?: string; + /** + * The page to fetch when browsing through several pages of results + * default: 100 + * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms + */ + page?: number; + /** + * Restrict the search to a specific type of synonym + * Use an empty string to search all types (default behavior) + * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms + */ + type?: string; + /** + * Number of hits per page + * default: 100 + * https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms + */ + hitsPerPage?: number; + } + interface AlgoliaBrowseResponse { + cursor?: string; + hits: any[]; + params: string; + query: string; + processingTimeMS: number; + } + /** + * Describes a synonym object + */ + interface AlgoliaSynonym { + /** + * ObjectID of the synonym + * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym + */ + objectID: string; + /** + * Type of synonym + * values: synonym,oneWaySynonym + * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym + */ + type: string; + /** + * Values used for the synonym + * https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym + */ + synonyms: string[]; + } + /** + * Describes the options used when generating new api keys + */ + interface AlgoliaSecuredApiOptions { + /** + * Filter the query with numeric, facet or/and tag filters + * default: "" + * https://github.com/algolia/algoliasearch-client-js#filters-1 + */ + filters?: string; + /** + * Defines the expiration date of the API key + * https://github.com/algolia/algoliasearch-client-js#valid-until + */ + validUntil?: number; + /** + * Restricts the key to a list of index names allowed for the secured API key + * https://github.com/algolia/algoliasearch-client-js#index-restriction + */ + restrictIndices?: string; + /** + * Allows you to restrict a single user to performing a maximum of N API calls per hour + * https://github.com/algolia/algoliasearch-client-js#user-rate-limiting + */ + userToken?: string; + } + + /** + * Describes the settings available for configure your index + */ + interface AlgoliaIndexSettings { + /** + * The list of attributes you want index + * default: * + * https://github.com/algolia/algoliasearch-client-js#attributestoindex + */ + attributesToIndex?: string[]; + /** + * The list of attributes you want to use for faceting + * default: null + * https://github.com/algolia/algoliasearch-client-js#attributesforfaceting + */ + attributesforFaceting?: string[]; + /** + * The list of attributes that cannot be retrieved at query time + * default: null + * https://github.com/algolia/algoliasearch-client-js#unretrievableattributes + */ + unretrievableAttributes?: string[]; + /** + * A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer + * default: * + * https://github.com/algolia/algoliasearch-client-js#attributestoretrieve + */ + attributesToRetrieve?: string[]; + /** + * Controls the way results are sorted + * default: ['typo', 'geo', 'words', 'filters', 'proximity', 'attribute', 'exact', 'custom'] + * https://github.com/algolia/algoliasearch-client-js#ranking + */ + ranking?: string[]; + /** + * Lets you specify part of the ranking + * default: [] + * https://github.com/algolia/algoliasearch-client-js#customranking + */ + customRanking?: string[]; + /** + * The list of indices on which you want to replicate all write operations + * default: [] + * https://github.com/algolia/algoliasearch-client-js#slaves + */ + slaves?: string[]; + /** + * Limit the number of facet values returned for each facet + * default: "" + * https://github.com/algolia/algoliasearch-client-js#maxvaluesperfacet + */ + maxValuesPerFacet?: string; + /** + * Default list of attributes to highlight. If set to null, all indexed attributes are highlighted. + * default: null + * https://github.com/algolia/algoliasearch-client-js#attributestohighlight + */ + attributesToHighlight?: string[]; + /** + * Default list of attributes to snippet alongside the number of words to return + * default: null + * https://github.com/algolia/algoliasearch-client-js#attributestosnippet + */ + attributesToSnippet?: string[]; + /** + * Specify the string that is inserted before the highlighted parts in the query result + * default: + * https://github.com/algolia/algoliasearch-client-js#highlightpretag + */ + highlightPreTag?: string; + /** + * Specify the string that is inserted after the highlighted parts in the query result + * default: + * https://github.com/algolia/algoliasearch-client-js#highlightposttag + */ + highlightPostTag?: string; + /** + * String used as an ellipsis indicator when a snippet is truncated. + * default: … + * https://github.com/algolia/algoliasearch-client-js#snippetellipsistext + */ + snippetEllipsisText?: string; + /** + * If set to true, restrict arrays in highlights and snippets to items that matched the query at least partially else return all array items in highlights and snippets + * default: false + * https://github.com/algolia/algoliasearch-client-js#restricthighlightandsnippetarrays + */ + restrictHighlightAndSnippetArrays?: boolean; + /** + * Pagination parameter used to select the number of hits per page + * default: 20 + * https://github.com/algolia/algoliasearch-client-js#hitsperpage + */ + hitsPerPage?: number; + /** + * The minimum number of characters needed to accept one typo + * default: 4 + * https://github.com/algolia/algoliasearch-client-js#minwordsizefor1typo + */ + minWordSizefor1Typo?: number; + /** + * The minimum number of characters needed to accept two typos. + * default: 8 + * https://github.com/algolia/algoliasearch-client-js#highlightposttag + */ + minWordSizefor2Typos?: number; + /** + * This option allows you to control the number of typos allowed in the result set + * default: true + * 'true' The typo tolerance is enabled and all matching hits are retrieved (default behavior). + * 'false' The typo tolerance is disabled. All results with typos will be hidden. + * 'min' Only keep results with the minimum number of typos. For example, if one result matches without typos, then all results with typos will be hidden. + * 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos. + * https://github.com/algolia/algoliasearch-client-js#typotolerance + */ + typoTolerance?: any; + /** + * If set to false, disables typo tolerance on numeric tokens (numbers). + * default: true + * https://github.com/algolia/algoliasearch-client-js#allowtyposonnumerictokens + */ + allowTyposOnNumericTokens?: boolean; + /** + * If set to true, plural won't be considered as a typo + * default: false + * https://github.com/algolia/algoliasearch-client-js#ignoreplurals + */ + ignorePlurals?: boolean; + /** + * List of attributes on which you want to disable typo tolerance + * default: "" + * https://github.com/algolia/algoliasearch-client-js#disabletypotoleranceonattributes + */ + disableTypoToleranceOnAttributes?: string; + /** + * Specify the separators (punctuation characters) to index. + * default: "" + * https://github.com/algolia/algoliasearch-client-js#separatorstoindex + */ + separatorsToIndex?: string; + /** + * Selects how the query words are interpreted + * default: 'prefixLast' + * 'prefixAll' All query words are interpreted as prefixes. This option is not recommended. + * 'prefixLast' Only the last word is interpreted as a prefix (default behavior). + * 'prefixNone' No query word is interpreted as a prefix. This option is not recommended. + * https://github.com/algolia/algoliasearch-client-js#querytype + */ + queryType?: any; + /** + * This option is used to select a strategy in order to avoid having an empty result page + * default: 'none' + * 'lastWords' When a query does not return any results, the last word will be added as optional + * 'firstWords' When a query does not return any results, the first word will be added as optional + * 'allOptional' When a query does not return any results, a second trial will be made with all words as optional + * 'none' No specific processing is done when a query does not return any results + * https://github.com/algolia/algoliasearch-client-js#removewordsifnoresults + */ + removeWordsIfNoResults?: string; + /** + * Enables the advanced query syntax + * default: false + * https://github.com/algolia/algoliasearch-client-js#advancedsyntax + */ + advancedSyntax?: boolean; + /** + * A string that contains the comma separated list of words that should be considered as optional when found in the query + * default: [] + * https://github.com/algolia/algoliasearch-client-js#optionalwords + */ + optionalWords?: string[]; + /** + * Remove stop words from the query before executing it + * default: false + * true|false: enable or disable stop words for all 41 supported languages; or + * a list of language ISO codes (as a comma-separated string) for which stop words should be enable + * https://github.com/algolia/algoliasearch-client-js#removestopwords + */ + removeStopWords?: string[]; + /** + * List of attributes on which you want to disable prefix matching + * default: [] + * https://github.com/algolia/algoliasearch-client-js#disableprefixonattributes + */ + disablePrefixOnAttributes?: string[]; + /** + * List of attributes on which you want to disable the computation of exact criteria + * default: [] + * https://github.com/algolia/algoliasearch-client-js#disableexactonattributes + */ + disableExactOnAttributes?: string[]; + /** + * This parameter control how the exact ranking criterion is computed when the query contains one word + * default: attribute + * 'none': no exact on single word query + * 'word': exact set to 1 if the query word is found in the record + * 'attribute': exact set to 1 if there is an attribute containing a string equals to the query + * https://github.com/algolia/algoliasearch-client-js#exactonsinglewordquery + */ + exactOnSingleWordQuery?: string; + /** + * Specify the list of approximation that should be considered as an exact match in the ranking formula + * default: ['ignorePlurals', 'singleWordSynonym'] + * 'ignorePlurals': alternative words added by the ignorePlurals feature + * 'singleWordSynonym': single-word synonym (For example "NY" = "NYC") + * 'multiWordsSynonym': multiple-words synonym + * https://github.com/algolia/algoliasearch-client-js#alternativesasexact + */ + alternativesAsExact?: any; + /** + * The name of the attribute used for the Distinct feature + * default: null + * https://github.com/algolia/algoliasearch-client-js#attributefordistinct + */ + attributeForDistinct?: string; + /** + * If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set. + * https://github.com/algolia/algoliasearch-client-js#distinct + */ + distinct?: any; + /** + * All numerical attributes are automatically indexed as numerical filters + * default '' + * https://github.com/algolia/algoliasearch-client-js#numericattributestoindex + */ + numericAttributesToIndex?: string[]; + /** + * Allows compression of big integer arrays. + * default: false + * https://github.com/algolia/algoliasearch-client-js#allowcompressionofintegerarray + */ + allowCompressionOfIntegerArray?: boolean; + /** + * Specify alternative corrections that you want to consider. + * default: [] + * https://github.com/algolia/algoliasearch-client-js#altcorrections + */ + altCorrections?: [{}]; + /** + * Configure the precision of the proximity ranking criterion + * default: 1 + * https://github.com/algolia/algoliasearch-client-js#minproximity + */ + minProximity?: number; + /** + * This is an advanced use-case to define a token substitutable by a list of words without having the original token searchable + * default: '' + * https://github.com/algolia/algoliasearch-client-js#placeholders + */ + placeholders?: any; + } + + interface AlgoliaQueryParameters { + /** + * Query string used to perform the search + * default: '' + * https://github.com/algolia/algoliasearch-client-js#query + */ + query?: string; + /** + * Filter the query with numeric, facet or/and tag filters + * default: "" + * https://github.com/algolia/algoliasearch-client-js#filters + */ + filters?: string; + /** + * A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer. + * default: * + * https://github.com/algolia/algoliasearch-client-js#attributestoretrieve + */ + attributesToRetrieve?: string[]; + /** + * List of attributes you want to use for textual search + * default: attributeToIndex + * https://github.com/algolia/algoliasearch-client-js#restrictsearchableattributes + */ + restrictSearchableAttributes?: string[]; + /** + * You can use facets to retrieve only a part of your attributes declared in attributesForFaceting attributes + * default: "" + * https://github.com/algolia/algoliasearch-client-js#facets + */ + facets?: string; + /** + * Limit the number of facet values returned for each facet. + * default: "" + * https://github.com/algolia/algoliasearch-client-js#maxvaluesperfacet + */ + maxValuesPerFacet?: string; + /** + * Default list of attributes to highlight. If set to null, all indexed attributes are highlighted. + * default: null + * https://github.com/algolia/algoliasearch-client-js#attributestohighlight + */ + attributesToHighlight?: string[]; + /** + * Default list of attributes to snippet alongside the number of words to return + * default: null + * https://github.com/algolia/algoliasearch-client-js#attributestosnippet + */ + attributesToSnippet?: string[]; + /** + * Specify the string that is inserted before the highlighted parts in the query result + * default: + * https://github.com/algolia/algoliasearch-client-js#highlightpretag + */ + highlightPreTag?: string; + /** + * Specify the string that is inserted after the highlighted parts in the query result + * default: + * https://github.com/algolia/algoliasearch-client-js#highlightposttag + */ + highlightPostTag?: string; + /** + * String used as an ellipsis indicator when a snippet is truncated. + * default: … + * https://github.com/algolia/algoliasearch-client-js#snippetellipsistext + */ + snippetEllipsisText?: string; + /** + * If set to true, restrict arrays in highlights and snippets to items that matched the query at least partially else return all array items in highlights and snippets + * default: false + * https://github.com/algolia/algoliasearch-client-js#restricthighlightandsnippetarrays + */ + restrictHighlightAndSnippetArrays?: boolean; + /** + * Pagination parameter used to select the number of hits per page + * default: 20 + * https://github.com/algolia/algoliasearch-client-js#hitsperpage + */ + hitsPerPage?: number; + /** + * Pagination parameter used to select the page to retrieve. + * default: 0 + * https://github.com/algolia/algoliasearch-client-js#page + */ + page?: number; + /** + * Offset of the first hit to return + * default: null + * https://github.com/algolia/algoliasearch-client-js#offset + */ + offset?: number; + /** + * Number of hits to return. + * default: null + * https://github.com/algolia/algoliasearch-client-js#length + */ + length?: number; + /** + * The minimum number of characters needed to accept one typo. + * default: 4 + * https://github.com/algolia/algoliasearch-client-js#minwordsizefor1typo + */ + minWordSizefor1Typo?: number; + /** + * The minimum number of characters needed to accept two typo. + * fault: 8 + * https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos + */ + minWordSizefor2Typos?: number; + /** + * This option allows you to control the number of typos allowed in the result set: + * default: true + * 'true' The typo tolerance is enabled and all matching hits are retrieved + * 'false' The typo tolerance is disabled. All results with typos will be hidden. + * 'min' Only keep results with the minimum number of typos + * 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos. + * https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos + */ + typoTolerance?: boolean; + /** + * If set to false, disables typo tolerance on numeric tokens (numbers). + * default: + * https://github.com/algolia/algoliasearch-client-js#allowtyposonnumerictokens + */ + allowTyposOnNumericTokens?: boolean; + /** + * If set to true, plural won't be considered as a typo + * default: false + * https://github.com/algolia/algoliasearch-client-js#ignoreplurals + */ + ignorePlurals?: boolean; + /** + * List of attributes on which you want to disable typo tolerance + * default: "" + * https://github.com/algolia/algoliasearch-client-js#disabletypotoleranceonattributes + */ + disableTypoToleranceOnAttributes?: string; + /** + * Search for entries around a given location + * default: "" + * https://github.com/algolia/algoliasearch-client-js#aroundlatlng + */ + aroundLatLng?: string; + /** + * Search for entries around a given latitude/longitude automatically computed from user IP address. + * default: "" + * https://github.com/algolia/algoliasearch-client-js#aroundlatlngviaip + */ + aroundLatLngViaIP?: string; + /** + * Control the radius associated with a geo search. Defined in meters. + * default: null + * You can specify aroundRadius=all if you want to compute the geo distance without filtering in a geo area + * https://github.com/algolia/algoliasearch-client-js#aroundradius + */ + aroundRadius?: any; + /** + * Control the precision of a geo search + * default: null + * https://github.com/algolia/algoliasearch-client-js#aroundprecision + */ + aroundPrecision?: number; + /** + * Define the minimum radius used for a geo search when aroundRadius is not set. + * default: null + * https://github.com/algolia/algoliasearch-client-js#minimumaroundradius + */ + minimumAroundRadius?: number; + /** + * Search entries inside a given area defined by the two extreme points of a rectangle + * default: null + * https://github.com/algolia/algoliasearch-client-js#insideboundingbox + */ + insideBoundingBox?: string; + /** + * Selects how the query words are interpreted + * default: 'prefixLast' + * 'prefixAll' All query words are interpreted as prefixes. This option is not recommended. + * 'prefixLast' Only the last word is interpreted as a prefix (default behavior). + * 'prefixNone' No query word is interpreted as a prefix. This option is not recommended. + * https://github.com/algolia/algoliasearch-client-js#querytype + */ + queryType?: any; + /** + * Search entries inside a given area defined by a set of points + * defauly: '' + * https://github.com/algolia/algoliasearch-client-js#insidepolygon + */ + insidePolygon?: string; + /** + * This option is used to select a strategy in order to avoid having an empty result page + * default: 'none' + * 'lastWords' When a query does not return any results, the last word will be added as optional + * 'firstWords' When a query does not return any results, the first word will be added as optional + * 'allOptional' When a query does not return any results, a second trial will be made with all words as optional + * 'none' No specific processing is done when a query does not return any results + * https://github.com/algolia/algoliasearch-client-js#removewordsifnoresults + */ + removeWordsIfNoResults?: string; + /** + * Enables the advanced query syntax + * default: false + * https://github.com/algolia/algoliasearch-client-js#advancedsyntax + */ + advancedSyntax?: boolean; + /** + * A string that contains the comma separated list of words that should be considered as optional when found in the query + * default: [] + * https://github.com/algolia/algoliasearch-client-js#optionalwords + */ + optionalWords?: string[]; + /** + * Remove stop words from the query before executing it + * default: false + * true|false: enable or disable stop words for all 41 supported languages; or + * a list of language ISO codes (as a comma-separated string) for which stop words should be enable + * https://github.com/algolia/algoliasearch-client-js#removestopwords + */ + removeStopWords?: string[]; + /** + * List of attributes on which you want to disable the computation of exact criteria + * default: [] + * https://github.com/algolia/algoliasearch-client-js#disableexactonattributes + */ + disableExactOnAttributes?: string[]; + /** + * This parameter control how the exact ranking criterion is computed when the query contains one word + * default: attribute + * 'none': no exact on single word query + * 'word': exact set to 1 if the query word is found in the record + * 'attribute': exact set to 1 if there is an attribute containing a string equals to the query + * https://github.com/algolia/algoliasearch-client-js#exactonsinglewordquery + */ + exactOnSingleWordQuery?: string; + /** + * Specify the list of approximation that should be considered as an exact match in the ranking formula + * default: ['ignorePlurals', 'singleWordSynonym'] + * 'ignorePlurals': alternative words added by the ignorePlurals feature + * 'singleWordSynonym': single-word synonym (For example "NY" = "NYC") + * 'multiWordsSynonym': multiple-words synonym + * https://github.com/algolia/algoliasearch-client-js#alternativesasexact + */ + alternativesAsExact?: any; + /** + * If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set. + * https://github.com/algolia/algoliasearch-client-js#distinct + */ + distinct?: any; + /** + * If set to true, the result hits will contain ranking information in the _rankingInfo attribute. + * default: false + * https://github.com/algolia/algoliasearch-client-js#getrankinginfo + */ + getRankingInfo?: boolean; + /** + * All numerical attributes are automatically indexed as numerical filters + * default: '' + * https://github.com/algolia/algoliasearch-client-js#numericattributestoindex + */ + numericAttributesToIndex?: string[]; + /** + * @deprecated please use filters instead + * A string that contains the comma separated list of numeric filters you want to apply. + * https://github.com/algolia/algoliasearch-client-js#numericfilters-deprecated + */ + numericFilters?: string[]; + /** + * @deprecated + * Filter the query by a set of tags. + * https://github.com/algolia/algoliasearch-client-js#tagfilters-deprecated + */ + tagFilters?: string; + /** + * @deprecated + * Filter the query by a set of facets. + * https://github.com/algolia/algoliasearch-client-js#facetfilters-deprecated + */ + facetFilters?: string; + /** + * If set to false, this query will not be taken into account in the analytics feature. + * default true + * https://github.com/algolia/algoliasearch-client-js#analytics + */ + analytics?: boolean; + /** + * If set, tag your query with the specified identifiers + * default: null + * https://github.com/algolia/algoliasearch-client-js#analyticstags + */ + analyticsTags?: string[]; + /** + * If set to false, the search will not use the synonyms defined for the targeted index. + * default: true + * https://github.com/algolia/algoliasearch-client-js#synonyms + */ + synonyms?: boolean; + /** + * If set to false, words matched via synonym expansion will not be replaced by the matched synonym in the highlighted result. + * default: true + * https://github.com/algolia/algoliasearch-client-js#replacesynonymsinhighlight + */ + replaceSynonymsInHighlight?: boolean; + /** + * Configure the precision of the proximity ranking criterion + * default: 1 + * https://github.com/algolia/algoliasearch-client-js#minproximity + */ + minProximity?: number; + } +} + +declare function algoliasearch(applicationId: string, apiKey: string, options?: algoliasearch.ClientOptions): algoliasearch.AlgoliaClient; +export = algoliasearch; diff --git a/algoliasearch/tsconfig.json b/algoliasearch/tsconfig.json new file mode 100644 index 0000000000..d9b7f174ed --- /dev/null +++ b/algoliasearch/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "algoliasearch-tests.ts" + ] +} \ No newline at end of file diff --git a/alt/tsconfig.json b/alt/tsconfig.json index eaac3c3364..43d717e299 100644 --- a/alt/tsconfig.json +++ b/alt/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/amazon-product-api/tsconfig.json b/amazon-product-api/tsconfig.json index 82dae0cfe8..625f8cbcb6 100644 --- a/amazon-product-api/tsconfig.json +++ b/amazon-product-api/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/amcharts/index.d.ts b/amcharts/index.d.ts index fbc2ee4ac9..41f7615ee3 100644 --- a/amcharts/index.d.ts +++ b/amcharts/index.d.ts @@ -24,6 +24,9 @@ declare namespace AmCharts { /** Set it to true if you want UTC time to be used instead of local time. */ var useUTC: boolean; + /** Object with themes */ + var themes: any; + /** Clears all the charts on page, removes listeners and intervals. */ function clear(): void; @@ -2318,6 +2321,8 @@ If you do not set properties such as dashLength, lineAlpha, lineColor, etc - val numberFormatter: Object; /** Name of the open field (used by floating columns, candlesticks and ohlc) in your dataProvider. */ openField: string; + /**Precision of values. Will use chart's precision if not set any.*/ + precision: number; /** Specifies where data points should be placed - on the beginning of the period (day, hour, etc) or in the middle (only when parseDates property of categoryAxis is set to true). This setting affects Serial chart only. Possible values are "start" and "middle". middle */ pointPosition: string; /** If graph's type is column and labelText is set, graph hides labels which do not fit into the column's space. If you don't want these labels to be hidden, set this to true. */ @@ -2591,5 +2596,8 @@ Your function should return string.*/ enabled: boolean; libs: Object; menu: Object; + config: any; + capture(config: any, callback: () => void); + toJPG(config: any, callback: (config:any) => void); } } diff --git a/amcharts/tsconfig.json b/amcharts/tsconfig.json index 126718d584..bf97b93a4d 100644 --- a/amcharts/tsconfig.json +++ b/amcharts/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/amplify-deferred/amplify-deferred-tests.ts b/amplify-deferred/amplify-deferred-tests.ts index 9482a8ef02..a4c7c656c4 100644 --- a/amplify-deferred/amplify-deferred-tests.ts +++ b/amplify-deferred/amplify-deferred-tests.ts @@ -1,265 +1,5 @@ - -/// - -// Copied examples directly from AmplifyJs site - -// Subscribe and publish with no data - -amplify.subscribe("nodataexample", function () { - alert("nodataexample topic published!"); -}); - -// Subscribe and publish with data - -amplify.publish("nodataexample"); - -amplify.subscribe("dataexample", function (data) { - alert(data.foo); // bar -}); - - -amplify.publish("dataexample", { foo: "bar" }); - -amplify.subscribe("dataexample2", function (param1, param2) { - alert(param1 + param2); // barbaz -}); - -//... - -amplify.publish("dataexample2", "bar", "baz"); - -// Subscribe and publish with context and data - -amplify.subscribe("datacontextexample", $("p:first"), function (data) { - this.text(data.exampleText); // first p element would have "foo bar baz" as text -}); - -amplify.publish("datacontextexample", { exampleText: "foo bar baz" }); - -// Subscribe to a topic with high priority - -amplify.subscribe("priorityexample", function (data) { - alert(data.foo); -}); - -amplify.subscribe("priorityexample", function (data) { - if (data.foo === "oops") { - return false; - } -}, 1); - - -// Store data with amplify storage picking the default storage technology: - -amplify.publish("priorityexample", { foo: "bar" }); -amplify.publish("priorityexample", { foo: "oops" }); - -amplify.store("storeExample1", { foo: "bar" }); -amplify.store("storeExample2", "baz"); -// retrieve the data later via the key -var myStoredValue = amplify.store("storeExample1"), - myStoredValue2 = amplify.store("storeExample2"), - myStoredValues = amplify.store(); -myStoredValue.foo; // bar -myStoredValue2; // baz -myStoredValues.storeExample1.foo; // bar -myStoredValues.storeExample2; // baz - -// Store data explicitly with session storage - -amplify.store.sessionStorage("explicitExample", { foo2: "baz" }); -// retrieve the data later via the key -var myStoredValue2 = amplify.store.sessionStorage("explicitExample"); -myStoredValue2.foo2; // baz - - -// REQUEST - -// Set up and use a request utilizing Ajax - - -amplify.request.define("ajaxExample1", "ajax", { - url: "/myApiUrl", - dataType: "json", - type: "GET" -}); - -// later in code -amplify.request("ajaxExample1", function (data) { - data.foo; // bar -}); - -// Set up and use a request utilizing Ajax and Caching - -amplify.request.define("ajaxExample2", "ajax", { - url: "/myApiUrl", - dataType: "json", - type: "GET", - cache: "persist" -}); - -// later in code -amplify.request("ajaxExample2", function (data) { - data.foo; // bar -}); - -// a second call will result in pulling from the cache -amplify.request("ajaxExample2", function (data) { - data.baz; // qux -}) - -// Set up and use a RESTful request utilizing Ajax - -amplify.request.define("ajaxRESTFulExample", "ajax", { - url: "/myRestFulApi/{type}/{id}", - type: "GET" -}) - -// later in code -amplify.request("ajaxRESTFulExample", - { - type: "foo", - id: "bar" - }, - function (data) { - // /myRESTFulApi/foo/bar was the URL used - data.foo; // bar - } - ); - -// POST data with Ajax - -amplify.request.define("ajaxPostExample", "ajax", { - url: "/myRestFulApi", - type: "POST" -}) - -// later in code -amplify.request("ajaxPostExample", - { - type: "foo", - id: "bar" - }, - function (data) { - data.foo; // bar - } - ); -// Using data maps - -// When searching Twitter, the key for the search phrase is q.If we want a more descriptive name, such as term, we can use a data map: - -amplify.request.define("twitter-search", "ajax", { - url: "http://search.twitter.com/search.json", - dataType: "jsonp", - dataMap: { - term: "q" - } -}); - -amplify.request("twitter-search", { term: "amplifyjs" }); - -// Similarly, we can create a request that searches for mentions, by accepting a username: - -amplify.request.define("twitter-mentions", "ajax", { - url: "http://search.twitter.com/search.json", - dataType: "jsonp", - dataMap: function (data) { - return { - q: "@" + data.user - }; - } -}); - -amplify.request("twitter-mentions", { user: "amplifyjs" }); - -// Setting up and using decoders - -//Example: - -var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, error) { - if (data.status === "success") { - success(data.data); - } else if (data.status === "fail" || data.status === "error") { - error(data.message, data.status); - } else { - error(data.message, "fatal"); - } -}; - -//a new decoder can be added to the amplifyDecoders interface -interface amplifyDecoders { - appEnvelope: amplifyDecoder; -} - -amplify.request.decoders.appEnvelope = appEnvelopeDecoder; - -//but you can also just add it via an index -amplify.request.decoders['appEnvelopeStr'] = appEnvelopeDecoder; - - -amplify.request.define("decoderExample", "ajax", { - url: "/myAjaxUrl", - type: "POST", - decoder: "appEnvelope" -}); - -amplify.request({ - resourceId: "decoderExample", - success: function (data) { - data.foo; // bar - }, - error: function (message, level) { - alert("always handle errors with alerts."); - } -}); - -// POST with caching and single - use decoder - -// Example: - -amplify.request.define("decoderSingleExample", "ajax", { - url: "/myAjaxUrl", - type: "POST", - decoder: function (data, status, xhr, success, error) { - if (data.status === "success") { - success(data.data); - } else if (data.status === "fail" || data.status === "error") { - error(data.message, data.status); - } else { - error(data.message, "fatal"); - } - } -}); - -amplify.request({ - resourceId: "decoderSingleExample", - success: function (data) { - data.foo; // bar - }, - error: function (message, level) { - alert("always handle errors with alerts."); - } -}); -// Handling Status -// Status in Success and Error Callbacks - -// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition. - -amplify.request.define("statusExample1", "ajax", { - //... -}); - -amplify.request({ - resourceId: "statusExample1", - success: function (data, status) { - }, - error: function (data, status) { - } -}); - amplify.request({ resourceId: "statusExample1" }).done(function (data, status) { }).fail(function (data, status) { }).always(function (data, status) { }); - diff --git a/amplify-deferred/index.d.ts b/amplify-deferred/index.d.ts index 3736a6644b..c6d2940930 100644 --- a/amplify-deferred/index.d.ts +++ b/amplify-deferred/index.d.ts @@ -1,182 +1,30 @@ -// Type definitions for AmplifyJs 1.1.0 using JQuery Deferred +// Type definitions for AmplifyJs (using JQuery Deferred) 1.1 // Project: http://amplifyjs.com/ // Definitions by: Jonas Eriksson , Laurentiu Stamate // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -interface amplifyRequestSettings { - resourceId: string; - data?: any; - success?: (...args: any[]) => void; - error?: (...args: any[]) => void; +import * as amplify from "amplify"; + +declare module "amplify" { + interface Request { + /*** + * Request a resource. + * resourceId: Identifier string for the resource. + * data: A set of key/value pairs of data to be sent to the resource. + * callback: A function to invoke if the resource is retrieved successfully. + */ + (resourceId: string, hash?: any, callback?: Function): JQueryPromise; + + /*** + * Request a resource. + * settings: A set of key/value pairs of settings for the request. + * resourceId: Identifier string for the resource. + * data (optional): Data associated with the request. + * success (optional): Function to invoke on success. + * error (optional): Function to invoke on error. + */ + (settings: RequestSettings): JQueryPromise; + } } - -interface amplifyDecoder { - ( - data?: any, - status?: string, - xhr?: JQueryXHR, - success?: (...args: any[]) => void, - error?: (...args: any[]) => void - ): void -} - -interface amplifyDecoders { - [decoderName: string]: amplifyDecoder; - jsSend: amplifyDecoder; -} - -interface amplifyAjaxSettings extends JQueryAjaxSettings { - cache?: any; - dataMap?: {} | ((data: any) => {}); - decoder?: any /* string or amplifyDecoder */; -} - -interface amplifyRequest { - - /*** - * Request a resource. - * resourceId: Identifier string for the resource. - * data: A set of key/value pairs of data to be sent to the resource. - * callback: A function to invoke if the resource is retrieved successfully. - */ - (resourceId: string, hash?: any, callback?: Function): JQueryPromise; - - /*** - * Request a resource. - * settings: A set of key/value pairs of settings for the request. - * resourceId: Identifier string for the resource. - * data (optional): Data associated with the request. - * success (optional): Function to invoke on success. - * error (optional): Function to invoke on error. - */ - (settings: amplifyRequestSettings): JQueryPromise; - - /*** - * Define a resource. - * resourceId: Identifier string for the resource. - * requestType: The type of data retrieval method from the server. See the request types sections for more information. - * settings: A set of key/value pairs that relate to the server communication technology. The following settings are available: - * Any settings found in jQuery.ajax(). - * cache: See the cache section for more details. - * decoder: See the decoder section for more details. - */ - define(resourceId: string, requestType: string, settings?: amplifyAjaxSettings): void; - - /*** - * Define a custom request. - * resourceId: Identifier string for the resource. - * resource: Function to handle requests. Receives a hash with the following properties: - * resourceId: Identifier string for the resource. - * data: Data provided by the user. - * success: Callback to invoke on success. - * error: Callback to invoke on error. - */ - define(resourceId: string, resource: (settings: amplifyRequestSettings) => void): void; - - decoders: amplifyDecoders; - cache: any; -} - -interface amplifySubscribe { - /*** - * Subscribe to a message. - * topic: Name of the message to subscribe to. - * callback: Function to invoke when the message is published. - */ - (topic: string, callback: Function): void; - /*** - * Subscribe to a message. - * topic: Name of the message to subscribe to. - * context: What this will be when the callback is invoked. - * callback: Function to invoke when the message is published. - * [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10. - */ - (topic: string, context: any, callback: Function, priority?: number): void; - /*** - * Subscribe to a message. - * topic: Name of the message to subscribe to. - * callback: Function to invoke when the message is published. - * [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10. - */ - (topic: string, callback: Function, priority?: number): void; -} -interface amplifyStorageTypeStore { - /*** - * Stores a value for a given key using the default storage type. - * - * key: Identifier for the value being stored. - * value: The value to store. The value can be anything that can be serialized as JSON. - * [options]: A set of key/value pairs that relate to settings for storing the value. - */ - (key: string, value: any, options?: any): void; - - /*** - * Gets a stored value based on the key. - */ - (key: string): any; - - /*** - * Gets a hash of all stored values. - */ - (): any; -} - -interface amplifyStore extends amplifyStorageTypeStore { - - /*** - * IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ - */ - localStorage: amplifyStorageTypeStore; - - /*** - * IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ - */ - sessionStorage: amplifyStorageTypeStore; - - /*** - * Firefox 2+ - */ - globalStorage: amplifyStorageTypeStore; - - /*** - * IE 5 - 7 - */ - userData: amplifyStorageTypeStore; - - /*** - * An in-memory store is provided as a fallback if none of the other storage types are available. - */ - memory: amplifyStorageTypeStore; - - -} - -interface amplifyStatic { - - subscribe: amplifySubscribe; - - /*** - * Remove a subscription. - * topic: The topic being unsubscribed from. - * callback: The callback that was originally subscribed. - */ - unsubscribe(topic: string, callback: Function): void; - - /*** - * Publish a message. - * topic: The name of the message to publish. - * Any additional parameters will be passed to the subscriptions. - * amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked. - */ - publish(topic: string, ...args: any[]): boolean; - - store: amplifyStore; - - request: amplifyRequest; - -} - -declare var amplify: amplifyStatic; - diff --git a/amplify-deferred/tsconfig.json b/amplify-deferred/tsconfig.json index ed8c892c6b..682819cad8 100644 --- a/amplify-deferred/tsconfig.json +++ b/amplify-deferred/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/amplify-deferred/tslint.json b/amplify-deferred/tslint.json new file mode 100644 index 0000000000..0f47deabb4 --- /dev/null +++ b/amplify-deferred/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "forbidden-types": false + } +} \ No newline at end of file diff --git a/amplify/amplifyjs-tests.ts b/amplify/amplifyjs-tests.ts index ec3807435d..f844642b8e 100644 --- a/amplify/amplifyjs-tests.ts +++ b/amplify/amplifyjs-tests.ts @@ -1,6 +1,8 @@ /// +import amplify = require("amplify"); + // Copied examples directly from AmplifyJs site // Subscribe and publish with no data @@ -176,7 +178,7 @@ amplify.request("twitter-mentions", { user: "amplifyjs" }); //Example: -var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, error) { +var appEnvelopeDecoder: amplify.Decoder = function (data, status, xhr, success, error) { if (data.status === "success") { success(data.data); } else if (data.status === "fail" || data.status === "error") { @@ -187,8 +189,10 @@ var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, e }; //a new decoder can be added to the amplifyDecoders interface -interface amplifyDecoders { - appEnvelope: amplifyDecoder; +declare module "amplify" { + interface Decoders { + appEnvelope: amplify.Decoder; + } } amplify.request.decoders.appEnvelope = appEnvelopeDecoder; diff --git a/amplify/index.d.ts b/amplify/index.d.ts index 8955fdc7de..d0e8d5b620 100644 --- a/amplify/index.d.ts +++ b/amplify/index.d.ts @@ -1,182 +1,177 @@ -// Type definitions for AmplifyJs 1.1.0 +// Type definitions for AmplifyJs 1.1 // Project: http://amplifyjs.com/ // Definitions by: Jonas Eriksson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -interface amplifyRequestSettings { - resourceId: string; - data?: any; - success?: (...args: any[]) => void; - error?: (...args: any[]) => void; +declare namespace amplify { + interface RequestSettings { + resourceId: string; + data?: any; + success?: (...args: any[]) => void; + error?: (...args: any[]) => void; + } + + type Decoder = + ( + data?: any, + status?: string, + xhr?: JQueryXHR, + success?: (...args: any[]) => void, + error?: (...args: any[]) => void + ) => void; + + interface Decoders { + [decoderName: string]: Decoder; + jsSend: Decoder; + } + + interface AjaxSettings extends JQueryAjaxSettings { + cache?: any; + dataMap?: {} | ((data: any) => {}); + decoder?: any /* string or amplifyDecoder */; + } + + interface Request { + + /*** + * Request a resource. + * resourceId: Identifier string for the resource. + * data: A set of key/value pairs of data to be sent to the resource. + * callback: A function to invoke if the resource is retrieved successfully. + */ + (resourceId: string, hash?: any, callback?: Function): void; + + /*** + * Request a resource. + * settings: A set of key/value pairs of settings for the request. + * resourceId: Identifier string for the resource. + * data (optional): Data associated with the request. + * success (optional): Function to invoke on success. + * error (optional): Function to invoke on error. + */ + (settings: RequestSettings): any; + + /*** + * Define a resource. + * resourceId: Identifier string for the resource. + * requestType: The type of data retrieval method from the server. See the request types sections for more information. + * settings: A set of key/value pairs that relate to the server communication technology. The following settings are available: + * Any settings found in jQuery.ajax(). + * cache: See the cache section for more details. + * decoder: See the decoder section for more details. + */ + define(resourceId: string, requestType: string, settings?: AjaxSettings): void; + + /*** + * Define a custom request. + * resourceId: Identifier string for the resource. + * resource: Function to handle requests. Receives a hash with the following properties: + * resourceId: Identifier string for the resource. + * data: Data provided by the user. + * success: Callback to invoke on success. + * error: Callback to invoke on error. + */ + define(resourceId: string, resource: (settings: RequestSettings) => void): void; + + decoders: Decoders; + cache: any; + } + + interface Subscribe { + /*** + * Subscribe to a message. + * topic: Name of the message to subscribe to. + * callback: Function to invoke when the message is published. + * [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10. + */ + (topic: string, callback: Function, priority?: number): void; + /*** + * Subscribe to a message. + * topic: Name of the message to subscribe to. + * context: What this will be when the callback is invoked. + * callback: Function to invoke when the message is published. + * [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10. + */ + (topic: string, context: any, callback: Function, priority?: number): void; + } + interface StorageTypeStore { + /*** + * Stores a value for a given key using the default storage type. + * + * key: Identifier for the value being stored. + * value: The value to store. The value can be anything that can be serialized as JSON. + * [options]: A set of key/value pairs that relate to settings for storing the value. + */ + (key: string, value: any, options?: any): void; + + /*** + * Gets a stored value based on the key. + */ + (key: string): any; + + /*** + * Gets a hash of all stored values. + */ + (): any; + } + + interface Store extends StorageTypeStore { + + /*** + * IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ + */ + localStorage: StorageTypeStore; + + /*** + * IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ + */ + sessionStorage: StorageTypeStore; + + /*** + * Firefox 2+ + */ + globalStorage: StorageTypeStore; + + /*** + * IE 5 - 7 + */ + userData: StorageTypeStore; + + /*** + * An in-memory store is provided as a fallback if none of the other storage types are available. + */ + memory: StorageTypeStore; + + + } + + interface Static { + + subscribe: Subscribe; + + /*** + * Remove a subscription. + * topic: The topic being unsubscribed from. + * callback: The callback that was originally subscribed. + */ + unsubscribe(topic: string, callback: Function): void; + + /*** + * Publish a message. + * topic: The name of the message to publish. + * Any additional parameters will be passed to the subscriptions. + * amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked. + */ + publish(topic: string, ...args: any[]): boolean; + + store: Store; + + request: Request; + } } -interface amplifyDecoder { - ( - data?: any, - status?: string, - xhr?: JQueryXHR, - success?: (...args: any[]) => void, - error?: (...args: any[]) => void - ): void -} - -interface amplifyDecoders { - [decoderName: string]: amplifyDecoder; - jsSend: amplifyDecoder; -} - -interface amplifyAjaxSettings extends JQueryAjaxSettings { - cache?: any; - dataMap?: {} | ((data: any) => {}); - decoder?: any /* string or amplifyDecoder */; -} - -interface amplifyRequest { - - /*** - * Request a resource. - * resourceId: Identifier string for the resource. - * data: A set of key/value pairs of data to be sent to the resource. - * callback: A function to invoke if the resource is retrieved successfully. - */ - (resourceId: string, hash?: any, callback?: Function): void; - - /*** - * Request a resource. - * settings: A set of key/value pairs of settings for the request. - * resourceId: Identifier string for the resource. - * data (optional): Data associated with the request. - * success (optional): Function to invoke on success. - * error (optional): Function to invoke on error. - */ - (settings: amplifyRequestSettings): any; - - /*** - * Define a resource. - * resourceId: Identifier string for the resource. - * requestType: The type of data retrieval method from the server. See the request types sections for more information. - * settings: A set of key/value pairs that relate to the server communication technology. The following settings are available: - * Any settings found in jQuery.ajax(). - * cache: See the cache section for more details. - * decoder: See the decoder section for more details. - */ - define(resourceId: string, requestType: string, settings?: amplifyAjaxSettings): void; - - /*** - * Define a custom request. - * resourceId: Identifier string for the resource. - * resource: Function to handle requests. Receives a hash with the following properties: - * resourceId: Identifier string for the resource. - * data: Data provided by the user. - * success: Callback to invoke on success. - * error: Callback to invoke on error. - */ - define(resourceId: string, resource: (settings: amplifyRequestSettings) => void): void; - - decoders: amplifyDecoders; - cache: any; -} - -interface amplifySubscribe { - /*** - * Subscribe to a message. - * topic: Name of the message to subscribe to. - * callback: Function to invoke when the message is published. - */ - (topic: string, callback: Function): void; - /*** - * Subscribe to a message. - * topic: Name of the message to subscribe to. - * context: What this will be when the callback is invoked. - * callback: Function to invoke when the message is published. - * [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10. - */ - (topic: string, context: any, callback: Function, priority?: number): void; - /*** - * Subscribe to a message. - * topic: Name of the message to subscribe to. - * callback: Function to invoke when the message is published. - * [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10. - */ - (topic: string, callback: Function, priority?: number): void; -} -interface amplifyStorageTypeStore { - /*** - * Stores a value for a given key using the default storage type. - * - * key: Identifier for the value being stored. - * value: The value to store. The value can be anything that can be serialized as JSON. - * [options]: A set of key/value pairs that relate to settings for storing the value. - */ - (key: string, value: any, options?: any): void; - - /*** - * Gets a stored value based on the key. - */ - (key: string): any; - - /*** - * Gets a hash of all stored values. - */ - (): any; -} - -interface amplifyStore extends amplifyStorageTypeStore{ - - /*** - * IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ - */ - localStorage: amplifyStorageTypeStore; - - /*** - * IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ - */ - sessionStorage: amplifyStorageTypeStore; - - /*** - * Firefox 2+ - */ - globalStorage: amplifyStorageTypeStore; - - /*** - * IE 5 - 7 - */ - userData: amplifyStorageTypeStore; - - /*** - * An in-memory store is provided as a fallback if none of the other storage types are available. - */ - memory: amplifyStorageTypeStore; - - -} - -interface amplifyStatic { - - subscribe: amplifySubscribe; - - /*** - * Remove a subscription. - * topic: The topic being unsubscribed from. - * callback: The callback that was originally subscribed. - */ - unsubscribe(topic: string, callback: Function): void; - - /*** - * Publish a message. - * topic: The name of the message to publish. - * Any additional parameters will be passed to the subscriptions. - * amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked. - */ - publish(topic: string, ...args: any[]): boolean; - - store: amplifyStore; - - request: amplifyRequest; - -} - -declare var amplify: amplifyStatic; -declare module "amplify" { export =amplify; } +declare var amplify: amplify.Static; +export = amplify; +export as namespace amplify; diff --git a/amplify/tsconfig.json b/amplify/tsconfig.json index d0c999bfb0..1adb36d073 100644 --- a/amplify/tsconfig.json +++ b/amplify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/amplify/tslint.json b/amplify/tslint.json new file mode 100644 index 0000000000..2d6cd90f81 --- /dev/null +++ b/amplify/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "../tslint.json", + "rules": { + "forbidden-types": false, + "unified-signatures": false + } +} \ No newline at end of file diff --git a/amplitude-js/tsconfig.json b/amplitude-js/tsconfig.json index 90d8060f52..b75d7280bf 100644 --- a/amplitude-js/tsconfig.json +++ b/amplitude-js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/amqp-rpc/tsconfig.json b/amqp-rpc/tsconfig.json index fd72436368..2433bce5bb 100644 --- a/amqp-rpc/tsconfig.json +++ b/amqp-rpc/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/amqplib/amqplib-0.3.d.ts b/amqplib/amqplib-0.3.d.ts new file mode 100644 index 0000000000..3138f7494e --- /dev/null +++ b/amqplib/amqplib-0.3.d.ts @@ -0,0 +1,219 @@ +// Type definitions for amqplib 0.3.x +// Project: https://github.com/squaremo/amqp.node +// Definitions by: Michael Nahkies , Ab Reitsma +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module "amqplib/properties" { + namespace Replies { + interface Empty { + } + interface AssertQueue { + queue: string; + messageCount: number; + consumerCount: number; + } + interface PurgeQueue { + messageCount: number; + } + interface DeleteQueue { + messageCount: number; + } + interface AssertExchange { + exchange: string; + } + interface Consume { + consumerTag: string; + } + } + + namespace Options { + interface AssertQueue { + exclusive?: boolean; + durable?: boolean; + autoDelete?: boolean; + arguments?: any; + messageTtl?: number; + expires?: number; + deadLetterExchange?: string; + deadLetterRoutingKey?: string; + maxLength?: number; + } + interface DeleteQueue { + ifUnused?: boolean; + ifEmpty?: boolean; + } + interface AssertExchange { + durable?: boolean; + internal?: boolean; + autoDelete?: boolean; + alternateExchange?: string; + arguments?: any; + } + interface DeleteExchange { + ifUnused?: boolean; + } + interface Publish { + expiration?: string; + userId?: string; + CC?: string | string[]; + + mandatory?: boolean; + persistent?: boolean; + deliveryMode?: boolean | number; + BCC?: string | string[]; + + contentType?: string; + contentEncoding?: string; + headers?: any; + priority?: number; + correlationId?: string; + replyTo?: string; + messageId?: string; + timestamp?: number; + type?: string; + appId?: string; + } + interface Consume { + consumerTag?: string; + noLocal?: boolean; + noAck?: boolean; + exclusive?: boolean; + priority?: number; + arguments?: any; + } + interface Get { + noAck?: boolean; + } + } + + interface Message { + content: Buffer; + fields: any; + properties: any; + } +} + +declare module "amqplib" { + + import events = require("events"); + import when = require("when"); + import shared = require("amqplib/properties") + export import Replies = shared.Replies; + export import Options = shared.Options; + export import Message = shared.Message; + + interface Connection extends events.EventEmitter { + close(): when.Promise; + createChannel(): when.Promise; + createConfirmChannel(): when.Promise; + } + + interface Channel extends events.EventEmitter { + close(): when.Promise; + + assertQueue(queue: string, options?: Options.AssertQueue): when.Promise; + checkQueue(queue: string): when.Promise; + + deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise; + purgeQueue(queue: string): when.Promise; + + bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; + unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; + + assertExchange(exchange: string, type: string, options?: Options.AssertExchange): when.Promise; + checkExchange(exchange: string): when.Promise; + + deleteExchange(exchange: string, options?: Options.DeleteExchange): when.Promise; + + bindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise; + unbindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise; + + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; + + consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): when.Promise; + + cancel(consumerTag: string): when.Promise; + get(queue: string, options?: Options.Get): when.Promise; + + ack(message: Message, allUpTo?: boolean): void; + ackAll(): void; + + nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; + nackAll(requeue?: boolean): void; + reject(message: Message, requeue?: boolean): void; + + prefetch(count: number, global?: boolean): when.Promise; + recover(): when.Promise; + } + + function connect(url: string, socketOptions?: any): when.Promise; +} + +declare module "amqplib/callback_api" { + + import events = require("events"); + import shared = require("amqplib/properties") + export import Replies = shared.Replies; + export import Options = shared.Options; + export import Message = shared.Message; + + interface Connection extends events.EventEmitter { + close(callback?: (err: any) => void): void; + createChannel(callback: (err: any, channel: Channel) => void): void; + createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void; + } + + interface Channel extends events.EventEmitter { + close(callback: (err: any) => void): void; + + assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void; + checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void; + + deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void; + purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void; + + bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + + assertExchange(exchange: string, type: string, options?: Options.AssertExchange, callback?: (err: any, ok: Replies.AssertExchange) => void): void; + checkExchange(exchange: string, callback?: (err: any, ok: Replies.Empty) => void): void; + + deleteExchange(exchange: string, options?: Options.DeleteExchange, callback?: (err: any, ok: Replies.Empty) => void): void; + + bindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + unbindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; + + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; + + consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void; + + cancel(consumerTag: string, callback?: (err: any, ok: Replies.Empty) => void): void; + get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | boolean) => void): void; + + ack(message: Message, allUpTo?: boolean): void; + ackAll(): void; + + nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; + nackAll(requeue?: boolean): void; + reject(message: Message, requeue?: boolean): void; + + prefetch(count: number, global?: boolean): void; + recover(callback?: (err: any, ok: Replies.Empty) => void): void; + } + + interface ConfirmChannel extends Channel { + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; + + waitForConfirms(callback?: (err: any) => void): void; + } + + function connect(callback: (err: any, connection: Connection) => void): void; + function connect(url: string, callback: (err: any, connection: Connection) => void): void; + function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void; +} diff --git a/amqplib/amqplib-tests.ts b/amqplib/amqplib-tests.ts index 07b9ec5402..b17128653a 100644 --- a/amqplib/amqplib-tests.ts +++ b/amqplib/amqplib-tests.ts @@ -1,44 +1,42 @@ - - // promise api tests -import amqp = require("amqplib"); +import amqp = require('amqplib'); -var msg = "Hello World"; +var msg = 'Hello World'; // test promise api -amqp.connect("amqp://localhost") +amqp.connect('amqp://localhost') .then(connection => { return connection.createChannel() - .tap(channel => channel.checkQueue("myQueue")) - .then(channel => channel.sendToQueue("myQueue", new Buffer(msg))) - .ensure(() => connection.close()); + .tap(channel => channel.checkQueue('myQueue')) + .then(channel => channel.sendToQueue('myQueue', new Buffer(msg))) + .finally(() => connection.close()); }); -amqp.connect("amqp://localhost") +amqp.connect('amqp://localhost') .then(connection => { return connection.createChannel() - .tap(channel => channel.checkQueue("myQueue")) - .then(channel => channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString()))) - .ensure(() => connection.close()); + .tap(channel => channel.checkQueue('myQueue')) + .then(channel => channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString()))) + .finally(() => connection.close()); }); // test promise api properties var amqpMessage: amqp.Message; -amqpMessage.properties.contentType = "application/json"; +amqpMessage.properties.contentType = 'application/json'; var amqpAssertExchangeOptions: amqp.Options.AssertExchange; var anqpAssertExchangeReplies: amqp.Replies.AssertExchange; // callback api tests -import amqpcb = require("amqplib/callback_api"); +import amqpcb = require('amqplib/callback_api'); -amqpcb.connect("amqp://localhost", (err, connection) => { +amqpcb.connect('amqp://localhost', (err, connection) => { if(!err) { connection.createChannel((err, channel) => { if (!err) { - channel.assertQueue("myQueue", {}, (err, ok) => { + channel.assertQueue('myQueue', {}, (err, ok) => { if(!err) { - channel.sendToQueue("myQueue", new Buffer(msg)); + channel.sendToQueue('myQueue', new Buffer(msg)); } }); } @@ -46,13 +44,13 @@ amqpcb.connect("amqp://localhost", (err, connection) => { } }); -amqpcb.connect("amqp://localhost", (err, connection) => { +amqpcb.connect('amqp://localhost', (err, connection) => { if(!err) { connection.createChannel((err, channel) => { if (!err) { - channel.assertQueue("myQueue", {}, (err, ok) => { + channel.assertQueue('myQueue', {}, (err, ok) => { if(!err) { - channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString())); + channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString())); } }); } @@ -62,6 +60,6 @@ amqpcb.connect("amqp://localhost", (err, connection) => { // test callback api properties var amqpcbMessage: amqpcb.Message; -amqpcbMessage.properties.contentType = "application/json"; +amqpcbMessage.properties.contentType = 'application/json'; var amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange; -var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange; \ No newline at end of file +var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange; diff --git a/amqplib/index.d.ts b/amqplib/index.d.ts index 3138f7494e..b406e00ac0 100644 --- a/amqplib/index.d.ts +++ b/amqplib/index.d.ts @@ -1,13 +1,76 @@ -// Type definitions for amqplib 0.3.x +// Type definitions for amqplib 0.5.x // Project: https://github.com/squaremo/amqp.node -// Definitions by: Michael Nahkies , Ab Reitsma +// Definitions by: Michael Nahkies , Ab Reitsma , Nicolás Fantone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// /// -declare module "amqplib/properties" { - namespace Replies { +declare module 'amqplib' { + import * as Promise from 'bluebird'; + import * as events from 'events'; + import shared = require('amqplib/properties'); + + export import Replies = shared.Replies; + export import Options = shared.Options; + export import Message = shared.Message; + + export interface Connection extends events.EventEmitter { + close(): Promise; + createChannel(): Promise; + createConfirmChannel(): Promise; + } + + export interface Channel extends events.EventEmitter { + close(): Promise; + + assertQueue(queue: string, options?: Options.AssertQueue): Promise; + checkQueue(queue: string): Promise; + + deleteQueue(queue: string, options?: Options.DeleteQueue): Promise; + purgeQueue(queue: string): Promise; + + bindQueue(queue: string, source: string, pattern: string, args?: any): Promise; + unbindQueue(queue: string, source: string, pattern: string, args?: any): Promise; + + assertExchange(exchange: string, type: string, options?: Options.AssertExchange): Promise; + checkExchange(exchange: string): Promise; + + deleteExchange(exchange: string, options?: Options.DeleteExchange): Promise; + + bindExchange(destination: string, source: string, pattern: string, args?: any): Promise; + unbindExchange(destination: string, source: string, pattern: string, args?: any): Promise; + + publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; + sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; + + consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): Promise; + + cancel(consumerTag: string): Promise; + get(queue: string, options?: Options.Get): Promise; + + ack(message: Message, allUpTo?: boolean): void; + ackAll(): void; + + nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; + nackAll(requeue?: boolean): void; + reject(message: Message, requeue?: boolean): void; + + prefetch(count: number, global?: boolean): Promise; + recover(): Promise; + } + + export interface ConfirmChannel extends Channel { + publish(exchange:string, routingKey:string, content:Buffer, options?:Options.Publish, callback?:(err:any, ok:Replies.Empty) => void):boolean; + sendToQueue(queue:string, content:Buffer, options?:Options.Publish, callback?:(err:any, ok:Replies.Empty) => void):boolean; + + waitForConfirms(): Promise; + } + + export function connect(url: string, socketOptions?: any): Promise; +} + +declare module 'amqplib/properties' { + export namespace Replies { interface Empty { } interface AssertQueue { @@ -29,7 +92,7 @@ declare module "amqplib/properties" { } } - namespace Options { + export namespace Options { interface AssertQueue { exclusive?: boolean; durable?: boolean; @@ -40,6 +103,7 @@ declare module "amqplib/properties" { deadLetterExchange?: string; deadLetterRoutingKey?: string; maxLength?: number; + maxPriority?: number; } interface DeleteQueue { ifUnused?: boolean; @@ -56,7 +120,7 @@ declare module "amqplib/properties" { ifUnused?: boolean; } interface Publish { - expiration?: string; + expiration?: string | number; userId?: string; CC?: string | string[]; @@ -89,92 +153,35 @@ declare module "amqplib/properties" { } } - interface Message { + export interface Message { content: Buffer; fields: any; properties: any; } } -declare module "amqplib" { +declare module 'amqplib/callback_api' { + import events = require('events'); + import shared = require('amqplib/properties') - import events = require("events"); - import when = require("when"); - import shared = require("amqplib/properties") export import Replies = shared.Replies; export import Options = shared.Options; export import Message = shared.Message; - interface Connection extends events.EventEmitter { - close(): when.Promise; - createChannel(): when.Promise; - createConfirmChannel(): when.Promise; - } - - interface Channel extends events.EventEmitter { - close(): when.Promise; - - assertQueue(queue: string, options?: Options.AssertQueue): when.Promise; - checkQueue(queue: string): when.Promise; - - deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise; - purgeQueue(queue: string): when.Promise; - - bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; - unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; - - assertExchange(exchange: string, type: string, options?: Options.AssertExchange): when.Promise; - checkExchange(exchange: string): when.Promise; - - deleteExchange(exchange: string, options?: Options.DeleteExchange): when.Promise; - - bindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise; - unbindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise; - - publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; - sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; - - consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): when.Promise; - - cancel(consumerTag: string): when.Promise; - get(queue: string, options?: Options.Get): when.Promise; - - ack(message: Message, allUpTo?: boolean): void; - ackAll(): void; - - nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; - nackAll(requeue?: boolean): void; - reject(message: Message, requeue?: boolean): void; - - prefetch(count: number, global?: boolean): when.Promise; - recover(): when.Promise; - } - - function connect(url: string, socketOptions?: any): when.Promise; -} - -declare module "amqplib/callback_api" { - - import events = require("events"); - import shared = require("amqplib/properties") - export import Replies = shared.Replies; - export import Options = shared.Options; - export import Message = shared.Message; - - interface Connection extends events.EventEmitter { + export interface Connection extends events.EventEmitter { close(callback?: (err: any) => void): void; createChannel(callback: (err: any, channel: Channel) => void): void; createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void; } - interface Channel extends events.EventEmitter { + export interface Channel extends events.EventEmitter { close(callback: (err: any) => void): void; - assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void; + assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err: any, ok: Replies.AssertQueue) => void): void; checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void; - deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void; - purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void; + deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err: any, ok: Replies.DeleteQueue) => void): void; + purgeQueue(queue: string, callback?: (err: any, ok: Replies.PurgeQueue) => void): void; bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; @@ -206,14 +213,14 @@ declare module "amqplib/callback_api" { recover(callback?: (err: any, ok: Replies.Empty) => void): void; } - interface ConfirmChannel extends Channel { + export interface ConfirmChannel extends Channel { publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; waitForConfirms(callback?: (err: any) => void): void; } - function connect(callback: (err: any, connection: Connection) => void): void; - function connect(url: string, callback: (err: any, connection: Connection) => void): void; - function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void; + export function connect(callback: (err: any, connection: Connection) => void): void; + export function connect(url: string, callback: (err: any, connection: Connection) => void): void; + export function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void; } diff --git a/amqplib/tsconfig.json b/amqplib/tsconfig.json index 10f2f8c294..e7bc5a878a 100644 --- a/amqplib/tsconfig.json +++ b/amqplib/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/analytics-node/analytics-node-tests.ts b/analytics-node/analytics-node-tests.ts index 594c15fae6..5207fe560b 100644 --- a/analytics-node/analytics-node-tests.ts +++ b/analytics-node/analytics-node-tests.ts @@ -1,8 +1,8 @@ -import AnalyticsNode = require("analytics-node"); -var analytics: AnalyticsNode.Analytics; +import Analytics = require("analytics-node"); +var analytics: Analytics; function testConfig(): void { - analytics = new AnalyticsNode.Analytics('YOUR_WRITE_KEY', { + analytics = new Analytics('YOUR_WRITE_KEY', { flushAt: 20, flushAfter: 10000 }); diff --git a/analytics-node/index.d.ts b/analytics-node/index.d.ts index 455b13c92b..fa0b8d6426 100644 --- a/analytics-node/index.d.ts +++ b/analytics-node/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Andrew Fong // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export = AnalyticsNode; +export = AnalyticsNode.Analytics; declare namespace AnalyticsNode { diff --git a/analytics-node/tsconfig.json b/analytics-node/tsconfig.json index 34783d00fc..eb770f82be 100644 --- a/analytics-node/tsconfig.json +++ b/analytics-node/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-agility/tsconfig.json b/angular-agility/tsconfig.json index 1d233e8b95..d8b827bfd7 100644 --- a/angular-agility/tsconfig.json +++ b/angular-agility/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-animate/index.d.ts b/angular-animate/index.d.ts index 624284be2c..219fb05b01 100644 --- a/angular-animate/index.d.ts +++ b/angular-animate/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.5 (ngAnimate module) +// Type definitions for Angular JS (ngAnimate module) 1.5 // Project: http://angularjs.org // Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer , Cody Schaaf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/angular-animate/tsconfig.json b/angular-animate/tsconfig.json index 81f1a4a364..5692e5627e 100644 --- a/angular-animate/tsconfig.json +++ b/angular-animate/tsconfig.json @@ -6,6 +6,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,6 +14,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angular-bootstrap-calendar/index.d.ts b/angular-bootstrap-calendar/index.d.ts index 5c6b4f1fec..a451ee9b03 100644 --- a/angular-bootstrap-calendar/index.d.ts +++ b/angular-bootstrap-calendar/index.d.ts @@ -7,7 +7,35 @@ import * as moment from 'moment'; import * as angular from 'angular'; declare module 'angular' { - export namespace bootstrap.calendar { + export namespace bootstrap.calendar { + interface IEventAction { + /** + * The label of the action + */ + label: string; + /** + * CSS class to be added to the action element + */ + cssClass?: string; + /** + * The action that occurs when it's clicked + * @param args - the IEvent whose action was clicked + */ + onClick: (args: any) => void; + } + + interface IEventColor { + /** + * The primary color of the event, should be darker than secondary + */ + primary: string; + + /** + * The secondary color of the event, should be lighter than primary + */ + secondary: string; + } + interface IEvent { /** * The title of the event @@ -16,7 +44,7 @@ declare module 'angular' { /** * The type of the event (determines its color). Can be important, warning, info, inverse, success or special */ - type: string; + type?: string; /** * A javascript date object for when the event starts */ @@ -25,6 +53,14 @@ declare module 'angular' { * Optional - a javascript date object for when the event ends */ endsAt?: Date; + /** + * Color of the Event + */ + color?: IEventColor; + /** + * Actions of the Event + */ + actions?: Array; /** * If edit-event-html is set and this field is explicitly set to false then dont make it editable. */ @@ -53,6 +89,10 @@ declare module 'angular' { * A CSS class (or more, just separate with spaces) that will be added to the event when it is displayed on each view. Useful for marking an event as selected / active etc */ cssClass?: string; + /** + * If set the event will display as all-day event + */ + allDay?: boolean; } interface ICalendarConfig { @@ -134,7 +174,7 @@ declare module 'angular' { } interface IOnViewChangeClick { - (calendarDate: Date, calendarNextView: string): void; + (calendarDate: Date, calendarNextView: string): boolean; } } } diff --git a/angular-bootstrap-calendar/tsconfig.json b/angular-bootstrap-calendar/tsconfig.json index 8098af1045..71d4fd7de1 100644 --- a/angular-bootstrap-calendar/tsconfig.json +++ b/angular-bootstrap-calendar/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-bootstrap-lightbox/tsconfig.json b/angular-bootstrap-lightbox/tsconfig.json index d75448c863..462ef95c8c 100644 --- a/angular-bootstrap-lightbox/tsconfig.json +++ b/angular-bootstrap-lightbox/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-breadcrumb/index.d.ts b/angular-breadcrumb/index.d.ts index 81bb8a1d37..a21d7f7ce0 100644 --- a/angular-breadcrumb/index.d.ts +++ b/angular-breadcrumb/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for angular-breadcrumb 0.4.1 +// Type definitions for angular-breadcrumb 0.4.1 // Project: https://github.com/ncuillery/angular-breadcrumb // Definitions by: Marc Talary // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -76,4 +76,4 @@ declare namespace ncy { **/ getLastStep(): angular.ui.IState; } -} \ No newline at end of file +} diff --git a/angular-breadcrumb/tsconfig.json b/angular-breadcrumb/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/angular-breadcrumb/tsconfig.json +++ b/angular-breadcrumb/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-clipboard/angular-clipboard-tests.ts b/angular-clipboard/angular-clipboard-tests.ts new file mode 100644 index 0000000000..ccb1c7ce9a --- /dev/null +++ b/angular-clipboard/angular-clipboard-tests.ts @@ -0,0 +1,14 @@ +/// +/// + +import * as angular from "angular"; +import {ClipboardService} from "angular-clipboard"; + +const app = angular.module('testModule', ['angular-clipboard']); +app.controller('TestController', ($scope: ng.IScope, clipboard: ClipboardService) => { + $scope['testCopy'] = () => { + if (clipboard.supported) { + clipboard.copyText('hiiiiiii'); + } + }; +}); diff --git a/angular-clipboard/index.d.ts b/angular-clipboard/index.d.ts new file mode 100644 index 0000000000..bb2d93ce49 --- /dev/null +++ b/angular-clipboard/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for angular-clipboard v1.5 +// Project: https://github.com/omichelsen/angular-clipboard +// Definitions by: Bradford Wagner +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Definition of the Clipboard Service + */ +export interface ClipboardService { + /** + * tells us whether or not angular-clipboard is supported + */ + supported: boolean; + + /** + * copies text to a clipboard + * @param text the text to be copied to the clipboard + */ + copyText(text: string): void; +} diff --git a/angular-clipboard/tsconfig.json b/angular-clipboard/tsconfig.json new file mode 100644 index 0000000000..c59541d1d6 --- /dev/null +++ b/angular-clipboard/tsconfig.json @@ -0,0 +1,20 @@ +{ + "files": [ + "index.d.ts", + "angular-clipboard-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/angular-cookie/tsconfig.json b/angular-cookie/tsconfig.json index fc5ba438ad..1d6e7037bc 100644 --- a/angular-cookie/tsconfig.json +++ b/angular-cookie/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-cookies/index.d.ts b/angular-cookies/index.d.ts index ad28d2bdfe..e71d636f73 100644 --- a/angular-cookies/index.d.ts +++ b/angular-cookies/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.4 (ngCookies module) +// Type definitions for Angular JS (ngCookies module) 1.4 // Project: http://angularjs.org // Definitions by: Diego Vilar , Anthony Ciccarello // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/angular-cookies/tsconfig.json b/angular-cookies/tsconfig.json index 81f1a4a364..5692e5627e 100644 --- a/angular-cookies/tsconfig.json +++ b/angular-cookies/tsconfig.json @@ -6,6 +6,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,6 +14,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angular-deferred-bootstrap/tsconfig.json b/angular-deferred-bootstrap/tsconfig.json index aa3c166f61..c67dc2ba32 100644 --- a/angular-deferred-bootstrap/tsconfig.json +++ b/angular-deferred-bootstrap/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angular-dialog-service/tsconfig.json b/angular-dialog-service/tsconfig.json index 991cda6562..a924915069 100644 --- a/angular-dialog-service/tsconfig.json +++ b/angular-dialog-service/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-dynamic-locale/tsconfig.json b/angular-dynamic-locale/tsconfig.json index a13430d7e5..0ac5e902ed 100644 --- a/angular-dynamic-locale/tsconfig.json +++ b/angular-dynamic-locale/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-environment/tsconfig.json b/angular-environment/tsconfig.json index 2ced791168..3520642e63 100644 --- a/angular-environment/tsconfig.json +++ b/angular-environment/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-es/tsconfig.json b/angular-es/tsconfig.json index 84628a938d..4e6a8eedd5 100644 --- a/angular-es/tsconfig.json +++ b/angular-es/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "experimentalDecorators": true, "baseUrl": "../", diff --git a/angular-feature-flags/tsconfig.json b/angular-feature-flags/tsconfig.json index 23971439cc..a36abdb3a1 100644 --- a/angular-feature-flags/tsconfig.json +++ b/angular-feature-flags/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-file-saver/angular-file-saver-tests.ts b/angular-file-saver/angular-file-saver-tests.ts new file mode 100644 index 0000000000..24a31470a1 --- /dev/null +++ b/angular-file-saver/angular-file-saver-tests.ts @@ -0,0 +1,10 @@ +class ExampleCtrl { + constructor(FileSaver: angular.FileSaver) { + var data = new Blob(["Hey ho lets go!"], { type: "text/plain;charset=utf-8" }); + FileSaver.saveAs(data, "text.txt"); + } +} + +angular + .module("fileSaverExample", ["ngFileSaver"]) + .controller("ExampleCtrl", ExampleCtrl); \ No newline at end of file diff --git a/angular-file-saver/index.d.ts b/angular-file-saver/index.d.ts new file mode 100644 index 0000000000..ef834f4dcb --- /dev/null +++ b/angular-file-saver/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for angular-file-saver 1.2.0 +// Project: https://github.com/alferov/angular-file-saver +// Definitions by: Donald Nairn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace angular { + /** + * A core Angular factory proving FileSaver functionality. + */ + interface FileSaver { + /** + * Immediately starts saving a file + * @param data: a Blob instance; + * @param filename: a String custom filename (an extension is optional); + * @param disableAutoBOM : (optional) Boolean Disable automatically provided Unicode text encoding hints; + */ + saveAs(blob: Blob, fileName: string, disableBOM?: boolean): void; + } +} \ No newline at end of file diff --git a/angular-file-saver/tsconfig.json b/angular-file-saver/tsconfig.json new file mode 100644 index 0000000000..0ee3560e7c --- /dev/null +++ b/angular-file-saver/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "angular-file-saver-tests.ts" + ] +} \ No newline at end of file diff --git a/angular-formly/tsconfig.json b/angular-formly/tsconfig.json index 780163f9c9..5bbd17c0c2 100644 --- a/angular-formly/tsconfig.json +++ b/angular-formly/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-fullscreen/tsconfig.json b/angular-fullscreen/tsconfig.json index 00b552f9c6..d6f6d3475a 100644 --- a/angular-fullscreen/tsconfig.json +++ b/angular-fullscreen/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-gettext/index.d.ts b/angular-gettext/index.d.ts index 380ef1d8b7..224f5032e0 100644 --- a/angular-gettext/index.d.ts +++ b/angular-gettext/index.d.ts @@ -1,73 +1,79 @@ -// Type definitions for angular-gettext v2.1.0 +// Type definitions for angular-gettext v2.1.0 // Project: https://angular-gettext.rocketeer.be/ // Definitions by: Ákos Lukács // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare namespace angular.gettext { - interface gettextCatalog { - ////////////// - /// Fields /// - ////////////// - - /** (default: false): Whether or not to prefix untranslated strings with [MISSING]: or a custom prefix. */ - debug: boolean; - /** (default: [MISSING]:): Custom prefix for untranslated strings. */ - debugPrefix: string; - /** (default: false): Whether or not to wrap all processed text with markers.Example output: [Welcome] */ - showTranslatedMarkers: boolean; - /** (default: [): Custom prefix to mark strings that have been run through angular-gettext. */ - translatedMarkerPrefix: string; - /** (default: ]): Custom suffix to mark strings that have been run through angular-gettext. */ - translatedMarkerSuffix: string; - /** An object of loaded translation strings.Shouldn't be used directly. */ - strings: {}; - /** The default language, in which you're application is written. This defaults to English and it's generally a bad idea to use anything else: if your language has different pluralization rules you'll end up with incorrect translations. Deprecated - * @deprecreated - */ - baseLanguage: string; +import * as angular from 'angular'; - /////////////// - /// Methods /// - /////////////// +declare module 'angular' { + export namespace gettext { + interface gettextCatalog { - /** Sets the current language and makes sure that all translations get updated correctly. */ - setCurrentLanguage(lang: string): void; + ////////////// + /// Fields /// + ////////////// - /** Returns the current language. */ - getCurrentLanguage(): string; + /** (default: false): Whether or not to prefix untranslated strings with [MISSING]: or a custom prefix. */ + debug: boolean; + /** (default: [MISSING]:): Custom prefix for untranslated strings. */ + debugPrefix: string; + /** (default: false): Whether or not to wrap all processed text with markers.Example output: [Welcome] */ + showTranslatedMarkers: boolean; + /** (default: [): Custom prefix to mark strings that have been run through angular-gettext. */ + translatedMarkerPrefix: string; + /** (default: ]): Custom suffix to mark strings that have been run through angular-gettext. */ + translatedMarkerSuffix: string; + /** An object of loaded translation strings.Shouldn't be used directly. */ + strings: {}; + /** The default language, in which you're application is written. This defaults to English and it's generally a bad idea to use anything else: if your language has different pluralization rules you'll end up with incorrect translations. Deprecated + * @deprecreated + */ + baseLanguage: string; - /** Processes an object of string definitions. More details https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/ - * @param language A language code. - * @param strings A dictionary of strings. The format of this dictionary is: - * - Keys: Singular English strings (as defined in the source files) - * - Values: Either a single string for signular-only strings or an array of plural forms. - */ - setStrings(language: string, strings: { [key: string]: string|string[] }): void; - /** Get the correct pluralized (but untranslated) string for the value of n. */ - getStringForm(string: string, n: number): string; + /////////////// + /// Methods /// + /////////////// - /** Translate a string with the given scope. Uses Angular.JS interpolation, so something like this will do what you expect: - * var hello = gettextCatalog.getString("Hello {{name}}!", { name: "Ruben" }); - * // var hello will be "Hallo Ruben!" in Dutch. - * The scope parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster. - */ - getString(string: string, scope?: any, context?: string): string; + /** Sets the current language and makes sure that all translations get updated correctly. */ + setCurrentLanguage(lang: string): void; - /** Translate a plural string with the given context. */ - getPlural(n: number, string: string, stringPlural: string, context?: any): string; + /** Returns the current language. */ + getCurrentLanguage(): string; - /** Load a set of translation strings from a given URL.This should be a JSON catalog generated with grunt-angular-gettext. More details https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ */ - loadRemote(url: string): ng.IHttpPromise; - } + /** Processes an object of string definitions. More details https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/ + * @param language A language code. + * @param strings A dictionary of strings. The format of this dictionary is: + * - Keys: Singular English strings (as defined in the source files) + * - Values: Either a single string for signular-only strings or an array of plural forms. + */ + setStrings(language: string, strings: { [key: string]: string|string[] }): void; - /** If you have text that should be translated in your JavaScript code, wrap it with a call to a function named gettext. This module provides an injectable function to do so */ - interface gettextFunction { - (dummyString: string): string; + /** Get the correct pluralized (but untranslated) string for the value of n. */ + getStringForm(string: string, n: number): string; + + /** Translate a string with the given scope. Uses Angular.JS interpolation, so something like this will do what you expect: + * var hello = gettextCatalog.getString("Hello {{name}}!", { name: "Ruben" }); + * // var hello will be "Hallo Ruben!" in Dutch. + * The scope parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster. + */ + getString(string: string, scope?: any, context?: string): string; + + /** Translate a plural string with the given context. */ + getPlural(n: number, string: string, stringPlural: string, context?: any): string; + + /** Load a set of translation strings from a given URL.This should be a JSON catalog generated with grunt-angular-gettext. More details https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ */ + loadRemote(url: string): ng.IHttpPromise; + } + + /** If you have text that should be translated in your JavaScript code, wrap it with a call to a function named gettext. This module provides an injectable function to do so */ + interface gettextFunction { + (dummyString: string): string; + } } } diff --git a/angular-gettext/tsconfig.json b/angular-gettext/tsconfig.json index e174048c1f..5148d47eb9 100644 --- a/angular-gettext/tsconfig.json +++ b/angular-gettext/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-google-analytics/angular-google-analytics-service.d.ts b/angular-google-analytics/angular-google-analytics-service.d.ts deleted file mode 100644 index 9801280740..0000000000 --- a/angular-google-analytics/angular-google-analytics-service.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Type definitions for angular-google-analytics v1.1.0 -// Project: https://github.com/revolunet/angular-google-analytics -// Definitions by: Matt Wheatley -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace angular.google.analytics { - interface AnalyticsService { - /** - * @summary If logging is enabled then all outbound calls are accessible via an in-memory array. - * This is useful for troubleshooting and seeing the order of outbound calls with parameters. - */ - log: Array; - - /** - * @summary If in offline mode then all calls are queued to an in-memory array for future processing. - * All calls queued to the offlineQueue are not outbound calls yet and hence do not show up in the log. - */ - offlineQueue: Array; - - /** - * @summary Returns the current URL that would be sent if a `trackPage` call was made. - * @return {string} The URL - */ - getUrl: () => string; - - /** - * @summary Manually create classic analytics (ga.js) script tag - */ - createScriptTag: () => void; - - /** - * @summary Manually create universal analytics (analytics.js) script tag - */ - createAnalyticsScriptTag: () => void; - - /** - * @summary Allows for advanced configuration and definitions in univeral analytics only. This is a no-op when using classic analytics. - */ - set: (key: string, value: any, accountName?: string) => void; - - /** - * @summary Creates a new page view event - * @param {string} pageURL URL of page view - * @param {string} title Page Title - * @param {Object} dimensions Additional dimensions and metrics - */ - trackPage: (pageURL: string, title?: string, dimensions?: { [expr: string]: any }) => void; - - /** - * @summary Create a new event - */ - trackEvent: (category: string, action: string, label: string, value?: any, nonInteractionFlag?: boolean, dimensions?: { [expr: string]: any }) => void; - - trackException: (descrption: string, isFatal: boolean) => void; - - /** - * @summary While in offline mode, no calls to the ga function or pushes to the gaq array are made. - * This will queue all calls for later sending once offline mode is reset to false. - */ - offline: (offlineMode: boolean) => void; - } -} diff --git a/angular-google-analytics/index.d.ts b/angular-google-analytics/index.d.ts index 20663bec30..d83753a7b7 100644 --- a/angular-google-analytics/index.d.ts +++ b/angular-google-analytics/index.d.ts @@ -4,171 +4,232 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -/// +import * as angular from 'angular'; -declare namespace angular.google.analytics { +declare module 'angular' { + export namespace google.analytics { + /** + * @summary Interface for {@link AnalyticsService}. + * @interface + */ + interface AnalyticsService { + /** + * @summary If logging is enabled then all outbound calls are accessible via an in-memory array. + * This is useful for troubleshooting and seeing the order of outbound calls with parameters. + */ + log: Array; + + /** + * @summary If in offline mode then all calls are queued to an in-memory array for future processing. + * All calls queued to the offlineQueue are not outbound calls yet and hence do not show up in the log. + */ + offlineQueue: Array; + + /** + * @summary Returns the current URL that would be sent if a `trackPage` call was made. + * @return {string} The URL + */ + getUrl: () => string; + + /** + * @summary Manually create classic analytics (ga.js) script tag + */ + createScriptTag: () => void; + + /** + * @summary Manually create universal analytics (analytics.js) script tag + */ + createAnalyticsScriptTag: () => void; + + /** + * @summary Allows for advanced configuration and definitions in univeral analytics only. This is a no-op when using classic analytics. + */ + set: (key: string, value: any, accountName?: string) => void; + + /** + * @summary Creates a new page view event + * @param {string} pageURL URL of page view + * @param {string} title Page Title + * @param {Object} dimensions Additional dimensions and metrics + */ + trackPage: (pageURL: string, title?: string, dimensions?: { [expr: string]: any }) => void; + + /** + * @summary Create a new event + */ + trackEvent: (category: string, action: string, label: string, value?: any, nonInteractionFlag?: boolean, dimensions?: { [expr: string]: any }) => void; + + trackException: (descrption: string, isFatal: boolean) => void; + + /** + * @summary While in offline mode, no calls to the ga function or pushes to the gaq array are made. + * This will queue all calls for later sending once offline mode is reset to false. + */ + offline: (offlineMode: boolean) => void; + } /** * @summary Interface for {@link AnalysticsProvider}. * @interface */ interface AnalyticsProvider { - /** - * @summary Use Delay Script Tag Insertion. - * @param {boolean} val If true, the delay script tag is inserted. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - delayScriptTag(val: boolean): AnalyticsProvider; + /** + * @summary Use Delay Script Tag Insertion. + * @param {boolean} val If true, the delay script tag is inserted. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + delayScriptTag(val: boolean): AnalyticsProvider; - /** - * @summary Activates the test mode. - */ - enterTestMode(): void; + /** + * @summary Activates the test mode. + */ + enterTestMode(): void; - /** - * @summary Gets the global cookie configuration. - * @return {Object} The global cookie configuration. - */ - getCookieConfig(): Object; + /** + * @summary Gets the global cookie configuration. + * @return {Object} The global cookie configuration. + */ + getCookieConfig(): Object; - /** - * @summary Ignore first page view. - * @param {boolean} val If true, the first page view is ignored. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - ignoreFirstPageLoad(val: boolean): AnalyticsProvider; + /** + * @summary Ignore first page view. + * @param {boolean} val If true, the first page view is ignored. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + ignoreFirstPageLoad(val: boolean): AnalyticsProvider; - /** - * @summary Enable Service Logging. - * @param {boolean} val If true, log all outbound calls to an in-memory array accessible. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - logAllCalls(val: boolean): AnalyticsProvider; + /** + * @summary Enable Service Logging. + * @param {boolean} val If true, log all outbound calls to an in-memory array accessible. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + logAllCalls(val: boolean): AnalyticsProvider; - /** - * @summary Set Google Analytics Accounts. - * @param {Object} tracker The account identifier(s). - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - setAccount(tracker: string|Object|Array): AnalyticsProvider; + /** + * @summary Set Google Analytics Accounts. + * @param {Object} tracker The account identifier(s). + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + setAccount(tracker: string | Object | Array): AnalyticsProvider; - /** - * @summary Set Cookie Configuration. - * @param {Object} config The custom cookie parameters. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - * @deprecated - */ - setCookieConfig(config: Object): AnalyticsProvider; + /** + * @summary Set Cookie Configuration. + * @param {Object} config The custom cookie parameters. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + * @deprecated + */ + setCookieConfig(config: Object): AnalyticsProvider; - /** - * @summary Set cross-linked domains. - * @param {Array} domains The domains. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - setCrossLinkDomains(domains: Array): AnalyticsProvider; + /** + * @summary Set cross-linked domains. + * @param {Array} domains The domains. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + setCrossLinkDomains(domains: Array): AnalyticsProvider; - /** - * @summary Set currency. - * @param {string} currencyCode The currency code. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - setCurrency(currencyCode: string): AnalyticsProvider; + /** + * @summary Set currency. + * @param {string} currencyCode The currency code. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + setCurrency(currencyCode: string): AnalyticsProvider; - /** - * @summary Set Domain Name. - * @param {string} domain The domain name. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - setDomainName(domain: string): AnalyticsProvider; + /** + * @summary Set Domain Name. + * @param {string} domain The domain name. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + setDomainName(domain: string): AnalyticsProvider; - /** - * @summary Enable Experiment (universal analytics only). - * @param {string} id The experiment identifier. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - setExperimentId(id: string): AnalyticsProvider; + /** + * @summary Enable Experiment (universal analytics only). + * @param {string} id The experiment identifier. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + setExperimentId(id: string): AnalyticsProvider; - /** - * @summary Support Hybrid Mobile Applications. - * @param {boolean} val If true, each account object will disable protocol checking and all injected scripts will use the HTTPS protocol. - */ - setHybridMobileSupport(val: boolean): AnalyticsProvider; + /** + * @summary Support Hybrid Mobile Applications. + * @param {boolean} val If true, each account object will disable protocol checking and all injected scripts will use the HTTPS protocol. + */ + setHybridMobileSupport(val: boolean): AnalyticsProvider; - /** - * @summary Set the default page event name. - * @param {string} name The default page event name. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - setPageEvent(name: string): AnalyticsProvider; + /** + * @summary Set the default page event name. + * @param {string} name The default page event name. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + setPageEvent(name: string): AnalyticsProvider; - /** - * @summary Sets the regex to scrub location before sending to analytics. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - * @param {RegExp} regex The regex. - */ - setRemoveRegExp(regex: RegExp): AnalyticsProvider; + /** + * @summary Sets the regex to scrub location before sending to analytics. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + * @param {RegExp} regex The regex. + */ + setRemoveRegExp(regex: RegExp): AnalyticsProvider; - /** - * @summary Starts the offline mode. - * @param {boolean} val If true, the offline mode is started. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - startOffline(val: boolean): AnalyticsProvider; + /** + * @summary Starts the offline mode. + * @param {boolean} val If true, the offline mode is started. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + startOffline(val: boolean): AnalyticsProvider; - /** - * @summary Track all routes. - * @param {boolean} val If true, all routes are tracked. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - trackPages(doTrack: boolean): AnalyticsProvider; + /** + * @summary Track all routes. + * @param {boolean} val If true, all routes are tracked. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + trackPages(doTrack: boolean): AnalyticsProvider; - /** - * @summary Sets the URL prefix. - * @param {string} prefix The URL prefix. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - trackPrefix(prefix: string): AnalyticsProvider; + /** + * @summary Sets the URL prefix. + * @param {string} prefix The URL prefix. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + trackPrefix(prefix: string): AnalyticsProvider; - /** - * @summary Track all URL query parameters. - * @param {boolean} val If true, all URL query parameters are tracked. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - trackUrlParams(val: boolean): AnalyticsProvider; + /** + * @summary Track all URL query parameters. + * @param {boolean} val If true, all URL query parameters are tracked. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + trackUrlParams(val: boolean): AnalyticsProvider; - /** - * @summary Use Classic Analytics. - * @param {boolean} val If true, use classic analytics. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - useAnalytics(val: boolean): AnalyticsProvider; + /** + * @summary Use Classic Analytics. + * @param {boolean} val If true, use classic analytics. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + useAnalytics(val: boolean): AnalyticsProvider; - /** - * @summary Use Cross Domain Linking. - * @param {boolean} val If true, the cross-linked domains are registered with Google Analytics. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - useCrossDomainLinker(val: boolean): AnalyticsProvider; + /** + * @summary Use Cross Domain Linking. + * @param {boolean} val If true, the cross-linked domains are registered with Google Analytics. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + useCrossDomainLinker(val: boolean): AnalyticsProvider; - /** - * @summary Use Display Features. - * @param {boolean} val If true, the display features module is loaded with Google Analytics. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - useDisplayFeatures(val: boolean): AnalyticsProvider; + /** + * @summary Use Display Features. + * @param {boolean} val If true, the display features module is loaded with Google Analytics. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + useDisplayFeatures(val: boolean): AnalyticsProvider; - /** - * @summary Enable enhanced e-commerce module. - * @param {boolean} val If true, the enhanced e-commerce module is enabled. - * @param {boolean} enhanced If true, the "ec.js" file is used, otherwises, the "ecommerce.js" is used. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - useECommerce(val: boolean, enhanced: boolean): AnalyticsProvider; + /** + * @summary Enable enhanced e-commerce module. + * @param {boolean} val If true, the enhanced e-commerce module is enabled. + * @param {boolean} enhanced If true, the "ec.js" file is used, otherwises, the "ecommerce.js" is used. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + useECommerce(val: boolean, enhanced: boolean): AnalyticsProvider; - /** - * @summary Use Enhanced Link Attribution. - * @param {boolean} val If true, the enhanced link attribution module is loaded with Google Analytics. - * @return {angular.google.analytics.IAnalyticsProvider} The object instance. - */ - useEnhancedLinkAttribution(val: boolean): AnalyticsProvider; + /** + * @summary Use Enhanced Link Attribution. + * @param {boolean} val If true, the enhanced link attribution module is loaded with Google Analytics. + * @return {angular.google.analytics.IAnalyticsProvider} The object instance. + */ + useEnhancedLinkAttribution(val: boolean): AnalyticsProvider; } + } } diff --git a/angular-google-analytics/tsconfig.json b/angular-google-analytics/tsconfig.json index 063747ad37..b3d6c86c3d 100644 --- a/angular-google-analytics/tsconfig.json +++ b/angular-google-analytics/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-growl-v2/tsconfig.json b/angular-growl-v2/tsconfig.json index b24e69e35a..4b9632329e 100644 --- a/angular-growl-v2/tsconfig.json +++ b/angular-growl-v2/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-hotkeys/tsconfig.json b/angular-hotkeys/tsconfig.json index bdad07860e..9b83f109d4 100644 --- a/angular-hotkeys/tsconfig.json +++ b/angular-hotkeys/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-http-auth/tsconfig.json b/angular-http-auth/tsconfig.json index 5db24b6270..de4c1c54c8 100644 --- a/angular-http-auth/tsconfig.json +++ b/angular-http-auth/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-httpi/tsconfig.json b/angular-httpi/tsconfig.json index 985d8b3285..5ce96cc629 100644 --- a/angular-httpi/tsconfig.json +++ b/angular-httpi/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-idle/index.d.ts b/angular-idle/index.d.ts index 668aef866f..782d3b4ec2 100644 --- a/angular-idle/index.d.ts +++ b/angular-idle/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ng-idle v1.1.1 +// Type definitions for ng-idle v1.1.1 // Project: http://hackedbychinese.github.io/ng-idle/ // Definitions by: mthamil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/angular-idle/tsconfig.json b/angular-idle/tsconfig.json index 22c30cfb25..5c86a83fd2 100644 --- a/angular-idle/tsconfig.json +++ b/angular-idle/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-jwt/index.d.ts b/angular-jwt/index.d.ts index 8c31b2d463..fd58699c79 100644 --- a/angular-jwt/index.d.ts +++ b/angular-jwt/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for angular-jwt 0.0.8 +// Type definitions for angular-jwt 0.0.8 // Project: https://github.com/auth0/angular-jwt // Definitions by: Reto Rezzonico // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/angular-jwt/tsconfig.json b/angular-jwt/tsconfig.json index 34109198fc..49abf9fb0d 100644 --- a/angular-jwt/tsconfig.json +++ b/angular-jwt/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-load/tsconfig.json b/angular-load/tsconfig.json index 10a9aa370b..aee2be4824 100644 --- a/angular-load/tsconfig.json +++ b/angular-load/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-loading-bar/tsconfig.json b/angular-loading-bar/tsconfig.json index 1a9882dad4..32c9a75063 100644 --- a/angular-loading-bar/tsconfig.json +++ b/angular-loading-bar/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-local-storage/tsconfig.json b/angular-local-storage/tsconfig.json index 768463c1e6..65d3698e22 100644 --- a/angular-local-storage/tsconfig.json +++ b/angular-local-storage/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-localforage/tsconfig.json b/angular-localforage/tsconfig.json index 3ac6b18efe..e962f64de3 100644 --- a/angular-localforage/tsconfig.json +++ b/angular-localforage/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-locker/tsconfig.json b/angular-locker/tsconfig.json index c2706703a8..ec481f65cf 100644 --- a/angular-locker/tsconfig.json +++ b/angular-locker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-material/index.d.ts b/angular-material/index.d.ts index 610dcf34d7..e3804acbc8 100644 --- a/angular-material/index.d.ts +++ b/angular-material/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular Material 1.1.0-rc5+ (angular.material module) // Project: https://github.com/angular/material -// Definitions by: Alex Staroselsky , Blake Bigelow , Peter Hajdu +// Definitions by: Blake Bigelow , Peter Hajdu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as angular from 'angular'; @@ -76,7 +76,7 @@ declare module 'angular' { } interface IColorService { - applyThemeColors(element: Element|JQuery, colorExpression: IColorExpression): void; + applyThemeColors(element: Element | JQuery, colorExpression: IColorExpression): void; getThemeColor(expression: string): string; hasTheme(): boolean; } @@ -155,10 +155,10 @@ declare module 'angular' { highlightClass(highlightClass: string): T; capsule(capsule: boolean): T; theme(theme: string): T; - hideDelay(delay: number): T; + hideDelay(delay: number | false): T; position(position: string): T; parent(parent?: string | Element | JQuery): T; // default: root node - toastClass(toastClass: string): T; + toastClass(toastClass: string): T; } interface ISimpleToastPreset extends IToastPreset { @@ -170,7 +170,7 @@ declare module 'angular' { autoWrap?: boolean; scope?: angular.IScope; // default: new child scope preserveScope?: boolean; // default: false - hideDelay?: number; // default (ms): 3000 + hideDelay?: number | false; // default (ms): 3000 position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left' toastClass?: string; controller?: string | Function; @@ -225,7 +225,7 @@ declare module 'angular' { hues: IThemeHues; } - interface IBrowserColors{ + interface IBrowserColors { theme: string; palette: string; hue: string; @@ -264,6 +264,7 @@ declare module 'angular' { definePalette(name: string, palette: IPalette): IThemingProvider; enableBrowserColor(browserColors: IBrowserColors): Function; extendPalette(name: string, palette: IPalette): IPalette; + registerStyles(styles: String): void; setDefaultTheme(theme: string): void; setNonce(nonce: string): void; theme(name: string, inheritFrom?: string): ITheme; @@ -336,12 +337,15 @@ declare module 'angular' { onRemoving?: Function; onDomRemoved?: Function; origin?: string | JQuery | Element; + onCloseSuccess?: ((panel: IPanelRef, closeReason: string) => any); } interface IPanelRef { id: string; config: IPanelConfig; isAttached: boolean; + panelContainer: JQuery; + panelEl: JQuery; open(): angular.IPromise; close(): angular.IPromise; attach(): angular.IPromise; @@ -408,6 +412,16 @@ declare module 'angular' { interceptorTypes: { CLOSE: string, }; + closeReasons: { + CLICK_OUTSIDE: string, + ESCAPE: string, + }; + absPosition: { + TOP: string, + RIGHT: string, + BOTTOM: string, + LEFT: string, + }; } } } diff --git a/angular-material/tsconfig.json b/angular-material/tsconfig.json index b4a0ec13bd..5c81b4a02d 100644 --- a/angular-material/tsconfig.json +++ b/angular-material/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-media-queries/index.d.ts b/angular-media-queries/index.d.ts index 328d4de27b..a1f1cc820e 100644 --- a/angular-media-queries/index.d.ts +++ b/angular-media-queries/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular matchMedia 0.6.0 (angular.matchMedia module) +// Type definitions for Angular matchMedia (angular.matchMedia module) 0.6 // Project: https://github.com/jacopotarantino/angular-match-media // Definitions by: Joao Monteiro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,7 +14,7 @@ declare module 'angular' { // Returns a value indicating if the current device has a retina screen isRetina: boolean; - + is(list: Array | string): boolean; // Executes the callback function on window resize with the match truthiness as the first argument. @@ -28,7 +28,7 @@ declare module 'angular' { onChange(scope: angular.IScope, list: Array | string, callback: (result: boolean) => void): boolean; // Executes the callback only when inside of the particular screensize. - // The 'scope' parameter is optional. If it's not passed in, '$rootScope' is used. + // The 'scope' parameter is optional. If it's not passed in, '$rootScope' is used. when(list: Array | string, callback: (result: boolean) => void, scope?: angular.IScope): boolean; } } diff --git a/angular-media-queries/tsconfig.json b/angular-media-queries/tsconfig.json index a148f1997a..df6257738e 100644 --- a/angular-media-queries/tsconfig.json +++ b/angular-media-queries/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-meteor/index.d.ts b/angular-meteor/index.d.ts index 8d64d3bae0..29bacb2e83 100644 --- a/angular-meteor/index.d.ts +++ b/angular-meteor/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS Meteor v0.8.8 (angular.meteor module) +// Type definitions for Angular JS Meteor (angular.meteor module) 0.8 // Project: https://github.com/Urigo/angular-meteor // Definitions by: Peter Grman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/angular-meteor/tsconfig.json b/angular-meteor/tsconfig.json index 20c8a44fb9..8febc3cb25 100644 --- a/angular-meteor/tsconfig.json +++ b/angular-meteor/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-mocks/angular-mocks-tests.ts b/angular-mocks/angular-mocks-tests.ts index d0d1dc5dce..8ea42e4122 100644 --- a/angular-mocks/angular-mocks-tests.ts +++ b/angular-mocks/angular-mocks-tests.ts @@ -106,6 +106,7 @@ $componentController<{}, { test: boolean }>('Test controller', { $scope: ('Test controller', { $scope: {} }, {}); $componentController<{}, {}>('Test controller', { $scope: {} }, {}, 'identity'); $componentController<{ cb: () => void }, {}>('Test controller', { $scope: {} }); +$componentController<{}, { test: {name: string} }>('Test controller', { test: {name: 'Test Local'} }); /////////////////////////////////////// // IHttpBackendService @@ -451,11 +452,11 @@ requestHandler.passThrough().passThrough(); requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']); requestHandler.respond((method, url, data, headers) => [404, 'data', { header: 'value' }, 'responseText']).respond({}); requestHandler.respond((method, url, data, headers) => { return [404, { key: 'value' }, { header: 'value' }, 'responseText']; }); -requestHandler.respond((method, url, data, headers, params) => { +requestHandler.respond((method, url, data, headers, params) => { if(params.id === 1) { return [200, { key: 'value'}, { header: 'value'}, 'responseText']; } else { - return [404, { key: 'value' }, { header: 'value' }, 'responseText']; + return [404, { key: 'value' }, { header: 'value' }, 'responseText']; } }); requestHandler.respond('data'); diff --git a/angular-mocks/index.d.ts b/angular-mocks/index.d.ts index e3ef7bad18..ddded4d0a8 100644 --- a/angular-mocks/index.d.ts +++ b/angular-mocks/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.5 (ngMock, ngMockE2E module) +// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.5 // Project: http://angularjs.org // Definitions by: Diego Vilar , Tony Curtis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -107,7 +107,7 @@ declare module 'angular' { interface IComponentControllerService { // TBinding is an interface exposed by a component as per John Papa's style guide // https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#accessible-members-up-top - (componentName: string, locals: { $scope: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T; + (componentName: string, locals: { $scope?: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T; } @@ -117,10 +117,13 @@ declare module 'angular' { /////////////////////////////////////////////////////////////////////////// interface IHttpBackendService { /** - * Flushes all pending requests using the trained responses. - * @param count Number of responses to flush (in the order they arrived). If undefined, all pending requests will be flushed. + * Flushes pending requests using the trained responses. Requests are flushed in the order they were made, but it is also possible to skip one or more requests (for example to have them flushed later). This is useful for simulating scenarios where responses arrive from the server in any order. + * + * If there are no pending requests to flush when the method is called, an exception is thrown (as this is typically a sign of programming error). + * @param count Number of responses to flush. If undefined/null, all pending requests (starting after `skip`) will be flushed. + * @param skip Number of pending requests to skip. For example, a value of 5 would skip the first 5 pending requests and start flushing from the 6th onwards. _(default: 0)_ */ - flush(count?: number): void; + flush(count?: number, skip?: number): void; /** * Resets all request expectations, but preserves all backend definitions. @@ -301,6 +304,25 @@ declare module 'angular' { whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler; } + /////////////////////////////////////////////////////////////////////////// + // AnimateService + // see https://docs.angularjs.org/api/ngMock/service/$animate + /////////////////////////////////////////////////////////////////////////// + module animate { + interface IAnimateService { + + /** + * This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining animation frames and/or callbacks. + */ + closeAndFlush(): void; + + /** + * This method is used to flush the pending callbacks and animation frames to either start an animation or conclude an animation. Note that this will not actually close an actively running animation (see `closeAndFlush()` for that). + */ + flush(): void; + } + } + export module mock { // returned interface by the the mocked HttpBackendService expect/when methods interface IRequestHandler { diff --git a/angular-mocks/tsconfig.json b/angular-mocks/tsconfig.json index b53af4d397..26d99af5fe 100644 --- a/angular-mocks/tsconfig.json +++ b/angular-mocks/tsconfig.json @@ -8,6 +8,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -15,6 +16,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angular-modal/tsconfig.json b/angular-modal/tsconfig.json index 4368649c99..a62e576664 100644 --- a/angular-modal/tsconfig.json +++ b/angular-modal/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-notifications/tsconfig.json b/angular-notifications/tsconfig.json index ea7849e630..e9fa035ac7 100644 --- a/angular-notifications/tsconfig.json +++ b/angular-notifications/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-notify/tsconfig.json b/angular-notify/tsconfig.json index cfa6076328..db064d4b3a 100644 --- a/angular-notify/tsconfig.json +++ b/angular-notify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-odata-resources/tsconfig.json b/angular-odata-resources/tsconfig.json index 4bfecb2bfc..70a06903c3 100644 --- a/angular-odata-resources/tsconfig.json +++ b/angular-odata-resources/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-permission/angular-permission-tests.ts b/angular-permission/angular-permission-tests.ts index 4f3a35f5df..051ace69b8 100644 --- a/angular-permission/angular-permission-tests.ts +++ b/angular-permission/angular-permission-tests.ts @@ -66,7 +66,7 @@ angular PermissionStore.removePermissionDefinition('user'); - let permissions: Array = PermissionStore.getStore(); + let permissions = PermissionStore.getStore(); }); @@ -90,5 +90,5 @@ angular RoleStore.removeRoleDefinition('user'); - let roles: Array = RoleStore.getStore(); + let roles = RoleStore.getStore(); }); diff --git a/angular-permission/index.d.ts b/angular-permission/index.d.ts index 0b8d06f32a..28781cb5df 100644 --- a/angular-permission/index.d.ts +++ b/angular-permission/index.d.ts @@ -30,8 +30,8 @@ declare module 'angular' { * @param validationFunction {Function} Function used to validate if permission is valid */ definePermission( - name: string, - validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise + permissionName: string, + validationFunction: PermissionValidationFunction ): void; /** @@ -43,10 +43,14 @@ declare module 'angular' { * @param validationFunction {Function} Function used to validate if permission is valid */ defineManyPermissions( - permissions: string[], - validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise + permissionNames: string[], + validationFunction: PermissionValidationFunction ): void; + /** + * Removes all permissions + * @method + */ clearStore(): void; /** @@ -55,7 +59,7 @@ declare module 'angular' { * * @param permissionName {String} Name of defined permission */ - removePermissionDefinition(permission: string): void; + removePermissionDefinition(permissionName: string): void; /** * Checks if permission exists @@ -66,13 +70,21 @@ declare module 'angular' { */ hasPermissionDefinition(permissionName: string): boolean; + /** + * Returns permission by it's name + * @method + * + * @returns {permission.Permission} Permissions definition object + */ + getPermissionDefinition(permissionName: string): Permission; + /** * Returns all permissions * @method * * @returns {Object} Permissions collection */ - getStore(): Permission[]; + getStore(): { [permissionName: string]: Permission }; } export interface RoleStore { @@ -85,8 +97,8 @@ declare module 'angular' { * @param [validationFunction] {Function} Function used to validate if permissions in role are valid */ defineRole( - role: string, - permissions: Array, + roleName: string, + permissions: string[], validationFunction: RoleValidationFunction ): void; @@ -97,7 +109,10 @@ declare module 'angular' { * @param roleName {String} Name of defined role * @param permissions {Array} Set of permission names */ - defineRole(role: string, permissions: Array): void; + defineRole( + roleName: string, + permissions: string[] + ): void; /** * Checks if role is defined in store @@ -106,7 +121,7 @@ declare module 'angular' { * @param roleName {String} Name of role * @returns {Boolean} */ - hasRoleDefinition(role: string): boolean; + hasRoleDefinition(roleName: string): boolean; /** * Returns role definition object by it's name @@ -136,27 +151,31 @@ declare module 'angular' { * * @returns {Object} Defined roles collection */ - getStore(): Role[]; + getStore(): { [roleName: string]: Role }; } export interface Role { roleName: string; permissionNames: string[]; validationFunction?: RoleValidationFunction; + validateRole: () => angular.IPromise; } export interface Permission { permissionName: string; validationFunction?: PermissionValidationFunction; + validatePermission: () => angular.IPromise; } - interface RoleValidationFunction { - (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; - } + export type RoleValidationFunction = ( + roleName?: string, + transitionProperties?: TransitionProperties + ) => boolean | angular.IPromise; - interface PermissionValidationFunction { - (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; - } + export type PermissionValidationFunction = ( + permissionName?: string, + transitionProperties?: TransitionProperties + ) => boolean | angular.IPromise; export interface IPermissionState extends angular.ui.IState { data?: any | DataWithPermissions; @@ -164,8 +183,8 @@ declare module 'angular' { export interface DataWithPermissions { permissions?: { - only?: (() => void) | Array | angular.IPromise; - except?: (() => void) | Array | angular.IPromise; + only?: (() => void) | string | string[] | angular.IPromise; + except?: (() => void) | string | string[] | angular.IPromise; redirectTo: string | (() => string) | (() => PermissionRedirectConfigation) | { [index: string]: PermissionRedirectConfigation } }; } diff --git a/angular-permission/tsconfig.json b/angular-permission/tsconfig.json index 60f90b2edf..c577c24510 100644 --- a/angular-permission/tsconfig.json +++ b/angular-permission/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-promise-tracker/angular-promise-tracker-tests.ts b/angular-promise-tracker/angular-promise-tracker-tests.ts new file mode 100644 index 0000000000..82f9e66c06 --- /dev/null +++ b/angular-promise-tracker/angular-promise-tracker-tests.ts @@ -0,0 +1,20 @@ +angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker', + ($q: angular.IQService, promiseTracker: angular.promisetracker.PromiseTrackerService) => { + const trackerWithoutOptions = promiseTracker(); + + const options = { + activationDelay: 10, + minDuration: 500 + } as angular.promisetracker.PromiseTrackerOptions; + const trackerWithOptions = promiseTracker(options); + + const isActive: boolean = trackerWithOptions.active(); + const tracking: boolean = trackerWithOptions.tracking(); + const trackingCount: number = trackerWithOptions.trackingCount(); + trackerWithOptions.cancel(); + + const createdPromise: angular.IDeferred = trackerWithOptions.createPromise(); + + const promiseToAdd = $q.defer().promise; + const addedPromise: angular.IDeferred = trackerWithOptions.addPromise(promiseToAdd); +}]); diff --git a/angular-promise-tracker/index.d.ts b/angular-promise-tracker/index.d.ts new file mode 100644 index 0000000000..c00f36e77c --- /dev/null +++ b/angular-promise-tracker/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for angular-promise-tracker 2.2.2 +// Project: https://github.com/ajoslin/angular-promise-tracker +// Definitions by: Rufus Linke +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as angular from 'angular'; + +declare module 'angular' { + export namespace promisetracker { + interface PromiseTrackerOptions { + activationDelay: number; + minDuration: number; + } + + interface PromiseTracker { + active(): boolean; + tracking(): boolean; + trackingCount(): number; + addPromise(promise: angular.IPromise): angular.IDeferred; + createPromise(): angular.IDeferred; + cancel(): void; + } + + interface PromiseTrackerService { + (options?: PromiseTrackerOptions): PromiseTracker; + } + } +} diff --git a/angular-promise-tracker/tsconfig.json b/angular-promise-tracker/tsconfig.json new file mode 100644 index 0000000000..7b782149cb --- /dev/null +++ b/angular-promise-tracker/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "angular-promise-tracker-tests.ts" + ] +} \ No newline at end of file diff --git a/angular-q-spread/angular-q-spread.d.ts b/angular-q-spread/index.d.ts similarity index 100% rename from angular-q-spread/angular-q-spread.d.ts rename to angular-q-spread/index.d.ts diff --git a/angular-q-spread/tsconfig.json b/angular-q-spread/tsconfig.json index 90110b0e9f..9de57dc2df 100644 --- a/angular-q-spread/tsconfig.json +++ b/angular-q-spread/tsconfig.json @@ -1,12 +1,13 @@ { "files": [ - "angular-q-spread.d.ts", + "index.d.ts", "angular-q-spread-tests.ts" ], "compilerOptions": { "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angular-resource/index.d.ts b/angular-resource/index.d.ts index e8726cc089..8880827de2 100644 --- a/angular-resource/index.d.ts +++ b/angular-resource/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.5 (ngResource module) +// Type definitions for Angular JS (ngResource module) 1.5 // Project: http://angularjs.org // Definitions by: Diego Vilar , Michael Jess // Definitions: https://github.com/daptiv/DefinitelyTyped @@ -162,6 +162,8 @@ declare module 'angular' { * Really just a regular Array object with $promise and $resolve attached to it */ interface IResourceArray extends Array> { + $cancelRequest(): void; + /** the promise of the original server interaction that created this collection. **/ $promise: angular.IPromise>; $resolved: boolean; diff --git a/angular-resource/tsconfig.json b/angular-resource/tsconfig.json index fe51bc7293..67f7158abc 100644 --- a/angular-resource/tsconfig.json +++ b/angular-resource/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angular-route/index.d.ts b/angular-route/index.d.ts index dc1f6507bf..98ba467b66 100644 --- a/angular-route/index.d.ts +++ b/angular-route/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.3 (ngRoute module) +// Type definitions for Angular JS (ngRoute module) 1.3 // Project: http://angularjs.org // Definitions by: Jonathan Park // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/angular-route/tsconfig.json b/angular-route/tsconfig.json index 96c224daaf..139769720d 100644 --- a/angular-route/tsconfig.json +++ b/angular-route/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angular-sanitize/index.d.ts b/angular-sanitize/index.d.ts index c9d4f35e51..8e4936b4b4 100644 --- a/angular-sanitize/index.d.ts +++ b/angular-sanitize/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.3 (ngSanitize module) +// Type definitions for Angular JS (ngSanitize module) 1.3 // Project: http://angularjs.org // Definitions by: Diego Vilar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/angular-sanitize/tsconfig.json b/angular-sanitize/tsconfig.json index c029bece36..7bb42c2dec 100644 --- a/angular-sanitize/tsconfig.json +++ b/angular-sanitize/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angular-scenario/index.d.ts b/angular-scenario/index.d.ts index 698649a8d8..c5804ffd80 100644 --- a/angular-scenario/index.d.ts +++ b/angular-scenario/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular Scenario Testing 1.3 (ngScenario module) +// Type definitions for Angular Scenario Testing (ngScenario module) 1.3 // Project: http://angularjs.org // Definitions by: RomanoLindano // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/angular-scenario/tsconfig.json b/angular-scenario/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/angular-scenario/tsconfig.json +++ b/angular-scenario/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-scroll/tsconfig.json b/angular-scroll/tsconfig.json index c61543efb9..08f50748ac 100644 --- a/angular-scroll/tsconfig.json +++ b/angular-scroll/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-signalr-hub/tsconfig.json b/angular-signalr-hub/tsconfig.json index 1cd2128978..4a970152c4 100644 --- a/angular-signalr-hub/tsconfig.json +++ b/angular-signalr-hub/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-spinner/angular-spinner-tests.ts b/angular-spinner/angular-spinner-tests.ts index 9ac20eed0c..c8d9e42479 100644 --- a/angular-spinner/angular-spinner-tests.ts +++ b/angular-spinner/angular-spinner-tests.ts @@ -1,4 +1,4 @@ - +/// var myApp = angular.module('testModule'); diff --git a/angular-spinner/index.d.ts b/angular-spinner/index.d.ts index e81901ef90..e7710e60e2 100644 --- a/angular-spinner/index.d.ts +++ b/angular-spinner/index.d.ts @@ -3,23 +3,21 @@ // Definitions by: Marcin Biegała // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - /** -* SpinnerService +* SpinnerService * see https://github.com/urish/angular-spinner */ -interface ISpinnerService { +declare interface ISpinnerService { /** * Start selected spinner - * + * * @param spinner key */ spin(key: string): void; /** * Stop selected spinner - * + * * @param spinner key */ stop(key: string): void; diff --git a/angular-spinner/tsconfig.json b/angular-spinner/tsconfig.json index 3936b5ffe3..7d3a338a97 100644 --- a/angular-spinner/tsconfig.json +++ b/angular-spinner/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-storage/tsconfig.json b/angular-storage/tsconfig.json index b66da3bae3..003520747b 100644 --- a/angular-storage/tsconfig.json +++ b/angular-storage/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-strap/index.d.ts b/angular-strap/index.d.ts index 49a1c310b4..3f279619dc 100644 --- a/angular-strap/index.d.ts +++ b/angular-strap/index.d.ts @@ -42,6 +42,7 @@ declare namespace mgcrea.ngStrap { show?: boolean; container?: string | boolean; template?: string; + templateUrl?: string; contentTemplate?: string; prefixEvent?: string; id?: string; diff --git a/angular-strap/tsconfig.json b/angular-strap/tsconfig.json index c64c49d0fb..c906ac720d 100644 --- a/angular-strap/tsconfig.json +++ b/angular-strap/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-toastr/tsconfig.json b/angular-toastr/tsconfig.json index a75ade93ae..558e803640 100644 --- a/angular-toastr/tsconfig.json +++ b/angular-toastr/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-toasty/tsconfig.json b/angular-toasty/tsconfig.json index 8635b9121c..d3b2bb7dbf 100644 --- a/angular-toasty/tsconfig.json +++ b/angular-toasty/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-touchspin/tsconfig.json b/angular-touchspin/tsconfig.json index 841a1463f6..bd902868ad 100644 --- a/angular-touchspin/tsconfig.json +++ b/angular-touchspin/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-translate/index.d.ts b/angular-translate/index.d.ts index 882b5d3a54..19e1962fab 100644 --- a/angular-translate/index.d.ts +++ b/angular-translate/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular Translate v2.4.0 (pascalprecht.translate module) +// Type definitions for Angular Translate (pascalprecht.translate module) 2.4 // Project: https://github.com/PascalPrecht/angular-translate // Definitions by: Michel Salib // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/angular-translate/tsconfig.json b/angular-translate/tsconfig.json index 347386347d..5284544f93 100644 --- a/angular-translate/tsconfig.json +++ b/angular-translate/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts index 43266798a6..84ddd63790 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts @@ -154,6 +154,8 @@ testApp.controller('TestCtrl', ( * test the $modal service */ var modalInstance = $modal.open({ + ariaLabelledBy: "label", + ariaDescribedBy: "description", animation: false, backdrop: 'static', backdropClass: 'modal-backdrop-test', diff --git a/angular-ui-bootstrap/index.d.ts b/angular-ui-bootstrap/index.d.ts index f4773975aa..24f8405125 100644 --- a/angular-ui-bootstrap/index.d.ts +++ b/angular-ui-bootstrap/index.d.ts @@ -1,12 +1,35 @@ -// Type definitions for Angular UI Bootstrap 0.13.3 +// Type definitions for Angular UI Bootstrap 0.13.3 // Project: https://github.com/angular-ui/bootstrap -// Definitions by: Brian Surowiec +// Definitions by: Brian Surowiec , Ryan Southgate // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// import * as angular from 'angular'; +export type IAccordionConfig = angular.ui.bootstrap.IAccordionConfig; +export type IButtonConfig = angular.ui.bootstrap.IButtonConfig; +export type IDatepickerConfig = angular.ui.bootstrap.IDatepickerConfig; +export type IDatepickerPopupConfig = angular.ui.bootstrap.IDatepickerPopupConfig; +export type IModalProvider = angular.ui.bootstrap.IModalProvider; +export type IModalService = angular.ui.bootstrap.IModalService; +export type IModalServiceInstance = angular.ui.bootstrap.IModalServiceInstance; +export type IModalScope = angular.ui.bootstrap.IModalScope; +export type IModalSettings = angular.ui.bootstrap.IModalSettings; +export type IModalStackService = angular.ui.bootstrap.IModalStackService; +export type IModalStackedMapKeyValuePair = angular.ui.bootstrap.IModalStackedMapKeyValuePair; +export type IPaginationConfig = angular.ui.bootstrap.IPaginationConfig; +export type IPagerConfig = angular.ui.bootstrap.IPagerConfig; +export type IPositionCoordinates = angular.ui.bootstrap.IPositionCoordinates; +export type IPositionService = angular.ui.bootstrap.IPositionService; +export type IProgressConfig = angular.ui.bootstrap.IProgressConfig; +export type IRatingConfig = angular.ui.bootstrap.IRatingConfig; +export type ITimepickerConfig = angular.ui.bootstrap.ITimepickerConfig; +export type ITooltipOptions = angular.ui.bootstrap.ITooltipOptions; +export type ITooltipProvider = angular.ui.bootstrap.ITooltipProvider; +export type ITransitionService = angular.ui.bootstrap.ITransitionService; +export type ITransitionServiceOptions = angular.ui.bootstrap.ITransitionServiceOptions; + declare module 'angular' { export namespace ui.bootstrap { @@ -402,6 +425,22 @@ declare module 'angular' { * - `resolve` - An object of the modal resolve values. See [UI Router resolves] for details. */ component?: string; + + /** + * Sets the `aria-describedby` property on the modal. + * The string should be an id (without the leading '#') pointing to the element that describes your modal. + * @type {string} + * @memberOf IModalSettings + */ + ariaDescribedBy?: string; + + /** + * Sets the `aria-labelledby` property on the modal. + * The string should be an id (without the leading '#') pointing to the element that labels your modal. + * @type {string} + * @memberOf IModalSettings + */ + ariaLabelledBy?: string; } interface IModalStackService { diff --git a/angular-ui-bootstrap/tsconfig.json b/angular-ui-bootstrap/tsconfig.json index cf2cdd2e3f..57cf6125c4 100644 --- a/angular-ui-bootstrap/tsconfig.json +++ b/angular-ui-bootstrap/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-ui-notification/tsconfig.json b/angular-ui-notification/tsconfig.json index 8e69a83745..c254264d1d 100644 --- a/angular-ui-notification/tsconfig.json +++ b/angular-ui-notification/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-ui-router-default/angular-ui-router-default-tests.ts b/angular-ui-router-default/angular-ui-router-default-tests.ts index 2b6bfbe61e..95229f68cd 100644 --- a/angular-ui-router-default/angular-ui-router-default-tests.ts +++ b/angular-ui-router-default/angular-ui-router-default-tests.ts @@ -1,10 +1,11 @@ -/// +import * as angular from "angular"; +import { ui } from "angular"; angular.module("test", [ "ui.router", "ui.router.default" ]) - .config(function($stateProvider: angular.ui.IStateProvider) { + .config(function($stateProvider: ui.IStateProvider) { $stateProvider .state('concrete', { // no abstract or default diff --git a/angular-ui-router-default/angular-ui-router-default.d.ts b/angular-ui-router-default/angular-ui-router-default.d.ts deleted file mode 100644 index 9d102681cf..0000000000 --- a/angular-ui-router-default/angular-ui-router-default.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Type definitions for angular-ui-router-default 0.5+ -// Project: https://github.com/nonplus/angular-ui-router-default -// Definitions by: Stepan Riha -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare namespace angular.ui { - export type StateDefaultSpecifier = string - | ((...args: any[]) => string) - | ((...args: any[]) => ng.IPromise) - | (string | ((...args: any[]) => string))[] - | (string | ((...args: any[]) => ng.IPromise))[]; - interface IState { - default?: StateDefaultSpecifier - } -} diff --git a/angular-ui-router-default/index.d.ts b/angular-ui-router-default/index.d.ts new file mode 100644 index 0000000000..76e4db23e0 --- /dev/null +++ b/angular-ui-router-default/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for angular-ui-router-default 0.5+ +// Project: https://github.com/nonplus/angular-ui-router-default +// Definitions by: Stepan Riha +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as aur from "angular-ui-router"; + +declare module "angular" { + namespace ui { + export type StateDefaultSpecifier = string + | ((...args: any[]) => string) + | ((...args: any[]) => ng.IPromise) + | (string | ((...args: any[]) => string))[] + | (string | ((...args: any[]) => ng.IPromise))[]; + interface IState { + default?: StateDefaultSpecifier + } + } +} diff --git a/angular-ui-router-default/tsconfig.json b/angular-ui-router-default/tsconfig.json new file mode 100644 index 0000000000..fb5738335b --- /dev/null +++ b/angular-ui-router-default/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "angular-ui-router-default-tests.ts" + ] +} \ No newline at end of file diff --git a/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts b/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts index 3f14b2a40f..2ca6e18806 100644 --- a/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts +++ b/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts @@ -1,5 +1,3 @@ -/// - angular.module("test", [ "ui.bootstrap", "ui.router", diff --git a/angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts b/angular-ui-router-uib-modal/index.d.ts similarity index 64% rename from angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts rename to angular-ui-router-uib-modal/index.d.ts index 598fe964fe..29e963fc6e 100644 --- a/angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts +++ b/angular-ui-router-uib-modal/index.d.ts @@ -3,10 +3,12 @@ // Definitions by: Stepan Riha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as auir from "angular-ui-router"; -declare namespace angular.ui { - interface IState { - modal?: boolean | string[]; +declare module "angular" { + namespace ui { + interface IState { + modal?: boolean | string[]; + } } } diff --git a/angular-ui-router-uib-modal/tsconfig.json b/angular-ui-router-uib-modal/tsconfig.json new file mode 100644 index 0000000000..043cfffa2a --- /dev/null +++ b/angular-ui-router-uib-modal/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "angular-ui-router-uib-modal-tests.ts" + ] +} \ No newline at end of file diff --git a/angular-ui-router/index.d.ts b/angular-ui-router/index.d.ts index 4bbd94d641..035dc93430 100644 --- a/angular-ui-router/index.d.ts +++ b/angular-ui-router/index.d.ts @@ -110,7 +110,7 @@ declare module 'angular' { interface IUrlMatcher { concat(pattern: string): IUrlMatcher; - exec(path: string, searchParams: {}): {}; + exec(path: string, search?: any, hash?: string, options?: any): {}; parameters(): string[]; format(values: {}): string; } diff --git a/angular-ui-router/tsconfig.json b/angular-ui-router/tsconfig.json index 6336d7c83d..58a6004990 100644 --- a/angular-ui-router/tsconfig.json +++ b/angular-ui-router/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-ui-scroll/tsconfig.json b/angular-ui-scroll/tsconfig.json index d5c7039513..97eb534066 100644 --- a/angular-ui-scroll/tsconfig.json +++ b/angular-ui-scroll/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-ui-sortable/tsconfig.json b/angular-ui-sortable/tsconfig.json index d3dcce467c..9d643f200e 100644 --- a/angular-ui-sortable/tsconfig.json +++ b/angular-ui-sortable/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-ui-tree/tsconfig.json b/angular-ui-tree/tsconfig.json index 3c61cfb95e..832beeb0e3 100644 --- a/angular-ui-tree/tsconfig.json +++ b/angular-ui-tree/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-websocket/angular-websocket-tests.ts b/angular-websocket/angular-websocket-tests.ts index e7cb30fe49..1df77b7a2a 100644 --- a/angular-websocket/angular-websocket-tests.ts +++ b/angular-websocket/angular-websocket-tests.ts @@ -1,5 +1,3 @@ -/// - let dummySocket: ng.websocket.IWebSocket; let dummyPromise: ng.IPromise; let dummyScope: ng.IScope; diff --git a/angular-websocket/angular-websocket.d.ts b/angular-websocket/index.d.ts similarity index 100% rename from angular-websocket/angular-websocket.d.ts rename to angular-websocket/index.d.ts diff --git a/angular-websocket/tsconfig.json b/angular-websocket/tsconfig.json index 7579a1591c..8d31059011 100644 --- a/angular-websocket/tsconfig.json +++ b/angular-websocket/tsconfig.json @@ -1,12 +1,13 @@ { "files": [ - "angular-websocket.d.ts", + "index.d.ts", "angular-websocket-tests.ts" ], "compilerOptions": { "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angular-wizard/tsconfig.json b/angular-wizard/tsconfig.json index 977340f904..bf9967dc89 100644 --- a/angular-wizard/tsconfig.json +++ b/angular-wizard/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular-xeditable/angular-xeditable-tests.ts b/angular-xeditable/angular-xeditable-tests.ts index 9264c47f41..57a3e53863 100644 --- a/angular-xeditable/angular-xeditable-tests.ts +++ b/angular-xeditable/angular-xeditable-tests.ts @@ -1,9 +1,7 @@ -/// - -var myApp = angular.module('testModule', ['xeditable']); +var myApp = angular.module('testModule', ['xeditable']); myApp.run(["editableOptions", (editableOptions: angular.xeditable.IEditableOptions) => { - + editableOptions.activate = "select"; editableOptions.activationEvent = "click"; editableOptions.blurElem = "ignore"; diff --git a/angular-xeditable/angular-xeditable.d.ts b/angular-xeditable/index.d.ts similarity index 97% rename from angular-xeditable/angular-xeditable.d.ts rename to angular-xeditable/index.d.ts index e0aba2a0e9..a0069f6764 100644 --- a/angular-xeditable/angular-xeditable.d.ts +++ b/angular-xeditable/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular xEditable 0.2.0 (angular.xeditable module) +// Type definitions for Angular xEditable (angular.xeditable module) 0.2 // Project: https://vitalets.github.io/angular-xeditable/ // Definitions by: Joao Monteiro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/angular-xeditable/tsconfig.json b/angular-xeditable/tsconfig.json index e9a9c10c51..1bfc6b2264 100644 --- a/angular-xeditable/tsconfig.json +++ b/angular-xeditable/tsconfig.json @@ -1,12 +1,13 @@ { "files": [ - "angular-xeditable.d.ts", + "index.d.ts", "angular-xeditable-tests.ts" ], "compilerOptions": { "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angular.throttle/tsconfig.json b/angular.throttle/tsconfig.json index e3eb5a4401..00a72b924c 100644 --- a/angular.throttle/tsconfig.json +++ b/angular.throttle/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angular/angular-tests.ts b/angular/angular-tests.ts index 8e0711d6f7..29a344426f 100644 --- a/angular/angular-tests.ts +++ b/angular/angular-tests.ts @@ -191,8 +191,25 @@ mod.controller({ MyCtrl2: function() {}, MyCtrl3: ['$fooService', function($fooService: any) { }] }); -mod.directive('name', function ($scope: ng.IScope) { }) -mod.directive('name', ['$scope', function ($scope: ng.IScope) { }]) +mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => { + return (scope, el, attrs) => { + let foo = 'none'; + el.click(e => { + foo = e.type; + $rootScope.$apply(); + }); + scope.$watch(() => foo, () => el.text(foo)); + }; +}); +mod.directive('myDirectiveB', ['$rootScope', function ($rootScope: ng.IRootScopeService) { + return { + link(scope, el, attrs) { + el.click(e => { + el.hide(); + }); + } + }; +}]); mod.directive({ myFooDir: () => ({ template: 'my-foo-dir.tpl.html' diff --git a/angular/index.d.ts b/angular/index.d.ts index ede4733708..4b85c4a804 100644 --- a/angular/index.d.ts +++ b/angular/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.5 // Project: http://angularjs.org -// Definitions by: Diego Vilar +// Definitions by: Diego Vilar , Georgii Dolzhykov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -984,9 +984,7 @@ declare namespace angular { * See http://docs.angularjs.org/api/ng/service/$q */ interface IQService { - new (resolver: (resolve: IQResolveReject) => any): IPromise; new (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; - (resolver: (resolve: IQResolveReject) => any): IPromise; (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; /** @@ -1207,6 +1205,33 @@ declare namespace angular { debugInfoEnabled(): boolean; debugInfoEnabled(enabled: boolean): ICompileProvider; + + /** + * Sets the number of times $onChanges hooks can trigger new changes before giving up and assuming that the model is unstable. + * Increasing the TTL could have performance implications, so you should not change it without proper justification. + * Default: 10. + * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#onChangesTtl + */ + onChangesTtl(): number; + onChangesTtl(limit: number): ICompileProvider; + + /** + * It indicates to the compiler whether or not directives on comments should be compiled. + * It results in a compilation performance gain since the compiler doesn't have to check comments when looking for directives. + * Defaults to true. + * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#commentDirectivesEnabled + */ + commentDirectivesEnabled(): boolean; + commentDirectivesEnabled(enabled: boolean): ICompileProvider; + + /** + * It indicates to the compiler whether or not directives on element classes should be compiled. + * It results in a compilation performance gain since the compiler doesn't have to check element classes when looking for directives. + * Defaults to true. + * See: https://docs.angularjs.org/api/ng/provider/$compileProvider#cssClassDirectivesEnabled + */ + cssClassDirectivesEnabled(): boolean; + cssClassDirectivesEnabled(enabled: boolean): ICompileProvider; } interface ICloneAttachFunction { @@ -1229,6 +1254,11 @@ declare namespace angular { (scope: IScope, cloneAttachFn: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQuery; // If one argument is provided, then it's assumed to be the cloneAttachFn. (cloneAttachFn?: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQuery; + + /** + * Returns true if the specified slot contains content (i.e. one or more DOM nodes) + */ + isSlotFilled(slotName: string): boolean; } /////////////////////////////////////////////////////////////////////////// @@ -1380,12 +1410,12 @@ declare namespace angular { */ url: string; /** - * Event listeners to be bound to the XMLHttpRequest object. + * Event listeners to be bound to the XMLHttpRequest object. * To bind events to the XMLHttpRequest upload object, use uploadEventHandlers. The handler will be called in the context of a $apply block. */ eventHandlers?: { [type: string]: EventListenerOrEventListenerObject }; /** - * Event listeners to be bound to the XMLHttpRequest upload object. + * Event listeners to be bound to the XMLHttpRequest upload object. * To bind events to the XMLHttpRequest object, use eventHandlers. The handler will be called in the context of a $apply block. */ uploadEventHandlers?: { [type: string]: EventListenerOrEventListenerObject }; @@ -1709,7 +1739,7 @@ declare namespace angular { (new (...args: any[]) => IController) | // Instead of classes, plain functions are often used as controller constructors, especially in examples. ((...args: any[]) => (void | IController)); - + /** * Directive controllers have a well-defined lifecycle. Each controller can implement "lifecycle hooks". These are methods that * will be called by Angular at certain points in the life cycle of the directive. @@ -1772,7 +1802,7 @@ declare namespace angular { /////////////////////////////////////////////////////////////////////////// interface IDirectiveFactory { - (...args: any[]): IDirective; + (...args: any[]): IDirective | IDirectiveLinkFn; } interface IDirectiveLinkFn { @@ -1780,8 +1810,8 @@ declare namespace angular { scope: IScope, instanceElement: JQuery, instanceAttributes: IAttributes, - controller: {}, - transclude: ITranscludeFunction + controller?: IController | IController[] | {[key: string]: IController}, + transclude?: ITranscludeFunction ): void; } @@ -1809,7 +1839,6 @@ declare namespace angular { controller?: string | Injectable; controllerAs?: string; /** - * @deprecated * Deprecation warning: although bindings for non-ES6 class controllers are currently bound to this before * the controller constructor is called, this use is now deprecated. Please place initialization code that * relies upon bindings inside a $onInit method on the controller, instead. diff --git a/angular/tsconfig.json b/angular/tsconfig.json index ea2099d486..ef071ac6ee 100644 --- a/angular/tsconfig.json +++ b/angular/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } \ No newline at end of file diff --git a/angularfire/tsconfig.json b/angularfire/tsconfig.json index 39968b20d3..fbdb58fc98 100644 --- a/angularfire/tsconfig.json +++ b/angularfire/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angularlocalstorage/tsconfig.json b/angularlocalstorage/tsconfig.json index 082a8e904e..ecdf8c2a96 100644 --- a/angularlocalstorage/tsconfig.json +++ b/angularlocalstorage/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/angulartics/angulartics-tests.ts b/angulartics/angulartics-tests.ts index a7d8ba5971..02888b0cc5 100644 --- a/angulartics/angulartics-tests.ts +++ b/angulartics/angulartics-tests.ts @@ -10,6 +10,10 @@ namespace Analytics { $analyticsProvider.withAutoBase(true); $analyticsProvider.developerMode(true); + $analyticsProvider.trackExceptions(true); + $analyticsProvider.trackRoutes(true); + $analyticsProvider.trackStates(true); + $analyticsProvider.registerEventTrack((action: string, properties?: any) => { console.log(action); }); @@ -19,5 +23,16 @@ namespace Analytics { }); $analyticsProvider.settings.pageTracking.basePath = "/my/base/path"; - }]); + }]) + .run(($analytics: angulartics.IAnalyticsService) => { + let isOptedOut = $analytics.getOptOut(); + + $analytics.eventTrack('eventName', { label: 'test' }); + $analytics.pageTrack('/'); + $analytics.setAlias('alias'); + $analytics.setOptOut(false); + $analytics.setUsername('username'); + $analytics.setUserProperties({ id: 1 }); + $analytics.setSuperProperties({ role: 'admin' }); + }); } diff --git a/angulartics/index.d.ts b/angulartics/index.d.ts index 11938c9679..561da3cfad 100644 --- a/angulartics/index.d.ts +++ b/angulartics/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angulartics v0.20.2 +// Type definitions for Angulartics v1.3.0 // Project: http://luisfarzati.github.io/angulartics/ // Definitions by: Steven Fan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,8 +12,10 @@ declare namespace angulartics { interface IAnalyticsService { eventTrack(eventName: string, properties?: any): any; + getOptOut(): boolean; pageTrack(path:string, location?:angular.ILocationService): any; setAlias(alias: string): any; + setOptOut(value: boolean): void; setUsername(username: string): any; setUserProperties(properties: any): any; setSuperProperties(properties: any): any; @@ -26,13 +28,16 @@ declare namespace angulartics { withBase(value: boolean): void; withAutoBase(value: boolean): void; developerMode(value: boolean): void; + trackExceptions(value: boolean): void; + trackRoutes(value: boolean): void; + trackStates(value: boolean): void; registerPageTrack(callback:(path:string, location?:angular.ILocationService) => any): void; registerEventTrack(callback: (eventName: string, properties?: any) => any): void; - registerSetAlias(callback: (alias: string) => any): void - registerSetUsername(callback: (username: string) => any): void - registerSetUserProperties(callback: (userProperties: any) => any): void - registerSetSuperProperties(callback: (superProperties: any) => any): void + registerSetAlias(callback: (alias: string) => any): void; + registerSetUsername(callback: (username: string) => any): void; + registerSetUserProperties(callback: (userProperties: any) => any): void; + registerSetSuperProperties(callback: (superProperties: any) => any): void; settings: { pageTracking: { diff --git a/angulartics/tsconfig.json b/angulartics/tsconfig.json index 6f4321f8c6..d1dfb9a0ec 100644 --- a/angulartics/tsconfig.json +++ b/angulartics/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/animation-frame/tsconfig.json b/animation-frame/tsconfig.json index b99fdd852e..8148191020 100644 --- a/animation-frame/tsconfig.json +++ b/animation-frame/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ansi-styles/tsconfig.json b/ansi-styles/tsconfig.json index 01ff60a3f9..f1da9621d7 100644 --- a/ansi-styles/tsconfig.json +++ b/ansi-styles/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ansicolors/tsconfig.json b/ansicolors/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/ansicolors/tsconfig.json +++ b/ansicolors/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/antd/tsconfig.json b/antd/tsconfig.json index c09515ca39..086ee4c0fc 100644 --- a/antd/tsconfig.json +++ b/antd/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "jsx": "react", diff --git a/any-db-transaction/tsconfig.json b/any-db-transaction/tsconfig.json index 5eeade92f6..6357e1d1e4 100644 --- a/any-db-transaction/tsconfig.json +++ b/any-db-transaction/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/any-db/tsconfig.json b/any-db/tsconfig.json index 6486cffd13..d48ad90f34 100644 --- a/any-db/tsconfig.json +++ b/any-db/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/anybar/anybar-tests.ts b/anybar/anybar-tests.ts new file mode 100644 index 0000000000..6b4ea8ef89 --- /dev/null +++ b/anybar/anybar-tests.ts @@ -0,0 +1,5 @@ +import * as anybar from 'anybar' + +anybar('red', { port: 123 }) + +anybar('green') diff --git a/anybar/index.d.ts b/anybar/index.d.ts new file mode 100644 index 0000000000..4972f29756 --- /dev/null +++ b/anybar/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for anybar 2.0.1 +// Project: https://github.com/sindresorhus/anybar +// Definitions by: Chris Khoo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace anybar { } + +declare function anybar(color: string, options?: { port: number }): void + +export = anybar diff --git a/anybar/tsconfig.json b/anybar/tsconfig.json new file mode 100644 index 0000000000..b0527674b4 --- /dev/null +++ b/anybar/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "anybar-tests.ts" + ] +} \ No newline at end of file diff --git a/anydb-sql-migrations/tsconfig.json b/anydb-sql-migrations/tsconfig.json index 232492fb95..7d76324af5 100644 --- a/anydb-sql-migrations/tsconfig.json +++ b/anydb-sql-migrations/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/anydb-sql/tsconfig.json b/anydb-sql/tsconfig.json index c949b3cd68..2cfda805ff 100644 --- a/anydb-sql/tsconfig.json +++ b/anydb-sql/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/aphrodite/tsconfig.json b/aphrodite/tsconfig.json index d32f7a3aac..d669701604 100644 --- a/aphrodite/tsconfig.json +++ b/aphrodite/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/api-error-handler/tsconfig.json b/api-error-handler/tsconfig.json index 1547be610b..7c4620ce17 100644 --- a/api-error-handler/tsconfig.json +++ b/api-error-handler/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/apigee-access/tsconfig.json b/apigee-access/tsconfig.json index 4e7f02b30c..84ec4d7ad5 100644 --- a/apigee-access/tsconfig.json +++ b/apigee-access/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/apn/tsconfig.json b/apn/tsconfig.json index b009071037..66579aa104 100644 --- a/apn/tsconfig.json +++ b/apn/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/app-root-path/tsconfig.json b/app-root-path/tsconfig.json index 9025308aca..3cc9bcb5bd 100644 --- a/app-root-path/tsconfig.json +++ b/app-root-path/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/appframework/tsconfig.json b/appframework/tsconfig.json index a5289db2ff..cf01c82b57 100644 --- a/appframework/tsconfig.json +++ b/appframework/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/appletvjs/tsconfig.json b/appletvjs/tsconfig.json index 9ccc0f2c83..973cac356e 100644 --- a/appletvjs/tsconfig.json +++ b/appletvjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/applicationinsights-js/tsconfig.json b/applicationinsights-js/tsconfig.json index ac2bb5fbe3..b43cbe673b 100644 --- a/applicationinsights-js/tsconfig.json +++ b/applicationinsights-js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/applicationinsights/tsconfig.json b/applicationinsights/tsconfig.json index 74ed4f6c6c..5ce4abcfd4 100644 --- a/applicationinsights/tsconfig.json +++ b/applicationinsights/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/arbiter/Arbiter-tests.ts b/arbiter/arbiter-tests.ts similarity index 100% rename from arbiter/Arbiter-tests.ts rename to arbiter/arbiter-tests.ts diff --git a/arbiter/tsconfig.json b/arbiter/tsconfig.json index e99a9268d5..f46496beda 100644 --- a/arbiter/tsconfig.json +++ b/arbiter/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/arcgis-js-api/tsconfig.json b/arcgis-js-api/tsconfig.json index 8cdccd24f9..eb9ef3d985 100644 --- a/arcgis-js-api/tsconfig.json +++ b/arcgis-js-api/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/archiver/index.d.ts b/archiver/index.d.ts index d67705e2ea..ea117239ac 100644 --- a/archiver/index.d.ts +++ b/archiver/index.d.ts @@ -18,29 +18,32 @@ import * as FS from 'fs'; import * as STREAM from 'stream'; -interface nameInterface { - name?: string; -} -interface Archiver extends STREAM.Transform { - pipe(writeStream: FS.WriteStream): void; - append(source: FS.ReadStream | Buffer | string, name: nameInterface): void; +declare function archiver(format: string, options?: archiver.Options): archiver.Archiver; + +declare namespace archiver { + + export function create(format: string, options?: Options): Archiver; + + + export interface nameInterface { + name?: string; + } + + export interface Archiver extends STREAM.Transform { + pipe(writeStream: FS.WriteStream): void; + append(source: STREAM.Readable | Buffer | string, name: nameInterface): void; directory(dirpath: string, destpath: nameInterface | string): void; directory(dirpath: string, destpath: nameInterface | string, data: any | Function): void; bulk(mappings: any): void; - finalize(): void; -} + finalize(): void; + } -interface Options { + export interface Options { -} - -declare function archiver(format: string, options?: Options): Archiver; - -declare namespace archiver { - function create(format: string, options?: Options): Archiver; + } } export = archiver; diff --git a/archiver/tsconfig.json b/archiver/tsconfig.json index 0f7cfc01f5..6b43119343 100644 --- a/archiver/tsconfig.json +++ b/archiver/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/archy/tsconfig.json b/archy/tsconfig.json index f8ec33fc36..88c25302ad 100644 --- a/archy/tsconfig.json +++ b/archy/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/argon2/argon2-tests.ts b/argon2/argon2-tests.ts new file mode 100644 index 0000000000..566292b4fa --- /dev/null +++ b/argon2/argon2-tests.ts @@ -0,0 +1,35 @@ + +import { defaults, limits, hash, verify, generateSalt } from 'argon2'; + +main(); + +async function main() { + + const defaultTimeCost: number = defaults.timeCost; + const defaultMemoryCost: number = defaults.memoryCost; + const defaultParallelism: number = defaults.parallelism; + const defaultArgon2d: boolean = defaults.argon2d; + + const minMemoryCost: number = limits.memoryCost.min; + const maxMemoryCost: number = limits.memoryCost.max; + const minTimeCost: number = limits.timeCost.min; + const maxTimeCost: number = limits.timeCost.max; + const minParallelism: number = limits.parallelism.min; + const maxParallelism: number = limits.parallelism.max; + + const options = { + timeCost: 4, + memoryCost: 13, + parallelism: 2, + argon2d: true, + }; + + const hash1: string = await hash('secret', new Buffer(''), options); + const hash2: string = await hash('secret', new Buffer(''), {}); + const hash3: string = await hash('secret', new Buffer('')); + + const verified: boolean = await verify('long-hash', 'secret'); + + const salt1: Buffer = await generateSalt(); + const salt2: Buffer = await generateSalt(32); +} diff --git a/argon2/index.d.ts b/argon2/index.d.ts new file mode 100644 index 0000000000..f4e4c41d1f --- /dev/null +++ b/argon2/index.d.ts @@ -0,0 +1,44 @@ +// Type definitions for argon2 0.14 +// Project: https://github.com/ranisalt/node-argon2#readme +// Definitions by: Peter Safranek +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace argon2 { + + export var defaults: { + timeCost: number; + memoryCost: number; + parallelism: number; + argon2d: boolean; + }; + + export var limits: { + memoryCost: { + min: number; + max: number; + }; + timeCost: { + min: number; + max: number; + }; + parallelism: { + min: number; + max: number; + }; + }; + + export function hash(plain: string, salt: Buffer, options?: { + timeCost?: number; + memoryCost?: number; + parallelism?: number; + argon2d?: boolean; + }): Promise; + + export function verify(hash: string, plain: string): Promise; + + export function generateSalt(length?: number): Promise; +} + +export = argon2; diff --git a/argon2/tsconfig.json b/argon2/tsconfig.json new file mode 100644 index 0000000000..d58eaf4f82 --- /dev/null +++ b/argon2/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "argon2-tests.ts" + ] +} \ No newline at end of file diff --git a/argon2/tslint.json b/argon2/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/argon2/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/argparse/tsconfig.json b/argparse/tsconfig.json index b31549abba..b01153dbc1 100644 --- a/argparse/tsconfig.json +++ b/argparse/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/argv/tsconfig.json b/argv/tsconfig.json index bd2065e5a2..fbf3f7b46d 100644 --- a/argv/tsconfig.json +++ b/argv/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/array-find-index/tsconfig.json b/array-find-index/tsconfig.json index f69a237654..5d7bda4d89 100644 --- a/array-find-index/tsconfig.json +++ b/array-find-index/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/array-foreach/array-foreach-tests.ts b/array-foreach/array-foreach-tests.ts new file mode 100644 index 0000000000..cc75ff25ae --- /dev/null +++ b/array-foreach/array-foreach-tests.ts @@ -0,0 +1,39 @@ +import arrayForEach = require('array-foreach'); + +const array: Array = [1, 2, 3, 4]; +const result: Array = []; + +arrayForEach(array, (i: number) => { + result.push(i); +}); + +arrayForEach(array, (i: number, index: number) => { + result.push(i + index); +}); + +arrayForEach(array, (i: number, index: number, array: Array) => { + result.push(array[i]); +}); + +const resultThis: Array<{i: number, that: string}> = []; + +arrayForEach(array, (i: number) => { + resultThis.push({ + i: i, + that: this.that + }); +}, { that: 'jeff' }); + +arrayForEach(array, (i: number, index: number) => { + resultThis.push({ + i: i + index, + that: this.that + }); +}, { that: 'jeff' }); + +arrayForEach(array, (i: number, index: number, array: Array) => { + resultThis.push({ + i: array[i], + that: this.that + }); +}, { that: 'jeff' }); \ No newline at end of file diff --git a/array-foreach/index.d.ts b/array-foreach/index.d.ts new file mode 100644 index 0000000000..6493ebd3ec --- /dev/null +++ b/array-foreach/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for array-foreach +// Project: https://www.npmjs.com/package/array-foreach +// Definitions by: Steve Jenkins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** +* Performs the specified action for each element in an array. +* @param arr Array of items to iterate over +* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. +* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. +*/ +declare function forEach(arr: Array, callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; + +/** +* Performs the specified action for each element in an array. +* @param arr Nodelist of items to iterate over +* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. +* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. +*/ +declare function forEach(arr: NodeListOf, callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; +export = forEach; diff --git a/array-foreach/tsconfig.json b/array-foreach/tsconfig.json new file mode 100644 index 0000000000..5fe9f2ab1a --- /dev/null +++ b/array-foreach/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "array-foreach-tests.ts" + ] +} \ No newline at end of file diff --git a/array-uniq/index-tests.ts b/array-uniq/index-tests.ts new file mode 100644 index 0000000000..8674d2508c --- /dev/null +++ b/array-uniq/index-tests.ts @@ -0,0 +1,5 @@ +import arrayUniq = require("array-uniq"); + +arrayUniq([1, 1, 2, 3, 3]); + +arrayUniq(["foo", "foo", "bar", "foo"]); \ No newline at end of file diff --git a/array-uniq/index.d.ts b/array-uniq/index.d.ts new file mode 100644 index 0000000000..25d97c0a94 --- /dev/null +++ b/array-uniq/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for array-uniq 1.0 +// Project: https://github.com/sindresorhus/array-uniq +// Definitions by: Daniel Rosenwasser +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function arrayUniq(arr: T[]): T[]; + +export = arrayUniq; \ No newline at end of file diff --git a/array-uniq/tsconfig.json b/array-uniq/tsconfig.json new file mode 100644 index 0000000000..3d8c032420 --- /dev/null +++ b/array-uniq/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "index-tests.ts" + ] +} \ No newline at end of file diff --git a/array-uniq/tslint.json b/array-uniq/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/array-uniq/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/asana/tsconfig.json b/asana/tsconfig.json index 25f84b87a7..5c8e54f344 100644 --- a/asana/tsconfig.json +++ b/asana/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/asciify/tsconfig.json b/asciify/tsconfig.json index 550de2aa56..63f36aff6b 100644 --- a/asciify/tsconfig.json +++ b/asciify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/asn1js/asn1js-tests.ts b/asn1js/asn1js-tests.ts new file mode 100644 index 0000000000..992ef2bbb1 --- /dev/null +++ b/asn1js/asn1js-tests.ts @@ -0,0 +1,52 @@ +import { LocalLengthBlock, Null } from "asn1js"; +import { OctetString } from "asn1js"; +import { ObjectIdentifier } from "asn1js"; +import { UTCTime } from "asn1js"; + +let t = new LocalLengthBlock(); + +{ + // Null + let testNull = new Null(); + let json = testNull.toJSON(); + + testNull.toBER(); + testNull.fromBER(new Uint8Array(0).buffer, 0, 0); +} + +{ + // OctetString + let test = new OctetString(); + let json = test.toJSON(); + + test.toBER(); + test.fromBER(new Uint8Array(0).buffer, 0, 0); + test.isEqual(test); + OctetString.blockName() === "name"; +} + +{ + // ObjectIdentifier + let test = new ObjectIdentifier(); + let json = test.toJSON(); + + test.toBER(); + test.fromBER(new Uint8Array(0).buffer, 0, 0); + OctetString.blockName() === "name"; +} + +{ + // UTCTime + let test = new UTCTime(); + test = new UTCTime({ + value: "" + }); + test = new UTCTime({ + valueDate: new Date() + }); + let json = test.toJSON(); + + test.toBER(); + test.fromBER(new Uint8Array(0).buffer, 0, 0); + OctetString.blockName() === "name"; +} diff --git a/asn1js/index.d.ts b/asn1js/index.d.ts new file mode 100644 index 0000000000..7eced899b2 --- /dev/null +++ b/asn1js/index.d.ts @@ -0,0 +1,675 @@ +// Type definitions for asn1js +// Project: https://github.com/PeculiarVentures/ASN1.js +// Definitions by: Stepan Miroshin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +import { getParametersValue, padNumber, isEqualBuffer, bufferToHexCodes, checkBufferParams, utilToBase, utilFromBase, utilEncodeTC, utilDecodeTC, utilConcatBuf, nearestPowerOf2 } from "pvutils"; + +export = Asn1js; + +declare namespace Asn1js { + + interface LocalBaseBlockParams { + blockLength?: number; + error?: string; + warnings?: string[]; + valueBeforeDecode?: ArrayBuffer; + } + + interface JsonLocalBaseBlock { + blockName: string; + blockLength: number; + error: string; + warnings: string[]; + valueBeforeDecode: ArrayBuffer; + } + + class LocalBaseBlock { + blockLength: number; + error: string; + warnings: string[]; + valueBeforeDecode: ArrayBuffer; + + constructor(params?: LocalBaseBlockParams); + /** + * Aux function, need to get a block name. Need to have it here for inhiritence + * + * @static + * @returns {string} + * + * @memberOf LocalBaseBlock + */ + static blockName(): string; + /** + * Convertion for the block to JSON object + * + * @returns {JsonLocalBaseBlock} + * + * @memberOf LocalBaseBlock + */ + toJSON(): JsonLocalBaseBlock; + } + + interface LocalHexBlockParams extends LocalBaseBlockParams { + isHexOnly?: boolean; + valueHex?: ArrayBuffer; + } + + interface ILocalHexBlock { + isHexOnly: boolean; + valueHex: ArrayBuffer; + /** + * Base function for converting block from BER encoded array of bytes + * + * @param {ArrayBuffer} inputBuffer ASN.1 BER encoded array + * @param {number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started + * @param {number} inputLength Maximum length of array of bytes which can be using in this function + * @returns {number} Offset after least decoded byte + * + * @memberOf LocalHexBlockMixin + */ + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + /** + * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules) + * + * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes + * @returns {ArrayBuffer} + * + * @memberOf LocalHexBlockMixin + */ + toBER(sizeOnly?: boolean): ArrayBuffer; + /** + * Convertion for the block to JSON object + * @returns {*} + */ + toJSON(): any; + } + + class LocalHexBlock implements ILocalHexBlock { + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params: any); + /** + * Aux function, need to get a block name. Need to have it here for inhiritence + * + * @static + * @returns {string} + * + * @memberOf LocalHexBlockMixin + */ + static blockName(): string; + /** + * Base function for converting block from BER encoded array of bytes + * + * @param {ArrayBuffer} inputBuffer ASN.1 BER encoded array + * @param {number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started + * @param {number} inputLength Maximum length of array of bytes which can be using in this function + * @returns {number} Offset after least decoded byte + * + * @memberOf LocalHexBlockMixin + */ + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + /** + * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules) + * + * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes + * @returns {ArrayBuffer} + * + * @memberOf LocalHexBlockMixin + */ + toBER(sizeOnly?: boolean): ArrayBuffer; + /** + * Convertion for the block to JSON object + * @returns {*} + */ + toJSON(): any; + } + + interface LocalIdentificationBlockParams { + idBlock?: LocalHexBlockParams & { + isConstructed?: boolean; + tagClass?: number; + tagNumber?: number; + }; + } + + class LocalIdentificationBlock extends LocalBaseBlock implements ILocalHexBlock { + isConstructed: boolean; + tagClass: number; + tagNumber: number; + + constructor(params?: LocalIdentificationBlockParams); + + // ILocalHexBlock implementation + isHexOnly: boolean; + valueHex: ArrayBuffer; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalLengthBlockParams { + lenBlock?: { + isIndefiniteForm?: boolean; + longFormUsed?: boolean; + length: number; + } + } + + class LocalLengthBlock extends LocalBaseBlock { + isIndefiniteForm: boolean; + longFormUsed: boolean; + length: number; + constructor(params?: LocalLengthBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): void; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + class LocalValueBlock extends LocalBaseBlock { + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): void; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface BaseBlockParams extends LocalBaseBlockParams { + name?: string; + optional?: boolean; + primitiveSchema?: Object; + } + + class BaseBlock extends LocalBaseBlock { + constructor(parameters?: BaseBlockParams, valueBlockType?: typeof LocalValueBlock); + idBlock: LocalIdentificationBlock; + lenBlock: LocalLengthBlock; + valueBlock: T; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalPrimitiveValueBlockParams extends LocalBaseBlockParams { + valueHex?: ArrayBuffer; + isHexOnly?: boolean; + } + class LocalPrimitiveValueBlock extends LocalValueBlock { + valueHex: ArrayBuffer; + isHexOnly: boolean; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + class Primitive extends BaseBlock { + } + + interface LocalConstructedValueBlockParams extends LocalBaseBlockParams { + value?: LocalValueBlock; + isIndefiniteForm?: boolean; + } + + class LocalConstructedValueBlock extends LocalValueBlock { + value: LocalValueBlock[]; + isIndefiniteForm: boolean; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + class Constructed extends BaseBlock { } + + interface LocalEndOfContentValueBlockParams extends LocalBaseBlockParams { } + + class LocalEndOfContentValueBlock extends LocalValueBlock { + constructor(params?: LocalEndOfContentValueBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + export class EndOfContent extends BaseBlock { } + + interface LocalBooleanValueBlockParams extends LocalBaseBlockParams { + value?: boolean; + isHexOnly?: boolean; + valueHex?: ArrayBuffer; + } + class LocalBooleanValueBlock extends LocalValueBlock { + value: boolean; + isHexOnly: boolean; + valueHex: ArrayBuffer; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + class Boolean extends BaseBlock { } + + class Sequence extends Constructed { } + class Set extends Constructed { } + class Null extends BaseBlock { } + + interface LocalOctetStringValueBlockParams extends LocalConstructedValueBlockParams, LocalHexBlockParams { + isConstructed?: boolean; + } + + class LocalOctetStringValueBlock extends LocalConstructedValueBlock implements ILocalHexBlock { + isConstructed: boolean; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalOctetStringValueBlockParams); + } + + export class OctetString extends BaseBlock { + constructor(params?: LocalOctetStringValueBlockParams); + /** + * Checking that two OCTETSTRINGs are equal + * + * @param {OctetString} octetString + * @returns {boolean} + * + * @memberOf OctetString + */ + isEqual(octetString: OctetString): boolean; + } + + interface LocalBitStringValueBlockParams extends LocalConstructedValueBlockParams, LocalHexBlockParams { + unusedBits?: number; + isConstructed?: boolean; + blockLength?: number; + } + + class LocalBitStringValueBlock extends LocalConstructedValueBlock implements LocalHexBlock { + unusedBits: number; + isConstructed: boolean; + blockLength: number; + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalBitStringValueBlockParams); + } + + class BitString extends BaseBlock { + constructor(params?: LocalBitStringValueBlockParams); + /** + * Checking that two BITSTRINGs are equal + * @param {BitString} bitString + */ + isEqual(bitString: BitString): boolean; + } + + interface LocalIntegerValueBlockParams extends LocalBaseBlockParams, LocalHexBlockParams { + } + + class LocalIntegerValueBlock extends LocalValueBlock implements LocalHexBlock { + valueDec: number; + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalIntegerValueBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + /** + * Base function for converting block from DER encoded array of bytes + * + * @param {ArrayBuffer} inputBuffer ASN.1 DER encoded array + * @param {number} inputOffset Offset in ASN.1 DER encoded array where decoding should be started + * @param {number} inputLength Maximum length of array of bytes which can be using in this function + * @param {number} [expectedLength=0] Expected length of converted "valueHex" buffer + * @returns {number} Offset after least decoded byte + */ + fromDER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number, expectedLength?: number): number; + /** + * Encoding of current ASN.1 block into ASN.1 encoded array (DER rules) + * + * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes + * @returns {ArrayBuffer} + */ + toDER(sizeOnly?: boolean): ArrayBuffer; + } + + interface IntegerParams { + value?: number; + } + export class Integer extends BaseBlock { + constructor(params?: IntegerParams) + /** + * Compare two Integer object, or Integer and ArrayBuffer objects + * + * @param {(Integer | ArrayBuffer)} otherValue + * @returns {boolean} + * + * @memberOf Integer + */ + isEqual(otherValue: Integer | ArrayBuffer): boolean; + /** + * Convert current Integer value from BER into DER format + * + * @returns {Integer} + */ + convertToDER(): Integer; + /** + * Convert current Integer value from DER to BER format + * @returns {Integer} + */ + convertFromDER(): Integer; + } + + class Enumerated extends Integer { } + + interface LocalSidValueBlockParams extends LocalBaseBlockParams, LocalHexBlockParams { + valueDec?: number; + isFirstSid?: boolean; + } + + class LocalSidValueBlock extends LocalBaseBlock implements LocalHexBlock { + valueDec: number; + isFirstSid: boolean; + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalSidValueBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + toString(): string; + } + + interface LocalObjectIdentifierValueBlockParams extends LocalBaseBlockParams { + value?: string; + } + + class LocalObjectIdentifierValueBlock extends LocalValueBlock { + constructor(params?: LocalObjectIdentifierValueBlockParams); + + /** + * Create "LocalObjectIdentifierValueBlock" class from string + * + * @param {string} string Input string to convert from + * @returns {boolean} + */ + fromString(data: string): boolean; + /** + * Converts "LocalObjectIdentifierValueBlock" class to string + * + * @returns {string} + * + * @memberOf LocalObjectIdentifierValueBlock + */ + toString(): string; + } + + export class ObjectIdentifier extends BaseBlock { + constructor(params?: LocalObjectIdentifierValueBlockParams); + } + + interface LocalUtf8StringValueBlockParams extends LocalBaseBlockParams, LocalHexBlock { + } + + class LocalUtf8StringValueBlock extends LocalBaseBlock implements LocalHexBlock { + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalSidValueBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + toString(): string; + } + + interface Utf8StringParams { + value?: string; + } + + class Utf8String extends BaseBlock { + constructor(params?: Utf8StringParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param {ArrayBuffer} inputBuffer ASN.1 BER encoded array + * + * @memberOf Utf8String + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param {string} inputString ASN.1 BER encoded array + * + * @memberOf Utf8String + */ + fromString(inputString: string): void; + } + + interface LocalBmpStringValueBlockParams extends LocalHexBlockParams, LocalBaseBlockParams { + } + + class LocalBmpStringValueBlock extends LocalBaseBlock implements LocalHexBlock { + value: string; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalBmpStringValueBlockParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface BmpStringParams { + value?: string; + } + + export class BmpString extends BaseBlock { + constructor(params?: BmpStringParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param {ArrayBuffer} inputBuffer ASN.1 BER encoded array + * + * @memberOf BmpString + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param {string} inputString ASN.1 BER encoded array + * + * @memberOf BmpString + */ + fromString(inputString: string): void; + } + + interface LocalUniversalStringValueParams extends LocalHexBlockParams, LocalBaseBlockParams { + } + + class LocalUniversalStringValueBlock extends LocalBaseBlock implements LocalHexBlock { + value: string; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalUniversalStringValueParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface UniversalStringParams { + value?: string; + } + + export class UniversalString extends BaseBlock { + constructor(params?: UniversalStringParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param {ArrayBuffer} inputBuffer ASN.1 BER encoded array + * + * @memberOf UniversalString + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param {string} inputString ASN.1 BER encoded array + * + * @memberOf UniversalString + */ + fromString(inputString: string): void; + } + interface LocalSimpleLocalSimpleStringValueBlockParams extends LocalHexBlockParams, LocalBaseBlockParams { + } + + class LocalSimpleLocalSimpleStringValueBlock extends LocalBaseBlock implements LocalHexBlock { + value: string; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalSimpleLocalSimpleStringValueBlockParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalSimpleStringBlockParams { + value?: string; + } + export class LocalSimpleStringBlock extends BaseBlock { + constructor(params?: LocalSimpleStringBlockParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param {ArrayBuffer} inputBuffer ASN.1 BER encoded array + * + * @memberOf LocalSimpleStringBlock + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param {string} inputString ASN.1 BER encoded array + * + * @memberOf LocalSimpleStringBlock + */ + fromString(inputString: string): void; + } + + export class NumericString extends LocalSimpleStringBlock { } + export class PrintableString extends LocalSimpleStringBlock { } + export class TeletexString extends LocalSimpleStringBlock { } + export class VideotexString extends LocalSimpleStringBlock { } + export class IA5String extends LocalSimpleStringBlock { } + export class GraphicString extends LocalSimpleStringBlock { } + export class VisibleString extends LocalSimpleStringBlock { } + export class GeneralString extends LocalSimpleStringBlock { } + export class CharacterString extends LocalSimpleStringBlock { } + + interface UTCTimeParams extends LocalSimpleLocalSimpleStringValueBlockParams { + value?: string; + valueDate?: Date; + } + + export class UTCTime extends VisibleString { + year: number; + month: number; + day: number; + hour: number; + minute: number; + second: number; + constructor(params?: UTCTimeParams); + /** + * Function converting ASN.1 internal string into ArrayBuffer + * + * @returns {ArrayBuffer} + * + * @memberOf UTCTime + */ + toBuffer(): ArrayBuffer; + /** + * Function converting "Date" object into ASN.1 internal string + * + * @param {Date} inputDate JavaScript "Date" object + * + * @memberOf UTCTime + */ + fromDate(inputDate: Date): void; + /** + * Function converting ASN.1 internal string into "Date" object + * + * @returns {Date} + * + * @memberOf UTCTime + */ + toDate(): Date; + } + + class GeneralizedTime extends UTCTime { + millisecond: number; + } + + class DATE extends Utf8String { } + class TimeOfDay extends Utf8String { } + class DateTime extends Utf8String { } + class Duration extends Utf8String { } + class TIME extends Utf8String { } + + interface ChoiceParams { + value?: LocalValueBlock[]; + optional?: boolean; + } + + class Choice { + value: LocalValueBlock[]; + optional: boolean; + constructor(params?: ChoiceParams); + } + + interface AnyParams { + name?: string; + optional?: boolean; + } + class Any { + name: string; + optional: boolean; + constructor(params?: AnyParams); + } + + interface RepeatedParams { + name?: string; + optional?: boolean; + value?: Any; + local?: boolean; + } + class Repeated { + name: string; + optional: boolean; + value: Any; + local: boolean; + constructor(params?: RepeatedParams); + } + interface RawDataParams { + data?: ArrayBuffer; + } + class RawData { + data: ArrayBuffer; + + constructor(params?: RawDataParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + /** + * Major function for decoding ASN.1 BER array into internal library structuries + * + * @param {ArrayBuffer} inputBuffer ASN.1 BER encoded array of bytes + * @returns {{ offset: number; result: LocalBaseBlock }} + */ + function fromBER(inputBuffer: ArrayBuffer): { offset: number; result: LocalBaseBlock }; + + /** + * Compare of two ASN.1 object trees + * + * @param {*} root Root of input ASN.1 object tree + * @param {*} inputData Input ASN.1 object tree + * @param {*} inputSchema Input ASN.1 schema to compare with + * @returns {{ verified: boolean, result?: any }} + */ + function compareSchema(root: any, inputData: any, inputSchema: any): { verified: boolean, result?: any }; + + /** + * ASN.1 schema verification for ArrayBuffer data + * + * @param {ArrayBuffer} inputBuffer Input BER-encoded ASN.1 data + * @param {*} inputSchema Input ASN.1 schema to verify against to + * @returns {{ verified: boolean, result?: any }} + */ + function verifySchema(inputBuffer: ArrayBuffer, inputSchema: any): { verified: boolean, result?: any }; + +} \ No newline at end of file diff --git a/asn1js/tsconfig.json b/asn1js/tsconfig.json new file mode 100644 index 0000000000..ff49d0edcd --- /dev/null +++ b/asn1js/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "asn1js-tests.ts" + ] +} \ No newline at end of file diff --git a/aspnet-identity-pw/tsconfig.json b/aspnet-identity-pw/tsconfig.json index 578e871e06..3d17794b1f 100644 --- a/aspnet-identity-pw/tsconfig.json +++ b/aspnet-identity-pw/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/assert/index.d.ts b/assert/index.d.ts index abd31688f1..23536f9597 100644 --- a/assert/index.d.ts +++ b/assert/index.d.ts @@ -1,10 +1,15 @@ // Type definitions for assert and power-assert -// Project: https://github.com/Jxck/assert -// Project: https://github.com/twada/power-assert +// Project: https://github.com/Jxck/assert, https://github.com/twada/power-assert // Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// copy from assert external module in node.d.ts +// Definitions for commonjs-assert match that of node.js' assert module, +// but commonjs-assert is intended to be used as an independent module, +// for instance when making a stand-alone site or app that doesn't have +// access to node modules. For that reason, these definitions define a +// "assert" module. This will conflict with node.d.ts and other assert +// modules such as "power-assert", but a project should realistically +// only be using one of these at a time. declare function assert(value:any, message?:string):void; declare namespace assert { @@ -51,3 +56,4 @@ declare namespace assert { export function ifError(value:any):void; } + diff --git a/assert/tsconfig.json b/assert/tsconfig.json index 4fc523d55b..b25f0dbcf3 100644 --- a/assert/tsconfig.json +++ b/assert/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/assertion-error/tsconfig.json b/assertion-error/tsconfig.json index 0b2b90d2ca..f51ddb9b83 100644 --- a/assertion-error/tsconfig.json +++ b/assertion-error/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/assertsharp/tsconfig.json b/assertsharp/tsconfig.json index d39cdd07b9..17d30d98c2 100644 --- a/assertsharp/tsconfig.json +++ b/assertsharp/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/async-lock/tsconfig.json b/async-lock/tsconfig.json index 173787ed8d..08f3f0fccc 100644 --- a/async-lock/tsconfig.json +++ b/async-lock/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/async-polling/async-polling-tests.ts b/async-polling/async-polling-tests.ts index ec9e5200f2..82adc0299e 100644 --- a/async-polling/async-polling-tests.ts +++ b/async-polling/async-polling-tests.ts @@ -1,6 +1,4 @@ -/// - -import * as AsyncPolling from "async-polling"; +import AsyncPolling = require("async-polling"); // Tests based on examples in https://github.com/cGuille/async-polling#readme diff --git a/async-polling/async-polling.d.ts b/async-polling/async-polling.d.ts deleted file mode 100644 index 579d041e37..0000000000 --- a/async-polling/async-polling.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Type definitions for AsyncPolling -// Project: https://github.com/cGuille/async-polling -// Definitions by: Zlatko Andonovski -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module "async-polling" { - module AsyncPolling { - export type EventName = "run"|"start"|"error"|"result"|"end"|"schedule"|"stop"; - } - - function AsyncPolling(pollingFunc: (end: (err?: Error, result?: Result) => any) => any, delay: number): { - run: () => any; - stop: () => any; - on: (eventName: AsyncPolling.EventName, listener: Function) => any; - } - - export = AsyncPolling; -} \ No newline at end of file diff --git a/async-polling/index.d.ts b/async-polling/index.d.ts new file mode 100644 index 0000000000..640c863874 --- /dev/null +++ b/async-polling/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for AsyncPolling +// Project: https://github.com/cGuille/async-polling +// Definitions by: Zlatko Andonovski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace AsyncPolling { + export type EventName = "run"|"start"|"error"|"result"|"end"|"schedule"|"stop"; +} + +declare function AsyncPolling(pollingFunc: (end: (err?: Error, result?: Result) => any) => any, delay: number): { + run: () => any; + stop: () => any; + on: (eventName: AsyncPolling.EventName, listener: Function) => any; +} + +export = AsyncPolling; \ No newline at end of file diff --git a/async-polling/tsconfig.json b/async-polling/tsconfig.json new file mode 100644 index 0000000000..4c00e760aa --- /dev/null +++ b/async-polling/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "async-polling-tests.ts" + ] +} \ No newline at end of file diff --git a/async-writer/tsconfig.json b/async-writer/tsconfig.json index b817d40f63..304d5c6f99 100644 --- a/async-writer/tsconfig.json +++ b/async-writer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/async/async-tests.ts b/async/async-tests.ts index b724582368..abc2653f60 100644 --- a/async/async-tests.ts +++ b/async/async-tests.ts @@ -1,27 +1,29 @@ /// import fs = require("fs"); +import process = require("process"); -var path: { - exists: (path: string, callback?: (err: string, exists: boolean) => any) => void; +declare var path: { + exists: (path: string, callback?: (err: Error, exists: boolean) => any) => void; }; +function funcStringCbErrBoolean(v:string, cb:(err:Error,res:boolean) => void) {} function callback() { } -async.map(['file1', 'file2', 'file3'], fs.stat, function (err, results) { }); -async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err, results) { }); -async.mapLimit(['file1', 'file2', 'file3'], 2, fs.stat, function (err, results) { }); +async.map(['file1', 'file2', 'file3'], fs.stat, function (err:Error, results:Array) { }); +async.mapSeries(['file1', 'file2', 'file3'], fs.stat, function (err:Error, results:Array) { }); +async.mapLimit(['file1', 'file2', 'file3'], 2, fs.stat, function (err:Error, results:Array) { }); -async.filter(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.filterSeries(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.filterLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { }); -async.select(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.selectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.selectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { }); +async.filter(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array) { }); +async.filterSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array) { }); +async.filterLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array) { }); +async.select(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array) { }); +async.selectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array) { }); +async.selectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array) { }); -async.reject(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.rejectSeries(['file1', 'file2', 'file3'], path.exists, function (results) { }); -async.rejectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (results) { }); +async.reject(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array) { }); +async.rejectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,results:Array) { }); +async.rejectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,results:Array) { }); async.parallel([ function () { }, @@ -33,8 +35,8 @@ async.series([ function () { } ]); -var data = []; -function asyncProcess(item, callback) { } +var data: any[] = []; +function asyncProcess(item: any, callback: (err: Error, result: any) => void) { } async.map(data, asyncProcess, function (err, results) { console.log(results); }); @@ -45,15 +47,15 @@ var openFilesObj = { file2: "fileTwo" } -var saveFile = function () { } -async.each(openFiles, saveFile, function (err) { }); -async.eachSeries(openFiles, saveFile, function (err) { }); +var saveFile = function (file:string,cb:(err:Error)=>void) { } +async.each(openFiles, saveFile, function (err:Error) { }); +async.eachSeries(openFiles, saveFile, function (err:Error) { }); -var documents, requestApi; +var documents: any, requestApi: any; async.eachLimit(documents, 20, requestApi, function (err) { }); // forEachOf* functions. May accept array or object. -function forEachOfIterator(item, key, forEachOfIteratorCallback) { +function forEachOfIterator(item: string, key: string, forEachOfIteratorCallback: any) { console.log("ForEach: item=" + item + ", key=" + key); forEachOfIteratorCallback(); } @@ -64,9 +66,8 @@ async.forEachOfSeries(openFilesObj, forEachOfIterator, function (err) { }); async.forEachOfLimit(openFiles, 2, forEachOfIterator, function (err) { }); async.forEachOfLimit(openFilesObj, 2, forEachOfIterator, function (err) { }); -var process; var numArray = [1, 2, 3]; -function reducer(memo, item, callback) { +function reducer(memo: any, item: any, callback: any) { process.nextTick(function () { callback(null, memo + item) }); @@ -77,9 +78,9 @@ async.foldl(numArray, 0, reducer, function (err, result) { }); async.reduceRight(numArray, 0, reducer, function (err, result) { }); async.foldr(numArray, 0, reducer, function (err, result) { }); -async.detect(['file1', 'file2', 'file3'], path.exists, function (result) { }); -async.detectSeries(['file1', 'file2', 'file3'], path.exists, function (result) { }); -async.detectLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { }); +async.detect(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err: Error,result:string) { }); +async.detectSeries(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err,result) { }); +async.detectLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err,result) { }); async.sortBy(['file1', 'file2', 'file3'], function (file, callback) { fs.stat(file, function (err, stats) { @@ -87,13 +88,13 @@ async.sortBy(['file1', 'file2', 'file3'], function (file, callback) { }); }, function (err, results) { }); -async.some(['file1', 'file2', 'file3'], path.exists, function (result) { }); -async.someLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { }); -async.any(['file1', 'file2', 'file3'], path.exists, function (result) { }); +async.some(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { }); +async.someLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,result:boolean) { }); +async.any(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { }); -async.every(['file1', 'file2', 'file3'], path.exists, function (result) { }); -async.everyLimit(['file1', 'file2', 'file3'], 2, path.exists, function (result) { }); -async.all(['file1', 'file2', 'file3'], path.exists, function (result) { }); +async.every(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { }); +async.everyLimit(['file1', 'file2', 'file3'], 2, funcStringCbErrBoolean, function (err:Error,result:boolean) { }); +async.all(['file1', 'file2', 'file3'], funcStringCbErrBoolean, function (err:Error,result:boolean) { }); async.concat(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { }); async.concatSeries(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { }); @@ -103,20 +104,20 @@ async.concatSeries(['dir1', 'dir2', 'dir3'], fs.readdir, function (err, files) { async.series([ function (callback) { - callback(null, 'one'); + callback(undefined, 'one'); }, function (callback) { - callback(null, 'two'); + callback(undefined, 'two'); }, ], function (err, results) { }); -async.series([ +async.series([ function (callback) { - callback(null, 'one'); + callback(undefined, 'one'); }, function (callback) { - callback(null, 'two'); + callback(undefined, 'two'); }, ], function (err, results) { }); @@ -124,39 +125,39 @@ function (err, results) { }); async.series({ one: function (callback) { setTimeout(function () { - callback(null, 1); + callback(undefined, 1); }, 200); }, two: function (callback) { setTimeout(function () { - callback(null, 2); + callback(undefined, 2); }, 100); }, }, function (err, results) { }); -async.series({ +async.series({ one: function (callback) { setTimeout(function () { - callback(null, 1); + callback(undefined, 1); }, 200); }, two: function (callback) { setTimeout(function () { - callback(null, 2); + callback(undefined, 2); }, 100); }, }, function (err, results) { }); async.times(5, function(n, next) { - next(null, n) + next(undefined as any, n) }, function(err, results) { console.log(results) }) async.timesSeries(5, function(n, next) { - next(null, n) + next(undefined as any, n) }, function(err, results) { console.log(results) }) @@ -164,26 +165,26 @@ async.timesSeries(5, function(n, next) { async.parallel([ function (callback) { setTimeout(function () { - callback(null, 'one'); + callback(undefined, 'one'); }, 200); }, function (callback) { setTimeout(function () { - callback(null, 'two'); + callback(undefined, 'two'); }, 100); }, ], function (err, results) { }); -async.parallel([ +async.parallel([ function (callback) { setTimeout(function () { - callback(null, 'one'); + callback(undefined, 'one'); }, 200); }, function (callback) { setTimeout(function () { - callback(null, 'two'); + callback(undefined, 'two'); }, 100); }, ], @@ -193,26 +194,26 @@ function (err, results) { }); async.parallel({ one: function (callback) { setTimeout(function () { - callback(null, 1); + callback(undefined, 1); }, 200); }, two: function (callback) { setTimeout(function () { - callback(null, 2); + callback(undefined, 2); }, 100); }, }, function (err, results) { }); -async.parallel({ +async.parallel({ one: function (callback) { setTimeout(function () { - callback(null, 1); + callback(undefined, 1); }, 200); }, two: function (callback) { setTimeout(function () { - callback(null, 2); + callback(undefined, 2); }, 100); }, }, @@ -221,12 +222,12 @@ async.parallel({ async.parallelLimit({ one: function (callback) { setTimeout(function () { - callback(null, 1); + callback(undefined, 1); }, 200); }, two: function (callback) { setTimeout(function () { - callback(null, 2); + callback(undefined, 2); }, 100); }, }, @@ -235,7 +236,7 @@ async.parallelLimit({ ); -function whileFn(callback) { +function whileFn(callback: any) { count++; setTimeout(callback, 1000); } @@ -258,19 +259,19 @@ async.forever(function (errBack) { ); async.waterfall([ - function (callback) { + function (callback: any) { callback(null, 'one', 'two'); }, - function (arg1, arg2, callback) { + function (arg1: any, arg2: any, callback: any) { callback(null, 'three'); }, - function (arg1, callback) { + function (arg1: any, callback: any) { callback(null, 'done'); } ], function (err, result) { }); -var q = async.queue(function (task: any, callback) { +var q = async.queue(function (task: any, callback: () => void) { console.log('hello ' + task.name); callback(); }, 2); @@ -323,7 +324,7 @@ q.resume(); q.kill(); // tests for strongly typed tasks -var q2 = async.queue(function (task: string, callback) { +var q2 = async.queue(function (task: string, callback: () => void) { console.log('Task: ' + task); callback(); }, 1); @@ -358,26 +359,26 @@ var cargo = async.cargo(function (tasks, callback) { // add some items -cargo.push({ name: 'foo' }, function (err) { +cargo.push({ name: 'foo' }, function (err: Error) { console.log('finished processing foo'); }); -cargo.push({ name: 'bar' }, function (err) { +cargo.push({ name: 'bar' }, function (err: Error) { console.log('finished processing bar'); }); -cargo.push({ name: 'baz' }, function (err) { +cargo.push({ name: 'baz' }, function (err: Error) { console.log('finished processing baz'); }); var filename = ''; async.auto({ - get_data: function (callback) { }, - make_folder: function (callback) { }, + get_data: function (callback: any) { }, + make_folder: function (callback: any) { }, //arrays with different types are not accepted by TypeScript. - write_file: ['get_data', 'make_folder', function (callback) { + write_file: ['get_data', 'make_folder', function (callback: any) { callback(null, filename); }], //arrays with different types are not accepted by TypeScript. - email_link: ['write_file', function (callback, results) { }] + email_link: ['write_file', function (callback: any, results: any) { }] }); async.retry(3, function (callback, results) { }, function (err, result) { }); @@ -386,10 +387,10 @@ async.retry({ times: 3, interval: (retryCount) => { return 200 * retryCount; } } async.parallel([ - function (callback) { }, + function (callback: ( err:Error, val:string ) => void ) { }, function (callback) { } ], -function (results) { +function (err:Error,results:Array) { async.series([ function (callback) { }, function email_link(callback) { } @@ -411,13 +412,13 @@ async.parallel([ }, ]); -var call_order = []; +var call_order: string[] = []; async.nextTick(function () { call_order.push('two'); }); call_order.push('one'); -var slow_fn = function (name, callback) { +var slow_fn = function (name: string, callback: any) { callback(null, 123); }; var fn = async.memoize(slow_fn); @@ -427,15 +428,369 @@ async.ensureAsync(function () { }); async.constant(42); async.asyncify(function () { }); -async.log(function (name, callback) { +async.log(function (name: any, callback: any) { setTimeout(function () { callback(null, 'hello ' + name); }, 0); }, "world" ); -async.dir(function (name, callback) { +async.dir(function (name: string, callback: any) { setTimeout(function () { callback(null, { hello: name }); }, 1000); }, "world"); + +// each + +async.each({ + "a": 1, + "b": 2 +}, function(val: number, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.each: ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.each: done."); + +}); + +async.eachSeries({ + "a": 1, + "b": 2 +}, function(val: number, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.eachSeries: ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.eachSeries: done."); + +}); + +async.eachLimit({ + "a": 1, + "b": 2, + "c": 3, + "d": 4, + "e": 5, + "f": 6 +}, 2, function(val: number, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.eachLimit: ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.eachLimit: done."); + +}); + +// forEachOf/eachOf + +async.eachOf({ + "a": 1, + "b": 2 +}, function(val: number, key: string, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.forEachOf/eachOf: ${key} = ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.forEachOf/eachOf: done."); + +}); + +async.forEachOfSeries({ + "a": 1, + "b": 2 +}, function(val: number, key: string, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.forEachOfSeries: ${key} = ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.forEachOfSeries: done."); + +}); + +async.forEachOfLimit({ + "a": 1, + "b": 2, + "c": 3, + "d": 4, + "e": 5, + "f": 6 +}, 2, function(val: number, key: string, next: ErrorCallback): void { + + setTimeout(function(): void { + + console.log(`async.forEachOfLimit: ${key} = ${val}`); + + next(); + + }, 500); + +}, function(err?: Error): void { + + console.log("async.forEachOfLimit: done."); + +}); + +// map + +async.map({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, next: AsyncResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.map: ${val}`); + + next(undefined as any, val.toString()); + + }, 500); + +}, function(err: Error, results: string[]): void { + + console.log("async.map: done with results", results); + +}); + +async.mapSeries({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, next: AsyncResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.mapSeries: ${val}`); + + next(undefined as any, val.toString()); + + }, 500); + +}, function(err: Error, results: string[]): void { + + console.log("async.mapSeries: done with results", results); + +}); + +async.mapLimit({ + "a": 1, + "b": 2, + "c": 3, + "d": 4, + "e": 5, + "f": 6 +}, 2, function(val: number, next: AsyncResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.mapLimit: ${val}`); + + next(undefined as any, val.toString()); + + }, 500); + +}, function(err: Error, results: string[]): void { + + console.log("async.mapLimit: done with results", results); + +}); + +// mapValues + +async.mapValues({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, key: string, next: AsyncResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.mapValues: ${key} = ${val}`); + + next(undefined as any, val.toString()); + + }, 500); + +}, function(err: Error, results: Dictionary): void { + + console.log("async.mapValues: done with results", results); + +}); + +async.mapValuesSeries({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, key: string, next: AsyncResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.mapValuesSeries: ${key} = ${val}`); + + next(undefined as any, val.toString()); + + }, 500); + +}, function(err: Error, results: Dictionary): void { + + console.log("async.mapValuesSeries: done with results", results); + +}); + +// filter/select/reject + +async.filter({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, next: AsyncBooleanResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.filter/select: ${val}`); + + next(undefined as any, val % 2 === 0); + + }, 500); + +}, function(err: Error, results: number[]): void { + + console.log("async.filter/select: done with results", results); + +}); + +async.reject({ + "a": 1, + "b": 2, + "c": 3 +}, function(val: number, next: AsyncBooleanResultCallback): void { + + setTimeout(function(): void { + + console.log(`async.reject: ${val}`); + + next(undefined as any, val % 2 === 0); + + }, 500); + +}, function(err: Error, results: number[]): void { + + console.log("async.reject: done with results", results); + +}); + +// concat + +async.concat({ + "a": "1", + "b": "2", + "c": "3" +}, function(item: string, next: AsyncResultCallback): void { + + console.log(`async.concat: ${item}`); + + next(undefined as any, [item, item, item]); + +}, function(err: Error, results: string[]) { + + console.log("async.concat: done with results", results); + +}); + +// detect/find + +async.detect({ + "a": 1, + "b": 2, + "c": 3 +}, function(item: number, next: AsyncBooleanResultCallback): void { + + console.log(`async.detect/find: ${item}`); + + next(undefined as any, item > 1); + +}, function(err: Error, result: number) { + + if (err) { + + console.log(err); + + } else { + + console.log("async.detect/find: done with result", result); + } + +}); + +// every/all + +async.every({ + "a": 1, + "b": 2, + "c": 3 +}, function(item: number, next: AsyncBooleanResultCallback): void { + + console.log(`async.every/all: ${item}`); + + next(undefined as any, item > 0); + +}, function(err: Error, result: boolean) { + + console.log("async.every/all: done with result", result); + +}); + +// some/any + +async.some({ + "a": 1, + "b": 2, + "c": 3 +}, function(item: number, next: AsyncBooleanResultCallback): void { + + console.log(`async.some/any: ${item}`); + + next(undefined as any, item > 2); + +}, function(err: Error, result: boolean) { + + console.log("async.some/any: done with result", result); + +}); diff --git a/async/index.d.ts b/async/index.d.ts index 96da35c1ea..86aa17ea6b 100644 --- a/async/index.d.ts +++ b/async/index.d.ts @@ -1,24 +1,26 @@ // Type definitions for Async 2.0.1 // Project: https://github.com/caolan/async -// Definitions by: Boris Yankov , Arseniy Maximov , Joe Herman +// Definitions by: Boris Yankov , Arseniy Maximov , Joe Herman , Angus Fenying // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface Dictionary { [key: string]: T; } -interface ErrorCallback { (err?: Error): void; } -interface AsyncResultCallback { (err: Error, result: T): void; } -interface AsyncResultArrayCallback { (err: Error, results: T[]): void; } -interface AsyncResultObjectCallback { (err: Error, results: Dictionary): void; } +interface ErrorCallback { (err?: T): void; } +interface AsyncWaterfallCallback { (err: E, ...args: any[]): void; } +interface AsyncBooleanResultCallback { (err: E, truthValue: boolean): void; } +interface AsyncResultCallback { (err: E, result: T): void; } +interface AsyncResultArrayCallback { (err: E, results: T[]): void; } +interface AsyncResultObjectCallback { (err: E, results: Dictionary): void; } -interface AsyncFunction { (callback: (err?: Error, result?: T) => void): void; } -interface AsyncIterator { (item: T, callback: ErrorCallback): void; } -interface AsyncForEachOfIterator { (item: T, key: number|string, callback: ErrorCallback): void; } -interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } -interface AsyncMemoIterator { (memo: R, item: T, callback: AsyncResultCallback): void; } -interface AsyncBooleanIterator { (item: T, callback: (err: string, truthValue: boolean) => void): void; } +interface AsyncFunction { (callback: (err?: E, result?: T) => void): void; } +interface AsyncIterator { (item: T, callback: ErrorCallback): void; } +interface AsyncForEachOfIterator { (item: T, key: number|string, callback: ErrorCallback): void; } +interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } +interface AsyncMemoIterator { (memo: R, item: T, callback: AsyncResultCallback): void; } +interface AsyncBooleanIterator { (item: T, callback: AsyncBooleanResultCallback): void; } -interface AsyncWorker { (task: T, callback: ErrorCallback): void; } -interface AsyncVoidFunction { (callback: ErrorCallback): void; } +interface AsyncWorker { (task: T, callback: ErrorCallback): void; } +interface AsyncVoidFunction { (callback: ErrorCallback): void; } interface AsyncQueue { length(): number; @@ -26,10 +28,10 @@ interface AsyncQueue { running(): number; idle(): boolean; concurrency: number; - push(task: T, callback?: ErrorCallback): void; - push(task: T[], callback?: ErrorCallback): void; - unshift(task: T, callback?: ErrorCallback): void; - unshift(task: T[], callback?: ErrorCallback): void; + push(task: T, callback?: ErrorCallback): void; + push(task: T[], callback?: ErrorCallback): void; + unshift(task: T, callback?: ErrorCallback): void; + unshift(task: T[], callback?: ErrorCallback): void; saturated: () => any; empty: () => any; drain: () => any; @@ -51,8 +53,8 @@ interface AsyncPriorityQueue { concurrency: number; started: boolean; paused: boolean; - push(task: T, priority: number, callback?: AsyncResultArrayCallback): void; - push(task: T[], priority: number, callback?: AsyncResultArrayCallback): void; + push(task: T, priority: number, callback?: AsyncResultArrayCallback): void; + push(task: T[], priority: number, callback?: AsyncResultArrayCallback): void; saturated: () => any; empty: () => any; drain: () => any; @@ -88,104 +90,122 @@ interface AsyncCargo { interface Async { // Collections - each(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; - eachSeries(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; - eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; - forEachOf(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; - forEachOf(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - forEachOfSeries(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; - forEachOfSeries(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void; - forEachOfLimit(obj: T[], limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; - map(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - mapSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - mapLimit(arr: T[], limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - mapValuesLimit(obj: {[name: string]: T}, limit: number, iteratee: (value: string, key: T, callback: AsyncResultCallback) => void, callback: AsyncResultCallback): void; - mapValues(obj: {[name: string]: T}, iteratee: (value: string, key: T, callback: AsyncResultCallback) => void, callback: AsyncResultCallback): void; + each(arr: T[], iterator: AsyncIterator, callback?: ErrorCallback): void; + each(arr: Dictionary, iterator: AsyncIterator, callback?: ErrorCallback): void; + eachSeries: typeof async.each; + eachLimit(arr: T[], limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; + eachLimit(arr: Dictionary, limit: number, iterator: AsyncIterator, callback?: ErrorCallback): void; + forEach: typeof async.each; + forEachSeries: typeof async.each; + forEachLimit: typeof async.eachLimit; + forEachOf(obj: T[], iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + forEachOf(obj: Dictionary, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + forEachOfSeries: typeof async.forEachOf; + forEachOfLimit(obj: T[], limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + forEachOfLimit(obj: Dictionary, limit: number, iterator: AsyncForEachOfIterator, callback?: ErrorCallback): void; + eachOf: typeof async.forEachOf; + eachOfSeries: typeof async.forEachOf; + eachOfLimit: typeof async.forEachOfLimit; + map(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + map(arr: Dictionary, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + mapSeries: typeof async.map; + mapLimit(arr: T[], limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + mapLimit(arr: Dictionary, limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + mapValuesLimit(obj: Dictionary, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback) => void, callback: AsyncResultObjectCallback): void; + mapValues(obj: Dictionary, iteratee: (value: T, key: string, callback: AsyncResultCallback) => void, callback: AsyncResultObjectCallback): void; mapValuesSeries: typeof async.mapValues; - filter(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - select(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - filterSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - selectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - filterLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - selectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - reject(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - rejectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - rejectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): any; - reduce(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; - inject(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; - foldl(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): any; - reduceRight(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncResultCallback): any; - foldr(arr: T[], memo: R, iterator: AsyncMemoIterator, callback: AsyncResultCallback): any; - detect(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): any; + filter(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; + filter(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; + filterSeries: typeof async.filter; + filterLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; + filterLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultArrayCallback): void; + select: typeof async.filter; + selectSeries: typeof async.filter; + selectLimit: typeof async.filterLimit; + reject: typeof async.filter; + rejectSeries: typeof async.filter; + rejectLimit: typeof async.filterLimit; + reduce(arr: T[], memo: R, iterator: AsyncMemoIterator, callback?: AsyncResultCallback): void; + inject: typeof async.reduce; + foldl: typeof async.reduce; + reduceRight: typeof async.reduce; + foldr: typeof async.reduce; + detect(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; + detect(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; + detectSeries: typeof async.detect; + detectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; + detectLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): void; find: typeof async.detect; - detectSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): any; - findSeries: typeof async.detectSeries; - detectLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncResultCallback): any; + findSeries: typeof async.detect; findLimit: typeof async.detectLimit; - sortBy(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - some(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; - someLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; - anyLimit: typeof async.someLimit; - someSeries(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; + sortBy(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + some(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + some(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + someSeries: typeof async.some; + someLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + someLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + any: typeof async.some; anySeries: typeof async.someSeries; - any(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => void): any; - every(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; - everyLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; - all(arr: T[], iterator: AsyncBooleanIterator, callback?: (result: boolean) => any): any; - concat(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; - concatSeries(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): any; + anyLimit: typeof async.someLimit; + every(arr: T[], iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + every(arr: Dictionary, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + everySeries: typeof async.every; + everyLimit(arr: T[], limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + everyLimit(arr: Dictionary, limit: number, iterator: AsyncBooleanIterator, callback?: AsyncBooleanResultCallback): void; + all: typeof async.every; + allSeries: typeof async.every; + allLimit: typeof async.everyLimit; + + concat(arr: T[], iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + concat(arr: Dictionary, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; + concatSeries: typeof async.concat; // Control Flow - series(tasks: AsyncFunction[], callback?: AsyncResultArrayCallback): void; - series(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; - parallel(tasks: Array>, callback?: AsyncResultArrayCallback): void; - parallel(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; - parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; - parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; - whilst(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void; - doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void; - until(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void; - doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void; - during(test: (testCallback : (error: Error, truth: boolean) => void) => void, fn: AsyncVoidFunction, callback: (err: any) => void): void; - doDuring(fn: AsyncVoidFunction, test: (testCallback: (error: Error, truth: boolean) => void) => void, callback: (err: any) => void): void; - forever(next: (errCallback : (err: Error) => void) => void, errBack: (err: Error) => void) : void; - waterfall(tasks: Function[], callback?: (err: Error, results?: any) => void): void; + series(tasks: AsyncFunction[], callback?: AsyncResultArrayCallback): void; + series(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; + parallel(tasks: Array>, callback?: AsyncResultArrayCallback): void; + parallel(tasks: Dictionary>, callback?: AsyncResultObjectCallback): void; + parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; + parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; + whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; + doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void; + until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; + doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void; + during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void; + doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void; + forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void; + waterfall(tasks: Function[], callback?: AsyncResultCallback): 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(worker: AsyncWorker, concurrency?: number): AsyncQueue; - priorityQueue(worker: AsyncWorker, concurrency: number): AsyncPriorityQueue; - cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo; - auto(tasks: any, concurrency?: number, callback?: (error: Error, results: any) => void): void; - autoInject(tasks: any, callback?: (error: Error, results: any) => void): void; - retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: (error: Error, results: any) => void): void; - retry(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback, results : any) => void, callback: (error: Error, results: any) => void): void; - retryable(opts: number | {times: number, interval: number}, task: AsyncFunction): AsyncFunction; - apply(fn: Function, ...arguments: any[]): AsyncFunction; + queue(worker: AsyncWorker, concurrency?: number): AsyncQueue; + priorityQueue(worker: AsyncWorker, concurrency: number): AsyncPriorityQueue; + cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo; + auto(tasks: any, concurrency?: number, callback?: AsyncResultCallback): void; + autoInject(tasks: any, callback?: AsyncResultCallback): void; + retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: AsyncResultCallback): void; + retry(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback, results : any) => void, callback: AsyncResultCallback): void; + retryable(opts: number | {times: number, interval: number}, task: AsyncFunction): AsyncFunction; + apply(fn: Function, ...arguments: any[]): AsyncFunction; nextTick(callback: Function, ...args: any[]): void; setImmediate: typeof async.nextTick; - allLimit(arr: T[], limit: number, iteratee: AsyncBooleanIterator, cb?: (result: boolean) => any) : any; - everySeries(arr: T[], iteratee: AsyncBooleanIterator, cb?: (result: boolean) => any) : any - allSeries: typeof async.everySeries; + reflect(fn: AsyncFunction) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void; + reflectAll(tasks: AsyncFunction[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[]; - reflect(fn: AsyncFunction) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void; - reflectAll(tasks: AsyncFunction[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[]; + timeout(fn: AsyncFunction, milliseconds: number, info: any): AsyncFunction; - timeout(fn: AsyncFunction, milliseconds: number, info: any): AsyncFunction; + times (n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; + timesSeries(n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; + timesLimit(n: number, limit: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; - times (n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; - timesSeries(n: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; - timesLimit(n: number, limit: number, iterator: AsyncResultIterator, callback: AsyncResultArrayCallback): void; + transform(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void; + transform(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void; + transform(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void; + transform(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void; - transform(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void; - transform(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: Error) => void) => void): void; - transform(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void; - transform(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: Error) => void) => void): void; - - race(tasks: (AsyncFunction)[], callback: AsyncResultCallback) : void; + race(tasks: (AsyncFunction)[], callback: AsyncResultCallback) : void; // Utils memoize(fn: Function, hasher?: Function): Function; diff --git a/async/tsconfig.json b/async/tsconfig.json index c655cc101a..d62fccf232 100644 --- a/async/tsconfig.json +++ b/async/tsconfig.json @@ -2,8 +2,9 @@ "compilerOptions": { "module": "commonjs", "target": "es6", - "noImplicitAny": false, - "strictNullChecks": false, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/asyncblock/tsconfig.json b/asyncblock/tsconfig.json index 1611b9a7b4..a9866b2780 100644 --- a/asyncblock/tsconfig.json +++ b/asyncblock/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/atmosphere/tsconfig.json b/atmosphere/tsconfig.json index 53982dbeb5..7eb03df28f 100644 --- a/atmosphere/tsconfig.json +++ b/atmosphere/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/atom-keymap/tsconfig.json b/atom-keymap/tsconfig.json index 305e6eb32d..6914b3702e 100644 --- a/atom-keymap/tsconfig.json +++ b/atom-keymap/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/atom/tsconfig.json b/atom/tsconfig.json index 0fe8268125..a2678c3d56 100644 --- a/atom/tsconfig.json +++ b/atom/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/atpl/index.d.ts b/atpl/index.d.ts index 1a97a957ff..869de67bc3 100644 --- a/atpl/index.d.ts +++ b/atpl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for atpl +// Type definitions for atpl // Project: https://github.com/soywiz/atpl.js // Definitions by: Carlos Ballesteros Velasco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/atpl/tsconfig.json b/atpl/tsconfig.json index 95f969d727..9a19ba3ae4 100644 --- a/atpl/tsconfig.json +++ b/atpl/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/auth0-angular/index.d.ts b/auth0-angular/index.d.ts index 0a91269942..16203813e1 100644 --- a/auth0-angular/index.d.ts +++ b/auth0-angular/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for auth0-angular +// Type definitions for auth0-angular // Project: https://github.com/auth0/auth0-angular // Definitions by: Matt Emory // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/auth0-angular/tsconfig.json b/auth0-angular/tsconfig.json index 1d97bc9052..5f7c2c98ba 100644 --- a/auth0-angular/tsconfig.json +++ b/auth0-angular/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/auth0-js/index.d.ts b/auth0-js/index.d.ts index 7e49961475..2907eba686 100644 --- a/auth0-js/index.d.ts +++ b/auth0-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Auth0.js +// Type definitions for Auth0.js // Project: https://github.com/auth0/auth0.js // Definitions by: Robert McLaws // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -22,7 +22,7 @@ interface Auth0Static { logout(query: string): void; getConnections(callback?: Function): void; refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; - getDelegationToken(targetClientId: string, id_token: string, options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; + getDelegationToken(options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; getProfile(id_token: string, callback?: Function): Auth0UserProfile; getSSOData(withActiveDirectories: any, callback?: Function): void; parseHash(hash: string): Auth0DecodedHash; @@ -84,7 +84,7 @@ interface Auth0Identity { interface Auth0DecodedHash { access_token: string; - id_token: string; + idToken: string; profile: Auth0UserProfile; state: any; } @@ -96,6 +96,7 @@ interface Auth0PopupOptions { interface Auth0LoginOptions { auto_login?: boolean; + responseType?: string; connection?: string; email?: string; username?: string; diff --git a/auth0-js/tsconfig.json b/auth0-js/tsconfig.json index 7a0a649c3b..fc79180f7e 100644 --- a/auth0-js/tsconfig.json +++ b/auth0-js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/auth0-lock/index.d.ts b/auth0-lock/index.d.ts index 5d53fd8dc3..1a05d3f913 100644 --- a/auth0-lock/index.d.ts +++ b/auth0-lock/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for auth0-lock v10.0.1 +// Type definitions for auth0-lock v10.0.1 // Project: http://auth0.com // Definitions by: Brian Caruso // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -122,5 +122,5 @@ interface Auth0LockStatic { declare var Auth0Lock: Auth0LockStatic; declare module "auth0-lock" { - export = Auth0Lock; + export default Auth0Lock; } diff --git a/auth0-lock/tsconfig.json b/auth0-lock/tsconfig.json index e4ae552448..641164d8a0 100644 --- a/auth0-lock/tsconfig.json +++ b/auth0-lock/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/auth0.widget/index.d.ts b/auth0.widget/index.d.ts index 24d978ab9d..1c30d83b6f 100644 --- a/auth0.widget/index.d.ts +++ b/auth0.widget/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Auth0Widget.js +// Type definitions for Auth0Widget.js // Project: http://auth0.com // Definitions by: Robert McLaws // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/auth0.widget/tsconfig.json b/auth0.widget/tsconfig.json index 23e1735109..004e2ca566 100644 --- a/auth0.widget/tsconfig.json +++ b/auth0.widget/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/auth0/auth0-tests.ts b/auth0/auth0-tests.ts index 391dee655a..502a72eec1 100644 --- a/auth0/auth0-tests.ts +++ b/auth0/auth0-tests.ts @@ -49,3 +49,30 @@ auth }).catch((err) => { // Handle the error. }); + + +// Update a user +management + .updateUser({id: "user_id"}, {"email": "hi@me.co"}); + +// Update a user using callback +management + .updateUser({id: "user_id"}, {"email": "hi@me.co"}, (err: Error, users: auth0.User) => {}); + + +// Update user metadata +management + .updateUserMetadata({id: "user_id"}, {"key": "value"}); + +// Update user metadata using callback +management + .updateUserMetadata({id: "user_id"}, {"key": "value"}, (err: Error, users: auth0.User) => {}); + + +// Update app metadata +management + .updateAppMetadata({id: "user_id"}, {"key": "value"}); + +// Update app metadata using callback +management + .updateAppMetadata({id: "user_id"}, {"key": "value"}, (err: Error, users: auth0.User) => {}); diff --git a/auth0/index.d.ts b/auth0/index.d.ts index 019d9edc38..b24b808529 100644 --- a/auth0/index.d.ts +++ b/auth0/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for auth0 v2.3.1 +// Type definitions for auth0 v2.3.1 // Project: https://github.com/auth0/node-auth0 // Definitions by: Seth Westphal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -10,15 +10,18 @@ export interface ManagementClientOptions { domain?: string; } +export type UserMetadata = {}; +export type AppMetadata = {}; + export interface UserData { connection: string; email?: string; username?: string; password?: string; phone_number?: string; - user_metadata?: {}; + user_metadata?: UserMetadata; email_verified?: boolean; - app_metadata?: {}; + app_metadata?: AppMetadata; } export interface GetUsersData { @@ -43,8 +46,8 @@ export interface User { created_at?: string; updated_at?: string; identities?: Identity[]; - app_metadata?: {}; - user_metadata?: {}; + app_metadata?: AppMetadata; + user_metadata?: UserMetadata; picture?: string; name?: string; nickname?: string; @@ -53,6 +56,8 @@ export interface User { last_login?: string; logins_count?: number; blocked?: boolean; + given_name?: string; + family_name?: string; } export interface Identity { @@ -62,6 +67,10 @@ export interface Identity { isSocial: boolean; } +export interface UpdateUserParameters { + id: string; +} + export class ManagementClient { constructor(options: ManagementClientOptions); @@ -69,6 +78,12 @@ export class ManagementClient { getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void; createUser(data: UserData): Promise; createUser(data: UserData, cb: (err: Error, data: User) => void): void; + updateUser(params: UpdateUserParameters, data: User): Promise; + updateUser(params: UpdateUserParameters, data: User, cb: (err: Error, data: User) => void): void; + updateUserMetadata(params: UpdateUserParameters, data: UserMetadata): Promise; + updateUserMetadata(params: UpdateUserParameters, data: UserMetadata, cb: (err: Error, data: User) => void): void + updateAppMetadata(params: UpdateUserParameters, data: AppMetadata): Promise; + updateAppMetadata(params: UpdateUserParameters, data: AppMetadata, cb: (err: Error, data: User) => void): void } export interface AuthenticationClientOptions { @@ -86,4 +101,4 @@ export class AuthenticationClient { requestChangePasswordEmail(data: RequestChangePasswordEmailData): Promise; requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void; -} \ No newline at end of file +} diff --git a/auth0/tsconfig.json b/auth0/tsconfig.json index 648402f946..42e522478d 100644 --- a/auth0/tsconfig.json +++ b/auth0/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/auto-launch/tsconfig.json b/auto-launch/tsconfig.json index 9f51f0f33a..2b9b9e5661 100644 --- a/auto-launch/tsconfig.json +++ b/auto-launch/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/autobahn/tsconfig.json b/autobahn/tsconfig.json index ba1f37e9db..7ef3d2e4eb 100644 --- a/autobahn/tsconfig.json +++ b/autobahn/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/autobind-decorator/tsconfig.json b/autobind-decorator/tsconfig.json index 7a407e8cfd..906d414b5d 100644 --- a/autobind-decorator/tsconfig.json +++ b/autobind-decorator/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "experimentalDecorators": true, diff --git a/autolinker/tsconfig.json b/autolinker/tsconfig.json index 35143b478d..6fb1656854 100644 --- a/autolinker/tsconfig.json +++ b/autolinker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/autoprefixer-core/tsconfig.json b/autoprefixer-core/tsconfig.json index 1063eeedb2..f89b9406ed 100644 --- a/autoprefixer-core/tsconfig.json +++ b/autoprefixer-core/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/autosize/tsconfig.json b/autosize/tsconfig.json index 09535bc88d..ec273c33df 100644 --- a/autosize/tsconfig.json +++ b/autosize/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/avoscloud-sdk/tsconfig.json b/avoscloud-sdk/tsconfig.json index 8db7d19601..dbd926926e 100644 --- a/avoscloud-sdk/tsconfig.json +++ b/avoscloud-sdk/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/awesomplete/awesomplete-tests.ts b/awesomplete/awesomplete-tests.ts index 8132ad4555..11abfdcba0 100644 --- a/awesomplete/awesomplete-tests.ts +++ b/awesomplete/awesomplete-tests.ts @@ -1,5 +1,3 @@ -/// - var input = document.getElementById("myinput"); new Awesomplete(input, {list: "#mylist"}); diff --git a/awesomplete/awesomplete.d.ts b/awesomplete/index.d.ts similarity index 100% rename from awesomplete/awesomplete.d.ts rename to awesomplete/index.d.ts diff --git a/awesomplete/tsconfig.json b/awesomplete/tsconfig.json new file mode 100644 index 0000000000..c169798465 --- /dev/null +++ b/awesomplete/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "awesomplete-tests.ts" + ] +} \ No newline at end of file diff --git a/aws-iot-device-sdk/aws-iot-device-sdk-tests.ts b/aws-iot-device-sdk/aws-iot-device-sdk-tests.ts new file mode 100644 index 0000000000..10eeed099d --- /dev/null +++ b/aws-iot-device-sdk/aws-iot-device-sdk-tests.ts @@ -0,0 +1,103 @@ +// Code adapted from +// https://github.com/aws/aws-iot-device-sdk-js/blob/97b0b468d59e02e2f6a1dce321000d914cb47894/examples/device-example.js +// and +// https://github.com/aws/aws-iot-device-sdk-js/blob/97b0b468d59e02e2f6a1dce321000d914cb47894/examples/thing-example.js + +import * as awsIot from "aws-iot-device-sdk"; +import * as mqtt from "mqtt"; + +const device = new awsIot.device({ + keyPath: "", + certPath: "", + caPath: "", + clientId: "", + region: "", + baseReconnectTimeMs: 1000, + keepalive: 10, + protocol: "wss", + port: 443, + host: "", + debug: false +}); + +device.subscribe("topic_1"); + +device + .on("connect", function() { + console.log("connect"); + }); + device + .on("close", function() { + console.log("close"); + }); + device + .on("reconnect", function() { + console.log("reconnect"); + }); + device + .on("offline", function() { + console.log("offline"); + }); + device + .on("error", function(error) { + console.log("error", error); + }); + device + .on("message", function(topic: string, payload: any) { + console.log("message", topic, payload.toString()); + }); + + +const thingShadows = new awsIot.thingShadow({ + keyPath: "", + certPath: "", + caPath: "", + clientId: "", + region: "", + baseReconnectTimeMs: 1000, + keepalive: 10, + protocol: "mqtts", + port: 0, + host: "", + debug: false + }); + + thingShadows.register( + "thingName", + { ignoreDeltas: false }, + (err: Error, failedTopics: mqtt.Granted[]) => { } + ); + + thingShadows.on("connect", function() { + console.log("connected to AWS IoT"); + }); + + thingShadows.on("close", function() { + console.log("close"); + thingShadows.unregister("thingName"); + }); + + thingShadows.on("reconnect", function() { + console.log("reconnect"); + }); + + thingShadows.on("offline", function() { + console.log("offline"); + }); + + thingShadows.on("error", function(error) { + console.log("error", error); + }); + + thingShadows.on("message", function(topic: string, payload: any) { + console.log("message", topic, payload.toString()); + }); + + thingShadows.on("status", function(thingName: string, stat: "accepted" | "rejected", clientToken: string, stateObject: any) { + }); + + thingShadows.on("delta", function(thingName, stateObject) { + }); + + thingShadows.on("timeout", function(thingName, clientToken) { + }); diff --git a/aws-iot-device-sdk/index.d.ts b/aws-iot-device-sdk/index.d.ts new file mode 100644 index 0000000000..b165089f82 --- /dev/null +++ b/aws-iot-device-sdk/index.d.ts @@ -0,0 +1,396 @@ +// Type definitions for aws-iot-device-sdk 1.0.13 +// Project: https://github.com/aws/aws-iot-device-sdk-js +// Definitions by: Markus Olsson +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as mqtt from "mqtt"; +import * as WebSocket from "ws"; + +export interface DeviceOptions extends mqtt.ClientOptions { + /** the AWS IoT region you will operate in (default "us-east-1") */ + region?: string; + + /** the client ID you will use to connect to AWS IoT */ + clientId?: string; + + /** + * path of the client certificate file path of the private key file + * associated with the client certificate + */ + certPath?: string; + + /** path of the private key file associated with the client certificate */ + keyPath?: string; + + /** path of your CA certificate file */ + caPath?: string; + + /** + * same as certPath, but can also accept a buffer containing client + * certificate data + */ + clientCert?: string; + + /** + * same as keyPath, but can also accept a buffer containing private key + * data + */ + privateKey?: string; + + /** + * same as caPath, but can also accept a buffer containing CA certificate + * data + */ + caCert?: string; + + /** + * set to "true" to automatically re-subscribe to topics after + * reconnection (default "true") + */ + autoResubscribe?: boolean; + + /** set to "true" to automatically queue published messages while + * offline (default "true") + */ + offlineQueueing?: boolean; + + /** + * enforce a maximum size for the offline message queue + * (default 0, e.g. no maximum) + */ + offlineQueueMaxSize?: number; + + /** + * set to "oldest" or "newest" to define drop behavior on a full + * queue when offlineQueueMaxSize > 0 + */ + offlineQueueDropBehavior?: "oldest" | "newest"; + + /** + * the minimum time in milliseconds between publishes when draining + * after reconnection (default 250) + */ + drainTimeMs?: number; + + /** the base reconnection time in milliseconds (default 1000) */ + baseReconnectTimeMs?: number; + + /** the maximum reconnection time in milliseconds (default 128000) */ + maximumReconnectTimeMs?: number; + + /** + * the minimum time in milliseconds that a connection must be maintained + * in order to be considered stable (default 20000) + */ + minimumConnectionTimeMs?: number; + + /** + * the connection type, either "mqtts" (default) or "wss" (WebSocket/TLS). + * Note that when set to "wss", values must be provided for the + * Access Key ID and Secret Key in either the following options or in + * environment variables as specified in WebSocket Configuration[1]. + * + * 1. https://github.com/aws/aws-iot-device-sdk-js#websockets + */ + protocol?: "mqtts" | "wss"; + /** + * if protocol is set to "wss", you can use this parameter to pass + * additional options to the underlying WebSocket object; + * these options are documented here. + */ + websocketOptions?: WebSocket.IClientOptions; + + /** + * used to specify the Access Key ID when protocol is set to "wss". + * Overrides the environment variable AWS_ACCESS_KEY_ID if set. + */ + accessKeyId?: string; + /** + * used to specify the Secret Key when protocol is set to "wss". + * Overrides the environment variable AWS_SECRET_ACCESS_KEY if set. + */ + secretKey?: string; + /** + * (required when authenticating via Cognito, optional otherwise) used + * to specify the Session Token when protocol is set to "wss". Overrides + * the environment variable AWS_SESSION_TOKEN if set. + */ + sessionToken?: string; + + /** + * optional hostname, if not specified a hostname will be constructed + * from the region option + */ + // NB Not documented but present in examples, see + // https://github.com/aws/aws-iot-device-sdk-js/blob/97b0b468d/device/index.js#L376 + // https://github.com/aws/aws-iot-device-sdk-js/blob/97b0b468d/device/index.js#L149 + host?: string; + + /** optional port, will be appended to hostname if present and not 443 */ + // NB Not documented but present in examples, see + // https://github.com/aws/aws-iot-device-sdk-js/blob/97b0b468d/device/index.js#L154 + port?: number; + + /** enable console logging, default false */ + // NB Not documented but present in examples, see + // https://github.com/aws/aws-iot-device-sdk-js/blob/97b0b468d/device/index.js#L436 + debug?: boolean; +} + +export class device extends NodeJS.EventEmitter { + /** + * Returns a wrapper for the mqtt.Client() class, configured for a TLS + * connection with the AWS IoT platform and with arguments as specified + * in options. + */ + constructor(options?: DeviceOptions); + + /** + * Update the credentials set used to authenticate via WebSocket/SigV4. + * + * This method is designed to be invoked during the callback of the + * getCredentialsForIdentity method in the AWS SDK for JavaScript. + */ + updateWebSocketCredentials(accessKeyId: string, secretKey: string, sessionToken: string, expiration: Date): void; + + on(event: "connect" | "close" | "reconnect" | "offline", listener: () => void): this; + + // Error | string comes from: + // https://github.com/aws/aws-iot-device-sdk-js/blob/97b0b46/device/index.js#L744 + // Remove when https://github.com/aws/aws-iot-device-sdk-js/issues/95 is fixed + on(event: "error", listener: (error: Error | string) => void): this; + + /** Emitted when a message is received on a topic not related to any Thing Shadows */ + on(event: "message", listener: (topic: string, payload: any) => void): this; + + // The following publish, subscribe, unsubscribe and end Definitions + // are derived from the mqtt definition as they are re-surfaced through + // thingShadow + // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e7772769fab8c206449ce9673cac417370330aa9/mqtt/mqtt.d.ts#L199 + + /** + * Publish a message to a topic + * + * @param topic to publish to + * @param message to publish + * @param publish options + * @param called when publish succeeds or fails + */ + publish(topic: string, message: Buffer | string, options?: mqtt.ClientPublishOptions, callback?: (error?: Error) => void): mqtt.Client; + + /** + * Subscribe to a topic or topics + * @param topic to subscribe to or an Array of topics to subscribe to. It can also be an object. + * @param the options to subscribe with + * @param callback fired on suback + */ + subscribe(topic: string | string[] | mqtt.Topic, options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client; + + /** + * Unsubscribe from a topic or topics + * + * @param topic is a String topic or an array of topics to unsubscribe from + * @param options + * @param callback fired on unsuback + */ + unsubscribe(topic: string | string[], options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client; + + /** + * end - close connection + * + * @param force passing it to true will close the client right away, without waiting for the in-flight messages to be acked. + * This parameter is optional. + * @param callback + */ + end(force?: boolean, callback?: Function): mqtt.Client; +} + +export interface ThingShadowOptions extends DeviceOptions { + /** the timeout for thing operations (default 10 seconds) */ + operationTimeout?: number; +} + +export interface RegisterOptions { + /** + * set to true to not subscribe to the delta sub-topic for this + * Thing Shadow; used in cases where the application is not interested in + * changes (e.g. update only.) (default false) + */ + ignoreDeltas?: boolean; + + /** + * set to false to unsubscribe from all operation sub-topics while not + * performing an operation (default true) + */ + persistentSubscribe?: boolean; + + /** + * set to false to allow receiving messages with old version + * numbers (default true) + */ + discardStale?: boolean; + + /** set to true to send version numbers with shadow updates (default true) */ + enableVersioning?: boolean; +} + +/** + * The thingShadow class wraps an instance of the device class with + * additional functionality to operate on Thing Shadows via the AWS IoT API. + */ +export class thingShadow extends NodeJS.EventEmitter { + + constructor(options?: ThingShadowOptions); + + /** + * Register interest in the Thing Shadow named thingName. + * + * The thingShadow class will subscribe to any applicable topics, and will + * fire events for the Thing Shadow until awsIot.thingShadow#unregister() + * is called with thingName + * + * If the callback parameter is provided, it will be invoked after + * registration is complete (i.e., when subscription ACKs have been received + * for all shadow topics). Applications should wait until shadow + * registration is complete before performing update/get/delete operations. + */ + register(thingName: string, options?: RegisterOptions, callback?: (error: Error, failedTopics: mqtt.Granted[]) => void): void + + /** + * Unregister interest in the Thing Shadow named thingName. + * + * The thingShadow class will unsubscribe from all applicable topics + * and no more events will be fired for thingName. + */ + unregister(thingName: string): void + + /** + * Update the Thing Shadow named thingName with the state specified in the + * JavaScript object stateObject. thingName must have been previously + * registered using awsIot.thingShadow#register(). + * + * The thingShadow class will subscribe to all applicable topics and + * publish stateObject on the update sub-topic. + * + * This function returns a clientToken, which is a unique value associated + * with the update operation. When a "status" or "timeout" event is emitted, + * the clientToken will be supplied as one of the parameters, allowing the + * application to keep track of the status of each operation. The caller may + * create their own clientToken value; if stateObject contains a clientToken + * property, that will be used rather than the internally generated value. + * Note that it should be of atomic type (i.e. numeric or string). + * This function returns "null" if an operation is already in progress. + */ + update(thingName: string, stateObject: any): string | null; + + /** + * Get the current state of the Thing Shadow named thingName, which must + * have been previously registered using awsIot.thingShadow#register(). + * The thingShadow class will subscribe to all applicable topics and + * publish on the get sub-topic. + * + * This function returns a clientToken, which is a unique value + * associated with the get operation. When a "status or "timeout" event + * is emitted, the clientToken will be supplied as one of the parameters, + * allowing the application to keep track of the status of each operation. + * The caller may supply their own clientToken value (optional); if + * supplied, the value of clientToken will be used rather than the + * internally generated value. Note that this value should be of atomic + * type (i.e. numeric or string). This function returns "null" if an + * operation is already in progress. + */ + get(thingName: string, clientToken?: string): string | null; + + /** + * Delete the Thing Shadow named thingName, which must have been previously + * registered using awsIot.thingShadow#register(). The thingShadow class + * will subscribe to all applicable topics and publish on the delete sub-topic. + * + * This function returns a clientToken, which is a unique value associated + * with the delete operation. When a "status" or "timeout" event is + * emitted, the clientToken will be supplied as one of the parameters, + * allowing the application to keep track of the status of each operation. + * The caller may supply their own clientToken value (optional); if + * supplied, the value of clientToken will be used rather than the + * internally generated value. Note that this value should be of atomic + * type (i.e. numeric or string). This function returns "null" if an + * operation is already in progress. + */ + delete(thingName: string, clientToken?: string): string | null; + + // The following publish, subscribe, unsubscribe and end Definitions + // are copied from the mqtt definition as they are re-surfaced through + // thingShadow + // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e7772769fab8c206449ce9673cac417370330aa9/mqtt/mqtt.d.ts#L199 + + /** + * Publish a message to a topic + * + * @param topic + * @param message + * @param options + * @param callback + */ + publish(topic: string, message: Buffer, options?: mqtt.ClientPublishOptions, callback?: Function): mqtt.Client; + publish(topic: string, message: string, options?: mqtt.ClientPublishOptions, callback?: Function): mqtt.Client; + + /** + * Subscribe to a topic or topics + * @param topic to subscribe to or an Array of topics to subscribe to. It can also be an object. + * @param the options to subscribe with + * @param callback fired on suback + */ + subscribe(topic: string, options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client; + subscribe(topic: string[], options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client; + subscribe(topic: mqtt.Topic, options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client; + + /** + * Unsubscribe from a topic or topics + * + * @param topic is a String topic or an array of topics to unsubscribe from + * @param options + * @param callback fired on unsuback + */ + unsubscribe(topic: string, options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client; + unsubscribe(topic: string[], options?: mqtt.ClientSubscribeOptions, callback?: mqtt.ClientSubscribeCallback): mqtt.Client; + + /** + * end - close connection + * + * @param force passing it to true will close the client right away, without waiting for the in-flight messages to be acked. + * This parameter is optional. + * @param callback + */ + end(force?: boolean, callback?: Function): mqtt.Client; + + on(event: "connect" | "close" | "reconnect" | "offline", listener: () => void): this; + on(event: "error", listener: (error: Error) => void): this; + + /** Emitted when a message is received on a topic not related to any Thing Shadows */ + on(event: "message", listener: (topic: string, payload: any) => void): this; + + /** + * Emitted when an operation update|get|delete completes. + * + * thingName - name of the Thing Shadow for which the operation has completed + * stat - status of the operation accepted|rejected + * clientToken - the operation"s clientToken + * stateObject - the stateObject returned for the operation + * + * Applications can use clientToken values to correlate status events with + * the operations that they are associated with by saving the clientTokens + * returned from each operation. + */ + on(event: "status", listener: (thingName: string, operationStatus: "accepted" | "rejected", clientToken: string, stateObject: any) => void): this; + + /** Emitted when an operation update|get|delete has timed out. */ + on(event: "timeout", listener: (thingName: string, clientToken: string) => void): this; + + /** Emitted when a delta has been received for a registered Thing Shadow. */ + on(event: "delta", listener: (thingName: string, stateObject: any) => void): this; + + /** Emitted when a different client"s update or delete operation is accepted on the shadow. */ + on(event: "foreignStateChange", listener: (thingName: string, operation: "update" | "delete", stateObject: any) => void): this; +} diff --git a/aws-iot-device-sdk/tsconfig.json b/aws-iot-device-sdk/tsconfig.json new file mode 100644 index 0000000000..a4c761b2a2 --- /dev/null +++ b/aws-iot-device-sdk/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "aws-iot-device-sdk-tests.ts" + ] +} \ No newline at end of file diff --git a/aws-lambda/aws-lambda-tests.ts b/aws-lambda/aws-lambda-tests.ts index cad44082ab..f54c3cc2d4 100644 --- a/aws-lambda/aws-lambda-tests.ts +++ b/aws-lambda/aws-lambda-tests.ts @@ -1,17 +1,18 @@ -import lambda = require('aws-lambda'); +/// var str: string = "any string"; var date: Date = new Date(); var anyObj: any = { abc: 123 }; var num: number = 5; -var identity: lambda.CognitoIdentity; var error: Error = new Error(); var b: boolean = true; -var clientCtx: lambda.ClientContext; +var clientCtx: AWSLambda.ClientContext; +var clientContextEnv: AWSLambda.ClientContextEnv; +var clientContextClient: AWSLambda.ClientContextClient; +var context: AWSLambda.Context; +var identity: AWSLambda.CognitoIdentity; /* Context */ -var context: lambda.Context; - b = context.callbackWaitsForEmptyEventLoop; str = context.functionName; str = context.functionVersion; @@ -24,13 +25,30 @@ identity = context.identity; clientCtx = context.clientContext; /* CognitoIdentity */ -var identity: lambda.CognitoIdentity; - str = identity.cognitoIdentityId; str = identity.cognitoIdentityPoolId; +/* ClientContext */ +clientContextClient = clientCtx.client; +anyObj = clientCtx.Custom; +clientContextEnv = clientCtx.env; + +/* ClientContextEnv */ +str = clientContextEnv.locale; +str = clientContextEnv.make; +str = clientContextEnv.model; +str = clientContextEnv.platform; +str = clientContextEnv.platformVersion; + +/* ClientContextClient */ +str = clientContextClient.appPackageName; +str = clientContextClient.appTitle; +str = clientContextClient.appVersionCode; +str = clientContextClient.appVersionName; +str = clientContextClient.installationId; + /* Callback */ -function callback(cb: lambda.Callback) { +function callback(cb: AWSLambda.Callback) { cb(); cb(null); cb(error); diff --git a/aws-lambda/index.d.ts b/aws-lambda/index.d.ts index 9d91c41de5..a5086eaadf 100644 --- a/aws-lambda/index.d.ts +++ b/aws-lambda/index.d.ts @@ -3,7 +3,6 @@ // Definitions by: James Darbyshire , Michael Skarum , Stef Heyenrath // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - // Context // http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html interface Context { @@ -23,9 +22,9 @@ interface Context { getRemainingTimeInMillis(): number; // Functions for compatibility with earlier Node.js Runtime v0.10.42 - // For more details see http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#nodejs-prog-model-oldruntime-context-methods - done(error?: Error, result?: any): void; - fail(error: Error): void; + // For more details see http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#nodejs-prog-model-oldruntime-context-methods + done(error?: Error, result?: any): void; + fail(error: Error): void; fail(message: string): void; succeed(message: string): void; succeed(object: any): void; @@ -66,4 +65,6 @@ interface ClientContextEnv { * @param error – an optional parameter that you can use to provide results of the failed Lambda function execution. * @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible. */ -export type Callback = (error?: Error, result?: any) => void; \ No newline at end of file +export type Callback = (error?: Error, result?: any) => void; + +export as namespace AWSLambda; \ No newline at end of file diff --git a/aws-lambda/tsconfig.json b/aws-lambda/tsconfig.json index 66d22dcfd7..fe6cbd47c5 100644 --- a/aws-lambda/tsconfig.json +++ b/aws-lambda/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/aws-sdk/aws-sdk-tests.ts b/aws-sdk/aws-sdk-tests.ts index 7d3b7a5c2c..5188a3e725 100644 --- a/aws-sdk/aws-sdk-tests.ts +++ b/aws-sdk/aws-sdk-tests.ts @@ -381,3 +381,42 @@ dynamoDBDocClient.query( else console.log(data); // successful response } ); + +var kinesis = new AWS.Kinesis(); + +var putRecordParam = { + Data: new Buffer('...') || 'STRING_VALUE', /* required */ + PartitionKey: 'STRING_VALUE', /* required */ + StreamName: 'STRING_VALUE', /* required */ + ExplicitHashKey: 'STRING_VALUE', + SequenceNumberForOrdering: 'STRING_VALUE' +}; +kinesis.putRecord(putRecordParam, function(err, data) { + if (err) console.log(err, err.stack); // an error occurred + else console.log(data); // successful response +}); + +var putRecordParams = { + Records: [ /* required */ + { + Data: new Buffer('...') || 'STRING_VALUE', /* required */ + PartitionKey: 'STRING_VALUE', /* required */ + ExplicitHashKey: 'STRING_VALUE' + }, + /* more items */ + ], + StreamName: 'STRING_VALUE' /* required */ +}; +kinesis.putRecords(putRecordParams, function(err, data) { + if (err) console.log(err, err.stack); // an error occurred + else console.log(data); // successful response +}); + +var increaseStreamRetentionPeriodParams = { + RetentionPeriodHours: 0, /* required */ + StreamName: 'STRING_VALUE' /* required */ +}; +kinesis.increaseStreamRetentionPeriod(increaseStreamRetentionPeriodParams, function(err, data) { + if (err) console.log(err, err.stack); // an error occurred + else console.log(data); // successful response +}); \ No newline at end of file diff --git a/aws-sdk/index.d.ts b/aws-sdk/index.d.ts index 7d70edf939..fbee8f926c 100644 --- a/aws-sdk/index.d.ts +++ b/aws-sdk/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for aws-sdk // Project: https://github.com/aws/aws-sdk-js -// Definitions by: midknight41 +// Definitions by: midknight41 , Casper Skydt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/aws-sdk.d.ts @@ -335,6 +335,56 @@ export declare class SNS { publish(request: Sns.PublishRequest, callback: (err: any, data: any) => void): void; } +export class Kinesis { + constructor(options?: any); + endpoint: Endpoint; + + putRecord(params: KINESIS.PutRecordParams, callback: (error: Error, data: KINESIS.PutRecordResult) => void): void; + putRecords(params: KINESIS.PutRecordsParams, callback: (error: Error, data: KINESIS.PutRecordsResult) => void): void; + increaseStreamRetentionPeriod(params: KINESIS.IncreaseStreamRetentionPeriodParams, callback: (error: Error, data: any) => void): void; + } + + export module KINESIS { + export interface Record { + Data: Buffer | string | Blob; + PartitionKey: string; + ExplicitHashKey?: string; + } + + export interface RecordResult { + SequenceNumber: string; + ShardId: string; + ErrorCode: string; + ErrorMessage: string; + } + + export interface PutRecordParams extends Record { + StreamName: string; + SequenceNumberForOrdering?: string; + } + + export interface PutRecordResult { + ShardId: string; + SequenceNumber: string; + } + + export interface PutRecordsParams { + StreamName: string; + Records: Record[]; + } + + export interface PutRecordsResult { + FailedRecordCount: number; + Records: RecordResult[] + } + + export interface IncreaseStreamRetentionPeriodParams { + RetentionPeriodHours: number; + StreamName: string; + } + } + + export declare class SWF { constructor(options?: any); endpoint: Endpoint; @@ -378,7 +428,8 @@ export declare class S3 { endpoint: Endpoint; getObject(params: s3.GetObjectRequest, callback?: (err: Error, data: any) => void): any; - putObject(params: s3.PutObjectRequest, callback: (err: Error, data: any) => void): void; + putObject(params: s3.PutObjectRequest, callback?: (err: Error, data: any) => void): any; + copyObject(params: s3.CopyObjectRequest, callback?: (err: Error, data: any) => void): any; deleteObject(params: s3.DeleteObjectRequest, callback: (err: Error, data: any) => void): void; headObject(params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void; getSignedUrl(operation: string, params: any): string; @@ -616,8 +667,8 @@ export module CloudFormation { ResourceTypes?: string[]; OnFailure?: string[]; // cannot specify both DisableRollback and OnFailure // DO_NOTHING | ROLLBACK | DELETE - StackPolicyBody?: string[]; // cannot specify both StackPolicyBody and StackPolicyURL - StackPolicyURL?: string[]; // cannot specify both StackPolicyBody and StackPolicyURL + StackPolicyBody?: string; // cannot specify both StackPolicyBody and StackPolicyURL + StackPolicyURL?: string; // cannot specify both StackPolicyBody and StackPolicyURL Tags?: CloudFormation.Tag[]; } @@ -2253,6 +2304,40 @@ export declare module s3 { WebsiteRedirectLocation?: string; } + export interface CopyObjectRequest { + Bucket: string; + CopySource: string; + Key: string; + ACL?: string; + CacheControl?: string; + ContentDisposition?: string; + ContentEncoding?: string; + ContentLanguage?: string; + ContentType?: string; + CopySourceIfMatch?: string; + CopySourceIfModifiedSince?: any; + CopySourceIfNoneMatch?: string; + CopySourceIfUnmodifiedSince?: any; + CopySourceSSECustomerAlgorithm?: string; + CopySourceSSECustomerKey?: any; + CopySourceSSECustomerKeyMD5?: string; + Expires?: any; + GrantFullControl?: string; + GrantRead?: string; + GrantReadACP?: string; + GrantWriteACP?: string; + Metadata?: { [key: string]: string; }; + MetadataDirective?: string; + RequestPayer?: string; + SSECustomerAlgorithm?: string; + SSECustomerKey?: any; + SSECustomerKeyMD5?: string; + SSEKMSKeyId?: string; + ServerSideEncryption?: string; + StorageClass?: string; + WebsiteRedirectLocation?: string; + } + export interface GetObjectRequest { Bucket: string; IfMatch?: string; diff --git a/aws-sdk/tsconfig.json b/aws-sdk/tsconfig.json index 2ac0e7b03a..9e94f9b05c 100644 --- a/aws-sdk/tsconfig.json +++ b/aws-sdk/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/aws-serverless-express/aws-serverless-express-tests.ts b/aws-serverless-express/aws-serverless-express-tests.ts index 6a0d7694d9..c46056ed25 100644 --- a/aws-serverless-express/aws-serverless-express-tests.ts +++ b/aws-serverless-express/aws-serverless-express-tests.ts @@ -1,5 +1,4 @@ -/// -/// +/// import * as awsServerlessExpress from 'aws-serverless-express'; import * as express from 'express'; diff --git a/aws-serverless-express/aws-serverless-express.d.ts b/aws-serverless-express/aws-serverless-express.d.ts deleted file mode 100644 index 50aa0e1a0b..0000000000 --- a/aws-serverless-express/aws-serverless-express.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Type definitions for aws-serverless-express -// Project: https://github.com/awslabs/aws-serverless-express -// Definitions by: Ben Speakman -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// - -declare module 'aws-serverless-express' { - - import * as http from 'http'; - import * as lambda from 'aws-lambda'; - - export function createServer( - requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => http.Server, - serverListenCallback?: () => any - ): http.Server; - - export function proxy( - server: http.Server, - event: any, - context: lambda.Context - ): void; -} diff --git a/aws-serverless-express/index.d.ts b/aws-serverless-express/index.d.ts new file mode 100644 index 0000000000..e4601e6ccd --- /dev/null +++ b/aws-serverless-express/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for aws-serverless-express +// Project: https://github.com/awslabs/aws-serverless-express +// Definitions by: Ben Speakman +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +import * as http from 'http'; +import * as lambda from 'aws-lambda'; + +export function createServer( + requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => http.Server, + serverListenCallback?: () => any +): http.Server; + +export function proxy( + server: http.Server, + event: any, + context: lambda.Context +): void; \ No newline at end of file diff --git a/aws-serverless-express/tsconfig.json b/aws-serverless-express/tsconfig.json new file mode 100644 index 0000000000..240c150976 --- /dev/null +++ b/aws-serverless-express/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "aws-serverless-express-tests.ts" + ] +} \ No newline at end of file diff --git a/aws4/aws4-tests.ts b/aws4/aws4-tests.ts new file mode 100644 index 0000000000..b611951e45 --- /dev/null +++ b/aws4/aws4-tests.ts @@ -0,0 +1,24 @@ +/// + +import * as aws4 from "."; + +let requestSigner = new aws4.RequestSigner({}, {}); +requestSigner.matchHost(""); +requestSigner.isSingleRegion(); +requestSigner.createHost(); +requestSigner.prepareRequest(); +requestSigner.sign(); +requestSigner.getDateTime(); +requestSigner.getDate(); +requestSigner.authHeader(); +requestSigner.signature(); +requestSigner.stringToSign(); +requestSigner.canonicalString(); +requestSigner.canonicalHeaders(); +requestSigner.signedHeaders(); +requestSigner.credentialString(); +requestSigner.defaultCredentials(); +requestSigner.parsePath(); +requestSigner.formatPath(); + +aws4.sign({}, {}); diff --git a/aws4/index.d.ts b/aws4/index.d.ts new file mode 100644 index 0000000000..6028be5334 --- /dev/null +++ b/aws4/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for aws4 1.5.0 +// Project: https://github.com/mhart/aws4 +// Definitions by: Andrew Crites +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export class RequestSigner { + constructor(request?: any, credentials?: any); + request: any; + credentials: any; + service: any; + region: any; + isCodeCommitGit: any; + + matchHost(host?: string): string; + isSingleRegion(): boolean; + createHost(): string; + prepareRequest(): void; + sign(): any; + getDateTime(): string; + getDate(): string; + authHeader(): string; + signature(): string; + stringToSign(): string; + canonicalString(): string; + canonicalHeaders(): string; + signedHeaders(): string; + credentialString(): string; + defaultCredentials(): any; + parsePath(): any; + formatPath(): string; +} + +export function sign(options?: any, credentials?: any): any; diff --git a/aws4/tsconfig.json b/aws4/tsconfig.json new file mode 100644 index 0000000000..8887a05d57 --- /dev/null +++ b/aws4/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "aws4-tests.ts" + ] +} \ No newline at end of file diff --git a/axe-core/tsconfig.json b/axe-core/tsconfig.json index 89989f0669..61566d440c 100644 --- a/axe-core/tsconfig.json +++ b/axe-core/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/axios/axios-tests.ts b/axios/axios-tests.ts index a321e97f19..eb98e2710c 100644 --- a/axios/axios-tests.ts +++ b/axios/axios-tests.ts @@ -80,7 +80,11 @@ var axiosInstance = axios.create({ timeout: 1000 }); -axiosInstance.request({url: "issues/1"}); +axiosInstance.request({url: "issues/1"}).then(res => { + if (res.headers['content-type'].startsWith('application/json')) { + throw new Error('Unexpected content-type'); + } +}); axios.all([getRepoDetails, getRepoDetails]).then(([repo1, repo2]) => { var sumIds = repo1.data.id + repo2.data.id; diff --git a/axios/index.d.ts b/axios/index.d.ts index a2c5bfbd45..d66dc3d48c 100644 --- a/axios/index.d.ts +++ b/axios/index.d.ts @@ -159,7 +159,7 @@ declare namespace Axios { /** * headers that the server responded with */ - headers: Object; + headers: {[index: string]: any}; /** * config that was provided to `axios` for the request diff --git a/axios/tsconfig.json b/axios/tsconfig.json index 72c4e742e8..9616b86245 100644 --- a/axios/tsconfig.json +++ b/axios/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/azure-mobile-apps/index.d.ts b/azure-mobile-apps/index.d.ts index b13bfbb803..53dd5edae3 100644 --- a/azure-mobile-apps/index.d.ts +++ b/azure-mobile-apps/index.d.ts @@ -237,7 +237,7 @@ declare namespace Azure.MobileApps { interface SqlParameterDefinition { name: string; value: any; - } + } interface TableDefinition { access?: AccessType; diff --git a/azure-mobile-apps/tsconfig.json b/azure-mobile-apps/tsconfig.json index fe79a01872..b01ae7cd85 100644 --- a/azure-mobile-apps/tsconfig.json +++ b/azure-mobile-apps/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/azure-mobile-services-client/tsconfig.json b/azure-mobile-services-client/tsconfig.json index d6164ec459..7ad1094d69 100644 --- a/azure-mobile-services-client/tsconfig.json +++ b/azure-mobile-services-client/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/azure-sb/tsconfig.json b/azure-sb/tsconfig.json index 5c167b1965..d8e1535f8d 100644 --- a/azure-sb/tsconfig.json +++ b/azure-sb/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/azure/tsconfig.json b/azure/tsconfig.json index 650eddd468..d583eb4b26 100644 --- a/azure/tsconfig.json +++ b/azure/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/babel-code-frame/babel-code-frame-tests.ts b/babel-code-frame/babel-code-frame-tests.ts new file mode 100644 index 0000000000..7047bf88d7 --- /dev/null +++ b/babel-code-frame/babel-code-frame-tests.ts @@ -0,0 +1,14 @@ +import codeFrame = require("babel-code-frame"); + +const code = ` + const number = 1; + var string = 'foo'; + + function print(name: string) { + console.log(string + name); + } +`; + +codeFrame(code, 5, 22); +codeFrame(code, 5, 22, { forceColor: true }); +codeFrame(code, 2, 2, { highlightCode: true }); diff --git a/babel-code-frame/index.d.ts b/babel-code-frame/index.d.ts new file mode 100644 index 0000000000..ebfde63c4c --- /dev/null +++ b/babel-code-frame/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for babel-code-frame 6.20 +// Project: https://github.com/babel/babel/tree/master/packages +// Definitions by: Mohsen Azimi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface BabelCodeFrameOptions { + /** Syntax highlight the code as JavaScript for terminals. default: false*/ + highlightCode?: boolean; + /** The number of lines to show above the error. default: 2 */ + linesBelow?: number; + /** The number of lines to show below the error. default: 3 */ + linesAbove?: number; + /** + * Forcibly syntax highlight the code as JavaScript (for non-terminals); + * overrides highlightCode. + * default: false + */ + forceColor?: boolean; +} + +/** + * Generate errors that contain a code frame that point to source locations. + * + * @param rawLines Raw lines to frame + * @param lineNumber Line number (1 indexed) + * @param colNumber Column number + * @param options Additional options + * + * @returns Framed code + */ +declare function codeFrame( + rawLines: string, + lineNumber: number, + colNumber: number, + options?: BabelCodeFrameOptions +): string; + +export = codeFrame; diff --git a/babel-code-frame/tsconfig.json b/babel-code-frame/tsconfig.json new file mode 100644 index 0000000000..a9f0f8522e --- /dev/null +++ b/babel-code-frame/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "babel-code-frame-tests.ts" + ] +} \ No newline at end of file diff --git a/babel-code-frame/tslint.json b/babel-code-frame/tslint.json new file mode 100644 index 0000000000..ec365f164b --- /dev/null +++ b/babel-code-frame/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/babel-core/tsconfig.json b/babel-core/tsconfig.json index ef8b754c2e..ade9d0e1df 100644 --- a/babel-core/tsconfig.json +++ b/babel-core/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/babel-generator/tsconfig.json b/babel-generator/tsconfig.json index 451aedaed2..ec0fb91c66 100644 --- a/babel-generator/tsconfig.json +++ b/babel-generator/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/babel-template/tsconfig.json b/babel-template/tsconfig.json index de71b61379..b860dd6fdd 100644 --- a/babel-template/tsconfig.json +++ b/babel-template/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/babel-traverse/tsconfig.json b/babel-traverse/tsconfig.json index 174451748f..051af6be38 100644 --- a/babel-traverse/tsconfig.json +++ b/babel-traverse/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/babel-types/tsconfig.json b/babel-types/tsconfig.json index 9b0ab0a68b..1ee708a599 100644 --- a/babel-types/tsconfig.json +++ b/babel-types/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/babelify/tsconfig.json b/babelify/tsconfig.json index bbeccefdbd..dcebf50de4 100644 --- a/babelify/tsconfig.json +++ b/babelify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/babylon/index.d.ts b/babylon/index.d.ts index 112e6be7be..45b929264d 100644 --- a/babylon/index.d.ts +++ b/babylon/index.d.ts @@ -43,5 +43,5 @@ export interface BabylonOptions { export type PluginName = 'jsx' | 'flow' | 'asyncFunctions' | 'classConstructorCall' | 'doExpressions' | 'trailingFunctionCommas' | 'objectRestSpread' | 'decorators' | 'classProperties' | 'exportExtensions' - | 'exponentiationOperator' | 'asyncGenerators' | 'functionBind' | 'functionSent'; + | 'exponentiationOperator' | 'asyncGenerators' | 'functionBind' | 'functionSent' | '*'; diff --git a/babylon/tsconfig.json b/babylon/tsconfig.json index c90afaae01..b7a13bc9fc 100644 --- a/babylon/tsconfig.json +++ b/babylon/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/babylonjs/tsconfig.json b/babylonjs/tsconfig.json index c90afaae01..b7a13bc9fc 100644 --- a/babylonjs/tsconfig.json +++ b/babylonjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/babyparse/tsconfig.json b/babyparse/tsconfig.json index c16df889b1..a4d6d35f99 100644 --- a/babyparse/tsconfig.json +++ b/babyparse/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backbone-associations/tsconfig.json b/backbone-associations/tsconfig.json index 47f983c2c3..b325572261 100644 --- a/backbone-associations/tsconfig.json +++ b/backbone-associations/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backbone-fetch-cache/tsconfig.json b/backbone-fetch-cache/tsconfig.json index 563a475286..2dcd4a6bc2 100644 --- a/backbone-fetch-cache/tsconfig.json +++ b/backbone-fetch-cache/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backbone-relational/tsconfig.json b/backbone-relational/tsconfig.json index afc2caeb37..e2c3f7a731 100644 --- a/backbone-relational/tsconfig.json +++ b/backbone-relational/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backbone.layoutmanager/tsconfig.json b/backbone.layoutmanager/tsconfig.json index 642dc13608..63f89b66b9 100644 --- a/backbone.layoutmanager/tsconfig.json +++ b/backbone.layoutmanager/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backbone.localstorage/tsconfig.json b/backbone.localstorage/tsconfig.json index e1ab0bd7c5..e7fbffcb9b 100644 --- a/backbone.localstorage/tsconfig.json +++ b/backbone.localstorage/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backbone.marionette/tsconfig.json b/backbone.marionette/tsconfig.json index c3e3e6557d..6fc8f27360 100644 --- a/backbone.marionette/tsconfig.json +++ b/backbone.marionette/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backbone.paginator/tsconfig.json b/backbone.paginator/tsconfig.json index b879455a67..81e1895330 100644 --- a/backbone.paginator/tsconfig.json +++ b/backbone.paginator/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backbone.radio/index.d.ts b/backbone.radio/index.d.ts index 9bb47391b1..7596722342 100644 --- a/backbone.radio/index.d.ts +++ b/backbone.radio/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Backbone.Radio v0.8.3 +// Type definitions for Backbone.Radio v0.8.3 // Project: https://github.com/marionettejs/backbone.radio // Definitions by: Peter Palotas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/backbone.radio/tsconfig.json b/backbone.radio/tsconfig.json index ed4e1835a4..6d33b07dbb 100644 --- a/backbone.radio/tsconfig.json +++ b/backbone.radio/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backbone/tsconfig.json b/backbone/tsconfig.json index 6b5ef70c48..b4a63b9ef0 100644 --- a/backbone/tsconfig.json +++ b/backbone/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backgrid/tsconfig.json b/backgrid/tsconfig.json index f43b4df809..0c44162460 100644 --- a/backgrid/tsconfig.json +++ b/backgrid/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/backlog-js/tsconfig.json b/backlog-js/tsconfig.json index cd1d4da21f..bc48446105 100644 --- a/backlog-js/tsconfig.json +++ b/backlog-js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/baconjs/tsconfig.json b/baconjs/tsconfig.json index eedf015d52..45bbf8cad5 100644 --- a/baconjs/tsconfig.json +++ b/baconjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/barcode/tsconfig.json b/barcode/tsconfig.json index 0f59bbcad5..e93f535c98 100644 --- a/barcode/tsconfig.json +++ b/barcode/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bardjs/index.d.ts b/bardjs/index.d.ts index c60330f9d6..d8a5bfd9f0 100644 --- a/bardjs/index.d.ts +++ b/bardjs/index.d.ts @@ -114,7 +114,7 @@ declare namespace bard { * [strings] - same string array you'd use to set fn.$inject * (...string) - string arguments turned into a string array */ - function inject(context?: Function, ...args: string[]): void; + function inject(context?: Function | Mocha.IHookCallbackContext, ...args: string[]): void; /** * Write to console if bard debugging flag is on diff --git a/bardjs/tsconfig.json b/bardjs/tsconfig.json index 75bb47fda6..001cc0e583 100644 --- a/bardjs/tsconfig.json +++ b/bardjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/base-x/tsconfig.json b/base-x/tsconfig.json index 6ba08f785e..e08a602ff1 100644 --- a/base-x/tsconfig.json +++ b/base-x/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/base16/tsconfig.json b/base16/tsconfig.json index 3f076573c6..2de5ed1f03 100644 --- a/base16/tsconfig.json +++ b/base16/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/base64-js/tsconfig.json b/base64-js/tsconfig.json index 0d0c14d324..ed61523cb7 100644 --- a/base64-js/tsconfig.json +++ b/base64-js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ diff --git a/base64-js/tslint.json b/base64-js/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/base64-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file diff --git a/base64url/tsconfig.json b/base64url/tsconfig.json index 9dc406f7ee..e5f6b4b0a6 100644 --- a/base64url/tsconfig.json +++ b/base64url/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bases/bases-tests.ts b/bases/bases-tests.ts index 5414b18764..85aa71406e 100644 --- a/bases/bases-tests.ts +++ b/bases/bases-tests.ts @@ -1,10 +1,9 @@ -/// import * as bases from 'bases'; - -let bs16String: string = bases.toBase(200, 16); // => 'c8' -let bs62String: string = bases.toBase(99999, 62); // => 'q0T' -let customBaseString: string = bases.toAlphabet(300, 'aAbBcC'); // => 'Abba' - -let frombs16Int: number = bases.fromBase('c8', 16); // => 200 -let frombs62Int: number = bases.fromBase('q0T', 62); // => 99999 -let customBaseInt: number = bases.fromAlphabet('Abba', 'aAbBcC'); // => 300 + +let bs16String: string = bases.toBase(200, 16); // => 'c8' +let bs62String: string = bases.toBase(99999, 62); // => 'q0T' +let customBaseString: string = bases.toAlphabet(300, 'aAbBcC'); // => 'Abba' + +let frombs16Int: number = bases.fromBase('c8', 16); // => 200 +let frombs62Int: number = bases.fromBase('q0T', 62); // => 99999 +let customBaseInt: number = bases.fromAlphabet('Abba', 'aAbBcC'); // => 300 diff --git a/bases/bases.d.ts b/bases/bases.d.ts deleted file mode 100644 index 2e62cf685a..0000000000 --- a/bases/bases.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Type definitions for bases 0.2.1 -// Project: https://github.com/aseemk/bases.js -// Definitions by: Hari Krishna -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module "bases" { - export function toAlphabet(num: number, alphabet: string): string; - - export function fromAlphabet(str: string, alphabet: string): number; - - export function toBase(num: number, base: number): string; - - export function fromBase(str: string, base:number): number; - - export let KNOWN_ALPHABETS: any; - - export let NUMERALS: string; - - export let LETTERS_LOWERCASE: string; - - export let LETTERS_UPPERCASE: string; -} diff --git a/bases/index.d.ts b/bases/index.d.ts new file mode 100644 index 0000000000..2111daddf6 --- /dev/null +++ b/bases/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for bases 0.2.1 +// Project: https://github.com/aseemk/bases.js +// Definitions by: Hari Krishna +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function toAlphabet(num: number, alphabet: string): string; + +export function fromAlphabet(str: string, alphabet: string): number; + +export function toBase(num: number, base: number): string; + +export function fromBase(str: string, base:number): number; + +export let KNOWN_ALPHABETS: any; + +export let NUMERALS: string; + +export let LETTERS_LOWERCASE: string; + +export let LETTERS_UPPERCASE: string; diff --git a/bases/tsconfig.json b/bases/tsconfig.json new file mode 100644 index 0000000000..b7d1d27d65 --- /dev/null +++ b/bases/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bases-tests.ts" + ] +} \ No newline at end of file diff --git a/basic-auth/tsconfig.json b/basic-auth/tsconfig.json index be30144a09..cbf7c76632 100644 --- a/basic-auth/tsconfig.json +++ b/basic-auth/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/batch-stream/tsconfig.json b/batch-stream/tsconfig.json index 2bfe010bef..e11bc04a59 100644 --- a/batch-stream/tsconfig.json +++ b/batch-stream/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bazinga-translator/tsconfig.json b/bazinga-translator/tsconfig.json index 23a0f9abdb..327e6b6ec2 100644 --- a/bazinga-translator/tsconfig.json +++ b/bazinga-translator/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bcrypt-nodejs/tsconfig.json b/bcrypt-nodejs/tsconfig.json index 5db2f8ea76..ffe1da2e5f 100644 --- a/bcrypt-nodejs/tsconfig.json +++ b/bcrypt-nodejs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bcrypt/bcrypt-tests.ts b/bcrypt/bcrypt-tests.ts index ec4701dab2..6824549a61 100644 --- a/bcrypt/bcrypt-tests.ts +++ b/bcrypt/bcrypt-tests.ts @@ -1,33 +1,56 @@ import bcrypt = require("bcrypt"); -var num: number; -var str: string; -var bool: boolean; +let num: number; +let str: string; +let bool: boolean; +let error: Error; str = bcrypt.genSaltSync(); str = bcrypt.genSaltSync(num); -bcrypt.genSalt(function (err: Error, salt: string): void { - str = salt; -}); -bcrypt.genSalt(num, function (err: Error, salt: string): void { - str = salt; -}); +bcrypt.genSalt(num, (err: Error, salt: string): void => { error = err; str = salt; }) + .then(salt => str = salt) + .catch(err => error = err); + +bcrypt.genSalt(num) + .then(salt => str = salt) + .catch(err => error = err); + +bcrypt.genSalt((err: Error, salt: string): void => { error = err; str = salt; }) + .then(salt => str = salt) + .catch(err => error = err); + +bcrypt.genSalt() + .then(salt => str = salt) + .catch(err => error = err); + str = bcrypt.hashSync(str, str); str = bcrypt.hashSync(str, num); -bcrypt.hash(str, str, function (err: Error, encrypted: string):void { - str = encrypted; -}) -bcrypt.hash(str, num, function (err: Error, encrypted: string): void { - str = encrypted; -}); +bcrypt.hash(str, str, (err: Error, encrypted: string):void => { str = encrypted; }) + .then(encrypted => str = encrypted) + .catch(err => error = err); +bcrypt.hash(str, str) + .then(encrypted => str = encrypted) + .catch(err => error = err); + +bcrypt.hash(str, num, (err: Error, encrypted: string): void => { str = encrypted; }) + .then(encrypted => str = encrypted) + .catch(err => error = err); +bcrypt.hash(str, num) + .then(encrypted => str = encrypted) + .catch(err => error = err); + bool = bcrypt.compareSync(str, str); -bcrypt.compare(str, str, function (err: Error, same: boolean): void { - bool = same; -}); -num = bcrypt.getRounds(str); \ No newline at end of file +bcrypt.compare(str, str, (err: Error, same: boolean): void => { bool = same; }) + .then(same => bool = same) + .catch(err => error = err); +bcrypt.compare(str, str) + .then(same => bool = same) + .catch(err => error = err); + +num = bcrypt.getRounds(str); diff --git a/bcrypt/index.d.ts b/bcrypt/index.d.ts index d9eafce4ef..98c7ba97fe 100644 --- a/bcrypt/index.d.ts +++ b/bcrypt/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for bcrypt +// Type definitions for bcrypt 1.0 // Project: https://www.npmjs.org/package/bcrypt -// Definitions by: Peter Harris +// Definitions by: Peter Harris , Ayman Nedjmeddine // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,36 +12,28 @@ export declare function genSaltSync(rounds?: number): string; /** * @param rounds The cost of processing the data. Default 10. * @param callback A callback to be fire once the sald has been generated. Uses eio making it asynchronous. + * @return A promise to be either resolved with the generated salt or rejected with an Error */ -export declare function genSalt(rounds: number, callback: (err: Error, salt: string) => void): void; +export declare function genSalt(rounds: number, callback?: (err: Error, salt: string) => void): Promise; /** * @param callback A callback to be fire once the sald has been generated. Uses eio making it asynchronous. + * @return A promise to be either resolved with the generated salt or rejected with an Error */ -export declare function genSalt(callback: (err: Error, salt: string) => void): void; +export declare function genSalt(callback?: (err: Error, salt: string) => void): Promise; /** * @param data The data to be encrypted. * @param salt The salt to be used in encryption. */ -export declare function hashSync(data: any, salt: string): string; -/** - * @param data The data to be encrypted. - * @param rounds A salt will be generated using the rounds specified. - */ -export declare function hashSync(data: any, rounds: number): string; +export declare function hashSync(data: any, saltOrRounds: string | number): string; /** * @param data The data to be encrypted. * @param salt The salt to be used in encryption. * @param callback A callback to be fired once the data has been encrypted. Uses eio making it asynchronous. + * @return A promise to be either resolved with the encrypted data salt or rejected with an Error */ -export declare function hash(data: any, salt: string, callback: (err: Error, encrypted: string) => void): void; -/** - * @param data The data to be encrypted. - * @param rounds A salt will be generated using the rounds specified. - * @param callback A callback to be fired once the data has been encrypted. Uses eio making it asynchronous. - */ -export declare function hash(data: any, rounds: number, callback: (err: Error, encrypted: string) => void): void; +export declare function hash(data: any, saltOrRounds: string | number, callback?: (err: Error, encrypted: string) => void): Promise; /** * @param data The data to be encrypted. @@ -53,12 +45,13 @@ export declare function compareSync(data: any, encrypted: string): boolean; * @param data The data to be encrypted. * @param encrypted The data to be compared against. * @param callback A callback to be fire once the data has been compared. Uses eio making it asynchronous. + * @return A promise to be either resolved with the comparision result salt or rejected with an Error */ -export declare function compare(data: any, encrypted: string, callback: (err: Error, same: boolean) => void): void; +export declare function compare(data: any, encrypted: string, callback?: (err: Error, same: boolean) => void): Promise; /** * Return the number of rounds used to encrypt a given hash - * + * * @param encrypted Hash from which the number of rounds used should be extracted. */ export declare function getRounds(encrypted: string): number; diff --git a/bcrypt/tsconfig.json b/bcrypt/tsconfig.json index 9d1c5fceba..0a545402e6 100644 --- a/bcrypt/tsconfig.json +++ b/bcrypt/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bcryptjs/tsconfig.json b/bcryptjs/tsconfig.json index afa3f32756..9db5b79791 100644 --- a/bcryptjs/tsconfig.json +++ b/bcryptjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/benchmark/tsconfig.json b/benchmark/tsconfig.json index 1d509459d8..cea823638e 100644 --- a/benchmark/tsconfig.json +++ b/benchmark/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/better-curry/tsconfig.json b/better-curry/tsconfig.json index 31370cf1de..c078d7e98d 100644 --- a/better-curry/tsconfig.json +++ b/better-curry/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bezier-easing/tsconfig.json b/bezier-easing/tsconfig.json index 21758ddc9b..9cbb3fb9f2 100644 --- a/bezier-easing/tsconfig.json +++ b/bezier-easing/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bezier-js/tsconfig.json b/bezier-js/tsconfig.json index e86d3238a7..1b6d173a81 100644 --- a/bezier-js/tsconfig.json +++ b/bezier-js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bgiframe/index.d.ts b/bgiframe/index.d.ts index 4959783f72..f8af8990f6 100644 --- a/bgiframe/index.d.ts +++ b/bgiframe/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bgiframe 1.0 +// Type definitions for bgiframe 1.0 // Project: https://github.com/sumegizoltan/BgiFrame // Definitions by: Zoltan Sumegi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bgiframe/tsconfig.json b/bgiframe/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/bgiframe/tsconfig.json +++ b/bgiframe/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/big-integer/tsconfig.json b/big-integer/tsconfig.json index de7bcb9e4a..14bd5ba3fc 100644 --- a/big-integer/tsconfig.json +++ b/big-integer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/big.js/tsconfig.json b/big.js/tsconfig.json index 19da6b94ed..5c6806c797 100644 --- a/big.js/tsconfig.json +++ b/big.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bigint/index.d.ts b/bigint/index.d.ts index 98cb205992..fb252bd57c 100644 --- a/bigint/index.d.ts +++ b/bigint/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for BigInt v5.5.3 +// Type definitions for BigInt v5.5.3 // Project: https://github.com/Evgenus/BigInt // Definitions by: Eugene Chernyshov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bigint/tsconfig.json b/bigint/tsconfig.json index e65612eeb1..962d064254 100644 --- a/bigint/tsconfig.json +++ b/bigint/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bignum/tsconfig.json b/bignum/tsconfig.json index 6faac38c8f..61dcc7492e 100644 --- a/bignum/tsconfig.json +++ b/bignum/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bigscreen/tsconfig.json b/bigscreen/tsconfig.json index ce4fdc543d..1e447a9cf7 100644 --- a/bigscreen/tsconfig.json +++ b/bigscreen/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bind-ponyfill/bind-ponyfill-tests.ts b/bind-ponyfill/bind-ponyfill-tests.ts new file mode 100644 index 0000000000..8c5ba7ec05 --- /dev/null +++ b/bind-ponyfill/bind-ponyfill-tests.ts @@ -0,0 +1,8 @@ +import ponyBind = require('bind-ponyfill'); + +let boundFn: Function; + +boundFn = ponyBind(() => { console.log(this); }, 'Hello world!'); +boundFn = ponyBind((...args: Array) => { console.log(this, ...args); }, 'Hello world!', 'arg1'); +boundFn = ponyBind((...args: Array) => { console.log(this, ...args); }, 'Hello world!', 'arg1', 'arg2'); +boundFn = ponyBind((arg1: string, arg2: number) => { console.log(this, arg1, arg2); }, 'Hello world!', 'arg1', 2); \ No newline at end of file diff --git a/bind-ponyfill/index.d.ts b/bind-ponyfill/index.d.ts new file mode 100644 index 0000000000..8fb2227627 --- /dev/null +++ b/bind-ponyfill/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for bind-ponyfill 0.1.0 +// Project: https://www.npmjs.com/package/bind-ponyfill +// Definitions by: Steve Jenkins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function ponyBind(fn: Function, that: any, ...args: Array): Function; +export = ponyBind; \ No newline at end of file diff --git a/bind-ponyfill/tsconfig.json b/bind-ponyfill/tsconfig.json new file mode 100644 index 0000000000..1253196869 --- /dev/null +++ b/bind-ponyfill/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bind-ponyfill-tests.ts" + ] +} \ No newline at end of file diff --git a/bingmaps/index.d.ts b/bingmaps/index.d.ts index 1e7e464930..95644801c5 100644 --- a/bingmaps/index.d.ts +++ b/bingmaps/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Microsoft.Maps 7.0 +// Type definitions for Microsoft.Maps 7.0 // Project: http://msdn.microsoft.com/en-us/library/gg427611.aspx // Definitions by: Eric Todd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bingmaps/tsconfig.json b/bingmaps/tsconfig.json index 3572f00992..c546d497fc 100644 --- a/bingmaps/tsconfig.json +++ b/bingmaps/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bintrees/bintrees-tests.ts b/bintrees/bintrees-tests.ts new file mode 100644 index 0000000000..707d8e0adf --- /dev/null +++ b/bintrees/bintrees-tests.ts @@ -0,0 +1,14 @@ +import { BinTree, RBTree } from 'bintrees'; + +let treeA = new RBTree((a:number, b:number) => a - b); + +treeA.insert(5); +treeA.insert(3); +treeA.remove(3); + +let treeB = new BinTree((a:string, b:string) => a.length - b.length); + +treeB.insert('hi'); +treeB.insert('there'); +treeB.insert('how'); +treeB.insert('are'); diff --git a/bintrees/index.d.ts b/bintrees/index.d.ts new file mode 100644 index 0000000000..9853be67dc --- /dev/null +++ b/bintrees/index.d.ts @@ -0,0 +1,61 @@ +// Type definitions for bintrees 1.0.1 +// Project: https://github.com/vadimg/js_bintrees +// Definitions by: Cayle Sharrock +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'bintrees' { + + type Callback = (err: Error, item: T) => void; + type Comparator = (a: T, b: T) => number; + + class Iterator { + constructor(tree: TreeBase); + + data(): T; + + next(): T; + + prev(): T; + } + + class TreeBase { + size: number; + + clear(): void; + + find(data: T): T; + + findIter(data: T): Iterator; + + lowerBound(item: T): Iterator; + + upperBound(item: T): Iterator; + + min(): T; + + max(): T; + + iterator(): Iterator; + + each(cb: Callback): void; + + reach(cb: Callback): void; + } + + + export class RBTree extends TreeBase { + constructor(comparator: Comparator); + + insert(item: T): boolean; + + remove(item: T): boolean; + } + + export class BinTree extends TreeBase { + constructor(comparator: Comparator); + + insert(item: T): boolean; + + remove(item: T): boolean; + } +} diff --git a/bintrees/tsconfig.json b/bintrees/tsconfig.json new file mode 100644 index 0000000000..d97622d9f8 --- /dev/null +++ b/bintrees/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bintrees-tests.ts" + ] +} \ No newline at end of file diff --git a/bip21/tsconfig.json b/bip21/tsconfig.json index c1ed6e8d86..050c9a1cdf 100644 --- a/bip21/tsconfig.json +++ b/bip21/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bit-array/tsconfig.json b/bit-array/tsconfig.json index 723db8fc00..943e7295cc 100644 --- a/bit-array/tsconfig.json +++ b/bit-array/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bitwise-xor/index.d.ts b/bitwise-xor/index.d.ts index c0a129fa70..9960023c97 100644 --- a/bitwise-xor/index.d.ts +++ b/bitwise-xor/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bitwise-xor 0.0.0 +// Type definitions for bitwise-xor 0.0.0 // Project: https://github.com/czzarr/node-bitwise-xor // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bitwise-xor/tsconfig.json b/bitwise-xor/tsconfig.json index c6044c1880..8a5de02f2b 100644 --- a/bitwise-xor/tsconfig.json +++ b/bitwise-xor/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bl/tsconfig.json b/bl/tsconfig.json index c7f3719dc8..d25057ecc4 100644 --- a/bl/tsconfig.json +++ b/bl/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/blazy/tsconfig.json b/blazy/tsconfig.json index 51d772f56d..6357e236df 100644 --- a/blazy/tsconfig.json +++ b/blazy/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/blessed/tsconfig.json b/blessed/tsconfig.json index 4bd9b84009..999cea2c7b 100644 --- a/blessed/tsconfig.json +++ b/blessed/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/blissfuljs/tsconfig.json b/blissfuljs/tsconfig.json index f1de3afe28..c0cb6bbbe1 100644 --- a/blissfuljs/tsconfig.json +++ b/blissfuljs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/blob-stream/tsconfig.json b/blob-stream/tsconfig.json index 144a9bdaf3..70fbfb30cd 100644 --- a/blob-stream/tsconfig.json +++ b/blob-stream/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/blocks/tsconfig.json b/blocks/tsconfig.json index 9ff49001dc..77fab8218d 100644 --- a/blocks/tsconfig.json +++ b/blocks/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/blue-tape/tsconfig.json b/blue-tape/tsconfig.json index 122eb01fed..9fa54bd259 100644 --- a/blue-tape/tsconfig.json +++ b/blue-tape/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bluebird-retry/index.d.ts b/bluebird-retry/index.d.ts index 2881d2065c..22c7b1c95e 100644 --- a/bluebird-retry/index.d.ts +++ b/bluebird-retry/index.d.ts @@ -16,6 +16,7 @@ declare namespace retry { max_interval?: number; timeout?: number; max_tries?: number; + predicate?: any; } } diff --git a/bluebird-retry/tsconfig.json b/bluebird-retry/tsconfig.json index 8c95b9f8d9..4eaa47aaf6 100644 --- a/bluebird-retry/tsconfig.json +++ b/bluebird-retry/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index 1591d1c3a5..ea1ea69882 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -336,6 +336,29 @@ fooOrBarProm = fooProm.caught(Promise.CancellationError, (reason: any) => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{ + class CustomError extends Error { + public customField: number; + } + fooProm = fooProm.catch(CustomError, reason => { + let a: number = reason.customField + }) +} + +{ + class CustomErrorWithConstructor extends Error { + constructor(public arg1: boolean, public arg2: number) { + super(); + }; + } + fooProm = fooProm.catch(CustomErrorWithConstructor, reason => { + let a: boolean = reason.arg1; + let b: number = reason.arg2; + }) +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + barProm = fooProm.error((reason: any) => { return bar; }); diff --git a/bluebird/index.d.ts b/bluebird/index.d.ts index 10077179e8..3087abb2e5 100644 --- a/bluebird/index.d.ts +++ b/bluebird/index.d.ts @@ -65,14 +65,19 @@ declare class Bluebird implements Bluebird.Thenable, Bluebird.Inspection boolean, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; caught(predicate: (error: any) => boolean, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + catch(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; caught(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; - catch(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; - caught(ErrorClass: Function, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; - catch(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; - caught(ErrorClass: Function, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; + + catch(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + caught(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + + catch(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | Bluebird.Thenable): Bluebird; + caught(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | Bluebird.Thenable): Bluebird; + catch(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; caught(predicate: Object, onReject: (error: any) => R | Bluebird.Thenable | void | Bluebird.Thenable): Bluebird; + catch(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; caught(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable): Bluebird; diff --git a/bluebird/tsconfig.json b/bluebird/tsconfig.json index 72e3f2fcc4..8e871c9e34 100644 --- a/bluebird/tsconfig.json +++ b/bluebird/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es5", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/blueimp-md5/tsconfig.json b/blueimp-md5/tsconfig.json index a2cb1cf007..5cae250d0d 100644 --- a/blueimp-md5/tsconfig.json +++ b/blueimp-md5/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/body-parser/tsconfig.json b/body-parser/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/body-parser/tsconfig.json +++ b/body-parser/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bonjour/bonjour-tests.ts b/bonjour/bonjour-tests.ts index b97794b071..1ae8a218fe 100644 --- a/bonjour/bonjour-tests.ts +++ b/bonjour/bonjour-tests.ts @@ -1,4 +1,3 @@ -/// import * as bonjour from 'bonjour'; var bonjourOptions: bonjour.BonjourOptions; diff --git a/bonjour/bonjour.d.ts b/bonjour/bonjour.d.ts deleted file mode 100644 index 0ffd9f1171..0000000000 --- a/bonjour/bonjour.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -// Type definitions for bonjour v3.5.0 -// Project: https://github.com/watson/bonjour -// Definitions by: Quentin Lampin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare module "bonjour" { - export interface BonjourOptions { - multicast?: boolean; - interface?: string; - port?: number; - ip?: string; - ttl?: number; - loopback?: boolean; - reuseAddr?: boolean; - } - - export interface BrowserOptions { - type?: string; - subtypes?: string[]; - protocol?: string; - txt?: Object; - } - - export interface ServiceOptions { - name: string; - host?: string; - port: number; - type: string; - subtypes?: string[]; - protocol?: 'udp'|'tcp'; - txt?: Object; - } - - export interface Service { - name: string; - type: string; - subtypes: string[]; - protocol: string; - host: string; - port: number; - fqdn: string; - rawTxt: Object; - txt: Object; - published: boolean; - - stop: (cb: ()=>any) => void; - start: () => void; - } - - export class Bonjour { - - constructor(opts: BonjourOptions); - publish(options: ServiceOptions):Service; - unpublishAll(cb: ()=>any): void; - find(options:BrowserOptions, onUp: ()=>any): Browser; - findOne(options:any, cb: (service: Service)=>any): Browser; - destroy():void; - } - - export class Browser { - services: Service[]; - - start():void; - update():void; - stop():void; - } - - export function find(options: BrowserOptions, onUp?: ()=>any): Browser; - export function findOne(options: BrowserOptions): Browser; - -} diff --git a/bonjour/index.d.ts b/bonjour/index.d.ts new file mode 100644 index 0000000000..0eb5b584c0 --- /dev/null +++ b/bonjour/index.d.ts @@ -0,0 +1,68 @@ +// Type definitions for bonjour v3.5.0 +// Project: https://github.com/watson/bonjour +// Definitions by: Quentin Lampin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface BonjourOptions { + multicast?: boolean; + interface?: string; + port?: number; + ip?: string; + ttl?: number; + loopback?: boolean; + reuseAddr?: boolean; +} + +export interface BrowserOptions { + type?: string; + subtypes?: string[]; + protocol?: string; + txt?: Object; +} + +export interface ServiceOptions { + name: string; + host?: string; + port: number; + type: string; + subtypes?: string[]; + protocol?: 'udp'|'tcp'; + txt?: Object; +} + +export interface Service { + name: string; + type: string; + subtypes: string[]; + protocol: string; + host: string; + port: number; + fqdn: string; + rawTxt: Object; + txt: Object; + published: boolean; + + stop: (cb: ()=>any) => void; + start: () => void; +} + +export class Bonjour { + + constructor(opts: BonjourOptions); + publish(options: ServiceOptions):Service; + unpublishAll(cb: ()=>any): void; + find(options:BrowserOptions, onUp: ()=>any): Browser; + findOne(options:any, cb: (service: Service)=>any): Browser; + destroy():void; +} + +export class Browser { + services: Service[]; + + start():void; + update():void; + stop():void; +} + +export function find(options: BrowserOptions, onUp?: ()=>any): Browser; +export function findOne(options: BrowserOptions): Browser; diff --git a/bonjour/tsconfig.json b/bonjour/tsconfig.json new file mode 100644 index 0000000000..08edb275c4 --- /dev/null +++ b/bonjour/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bonjour-tests.ts" + ] +} \ No newline at end of file diff --git a/bookshelf/bookshelf-tests.ts b/bookshelf/bookshelf-tests.ts index 8c59b88413..5b743bef71 100644 --- a/bookshelf/bookshelf-tests.ts +++ b/bookshelf/bookshelf-tests.ts @@ -2,6 +2,7 @@ import * as Knex from 'knex'; import * as Bookshelf from 'bookshelf'; import * as assert from 'assert'; import * as express from 'express'; +import * as _ from "lodash"; /** * The examples/tests below follow Bookshelf documentation chapter after chapter: http://bookshelfjs.org/ @@ -296,7 +297,7 @@ class Account extends bookshelf.Model { } { var checkit = require('checkit'); - + //todo: make sure this works with BlueBird 3.0 var bcrypt:any; // = Promise.promisifyAll(require('bcrypt')); diff --git a/bookshelf/tsconfig.json b/bookshelf/tsconfig.json index 6c039f8a8c..da566d66b8 100644 --- a/bookshelf/tsconfig.json +++ b/bookshelf/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/boolify-string/tsconfig.json b/boolify-string/tsconfig.json index 6d944e29d8..82d9ff7875 100644 --- a/boolify-string/tsconfig.json +++ b/boolify-string/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/boom/tsconfig.json b/boom/tsconfig.json index c517abebcb..2ff569cd92 100644 --- a/boom/tsconfig.json +++ b/boom/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootbox/tsconfig.json b/bootbox/tsconfig.json index a48da8b93d..b088f79e39 100644 --- a/bootbox/tsconfig.json +++ b/bootbox/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootpag/tsconfig.json b/bootpag/tsconfig.json index 0a64673ec3..6760ddda5c 100644 --- a/bootpag/tsconfig.json +++ b/bootpag/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootstrap-datepicker/index.d.ts b/bootstrap-datepicker/index.d.ts index 1f9fd065d2..a692b663bb 100644 --- a/bootstrap-datepicker/index.d.ts +++ b/bootstrap-datepicker/index.d.ts @@ -12,7 +12,7 @@ * “w” (week), “m” (month), and “y” (year). * * See online docs for more info: - * http://bootstrap-datepicker.readthedocs.org/en/release/options.html + * https://bootstrap-datepicker.readthedocs.io/en/latest/options.html */ interface DatepickerOptions { format?: string | DatepickerCustomFormatOptions; @@ -37,6 +37,11 @@ interface DatepickerOptions { orientation?: string; assumeNearbyYear?: any; viewMode?: string; + templates?: any; + zIndexOffset?: number; + showOnFocus?: boolean; + immediateUpdates?: boolean; + title?: string; } interface DatepickerCustomFormatOptions { diff --git a/bootstrap-datepicker/tsconfig.json b/bootstrap-datepicker/tsconfig.json index 76815ada13..95e18e8189 100644 --- a/bootstrap-datepicker/tsconfig.json +++ b/bootstrap-datepicker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "index.d.ts", "bootstrap-datepicker-tests.ts" ] -} +} \ No newline at end of file diff --git a/bootstrap-fileinput/bootstrap-fileinput.d.ts b/bootstrap-fileinput/index.d.ts similarity index 99% rename from bootstrap-fileinput/bootstrap-fileinput.d.ts rename to bootstrap-fileinput/index.d.ts index 139ca2c490..b7dcd6fd16 100644 --- a/bootstrap-fileinput/bootstrap-fileinput.d.ts +++ b/bootstrap-fileinput/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bootstrap-fileinput +// Type definitions for bootstrap-fileinput // Project: https://github.com/kartik-v/bootstrap-fileinput // Definitions by: Ché Coxshall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bootstrap-fileinput/tsconfig.json b/bootstrap-fileinput/tsconfig.json index 5b7c6fc2bf..bf97b93a4d 100644 --- a/bootstrap-fileinput/tsconfig.json +++ b/bootstrap-fileinput/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,6 +14,6 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "bootstrap-fileinput.d.ts" + "index.d.ts" ] } \ No newline at end of file diff --git a/bootstrap-maxlength/tsconfig.json b/bootstrap-maxlength/tsconfig.json index aa05acba0c..a4daca7b77 100644 --- a/bootstrap-maxlength/tsconfig.json +++ b/bootstrap-maxlength/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootstrap-notify/tsconfig.json b/bootstrap-notify/tsconfig.json index 242a7aa566..c13c33a92b 100644 --- a/bootstrap-notify/tsconfig.json +++ b/bootstrap-notify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootstrap-select/bootstrap-select-tests.ts b/bootstrap-select/bootstrap-select-tests.ts new file mode 100644 index 0000000000..e2e8c88560 --- /dev/null +++ b/bootstrap-select/bootstrap-select-tests.ts @@ -0,0 +1,40 @@ +/// + +$(".selectpicker").selectpicker({ + actionsBox: true, + container: "body", + countSelectedText: "counts > #", + deselectAllText: "test", + dropdownAlignRight: true, + dropupAuto: true, + header: "test", + hideDisabled: true, + iconBase: "fa", + liveSearch: true, + liveSearchNormalize: true, + liveSearchPlaceholder: "test", + liveSearchStyle: "contains", + maxOptions: 10, + maxOptionsText: "test", + mobile: true, + multipleSeparator: ", ", + noneSelectedText: "test", + selectAllText: "test", + selectedTextFormat: "values", + selectOnTab: true, + showContent: true, + showIcon: true, + showSubtext: true, + showTick: true, + size: "auto", + style: "test", + tickIcon: "test", + title: "test", + width: "auto" +}) + +$(".selectpicker").selectpicker("val", "foo") +$(".selectpicker").selectpicker("val", ["foo", "bar"]) +$(".selectpicker").selectpicker("selectAll") +$(".selectpicker").selectpicker("setStyle", "btn-large", "add") + diff --git a/bootstrap-select/index.d.ts b/bootstrap-select/index.d.ts new file mode 100644 index 0000000000..5f511685ba --- /dev/null +++ b/bootstrap-select/index.d.ts @@ -0,0 +1,44 @@ +// Type definitions for bootstrap-select v1.11.2 +// Project: https://silviomoreto.github.io/bootstrap-select/ +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface BootstrapSelectOptions { + actionsBox?: boolean + container?: string | boolean + countSelectedText?: string | Function + deselectAllText?: string + dropdownAlignRight?: string | boolean + dropupAuto?: boolean + header?: string + hideDisabled?: boolean + iconBase?: string + liveSearch?: boolean + liveSearchNormalize?: boolean + liveSearchPlaceholder?: string + liveSearchStyle?: string + maxOptions?: number | boolean + maxOptionsText?: string | Array | Function + mobile?: boolean + multipleSeparator?: string + noneSelectedText?: string + selectAllText?: string + selectedTextFormat?: string + selectOnTab?: boolean + showContent?: boolean + showIcon?: boolean + showSubtext?: boolean + showTick?: boolean + size?: string | number | boolean + style?: string + tickIcon?: string + title?: string + width?: string | boolean +} + +interface JQuery { + selectpicker(opts?: BootstrapSelectOptions): void + selectpicker(method: string, ...args: Array>): void +} diff --git a/bootstrap-select/tsconfig.json b/bootstrap-select/tsconfig.json new file mode 100644 index 0000000000..b947cab95c --- /dev/null +++ b/bootstrap-select/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bootstrap-select-tests.ts" + ] +} \ No newline at end of file diff --git a/bootstrap-slider/tsconfig.json b/bootstrap-slider/tsconfig.json index e6f6a59569..03e9cbfbab 100644 --- a/bootstrap-slider/tsconfig.json +++ b/bootstrap-slider/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootstrap-switch/index.d.ts b/bootstrap-switch/index.d.ts index fe6d5f5a0c..302e4f8735 100644 --- a/bootstrap-switch/index.d.ts +++ b/bootstrap-switch/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Bootstrap Switch +// Type definitions for Bootstrap Switch // Project: http://www.bootstrap-switch.org/ // Definitions by: John M. Baughman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bootstrap-switch/tsconfig.json b/bootstrap-switch/tsconfig.json index a68da8f473..618011fead 100644 --- a/bootstrap-switch/tsconfig.json +++ b/bootstrap-switch/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootstrap-table/bootstrap-table-tests.ts b/bootstrap-table/bootstrap-table-tests.ts new file mode 100644 index 0000000000..6336ba4f8d --- /dev/null +++ b/bootstrap-table/bootstrap-table-tests.ts @@ -0,0 +1 @@ +$().bootstrapTable({}); diff --git a/bootstrap-table/bootstrap-table.d.ts b/bootstrap-table/index.d.ts similarity index 87% rename from bootstrap-table/bootstrap-table.d.ts rename to bootstrap-table/index.d.ts index d0356dff84..5ed1b5e529 100644 --- a/bootstrap-table/bootstrap-table.d.ts +++ b/bootstrap-table/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Talat Baig // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// interface JQuery { bootstrapTable(options?: any): JQuery; diff --git a/bootstrap-table/tsconfig.json b/bootstrap-table/tsconfig.json new file mode 100644 index 0000000000..05ecd1dc75 --- /dev/null +++ b/bootstrap-table/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bootstrap-table-tests.ts" + ] +} \ No newline at end of file diff --git a/bootstrap-touchspin/index.d.ts b/bootstrap-touchspin/index.d.ts index 268a33df38..3026560f02 100644 --- a/bootstrap-touchspin/index.d.ts +++ b/bootstrap-touchspin/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Bootstrap TouchSpin +// Type definitions for Bootstrap TouchSpin // Project: http://www.virtuosoft.eu/code/bootstrap-touchspin/ // Definitions by: Albin Sunnanbo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bootstrap-touchspin/tsconfig.json b/bootstrap-touchspin/tsconfig.json index 6fb5318338..d72a9c0f92 100644 --- a/bootstrap-touchspin/tsconfig.json +++ b/bootstrap-touchspin/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootstrap.paginator/tsconfig.json b/bootstrap.paginator/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/bootstrap.paginator/tsconfig.json +++ b/bootstrap.paginator/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootstrap.timepicker/index.d.ts b/bootstrap.timepicker/index.d.ts index b1325323af..417f385526 100644 --- a/bootstrap.timepicker/index.d.ts +++ b/bootstrap.timepicker/index.d.ts @@ -5,9 +5,12 @@ /// -interface TimeickerOptions { - defaultTime?: string; +interface TimepickerOptions { + defaultTime?: string|boolean; disableFocus?: boolean; + disableMousewheel?: boolean; + explicitMode?: boolean; + icons?: TimepickerIconOptions; isOpen?: boolean; minuteStep?: number; modalBackdrop?: boolean; @@ -15,13 +18,32 @@ interface TimeickerOptions { showSeconds?: boolean; showInputs?: boolean; showMeridian?: boolean; - template?: string; + template?: string|boolean; appendWidgetTo?: string; + maxHours?: number; + snapToStep?: boolean; +} + +interface TimepickerIconOptions { + up?: string; + down?: string; +} + +interface TimepickerTime { + value?: string; + hours?: number; + minutes?: number; + seconds?: number; + meridian?: string; } interface JQuery { timepicker(): JQuery; timepicker(methodName: string): JQuery; timepicker(methodName: string, params: any): JQuery; - timepicker(options: TimeickerOptions): JQuery; + timepicker(options: TimepickerOptions): JQuery; +} + +interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { + time?: TimepickerTime; } diff --git a/bootstrap.timepicker/tsconfig.json b/bootstrap.timepicker/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/bootstrap.timepicker/tsconfig.json +++ b/bootstrap.timepicker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootstrap.v3.datetimepicker/index.d.ts b/bootstrap.v3.datetimepicker/index.d.ts index 942a9da56d..565ad9a356 100644 --- a/bootstrap.v3.datetimepicker/index.d.ts +++ b/bootstrap.v3.datetimepicker/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Bootstrap 3 Datepicker v4.17.37 +// Type definitions for Bootstrap 3 Datepicker v4.17.37 // Project: http://eonasdan.github.io/bootstrap-datetimepicker // Definitions by: Katona Péter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bootstrap.v3.datetimepicker/tsconfig.json b/bootstrap.v3.datetimepicker/tsconfig.json index 9687ed171c..2eef3f5e3f 100644 --- a/bootstrap.v3.datetimepicker/tsconfig.json +++ b/bootstrap.v3.datetimepicker/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bootstrap/tsconfig.json b/bootstrap/tsconfig.json index cef6cee74d..6e2189e5bf 100644 --- a/bootstrap/tsconfig.json +++ b/bootstrap/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bounce.js/tsconfig.json b/bounce.js/tsconfig.json index 21e0c7c332..d06c697a6b 100644 --- a/bounce.js/tsconfig.json +++ b/bounce.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bowser/tsconfig.json b/bowser/tsconfig.json index 5261c0e68b..51ffd1dd85 100644 --- a/bowser/tsconfig.json +++ b/bowser/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/box2d/tsconfig.json b/box2d/tsconfig.json index 8333376bb5..426500dcfd 100644 --- a/box2d/tsconfig.json +++ b/box2d/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/braintree-web/index.d.ts b/braintree-web/index.d.ts index e58cf7455b..6d896a5efe 100644 --- a/braintree-web/index.d.ts +++ b/braintree-web/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Braintree-web v3.5.0 +// Type definitions for Braintree-web v3.6.1 // Project: https://github.com/braintree/braintree-web // Definitions by: Guy Shahine // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -97,7 +97,7 @@ declare namespace BraintreeWeb { // billingContact // Billing contact information for the user. // countryCode -//Required.The merchants two- letter ISO 3166 country code. +//Required.The merchant’s two- letter ISO 3166 country code. // currencyCode // Required.The three- letter ISO 4217 currency code for the payment. // lineItems @@ -427,10 +427,10 @@ declare namespace BraintreeWeb { * Used by other modules to formulate all network requests to the Braintree gateway. It is also capable of being used directly from your own form to tokenize credit card information. However, be sure to satisfy PCI compliance if you use direct card tokenization. * @public * @param {object} options Request options: - * @param {string} options.method HTTP method. i.e. "get" or "post" - * @param {string} options.endpoint Enpoint path. i.e. "payment_methods" + * @param {string} options.method HTTP method, e.g. "get" or "post" + * @param {string} options.endpoint Endpoint path. e.g. "payment_methods" * @param {object} options.data Data to send with the request - * @param {string} [options.timeout=60000] Timeout limit + * @param {number} [options.timeout=60000] Set a timeout (in milliseconds) for the request. * @param {callback} callback The second argument, data, is the returned server data. * @example * Direct Credit Card Tokenization @@ -447,6 +447,9 @@ declare namespace BraintreeWeb { * expirationDate: form['cc-date'].value, * billingAddress: { * postalCode: form['cc-postal'].value + * }, + * options: { + * validate: false * } * } * }; @@ -459,6 +462,7 @@ declare namespace BraintreeWeb { * method: 'post', * data: data * }, function (requestErr, response) { + * // More detailed example of handling API errors: https://codepen.io/braintree/pen/MbwjdM * if (requestErr) { throw new Error(requestErr); } * * console.log('Got nonce:', response.creditCards[0].nonce); @@ -477,6 +481,7 @@ declare namespace BraintreeWeb { /** * @static * @function create + * @description Creates a DataCollector instance. Requires advanced fraud protection to be enabled in the Braintree gateway. Contact our [support team](mailto:support@braintreepayments.com) to configure your Kount ID. * @param {object} options Creation options: * @param {Client} options.client A {@link Client} instance. * @param {boolean} [options.kount] If true, Kount fraud data collection is enabled. @@ -498,7 +503,7 @@ declare namespace BraintreeWeb { * @global * @name DataCollector * @description Do not use this constructor directly. Use {@link module:braintree-web/data-collector.create|braintree-web.data-collector.create} instead. - * @classdesc This class is used for advanced fraud integration with PayPal and Kount. Instances of this class have {@link DataCollector#deviceData|deviceData} which is used to correlate user sessions with server transactions. + * @classdesc This class is used for advanced fraud integration with PayPal and Kount. Instances of this class have {@link DataCollector#deviceData|deviceData} which is used to correlate user sessions with server transactions. Before using DataCollector, make sure you have enabled advanced fraud protection in the Braintree gateway. To use your own Kount ID, contact our support team ([support@braintreepayments.com](mailto:support@braintreepayments.com) or [877.434.2894](tel:877.434.2894)). */ export class DataCollector { /** @@ -740,7 +745,33 @@ declare namespace BraintreeWeb { * * These are the CSS properties that Hosted Fields supports. Any other CSS should be specified on your page and outside of any Braintree configuration. Trying to set unsupported properties will fail and put a warning in the console. * - * `color` `font-family` `font-size-adjust` `font-size` `font-stretch` `font-style` `font-variant-alternates` `font-variant-caps` `font-variant-east-asian` `font-variant-ligatures` `font-variant-numeric` `font-variant` `font-weight` `font` `line-height` `opacity` `outline` `text-shadow` `transition` `-moz-osx-font-smoothing` `-moz-tap-highlight-color` `-moz-transition` `-webkit-font-smoothing` `-webkit-tap-highlight-color` `-webkit-transition` + * Supported CSS properties are: + * `color` + * `font-family` + * `font-size-adjust` + * `font-size` + * `font-stretch` + * `font-style` + * `font-variant-alternates` + * `font-variant-caps` + * `font-variant-east-asian` + * `font-variant-ligatures` + * `font-variant-numeric` + * `font-variant` + * `font-weight` + * `font` + * `letter-spacing` + * `line-height` + * `opacity` + * `outline` + * `text-shadow` + * `transition` + * `-moz-osx-font-smoothing` + * `-moz-tap-highlight-color` + * `-moz-transition` + * `-webkit-font-smoothing` + * `-webkit-tap-highlight-color` + * `-webkit-transition` * @typedef {object} styleOptions */ styleOptions: any; @@ -782,7 +813,7 @@ declare namespace BraintreeWeb { * }); * @returns {void} */ - on(event: string, handler: (() => any)): void; + on(event: string, handler: ((event: any) => any)): void; /** * Cleanly tear down anything set up by {@link module:braintree-web/hosted-fields.create|create} @@ -976,7 +1007,9 @@ declare namespace BraintreeWeb { * @property {string} details.shippingAddress.postalCode Postal code. * @property {string} details.shippingAddress.countryCode 2 character country code (e.g. US). * @property {?object} details.billingAddress User's billing address details. - * You will also need to enable the PayPal Billing Address Request feature in your PayPal account. + * Not available to all merchants; [contact PayPal](https://developers.braintreepayments.com/support/guides/paypal/setup-guide#contacting-paypal-support) for details on eligibility and enabling this feature. + * To enable this feature, [contact PayPal](https://developers.braintreepayments.com/support/guides/paypal/setup-guide#contacting-paypal-support). + * Alternatively, see `shippingAddress` above as an available client opt * To enable this feature, [contact PayPal](https://developers.braintreepayments.com/support/guides/paypal/setup-guide#contacting-paypal-support). * @property {string} details.billingAddress.line1 Street number and name. * @property {string} details.billingAddress.line2 Extended address. @@ -1029,7 +1062,7 @@ declare namespace BraintreeWeb { * @param {Client} options.client A {@link Client} instance. * @param {callback} callback The second argument, `data`, is the {@link PayPal} instance. * @example - * braintree.paypal.create( + * braintree.paypal.create({ * client: clientInstance * }, function (createErr, paypalInstance) { * if (createErr) { @@ -1039,7 +1072,7 @@ declare namespace BraintreeWeb { * console.error('Error!', createErr); * } * } - * } + * }); * @returns {void} */ create: (options: { client: Client }, callback: callback) => void; @@ -1083,7 +1116,33 @@ declare namespace BraintreeWeb { * @param {string|number} [options.amount] The amount of the transaction. Required when using the Checkout flow. * @param {string} [options.currency] The currency code of the amount, such as 'USD'. Required when using the Checkout flow. * @param {string} [options.displayName] The merchant name displayed inside of the PayPal lightbox; defaults to the company name on your Braintree account - * @param {string} [options.locale=en_US] Use this option to change the language, links, and terminology used in the PayPal flow to suit the country and language of your customer. + * @param {string} [options.locale=en_US] Use this option to change the language, links, and terminology used in the PayPal flow. This locale will be used unless the buyer has set a preferred locale for their account. If an unsupported locale is supplied, a fallback locale (determined by buyer preference or browser data) will be used and no error will be thrown. + * + * Supported locales are: + * `da_DK`, + * `de_DE`, + * `en_AU`, + * `en_GB`, + * `en_US`, + * `es_ES`, + * `fr_CA`, + * `fr_FR`, + * `id_ID`, + * `it_IT`, + * `ja_JP`, + * `ko_KR`, + * `nl_NL`, + * `no_NO`, + * `pl_PL`, + * `pt_BR`, + * `pt_PT`, + * `ru_RU`, + * `sv_SE`, + * `th_TH`, + * `zh_CN`, + * `zh_HK`, + * and `zh_TW`. + * * @param {boolean} [options.enableShippingAddress=false] Returns a shipping address object in {@link PayPal#tokenize}. * @param {object} [options.shippingAddressOverride] Allows you to pass a shipping address you have already collected into the PayPal payment flow. * @param {string} options.shippingAddressOverride.line1 Street address. @@ -1603,6 +1662,134 @@ declare namespace BraintreeWeb { public teardown(callback?: callback): void; } + + /** + * @module braintree-web/us-bank-account + * @description This module is for accepting payments of US bank accounts. + */ + export interface USBankAccount { + /** + * @static + * @function create + * @param {object} options Creation options: + * @param {Client} options.client A {@link Client} instance. + * @param {callback} callback The second argument, `data`, is the {@link USBankAccount} instance. + * @returns {void} + */ + create: (options: { client: Client }, callback: callback) => void; + + /** + * @description The current version of the SDK, i.e. `{@pkg version}`. + * @type {string} + */ + VERSION: string; + } + + /** + * @class + * @param {object} options See {@link module:braintree-web/us-bank-account.create|us-bank-account.create}. + * @classdesc This class represents a US Bank Account component. Instances of this class can tokenize raw bank details or present a bank login. You cannot use this constructor directly. Use {@link module:braintree-web/us-bank-account.create|braintree.us-bank-account.create} instead. + */ + export class USBankAccount { + /** + * @class + * @param {object} options See {@link module:braintree-web/us-bank-account.create|us-bank-account.create}. + * @classdesc This class represents a US Bank Account component. Instances of this class can tokenize raw bank details or present a bank login. You cannot use this constructor directly. Use {@link module:braintree-web/us-bank-account.create|braintree.us-bank-account.create} instead. + */ + constructor(options: any) + + + /** + * Tokenizes bank information to return a payment method nonce. You can tokenize bank details by providing information like account and routing numbers. You can also tokenize with a bank login UI that prompts the customer to log into their bank account. + * @public + * @param {object} options All tokenization options for the US Bank Account component. + * @param {string} options.mandateText A string for proof of customer authorization. For example, `'I authorize Braintree to debit my bank account on behalf of My Online Store.'`. + * @param {object} [options.bankDetails] Bank detail information (such as account and routing numbers). `bankDetails` or `bankLogin` option must be provided. + * @param {string} options.bankDetails.routingNumber The customer's bank routing number, such as `'307075259'`. + * @param {string} options.bankDetails.accountNumber The customer's bank account number, such as `'999999999'`. + * @param {string} options.bankDetails.accountType The customer's bank account type. Must be `'checking'` or `'savings'`. + * @param {string} options.bankDetails.accountHolderName The customer's bank account holder name, such as `'Rosetta Fox'`. + * @param {object} options.bankDetails.billingAddress The customer's billing address. + * @param {string} options.bankDetails.billingAddress.streetAddress The street address for the customer's billing address, such as `'123 Fake St'`. + * @param {string} [options.bankDetails.billingAddress.extendedAddress] The extended street address for the customer's billing address, such as `'Apartment B'`. + * @param {string} options.bankDetails.billingAddress.locality The locality for the customer's billing address. This is typically a city, such as `'San Francisco'`. + * @param {string} options.bankDetails.billingAddress.region The region for the customer's billing address. This is typically a state, such as `'CA'`. + * @param {string} options.bankDetails.billingAddress.postalCode The postal code for the customer's billing address. This is typically a ZIP code, such as `'94119'`. + * @param {object} [options.bankLogin] Bank login information. `bankLogin` or `bankDetails` option must be provided. + * @param {string} options.bankLogin.displayName Display name for the bank login UI, such as `'My Store'`. + * @param {callback} callback The second argument, data, is a {@link USBankAccount~tokenizePayload|tokenizePayload}. + * @returns {void} + * @example + * Tokenizing raw bank details + * submitButton.addEventListener('click', function (event) { + * var routingNumberInput = document.querySelector('input#routing-number'); + * var accountNumberInput = document.querySelector('input#account-number'); + * var accountHolderNameInput = document.querySelector('input#account-holder-name'); + * var accountTypeInput = document.querySelector('input[name="account-type"]:checked'); + * var billingAddressStreetInput = document.querySelector('input#street-address'); + * var billingAddressExtendedInput = document.querySelector('input#extended-address'); + * var billingAddressLocalityInput = document.querySelector('input#locality'); + * var billingAddressRegionSelect = document.querySelector('select#region'); + * var billingAddressPostalInput = document.querySelector('input#postal-code'); + * + * event.preventDefault(); + * + * usBankAccountInstance.tokenize({ + * bankDetails: { + * routingNumber: routingNumberInput.value, + * accountNumber: accountNumberInput.value, + * accountHolderName: accountHolderNameInput.value, + * accountType: accountTypeInput.value, + * billingAddress: { + * streetAddress: billingAddressStreetInput.value, + * extendedAddress: billingAddressExtendedInput.value, + * locality: billingAddressLocalityInput.value, + * region: billingAddressRegionSelect.value, + * postalCode: billingAddressPostalInput.value + * } + * }, + * mandateText: 'I authorize Braintree to debit my bank account on behalf of My Online Store.' + * }, function (tokenizeErr, tokenizedPayload) { + * if (tokenizeErr) { + * console.error('There was an error tokenizing the bank details.'); + * return; + * } + * + * // Send tokenizePayload.nonce to your server here! + * }); + * }); + * @example + * Tokenizing with bank login UI + * bankLoginButton.addEventListener('click', function (event) { + * event.preventDefault(); + * + * usBankAccountInstance.tokenize({ + * bankLogin: { + * displayName: 'My Online Store' + * }, + * mandateText: 'I authorize Braintree to debit my bank account on behalf of My Online Store.' + * }, function (tokenizeErr, tokenizedPayload) { + * if (tokenizeErr) { + * console.error('There was an error tokenizing the bank details.'); + * return; + * } + * + * // Send tokenizePayload.nonce to your server here! + * }); + * }); + */ + public tokenize(options: { mandateText: string, bankDetails: any, bankLogin: any }, callback: callback): void; + + /** + * Cleanly tear down anything set up by {@link module:braintree-web/us-bank-account.create|create}. + * @public + * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully. + * @returns {void} + */ + public teardown(callback?: callback): void; + + } + } declare namespace BraintreeError { @@ -1733,6 +1920,9 @@ interface BraintreeStatic { /** @type {module:braintree-web/apple-pay} */ applePay: BraintreeWeb.ApplePay; + /** @type {module:braintree-web/us-bank-account} */ + usBankAccount: BraintreeWeb.USBankAccount; + /** * @description The current version of the SDK, i.e. `3.0.2`. * @type {string} @@ -1740,4 +1930,4 @@ interface BraintreeStatic { VERSION: string; } -declare var braintree: BraintreeStatic; \ No newline at end of file +declare var braintree: BraintreeStatic; diff --git a/braintree-web/tsconfig.json b/braintree-web/tsconfig.json index caa9c36450..2c052fabc8 100644 --- a/braintree-web/tsconfig.json +++ b/braintree-web/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/breeze/tsconfig.json b/breeze/tsconfig.json index 61c40b0c21..a3916d6c5c 100644 --- a/breeze/tsconfig.json +++ b/breeze/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/brorand/tsconfig.json b/brorand/tsconfig.json index 3364b18700..c8152cfdb2 100644 --- a/brorand/tsconfig.json +++ b/brorand/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/browser-harness/tsconfig.json b/browser-harness/tsconfig.json index 8d91341dc2..5bd3144ee4 100644 --- a/browser-harness/tsconfig.json +++ b/browser-harness/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/browser-pack/tsconfig.json b/browser-pack/tsconfig.json index aa0bdc75fd..5c463f38f6 100644 --- a/browser-pack/tsconfig.json +++ b/browser-pack/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/browser-resolve/tsconfig.json b/browser-resolve/tsconfig.json index 937a2406b8..35613062f3 100644 --- a/browser-resolve/tsconfig.json +++ b/browser-resolve/tsconfig.json @@ -1,8 +1,9 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/browser-sync/tsconfig.json b/browser-sync/tsconfig.json index 00f6a385be..40e4d9c28c 100644 --- a/browser-sync/tsconfig.json +++ b/browser-sync/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/browserify/tsconfig.json b/browserify/tsconfig.json index 76abfe7cdf..789228dcf3 100644 --- a/browserify/tsconfig.json +++ b/browserify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bs58/tsconfig.json b/bs58/tsconfig.json index 1b125313a3..d4b6ed9e9f 100644 --- a/bs58/tsconfig.json +++ b/bs58/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bson/tsconfig.json b/bson/tsconfig.json index 2867dd77b7..06b0fe8c52 100644 --- a/bson/tsconfig.json +++ b/bson/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bucks/tsconfig.json b/bucks/tsconfig.json index 7fe2ceb2ad..9231c0db3b 100644 --- a/bucks/tsconfig.json +++ b/bucks/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/buffer-compare/tsconfig.json b/buffer-compare/tsconfig.json index 2f0ab706cb..7adb2631f5 100644 --- a/buffer-compare/tsconfig.json +++ b/buffer-compare/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/buffer-equal/tsconfig.json b/buffer-equal/tsconfig.json index 023af87516..015854b604 100644 --- a/buffer-equal/tsconfig.json +++ b/buffer-equal/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/buffers/tsconfig.json b/buffers/tsconfig.json index 7e5fabe5ab..a8d7cbbf92 100644 --- a/buffers/tsconfig.json +++ b/buffers/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bufferstream/tsconfig.json b/bufferstream/tsconfig.json index 44b1becec2..2d0055c5f2 100644 --- a/bufferstream/tsconfig.json +++ b/bufferstream/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bugsnag/tsconfig.json b/bugsnag/tsconfig.json index 17df589138..34e7a6fa4f 100644 --- a/bugsnag/tsconfig.json +++ b/bugsnag/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bull/tsconfig.json b/bull/tsconfig.json index 4650ae9557..8ee650885d 100644 --- a/bull/tsconfig.json +++ b/bull/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bunnymq/tsconfig.json b/bunnymq/tsconfig.json index fac4aa837c..b061b72bac 100644 --- a/bunnymq/tsconfig.json +++ b/bunnymq/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bunyan-config/tsconfig.json b/bunyan-config/tsconfig.json index a86c564880..994b268230 100644 --- a/bunyan-config/tsconfig.json +++ b/bunyan-config/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bunyan-logentries/tsconfig.json b/bunyan-logentries/tsconfig.json index d99107bfb5..f50f595e76 100644 --- a/bunyan-logentries/tsconfig.json +++ b/bunyan-logentries/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bunyan-prettystream/index.d.ts b/bunyan-prettystream/index.d.ts index 04c328b058..c82d444f76 100644 --- a/bunyan-prettystream/index.d.ts +++ b/bunyan-prettystream/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bunyan-prettystream 0.1.3 +// Type definitions for bunyan-prettystream 0.1.3 // Project: https://www.npmjs.com/package/bunyan-prettystream // Definitions by: Jason Swearingen , Vadim Macagon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bunyan-prettystream/tsconfig.json b/bunyan-prettystream/tsconfig.json index dcbdd86fcd..57900123eb 100644 --- a/bunyan-prettystream/tsconfig.json +++ b/bunyan-prettystream/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bunyan/bunyan-tests.ts b/bunyan/bunyan-tests.ts index c609901b0a..06fce4b410 100644 --- a/bunyan/bunyan-tests.ts +++ b/bunyan/bunyan-tests.ts @@ -26,6 +26,7 @@ level = bunyan.resolveLevel(bunyan.FATAL); var options:bunyan.LoggerOptions = { name: 'test-logger', + serializers: bunyan.stdSerializers, streams: [{ type: 'stream', stream: process.stdout, diff --git a/bunyan/index.d.ts b/bunyan/index.d.ts index 79aa9e5f20..6886aade90 100644 --- a/bunyan/index.d.ts +++ b/bunyan/index.d.ts @@ -11,7 +11,7 @@ import { EventEmitter } from 'events'; declare class Logger extends EventEmitter { constructor(options: LoggerOptions); addStream(stream: Stream): void; - addSerializers(serializers:Serializers | StdSerializers):void; + addSerializers(serializers:Serializers | StdSerializers):void; child(options: LoggerOptions, simple?: boolean): Logger; child(obj: Object, simple?: boolean): Logger; reopenFileStreams(): void; @@ -21,7 +21,7 @@ declare class Logger extends EventEmitter { levels(name: number | string, value: number | string): void; fields: any; - src:boolean; + src:boolean; trace(error: Error, format?: any, ...params: any[]): void; trace(buffer: Buffer, format?: any, ...params: any[]): void; @@ -54,22 +54,23 @@ interface LoggerOptions { streams?: Stream[]; level?: string | number; stream?: NodeJS.WritableStream; - serializers?: Serializers; + serializers?: Serializers | StdSerializers; src?: boolean; + [custom: string]: any; } - interface Serializer { - (input:any): any; - } +interface Serializer { + (input:any): any; +} interface Serializers { - [key:string]: Serializer; - } + [key: string]: Serializer +} - interface StdSerializers { - err: Serializer; - res: Serializer; - req: Serializer; +interface StdSerializers { + err: Serializer; + res: Serializer; + req: Serializer; } interface Stream { @@ -82,7 +83,7 @@ interface Stream { count?: number; } - export var stdSerializers:StdSerializers; +export declare var stdSerializers: StdSerializers; export declare var TRACE: number; export declare var DEBUG: number; diff --git a/bunyan/tsconfig.json b/bunyan/tsconfig.json index 24893f27fb..2349bbd240 100644 --- a/bunyan/tsconfig.json +++ b/bunyan/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/busboy/tsconfig.json b/busboy/tsconfig.json index 50d1d83321..aee3c8ccae 100644 --- a/busboy/tsconfig.json +++ b/busboy/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/business-rules-engine/tsconfig.json b/business-rules-engine/tsconfig.json index d78f12fad1..bc9aaa2d87 100644 --- a/business-rules-engine/tsconfig.json +++ b/business-rules-engine/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bwip-js/bwip-js-tests.ts b/bwip-js/bwip-js-tests.ts index 71601f111a..29cc419d2c 100644 --- a/bwip-js/bwip-js-tests.ts +++ b/bwip-js/bwip-js-tests.ts @@ -1,7 +1,3 @@ -/// -/// -'use strict'; - import * as bwipjs from 'bwip-js'; import * as http from 'http'; import * as fs from 'fs'; @@ -13,7 +9,7 @@ bwipjs.loadFont('Inconsolata', 108, http.createServer(function(req, res) { // If the url does not begin /?bcid= then 404. Otherwise, we end up // returning 400 on requests like favicon.ico. - if (req.url.indexOf('/?bcid=') != 0) { + if (req.url!.indexOf('/?bcid=') != 0) { res.writeHead(404, { 'Content-Type':'text/plain' }); res.end('BWIPJS: Unknown request format.', 'utf8'); } else { diff --git a/bwip-js/bwip-js.d.ts b/bwip-js/bwip-js.d.ts deleted file mode 100644 index 0f40b5771e..0000000000 --- a/bwip-js/bwip-js.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -// Type definitions for bwip-js 1.1.1 -// Project: https://github.com/metafloor/bwip-js -// Definitions by: TANAKA Koichi -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare module 'bwip-js' { - import {IncomingMessage as Request, ServerResponse as Response} from 'http'; - - module BwipJs { - export function loadFont(fontName:string, sizeMulti: number, fontFile: string): void; - export function toBuffer(opts: ToBufferOptions, callback:(err: string|Error, png: Buffer) => void): void; - interface ToBufferOptions { - bcid: string; - text: string; - - parse?: boolean; - parsefunc?: boolean; - - height?: number; - width?: number; - - scaleX?: number; - scaleY?: number; - scale?: number; - - rotate?: 'N'|'R'|'L'|'I'; - - paddingwidth?: number; - paddingheight?: number; - - monochrome?: boolean; - alttext?: boolean; - - includetext?: boolean; - textfont?: string; - textsize?: number; - textgaps?: number; - - textxalign?:'offleft'|'left'|'center'|'right'|'offright'|'justify'; - textyalign?:'below'|'center'|'above'; - textxoffset?: number; - textyoffset?: number; - - showborder?: boolean; - borderwidth?: number; - borderleft?: number; - borderright?: number; - bordertop?: number; - boraderbottom?: number; - - barcolor?: string; - backgroundcolor?: string; - bordercolor?: string; - textcolor?: string; - - addontextxoffset?: number; - addontextyoffset?: number; - addontextfont?: string; - addontextsize?: number; - - guardwhitespace?: boolean; - guardwidth?: number; - guardheight?: number; - guardleftpos?: number; - guardrightpos?: number; - guardleftypos?: number; - guardrightypos?: number; - - sizelimit?: number; - - includecheck?: boolean; - includecheckintext?: boolean; - - inkspread?: number; - inkspreadh?: number; - inkspreadv?: number; - } - } - - - function BwipJs(req: Request, res: Response, opts?:BwipJs.ToBufferOptions): void; - - export = BwipJs; -} diff --git a/bwip-js/index.d.ts b/bwip-js/index.d.ts new file mode 100644 index 0000000000..9c37fa6e44 --- /dev/null +++ b/bwip-js/index.d.ts @@ -0,0 +1,83 @@ +// Type definitions for bwip-js 1.1.1 +// Project: https://github.com/metafloor/bwip-js +// Definitions by: TANAKA Koichi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import {IncomingMessage as Request, ServerResponse as Response} from 'http'; + +declare namespace BwipJs { + export function loadFont(fontName:string, sizeMulti: number, fontFile: string): void; + export function toBuffer(opts: ToBufferOptions, callback:(err: string|Error, png: Buffer) => void): void; + interface ToBufferOptions { + bcid: string; + text: string; + + parse?: boolean; + parsefunc?: boolean; + + height?: number; + width?: number; + + scaleX?: number; + scaleY?: number; + scale?: number; + + rotate?: 'N'|'R'|'L'|'I'; + + paddingwidth?: number; + paddingheight?: number; + + monochrome?: boolean; + alttext?: boolean; + + includetext?: boolean; + textfont?: string; + textsize?: number; + textgaps?: number; + + textxalign?:'offleft'|'left'|'center'|'right'|'offright'|'justify'; + textyalign?:'below'|'center'|'above'; + textxoffset?: number; + textyoffset?: number; + + showborder?: boolean; + borderwidth?: number; + borderleft?: number; + borderright?: number; + bordertop?: number; + boraderbottom?: number; + + barcolor?: string; + backgroundcolor?: string; + bordercolor?: string; + textcolor?: string; + + addontextxoffset?: number; + addontextyoffset?: number; + addontextfont?: string; + addontextsize?: number; + + guardwhitespace?: boolean; + guardwidth?: number; + guardheight?: number; + guardleftpos?: number; + guardrightpos?: number; + guardleftypos?: number; + guardrightypos?: number; + + sizelimit?: number; + + includecheck?: boolean; + includecheckintext?: boolean; + + inkspread?: number; + inkspreadh?: number; + inkspreadv?: number; + } +} + +declare function BwipJs(req: Request, res: Response, opts?:BwipJs.ToBufferOptions): void; + +export = BwipJs; diff --git a/bwip-js/tsconfig.json b/bwip-js/tsconfig.json new file mode 100644 index 0000000000..66f010939e --- /dev/null +++ b/bwip-js/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bwip-js-tests.ts" + ] +} \ No newline at end of file diff --git a/byline/tsconfig.json b/byline/tsconfig.json index 86e1cca418..bad6eafe23 100644 --- a/byline/tsconfig.json +++ b/byline/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bytebuffer/tsconfig.json b/bytebuffer/tsconfig.json index 0f1705cac0..caa21be4bb 100644 --- a/bytebuffer/tsconfig.json +++ b/bytebuffer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/bytes/index.d.ts b/bytes/index.d.ts index cc9b5975b7..fd0a65c365 100644 --- a/bytes/index.d.ts +++ b/bytes/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bytes v2.4.0 +// Type definitions for bytes v2.4.0 // Project: https://github.com/visionmedia/bytes.js // Definitions by: Zhiyuan Wang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bytes/tsconfig.json b/bytes/tsconfig.json index 907ef89767..027930acd8 100644 --- a/bytes/tsconfig.json +++ b/bytes/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/c3/tsconfig.json b/c3/tsconfig.json index dd50256240..f439630232 100644 --- a/c3/tsconfig.json +++ b/c3/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "noEmit": true, "forceConsistentCasingInFileNames": true @@ -11,4 +12,4 @@ "index.d.ts", "c3-tests.ts" ] -} +} \ No newline at end of file diff --git a/cache-manager/tsconfig.json b/cache-manager/tsconfig.json index c96d6c485c..b32e787047 100644 --- a/cache-manager/tsconfig.json +++ b/cache-manager/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cachefactory/tsconfig.json b/cachefactory/tsconfig.json index 41bb03d433..86d3b5a1e3 100644 --- a/cachefactory/tsconfig.json +++ b/cachefactory/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cal-heatmap/index.d.ts b/cal-heatmap/index.d.ts index 356487c3e9..4ecc4d3d87 100644 --- a/cal-heatmap/index.d.ts +++ b/cal-heatmap/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cal-heatmap v3.5.4 +// Type definitions for cal-heatmap v3.5.4 // Project: https://github.com/wa0x6e/cal-heatmap // Definitions by: Chris Baker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/cal-heatmap/tsconfig.json b/cal-heatmap/tsconfig.json index 6b19258ef7..fb5a562148 100644 --- a/cal-heatmap/tsconfig.json +++ b/cal-heatmap/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -17,4 +18,4 @@ "index.d.ts", "cal-heatmap-tests.ts" ] -} +} \ No newline at end of file diff --git a/callsite/tsconfig.json b/callsite/tsconfig.json index 4be2800535..9fe360ce2b 100644 --- a/callsite/tsconfig.json +++ b/callsite/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/calq/tsconfig.json b/calq/tsconfig.json index 8907ad6544..7629a025e1 100644 --- a/calq/tsconfig.json +++ b/calq/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/camel-case/camel-case-tests.ts b/camel-case/camel-case-tests.ts deleted file mode 100644 index f26f7cdb85..0000000000 --- a/camel-case/camel-case-tests.ts +++ /dev/null @@ -1,9 +0,0 @@ - -import camelCase = require('camel-case'); - -console.log(camelCase('string')); // => "string" -console.log(camelCase('dot.case')); // => "dotCase" -console.log(camelCase('PascalCase')); // => "pascalCase" -console.log(camelCase('version 1.2.10')); // => "version1_2_10" - -console.log(camelCase('STRING 1.2', 'tr')); // => "strıng1_2" diff --git a/camel-case/index.d.ts b/camel-case/index.d.ts deleted file mode 100644 index 1345063e82..0000000000 --- a/camel-case/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for camel-case -// Project: https://github.com/blakeembrey/camel-case -// Definitions by: Sam Saint-Pettersen -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare function camelCase(string: string, locale?: string): string; -export = camelCase; diff --git a/camelcase/tsconfig.json b/camelcase/tsconfig.json index c92cab2221..5fc9824568 100644 --- a/camelcase/tsconfig.json +++ b/camelcase/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/camljs/tsconfig.json b/camljs/tsconfig.json index f6a6f272de..d583ec258e 100644 --- a/camljs/tsconfig.json +++ b/camljs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/camo/camo-tests.ts b/camo/camo-tests.ts index 31354dc945..6830133f8f 100644 --- a/camo/camo-tests.ts +++ b/camo/camo-tests.ts @@ -1,4 +1,3 @@ - import { connect, Document as CamoDocument, @@ -16,7 +15,7 @@ connect("mongodb://user:password@localhost:27017/database?authSource=admin").the dateCreated?: Date; } - class User extends CamoDocument { + class User extends CamoDocument { private name: SchemaTypeExtended = String; private password: SchemaTypeExtended = String; private friends: SchemaTypeExtended = [String]; diff --git a/camo/index.d.ts b/camo/index.d.ts index 168765f136..325a1c3b95 100644 --- a/camo/index.d.ts +++ b/camo/index.d.ts @@ -1,137 +1,322 @@ -// Type definitions for camo v0.11.4 +// Type definitions for camo v0.12.2 // Project: https://github.com/scottwrobinson/camo // Definitions by: Lucas Matías Ciruzzi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare module "camo" { + /** + * Connect function + * + * @export + * @param {string} uri Connection URI + * @returns {Promise} + */ + export function connect (uri: string): Promise; -type TypeOrArray = Type | Type[]; + type TypeOrArrayOfType = Type | Type[]; -/** - * Supported type constructors for document properties - */ -export type SchemaTypeConstructor = - TypeOrArray | - TypeOrArray | - TypeOrArray | - TypeOrArray | - TypeOrArray | - TypeOrArray; + /** + * Supported type constructors for document properties + */ + export type SchemaTypeConstructor = + TypeOrArrayOfType | + TypeOrArrayOfType | + TypeOrArrayOfType | + TypeOrArrayOfType | + TypeOrArrayOfType | + TypeOrArrayOfType | + TypeOrArrayOfType; -/** - * Supported types for document properties - */ -export type SchemaType = TypeOrArray; + /** + * Supported types for document properties + */ + export type SchemaType = TypeOrArrayOfType; + + /** + * Document property with options + */ + export interface SchemaTypeOptions { + /** + * Type of data + */ + type: SchemaTypeConstructor; + /** + * Default value + */ + default?: Type; + /** + * Min value (only with Number) + */ + min?: number; + /** + * Max value (only with Number) + */ + max?: number; + /** + * Posible options + */ + choices?: Type[]; + /** + * RegEx to match value + */ + match?: RegExp; + /** + * Validation function. + * + * @param {Type} value Value taken. + * @returns {boolean} true (validation ok) or false (validation wrong). + */ + validate?(value: Type): boolean; + /** + * Unique value (like ids) + */ + unique?: boolean; + /** + * Required field + */ + required?: boolean; + } + + /** + * Document property type or options + */ + export type SchemaTypeExtended = SchemaTypeConstructor | SchemaTypeOptions; + + /** + * Schema passed to Document.create() + */ + export interface DocumentSchema { + /** + * Index signature + */ + [property: string]: SchemaType; + /** + * Document id + */ + _id?: string; + } + + /** + * findOneAndUpdate method options. + * + * @interface findOneAndUpdateOptions + */ + export interface FindOneAndUpdateOptions { + /** + * Return a new document if one is not found with the given query. + * + * @type {boolean} + */ + upsert?: boolean; + } + + /** + * findOne method options. + * + * @interface FindOneOptions + */ + export interface FindOneOptions { + /** + * Find all or no references. + * Pass an array of field names to only populate the specified references. + * + * @type {(boolean | string[])} + */ + populate?: boolean | string[]; + } + + /** + * find method options. + * + * @interface FindOptions + */ + export interface FindOptions { + /** + * Find all or no references. + * Pass an array of field names to only populate the specified references. + * + * @type {(boolean | string[])} + */ + populate?: boolean | string[]; + /** + * Sort the documents by the given field(s). + * + * @type {TypeOrArrayOfType} + */ + sort?: TypeOrArrayOfType; + /** + * Limits the number of documents returned. + * + * @type {number} + */ + limit?: number; + /** + * Skips the given number of documents and returns the rest. + * + * @type {number} + */ + skip?: number; + } + + /** + * Camo document + */ + export class Document { + /** + * Index signature + */ + [property: string]: SchemaTypeExtended | string | Document | Function; + /** + * Static method to define the collection name. + * + * @protected + * @static + * @returns {string} The collection name. + */ + protected static collectionName(): string; + /** + * Sets the schema (to be used on the constructor). + * + * @protected + * @template Schema + * @param {Schema} schema + */ + protected schema(schema: Schema): void; + /** + * Creates a camo document instance. + * + * @static + * @template StaticSchema + * @param {StaticSchema} schema Base schema to create a document. + * @returns {DocumentInstance} A camo document instance. + */ + public static create(schema: StaticSchema): Document; + /** + * Saves the document instance to the database. + * + * @returns {Promise} + */ + public save(): Promise; + /** + * Return the first document found, even if multiple documents match the query. + * + * @static + * @template StaticSchema + * @param {*} query Find query. + * @param {FindOneOptions} options findOne method options. + * @returns {Promise} + */ + public static findOne(query: any, options?: FindOneOptions): Promise; + /** + * Return all documents matching the query. + * + * @static + * @template StaticSchema + * @param {*} query Find query. + * @param {FindOptions} options + * @returns {Promise} + */ + public static find(query: any, options?: FindOptions): Promise; + /** + * Find and update (or insert) a document in one atomic operation (atomic for MongoDB only). + * + * @static + * @template StaticSchema + * @param {*} query Find query. + * @param {Schema} values Values to set. + * @param {FindOneAndUpdateOptions} options findOneAndUpdate method options. + * @returns {Promise} + */ + public static findOneAndUpdate(query: any, values: StaticSchema, options?: FindOneAndUpdateOptions): Promise; + /** + * Removes documents from the database. + * Should only be used on an instantiated document with a valid id. + * + * @returns {Promise} Number of deleted documents. + */ + public delete(): Promise; + /** + * Removes the first document found, even if multiple documents match the query. + * + * @static + * @param {*} query Delete query. + * @returns {Promise} Number of deleted documents. + */ + public static deleteOne(query: any): Promise; + /** + * Removes all documents matching the query. + * + * @static + * @param {*} query Delete query. + * @returns {Promise} Number of deleted documents. + */ + public static deleteMany(query: any): Promise; + /** + * Find the first document and delete it. + * + * @static + * @param {*} query Delete query. + * @param {*} options Database Options for findOneAndDelete method. + * @returns {Promise} Number of deleted documents. + */ + public static findOneAndDelete(query: any, options?: any): Promise; + /** + * Number of matching documents without retrieving all the data. + * + * @static + * @param {*} query Count query. + * @returns {Promise} + */ + public static count(query: any): Promise; + /** + * pre-validate hook. + * + * @protected + * @returns {Promise} + */ + protected preValidate(): Promise; + /** + * post-validate hook. + * + * @protected + * @returns {Promise} + */ + protected postValidate(): Promise; + /** + * pre-save hook. + * + * @protected + * @returns {Promise} + */ + protected preSave(): Promise; + /** + * post-save hook. + * + * @protected + * @returns {Promise} + */ + protected postSave(): Promise; + /** + * pre-delete hook. + * + * @protected + * @returns {Promise} + */ + protected preDelete(): Promise; + /** + * post-delete hook. + * + * @protected + * @returns {Promise} + */ + protected postDelete(): Promise; + /** + * Serialized document to just the data, which includes nested and referenced data. + * + * @returns {*} + */ + public toJSON(): any; + } -/** - * Document property with options - */ -export interface SchemaTypeOptions { - /** - * Type of data - */ - type: SchemaTypeConstructor; - /** - * Default value - */ - default?: Type; - /** - * Min value (only with Number) - */ - min?: number; - /** - * Max value (only with Number) - */ - max?: number; - /** - * Posible options - */ - choices?: Type[]; - /** - * RegEx to match value - */ - match?: RegExp; - /** - * Validation function - * - * @param value Value taken - * @returns true (validation ok) or false (validation wrong) - */ - validate?(value: Type): boolean; - /** - * Unique value (like ids) - */ - unique?: boolean; - /** - * Required field - */ - required?: boolean; } - -/** - * Document property type or options - */ -export type SchemaTypeExtended = SchemaTypeConstructor | SchemaTypeOptions; - -/** - * Schema passed to Document.create() - */ -interface DocumentSchema { - /** - * Index signature - */ - [property: string]: SchemaType; - /** - * Document id - */ - _id?: string; -} - -/** - * Camo document instance - */ -declare class DocumentInstance { - public save(): Promise; - public loadOne(): Promise; - public loadMany(): Promise; - public delete(): Promise; - public deleteOne(): Promise; - public deleteMany(): Promise; - public loadOneAndDelete(): Promise; - public count(): Promise; - public preValidate(): Promise; - public postValidate(): Promise; - public preSave(): Promise; - public postSave(): Promise; - public preDelete(): Promise; - public postDelete(): Promise; -} - -/** - * Camo document - */ -export declare class Document { - /** - * Index signature - */ - [property: string]: SchemaTypeExtended | string | DocumentInstance; - /** - * Static method to define the collection name - * - * @returns The collection name - */ - static collectionName(): string; - /** - * Creates a camo document instance - * - * @returns A camo document instance - */ - static create(schema: Schema): DocumentInstance; -} - -/** - * Connect function - * - * @param uri Connection URI - */ -export declare function connect(uri: string): Promise; diff --git a/camo/tsconfig.json b/camo/tsconfig.json index 27a2fc316d..d53c982b25 100644 --- a/camo/tsconfig.json +++ b/camo/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/canvas-gauges/tsconfig.json b/canvas-gauges/tsconfig.json index 3719e86106..6f6aa11e1d 100644 --- a/canvas-gauges/tsconfig.json +++ b/canvas-gauges/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/canvasjs/index.d.ts b/canvasjs/index.d.ts index bfb4dd03cd..79a168f2d0 100644 --- a/canvasjs/index.d.ts +++ b/canvasjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for CanvasJS v1.5.1 +// Type definitions for CanvasJS v1.5.1 // Project: http://canvasjs.com/ // Definitions by: Mark Overholt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/canvasjs/tsconfig.json b/canvasjs/tsconfig.json index 40aa730bfc..e609a4a9c4 100644 --- a/canvasjs/tsconfig.json +++ b/canvasjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cash/tsconfig.json b/cash/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/cash/tsconfig.json +++ b/cash/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/casperjs/index.d.ts b/casperjs/index.d.ts index a3f456f238..f252509af3 100644 --- a/casperjs/index.d.ts +++ b/casperjs/index.d.ts @@ -1,26 +1,22 @@ -// Type definitions for CasperJS v1.0.0 +// Type definitions for CasperJS v1.0.29 // Project: http://casperjs.org/ // Definitions by: Jed Mao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -interface CasperModule { - create(options: CasperOptions): Casper; - selectXPath(expression: string): Object -} -interface EventEmitter { - removeAllFilters(filter: string): Casper; - setFilter(filter: string, cb: Function): boolean; -} +export function create(options?: CasperOptions): Casper; -interface Casper extends EventEmitter { - test: Tester; +export function selectXPath(expression: string): Object; - constructor (options: CasperOptions): Casper; +export class Casper { + constructor(options: CasperOptions); + + test: Tester; options: CasperOptions; + // Properties __utils__: ClientUtils; @@ -41,10 +37,10 @@ interface Casper extends EventEmitter { debugPage(): Casper; die(message: string, status?: number): Casper; download(url: string, target?: string, method?: string, data?: any): Casper; - each(array: T[], fn: (self: Casper, item: T, index: number) => void): Casper; + each(array: T[], fn: (this: Casper, item: T, index: number) => void): Casper; echo(message: string, style?: string): Casper; - evaluate(fn: () => T, ...args: any[]): T - evaluateOrDie(fn: () => any, message?: string, status?: number): Casper; + evaluate(fn: () => T, ...args: any[]): T + evaluateOrDie(fn: () => any, message?: string, status?: number): Casper; exit(status?: number): Casper; exists(selector: string): boolean; fetchText(selector: string): string; @@ -78,12 +74,12 @@ interface Casper extends EventEmitter { setHttpAuth(username: string, password: string): Casper; start(url?: string, then?: (response: HttpResponse) => void): Casper; status(asString: boolean): any; - then(fn: (self?: Casper) => void): Casper; + then(fn: (this: Casper) => void): Casper; thenBypass(nb: number): Casper; thenBypassIf(condition: any, nb: number): Casper; thenBypassUnless(condition: any, nb: number): Casper; thenClick(selector: string): Casper; - thenEvaluate(fn: () => any, ...args: any[]): Casper; + thenEvaluate(fn: () => any, ...args: any[]): Casper; thenOpen(location: string, then?: (response: HttpResponse) => void): Casper; thenOpen(location: string, options?: OpenSettings, then?: (response: HttpResponse) => void): Casper; thenOpenAndEvaluate(location: string, then?: Function, ...args: any[]): Casper; @@ -112,6 +108,8 @@ interface Casper extends EventEmitter { withPopup(popupInfo: string, step: Function): Casper; withPopup(popupInfo: RegExp, step: Function): Casper; zoom(factor: number): Casper; + removeAllFilters(filter: string): Casper; + setFilter(filter: string, cb: Function): boolean; } interface HttpResponse { @@ -212,8 +210,8 @@ interface Tester { assertDoesntExist(selector: string, message?: string): any; assertElementCount(selctor: string, expected: number, message?: string): any; assertEquals(testValue: any, expected: any, message?: string): any; - assertEval(fn: Function, message: string, arguments: any): any; - assertEvalEquals(fn: Function, expected: any, message?: string, arguments?: any): any; + assertEval(fn: Function, message: string, args: any): any; + assertEvalEquals(fn: Function, expected: any, message?: string, args?: any): any; assertExists(selector: string, message?: string): any; assertFalsy(subject: any, message?: string): any; assertField(inputName: string, expected: string, message?: string): any; @@ -241,11 +239,11 @@ interface Tester { assertUrlMatch(pattern: RegExp, message?: string): any; assertVisible(selector: string, message?: string): any; - /* since 1.1 */ - begin(description: string, planned: number, suite: Function): any; - begin(description: string, suite: Function): any; - begin(description: string, planned: number, config: Object): any; - begin(description: string, config: Object): any; + /* since 1.1 */ + begin(description: string, planned: number, suite: Function): any; + begin(description: string, suite: Function): any; + begin(description: string, planned: number, config: Object): any; + begin(description: string, config: Object): any; colorize(message: string, style: string): any; comment(message: string): any; diff --git a/casperjs/tsconfig.json b/casperjs/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/casperjs/tsconfig.json +++ b/casperjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cassandra-driver/index.d.ts b/cassandra-driver/index.d.ts index 041f9f84e2..16466316f4 100644 --- a/cassandra-driver/index.d.ts +++ b/cassandra-driver/index.d.ts @@ -134,7 +134,7 @@ export namespace types { var LocalTime: LocalTimeStatic; var Long: _Long; var ResultSet: ResultSetStatic; - // var ResultStream: ResultStreamStatic; + // var ResultStream: ResultStreamStatic; var Row: RowStatic; var TimeUuid: TimeUuidStatic; var Tuple: TupleStatic; @@ -438,7 +438,7 @@ export var Encoder: EncoderStatic; export interface ClientOptions { contactPoints: Array, - keyspace: string, + keyspace?: string, policies?: { addressResolution?: policies.addressResolution.AddressTranslator, loadBalancing?: policies.loadBalancing.LoadBalancingPolicy, diff --git a/cassandra-driver/tsconfig.json b/cassandra-driver/tsconfig.json index 0dec57214f..2cc6b7e782 100644 --- a/cassandra-driver/tsconfig.json +++ b/cassandra-driver/tsconfig.json @@ -1,8 +1,9 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ }, "files": [ "index.d.ts", - "cassandra-driver.tests.ts" + "cassandra-driver-tests.ts" ] } \ No newline at end of file diff --git a/cbor/cbor-tests.ts b/cbor/cbor-tests.ts new file mode 100644 index 0000000000..4fb153956a --- /dev/null +++ b/cbor/cbor-tests.ts @@ -0,0 +1,65 @@ +/// +/// + +import cbor = require('cbor'); +import assert = require('assert'); +import fs = require('fs'); + +var encoded = cbor.encode(true); // returns +cbor.decodeFirst(encoded, function(error, obj) { + // error != null if there was an error + // obj is the unpacked object + assert.ok(obj === true); +}); + +// Use integers as keys? +var m = new Map(); +m.set(1, 2); +encoded = cbor.encode(m); // + +var d = new cbor.Decoder(); +d.on('data', function(obj: any) { + console.log(obj); +}); + +var s = fs.createReadStream('foo'); +s.pipe(d); + +var d2 = new cbor.Decoder({ input: '00', encoding: 'hex' }); +d.on('data', function(obj: any) { + console.log(obj); +}); + +try { + console.log(cbor.decodeFirstSync('02')); // 2 + console.log(cbor.decodeAllSync('0202')); // [2, 2] +} catch (e) { + // throws on invalid input +} + +class Bar { + three: number; + constructor() { + this.three = 3; + } +} +const enc = new cbor.Encoder() +enc.addSemanticType(Bar, (encoder, b) => { + encoder.pushAny(b.three); +}) + +class Foo { + one: number; + two: string; +} +const d3 = new cbor.Decoder({ + tags: { + 64000: (val) => { + // check val to make sure it's an Array as expected, etc. + const foo = new Foo(); + foo.one = val[0]; + foo.two = val[1]; + return foo; + } + } +}) diff --git a/cbor/index.d.ts b/cbor/index.d.ts new file mode 100644 index 0000000000..897b6f0629 --- /dev/null +++ b/cbor/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for cbor 2.0.2 +// Project: https://github.com/hildjj/node-cbor +// Definitions by: Jeffery Grajkowski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import stream = require("stream"); + +export function decode(input: Buffer | string): any; +export function decodeAll(input: Buffer | string, callback: (error: any, objs: any[]) => void): void; +export function decodeAllSync(input: Buffer | string): any[]; +export function decodeFirst(input: Buffer | string, callback: (error: any, obj: any) => void): void; +export function decodeFirstSync(input: Buffer | string): any; +export function encode(input: any): Buffer; + +export class Decoder extends stream.Transform { + constructor(params?: { + input?: Buffer | string; + encoding?: string; + tags?: {[tag: number]: (val: any[]) => any} + }); +} + +export class Encoder extends stream.Transform { + constructor(); + addSemanticType(type: new (...args: any[]) => T, encodeFunction: (encoder: Encoder, t: T) => void): void; + pushAny(input: any): void; +} + +export namespace leveldb { + export function decode(input: Buffer | string): any[]; + export function encode(input: any): Buffer; + export const buffer: boolean; + export const name: string; +} diff --git a/cbor/tsconfig.json b/cbor/tsconfig.json new file mode 100644 index 0000000000..e3ece1c983 --- /dev/null +++ b/cbor/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cbor-tests.ts" + ] +} \ No newline at end of file diff --git a/chai-as-promised/tsconfig.json b/chai-as-promised/tsconfig.json index ab6e25f533..be115c3f06 100644 --- a/chai-as-promised/tsconfig.json +++ b/chai-as-promised/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chai-datetime/tsconfig.json b/chai-datetime/tsconfig.json index 5dc6f30b84..43277c3b0d 100644 --- a/chai-datetime/tsconfig.json +++ b/chai-datetime/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chai-dom/chai-dom-tests.ts b/chai-dom/chai-dom-tests.ts index 2fca54765e..61b3b3c600 100644 --- a/chai-dom/chai-dom-tests.ts +++ b/chai-dom/chai-dom-tests.ts @@ -1,5 +1,3 @@ -/// - import * as chai from 'chai'; import * as chaiDom from 'chai-dom'; diff --git a/chai-dom/chai-dom.d.ts b/chai-dom/index.d.ts similarity index 100% rename from chai-dom/chai-dom.d.ts rename to chai-dom/index.d.ts diff --git a/chai-dom/tsconfig.json b/chai-dom/tsconfig.json index 79855c3e09..84cd4a668d 100644 --- a/chai-dom/tsconfig.json +++ b/chai-dom/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "chai-dom.d.ts", + "index.d.ts", "chai-dom-tests.ts" ] } \ No newline at end of file diff --git a/chai-enzyme/chai-enzyme-tests.tsx b/chai-enzyme/chai-enzyme-tests.tsx index 0e491a7ba7..a70f7e7f96 100644 --- a/chai-enzyme/chai-enzyme-tests.tsx +++ b/chai-enzyme/chai-enzyme-tests.tsx @@ -1,5 +1,4 @@ /// -/// /// /// diff --git a/chai-enzyme/chai-enzyme.d.ts b/chai-enzyme/index.d.ts similarity index 100% rename from chai-enzyme/chai-enzyme.d.ts rename to chai-enzyme/index.d.ts diff --git a/chai-enzyme/tsconfig.json b/chai-enzyme/tsconfig.json index 81fa4a5105..e04b4818ad 100644 --- a/chai-enzyme/tsconfig.json +++ b/chai-enzyme/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -11,11 +12,10 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, - "jsx": "react" }, "files": [ - "chai-enzyme.d.ts", + "index.d.ts", "chai-enzyme-tests.tsx" ] } \ No newline at end of file diff --git a/chai-fuzzy/tsconfig.json b/chai-fuzzy/tsconfig.json index b66762c48a..f173a4421c 100644 --- a/chai-fuzzy/tsconfig.json +++ b/chai-fuzzy/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chai-http/tsconfig.json b/chai-http/tsconfig.json index 7d97f81bce..53cde6fe52 100644 --- a/chai-http/tsconfig.json +++ b/chai-http/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chai-jquery/tsconfig.json b/chai-jquery/tsconfig.json index f2c908f2d9..f101ab5f0e 100644 --- a/chai-jquery/tsconfig.json +++ b/chai-jquery/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chai-oequal/chai-oequal-tests.ts b/chai-oequal/chai-oequal-tests.ts new file mode 100644 index 0000000000..ae7dbdc29f --- /dev/null +++ b/chai-oequal/chai-oequal-tests.ts @@ -0,0 +1,35 @@ +import Chai = require('chai'); +import ChaiOequal = require('chai-oequal'); + +Chai.use(ChaiOequal); + +import { + expect, + assert +} from 'chai'; + +expect({ + equals: () => true, +}).to.be.oequal({}); +expect({ + customequals: () => true, +}).to.be.oequal({}, 'customequals'); +expect({ + equals: () => true, +}).to.be.oeql({}); +expect({ + equals: () => true, +}).to.be.oeq({}); + +assert.oequal({ + equals: () => true, +}, {}); +assert.oequal({ + customequals: () => true, +}, {}, 'customequals'); +assert.oeql({ + equals: () => true, +}, {}); +assert.oeq({ + equals: () => true, +}, {}); diff --git a/chai-oequal/index.d.ts b/chai-oequal/index.d.ts new file mode 100644 index 0000000000..78160c255e --- /dev/null +++ b/chai-oequal/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for chai-oequal 0.0 +// Project: https://github.com/wrwrwr/chai-oequal +// Definitions by: Mizunashi Mana +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace Chai { + // For BDD APIs + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + oequal(result: any, method?: string): Equal; + oeql(result: any, method?: string): Equal; + oeq(result: any, method?: string): Equal; + } + + // For Assert APIs + interface Assert { + oequal(act: any, exp: any, method?: string): Equal; + oeql(act: any, exp: any, method?: string): Equal; + oeq(act: any, exp: any, method?: string): Equal; + } +} + +declare module 'chai-oequal' { + function chaiOequal(chai: any, utils: any): void; + namespace chaiOequal {} + export = chaiOequal; +} diff --git a/chai-oequal/tsconfig.json b/chai-oequal/tsconfig.json new file mode 100644 index 0000000000..a1f6103868 --- /dev/null +++ b/chai-oequal/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chai-oequal-tests.ts" + ] +} \ No newline at end of file diff --git a/chai-oequal/tslint.json b/chai-oequal/tslint.json new file mode 100644 index 0000000000..cfdf2986e5 --- /dev/null +++ b/chai-oequal/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "no-single-declare-module": false + } +} diff --git a/chai-spies/chai-spies-tests.ts b/chai-spies/chai-spies-tests.ts new file mode 100644 index 0000000000..7ac0610e4d --- /dev/null +++ b/chai-spies/chai-spies-tests.ts @@ -0,0 +1,135 @@ +/// +/// + +import * as chai from 'chai'; +import * as spies from 'chai-spies'; +import * as Mocha from 'mocha'; + +function original(): void { + // do something cool +} + +let ee = { + on(name: string, fn: () => void) { + } +}; + +let spiedFn = chai.spy(original); + +// then use in place of original +ee.on('some event', spiedFn); + +// or use without original +let spy_again = chai.spy(); +ee.on('some other event', spy_again); + +// or you can track an object's method +let array = [ 1, 2, 3 ]; +chai.spy.on(array, 'push'); + +// or you can track multiple object's methods +chai.spy.on(array, 'push', 'pop'); + +array.push(5); + +// and you can reset the object calls +// array.push.reset(); + +// or you can create spy object +let object = chai.spy.object([ 'push', 'pop' ]); +object.push(5); + +// or you create spy which returns static value +spiedFn = chai.spy.returns(true); + +spiedFn(); // true + + +let should = chai.should() + , expect = chai.expect; + +const spy = chai.spy(); + +// .spy + +expect(spy).to.be.spy; +spy.should.be.spy; + +// .called + +expect(spy).to.have.been.called(); +spy.should.have.been.called(); + +// .with +const spyStringArg = chai.spy((arg: string) => arg); +spyStringArg('foo'); +expect(spyStringArg).to.have.been.called.with('foo'); +spyStringArg.should.have.been.called.with('foo'); + +const spyTwoStringArgsAndOneNumber = chai.spy((arg1: string, arg2: string, arg3: number) => arg3); +spyTwoStringArgsAndOneNumber('foo', 'bar', 1); +expect(spyTwoStringArgsAndOneNumber).to.have.been.called.with('bar', 'foo'); +spyTwoStringArgsAndOneNumber.should.have.been.called.with('bar', 'foo'); + +// .with.exactly +const spyTwoStringArgs = chai.spy((arg1: string, arg2: string) => arg1); +spyTwoStringArgs('', ''); +spyTwoStringArgs('foo', 'bar'); +expect(spyTwoStringArgs).to.have.been.called.with.exactly('foo', 'bar'); +spyTwoStringArgs.should.have.been.called.with.exactly('foo', 'bar'); + +// .always.with +const spyThreeAnyArgs = chai.spy((arg1: any, arg2: any, arg3: any) => arg1); +spyThreeAnyArgs('foo', null, null); +spyThreeAnyArgs('foo', 'bar', null); +spyThreeAnyArgs(1, 2, 'foo'); +expect(spy).to.have.been.called.always.with('foo'); +spy.should.have.been.called.always.with('foo'); + +// .always.with.exactly +spyStringArg('foo'); +spyStringArg('foo'); +expect(spyStringArg).to.have.been.called.always.with.exactly('foo'); +spyStringArg.should.have.been.called.always.with.exactly('foo'); + +// .once +expect(spy).to.have.been.called.once; +expect(spy).to.not.have.been.called.once; +spy.should.have.been.called.once; +spy.should.not.have.been.called.once; + +// .twice +expect(spy).to.have.been.called.twice; +expect(spy).to.not.have.been.called.twice; +spy.should.have.been.called.twice; +spy.should.not.have.been.called.twice; + +// .exactly(n) +expect(spy).to.have.been.called.exactly(3); +expect(spy).to.not.have.been.called.exactly(3); +spy.should.have.been.called.exactly(3); +spy.should.not.have.been.called.exactly(3); + +// .min(n) / .at.least(n) +expect(spy).to.have.been.called.min(3); +expect(spy).to.not.have.been.called.at.least(3); +spy.should.have.been.called.at.least(3); +spy.should.not.have.been.called.min(3); + +// .max(n) / .at.most(n) +expect(spy).to.have.been.called.max(3); +expect(spy).to.not.have.been.called.at.most(3); +spy.should.have.been.called.at.most(3); +spy.should.not.have.been.called.max(3); + +// .above(n) / .gt(n) +expect(spy).to.have.been.called.above(3); +expect(spy).to.not.have.been.called.gt(3); +spy.should.have.been.called.gt(3); +spy.should.not.have.been.called.above(3); + +// .below(n) / .lt(n) +expect(spy).to.have.been.called.below(3); +expect(spy).to.not.have.been.called.lt(3); +spy.should.have.been.called.lt(3); +spy.should.not.have.been.called.below(3); \ No newline at end of file diff --git a/chai-spies/index.d.ts b/chai-spies/index.d.ts new file mode 100644 index 0000000000..ffed6e594b --- /dev/null +++ b/chai-spies/index.d.ts @@ -0,0 +1,411 @@ +// Type definitions for chai-spies +// Project: https://github.com/chaijs/chai-spies +// Definitions by: Ilya Kuznetsov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace Chai { + interface ChaiStatic { + spy: ChaiSpies.Spy; + } + + interface Assertion { + /** + * ####.spy + * Asserts that object is a spy. + * ```ts + * expect(spy).to.be.spy; + * spy.should.be.spy; + * ``` + */ + spy: Assertion; + + /** + * ####.called + * Assert that a spy has been called. Negation passes through. + * ```ts + * expect(spy).to.have.been.called(); + * spy.should.have.been.called(); + * ``` + * Note that ```called``` can be used as a chainable method. + */ + called: ChaiSpies.Called; + } +} + +declare namespace ChaiSpies { + + interface Spy { + /** + * #### chai.spy (function) + * + * Wraps a function in a proxy function. All calls will pass through to the original function. + * ```ts + * function original() {} + * var spy = chai.spy(original) + * , e_spy = chai.spy(); + * ``` + * @param fn function to spy on. @default ```function () {}``` + * @returns function to actually call + */ + (): SpyFunc0Proxy; + (fn: SpyFunc0): SpyFunc0Proxy; + (fn: SpyFunc1): SpyFunc1Proxy; + (fn: SpyFunc2): SpyFunc2Proxy; + (fn: SpyFunc3): SpyFunc3Proxy; + (fn: SpyFunc4): SpyFunc4Proxy; + (fn: SpyFunc5): SpyFunc5Proxy; + (fn: SpyFunc6): SpyFunc6Proxy; + (fn: SpyFunc7): SpyFunc7Proxy; + (fn: SpyFunc8): SpyFunc8Proxy; + (fn: SpyFunc9): SpyFunc9Proxy; + (fn: SpyFunc10): SpyFunc10Proxy; + (name: string, fn: SpyFunc0): SpyFunc0Proxy; + (name: string, fn: SpyFunc1): SpyFunc1Proxy; + (name: string, fn: SpyFunc2): SpyFunc2Proxy; + (name: string, fn: SpyFunc3): SpyFunc3Proxy; + (name: string, fn: SpyFunc4): SpyFunc4Proxy; + (name: string, fn: SpyFunc5): SpyFunc5Proxy; + (name: string, fn: SpyFunc6): SpyFunc6Proxy; + (name: string, fn: SpyFunc7): SpyFunc7Proxy; + (name: string, fn: SpyFunc8): SpyFunc8Proxy; + (name: string, fn: SpyFunc9): SpyFunc9Proxy; + (name: string, fn: SpyFunc10): SpyFunc10Proxy; + + /** + * #### chai.spy.on (function) + * + * Wraps an object method into spy. All calls will pass through to the original function. + * ```ts + * var spy = chai.spy.on(Array, 'isArray'); + * ``` + * @param {Object} object + * @param {String} method name to spy on + * @returns function to actually call + */ + on(object: Object, ...methodNames: string[]): any; + + /** + * #### chai.spy.object (function) + * + * Creates an object with spied methods. + * ```ts + * var object = chai.spy.object('Array', [ 'push', 'pop' ]); + * ``` + * @param {String} [name] object name + * @param {String[]|Object} method names or method definitions + * @returns object with spied methods + */ + object(name: string, methods: string[]): any; + object(methods: string[]): any; + object(name: string, methods: T): T; + object(methods: T): T; + + /** + * #### chai.spy.returns (function) + * + * Creates a spy which returns static value. + *```ts + * var method = chai.spy.returns(true); + *``` + * @param {*} value static value which is returned by spy + * @returns new spy function which returns static value + * @api public + */ + + returns(value: T): SpyFunc0Proxy; + } + + interface Called { + (): Chai.Assertion; + with: With; + always: Always; + + /** + * ####.once + * Assert that a spy has been called exactly once. + * ```ts + * expect(spy).to.have.been.called.once; + * expect(spy).to.not.have.been.called.once; + * spy.should.have.been.called.once; + * spy.should.not.have.been.called.once; + * ``` + */ + once: Chai.Assertion; + + /** + * ####.twice + * Assert that a spy has been called exactly twice. + * ```ts + * expect(spy).to.have.been.called.twice; + * expect(spy).to.not.have.been.called.twice; + * spy.should.have.been.called.twice; + * spy.should.not.have.been.called.twice; + * ``` + */ + twice: Chai.Assertion; + + /** + * ####.exactly(n) + * Assert that a spy has been called exactly ```n``` times. + * ```ts + * expect(spy).to.have.been.called.exactly(3); + * expect(spy).to.not.have.been.called.exactly(3); + * spy.should.have.been.called.exactly(3); + * spy.should.not.have.been.called.exactly(3); + * ``` + */ + exactly(n: number): Chai.Assertion; + + /** + * ####.min(n) / .at.least(n) + * Assert that a spy has been called minimum of ```n``` times. + * ```ts + * expect(spy).to.have.been.called.min(3); + * expect(spy).to.not.have.been.called.at.least(3); + * spy.should.have.been.called.at.least(3); + * spy.should.not.have.been.called.min(3); + * ``` + */ + min(n: number): Chai.Assertion; + + /** + * ####.max(n) / .at.most(n) + * Assert that a spy has been called maximum of ```n``` times. + * ```ts + * expect(spy).to.have.been.called.max(3); + * expect(spy).to.not.have.been.called.at.most(3); + * spy.should.have.been.called.at.most(3); + * spy.should.not.have.been.called.max(3); + * ``` + */ + max(n: number): Chai.Assertion; + + at: At; + /** + * ####.above(n) / .gt(n) + * Assert that a spy has been called more than ```n``` times. + * ```ts + * expect(spy).to.have.been.called.above(3); + * spy.should.not.have.been.called.above(3); + * ``` + */ + above(n: number): Chai.Assertion; + + /** + * ####.above(n) / .gt(n) + * Assert that a spy has been called more than ```n``` times. + * ```ts + * expect(spy).to.have.been.called.gt(3); + * spy.should.not.have.been.called.gt(3); + * ``` + */ + gt(n: number): Chai.Assertion; + + /** + * ####.below(n) / .lt(n) + * Assert that a spy has been called fewer than ```n``` times. + * ```ts + * expect(spy).to.have.been.called.below(3); + * spy.should.not.have.been.called.below(3); + * ``` + */ + below(n: number): Chai.Assertion; + + /** + * ####.below(n) / .lt(n) + * Assert that a spy has been called fewer than ```n``` times. + * ```ts + * expect(spy).to.have.been.called.lt(3); + * spy.should.not.have.been.called.lt(3); + * ``` + */ + lt(n: number): Chai.Assertion; + } + + interface With { + /** + * ####.with + * Assert that a spy has been called with a given argument at least once, even if more arguments were provided. + * ```ts + * spy('foo'); + * expect(spy).to.have.been.called.with('foo'); + * spy.should.have.been.called.with('foo'); + * ``` + * Will also pass for ```spy('foo', 'bar')``` and ```spy(); spy('foo')```. + * If used with multiple arguments, assert that a spy has been called with all the given arguments at least once. + * ```ts + * spy('foo', 'bar', 1); + * expect(spy).to.have.been.called.with('bar', 'foo'); + * spy.should.have.been.called.with('bar', 'foo'); + * ``` + */ + (a: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion; + + /** + * ####.with.exactly + * Similar to .with, but will pass only if the list of arguments is exactly the same as the one provided. + * ```ts + * spy(); + * spy('foo', 'bar'); + * expect(spy).to.have.been.called.with.exactly('foo', 'bar'); + * spy.should.have.been.called.with.exactly('foo', 'bar'); + * ``` + * Will not pass for ```spy('foo')```, ```spy('bar')```, ```spy('bar'); spy('foo')```, ```spy('foo'); spy('bar')```, ```spy('bar', 'foo')``` or ```spy('foo', 'bar', 1)```. + * Can be used for calls with a single argument too. + */ + + exactly(a?: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion; + } + + interface Always { + with: AlwaysWith; + } + + interface AlwaysWith { + /** + * ####.always.with + * Assert that every time the spy has been called the argument list contained the given arguments. + * ```ts + * spy('foo'); + * spy('foo', 'bar'); + * spy(1, 2, 'foo'); + * expect(spy).to.have.been.called.always.with('foo'); + * spy.should.have.been.called.always.with('foo'); + * ``` + */ + (a: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion; + + /** + * ####.always.with.exactly + * Assert that the spy has never been called with a different list of arguments than the one provided. + * ```ts + * spy('foo'); + * spy('foo'); + * expect(spy).to.have.been.called.always.with.exactly('foo'); + * spy.should.have.been.called.always.with.exactly('foo'); + * ``` + */ + exactly(a?: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion; + } + + interface At { + /** + * ####.min(n) / .at.least(n) + * Assert that a spy has been called minimum of ```n``` times. + * ```ts + * expect(spy).to.have.been.called.min(3); + * expect(spy).to.not.have.been.called.at.least(3); + * spy.should.have.been.called.at.least(3); + * spy.should.not.have.been.called.min(3); + * ``` + */ + least(n: number): Chai.Assertion; + + /** + * ####.max(n) / .at.most(n) + * Assert that a spy has been called maximum of ```n``` times. + * ```ts + * expect(spy).to.have.been.called.max(3); + * expect(spy).to.not.have.been.called.at.most(3); + * spy.should.have.been.called.at.most(3); + * spy.should.not.have.been.called.max(3); + * ``` + */ + most(n: number): Chai.Assertion; + } + + interface Resetable { + /** + * #### proxy.reset (function) + * + * Resets __spy object parameters for instantiation and reuse + * @returns proxy spy object + */ + reset(): this; + } + + interface SpyFunc0 { + (): R; + } + + interface SpyFunc1 { + (a: A1): R; + } + + interface SpyFunc2 { + (a: A1, b: A2): R; + } + + interface SpyFunc3 { + (a: A1, b: A2, c: A3): R; + } + + interface SpyFunc4 { + (a: A1, b: A2, c: A3, d: A4): R; + } + + interface SpyFunc5 { + (a: A1, b: A2, c: A3, d: A4, e: A5): R; + } + + interface SpyFunc6 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R; + } + + interface SpyFunc7 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R; + } + + interface SpyFunc8 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R; + } + + interface SpyFunc9 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R; + } + + interface SpyFunc10 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R; + } + + interface SpyFunc0Proxy extends SpyFunc0, Resetable { + } + + interface SpyFunc1Proxy extends SpyFunc1, Resetable { + } + + interface SpyFunc2Proxy extends SpyFunc2, Resetable { + } + + interface SpyFunc3Proxy extends SpyFunc3, Resetable { + } + + interface SpyFunc4Proxy extends SpyFunc4, Resetable { + } + + interface SpyFunc5Proxy extends SpyFunc5, Resetable { + } + + interface SpyFunc6Proxy extends SpyFunc6, Resetable { + } + + interface SpyFunc7Proxy extends SpyFunc7, Resetable { + } + + interface SpyFunc8Proxy extends SpyFunc8, Resetable { + } + + interface SpyFunc9Proxy extends SpyFunc9, Resetable { + } + + interface SpyFunc10Proxy extends SpyFunc10, Resetable { + } +} + +declare var spies: ChaiSpies.Spy; + +declare module "chai-spies" { + export = spies; +} diff --git a/chai-spies/tsconfig.json b/chai-spies/tsconfig.json new file mode 100644 index 0000000000..88143d7886 --- /dev/null +++ b/chai-spies/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chai-spies-tests.ts" + ] +} \ No newline at end of file diff --git a/chai-string/chai-string-tests.ts b/chai-string/chai-string-tests.ts index af18987bb5..16f32760f8 100644 --- a/chai-string/chai-string-tests.ts +++ b/chai-string/chai-string-tests.ts @@ -53,46 +53,48 @@ describe('chai-string', function() { }); describe('tdd alias', function() { + let str: string; + let str2: string; beforeEach(function() { - this.str = 'abcdef'; - this.str2 = 'a\nb\tc\r d ef'; + str = 'abcdef'; + str2 = 'a\nb\tc\r d ef'; }); it('.startsWith', function() { - assert.startsWith(this.str, 'abc'); + assert.startsWith(str, 'abc'); }); it('.notStartsWith', function() { - assert.notStartsWith(this.str, 'cba'); + assert.notStartsWith(str, 'cba'); }); it('.endsWith', function() { - assert.endsWith(this.str, 'def'); + assert.endsWith(str, 'def'); }); it('.notEndsWith', function() { - assert.notEndsWith(this.str, 'fed'); + assert.notEndsWith(str, 'fed'); }); it('.equalIgnoreCase', function() { - assert.equalIgnoreCase(this.str, 'AbCdEf'); + assert.equalIgnoreCase(str, 'AbCdEf'); }); it('.notEqualIgnoreCase', function() { - assert.notEqualIgnoreCase(this.str, 'abDDD'); + assert.notEqualIgnoreCase(str, 'abDDD'); }); it('.equalIgnoreSpaces', function() { - assert.equalIgnoreSpaces(this.str, this.str2); + assert.equalIgnoreSpaces(str, str2); }); it('.notEqualIgnoreSpaces', function() { - assert.notEqualIgnoreSpaces(this.str, this.str2 + 'g'); + assert.notEqualIgnoreSpaces(str, str2 + 'g'); }); it('.singleLine', function() { - assert.singleLine(this.str); + assert.singleLine(str); }); it('.notSingleLine', function() { @@ -100,11 +102,11 @@ describe('chai-string', function() { }); it('.reverseOf', function() { - assert.reverseOf(this.str, 'fedcba'); + assert.reverseOf(str, 'fedcba'); }); it('.notReverseOf', function() { - assert.notReverseOf(this.str, 'aaaaa'); + assert.notReverseOf(str, 'aaaaa'); }); it('.palindrome', function() { @@ -114,7 +116,7 @@ describe('chai-string', function() { }); it('.notPalindrome', function() { - assert.notPalindrome(this.str); + assert.notPalindrome(str); }); it('.entriesCount', function() { diff --git a/chai-string/tsconfig.json b/chai-string/tsconfig.json index 8582c91588..9eaaa0490d 100644 --- a/chai-string/tsconfig.json +++ b/chai-string/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chai-subset/tsconfig.json b/chai-subset/tsconfig.json index 38503c0b4f..1a7f852ff5 100644 --- a/chai-subset/tsconfig.json +++ b/chai-subset/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chai-things/tsconfig.json b/chai-things/tsconfig.json index 6a1bf346d2..a59ed9561c 100644 --- a/chai-things/tsconfig.json +++ b/chai-things/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chai-xml/chai-xml-tests.ts b/chai-xml/chai-xml-tests.ts new file mode 100644 index 0000000000..492e671bbe --- /dev/null +++ b/chai-xml/chai-xml-tests.ts @@ -0,0 +1,15 @@ +import * as chai from 'chai'; +import chaiXml = require('chai-xml'); + +chai.use(chaiXml); +let expect = chai.expect; + +function test_chaiXml() { + let testXml = 'test'; + expect('nope').xml.not.to.be.valid(); + expect(testXml).xml.to.be.valid(); + expect(testXml).xml.to.equal('\ntest\n'); + expect(testXml).xml.to.not.equal('' ); +} + +test_chaiXml(); diff --git a/chai-xml/index.d.ts b/chai-xml/index.d.ts new file mode 100644 index 0000000000..7f6a78f653 --- /dev/null +++ b/chai-xml/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for chai-xml 0.3 +// Project: https://github.com/krampstudio/chai-xml +// Definitions by: Jeff Goddard +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare global { + namespace Chai { + interface Assertion { + xml: ChaiXml.XmlAssertion; + } + } +} + +declare namespace ChaiXml { + interface XmlAssertion extends Chai.Assertion { + valid(): XmlAssertion; + + not: XmlAssertion; + to: XmlAssertion; + be: XmlAssertion; + been: XmlAssertion; + is: XmlAssertion; + that: XmlAssertion; + which: XmlAssertion; + and: XmlAssertion; + has: XmlAssertion; + have: XmlAssertion; + with: XmlAssertion; + at: XmlAssertion; + of: XmlAssertion; + same: XmlAssertion; + } +} + +declare function chaiXml(chai: any, utils: any): void; +export = chaiXml; diff --git a/chai-xml/tsconfig.json b/chai-xml/tsconfig.json new file mode 100644 index 0000000000..abd4d0df2b --- /dev/null +++ b/chai-xml/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chai-xml-tests.ts" + ] +} \ No newline at end of file diff --git a/chai-xml/tslint.json b/chai-xml/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/chai-xml/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/chai/tsconfig.json b/chai/tsconfig.json index b253cec563..399af1570c 100644 --- a/chai/tsconfig.json +++ b/chai/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chalk/tsconfig.json b/chalk/tsconfig.json index 6a207e3d73..170f4bea66 100644 --- a/chalk/tsconfig.json +++ b/chalk/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ diff --git a/chance/index.d.ts b/chance/index.d.ts index 6390b57864..7ce79b431f 100644 --- a/chance/index.d.ts +++ b/chance/index.d.ts @@ -5,13 +5,19 @@ declare namespace Chance { + interface Seeded { + seed: number; + } + + type SeededChance = Chance & Seeded; + interface ChanceStatic { (): Chance - (seed: number): Chance + (seed: number): SeededChance (generator: () => any): Chance new(): Chance; - new(seed: number): Chance; + new(seed: number): SeededChance; new(generator: () => any): Chance; } diff --git a/chance/tsconfig.json b/chance/tsconfig.json index 6c16bfd3d2..ae3cd15626 100644 --- a/chance/tsconfig.json +++ b/chance/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/change-case/change-case-tests.ts b/change-case/change-case-tests.ts deleted file mode 100644 index 67ef86405b..0000000000 --- a/change-case/change-case-tests.ts +++ /dev/null @@ -1,37 +0,0 @@ -import changeCase = require("change-case"); - -var s: string; -var b: boolean; - -s = changeCase.dot(s); -s = changeCase.dotCase(s); -s = changeCase.swap(s); -s = changeCase.swapCase(s); -s = changeCase.path(s); -s = changeCase.pathCase(s); -s = changeCase.upper(s); -s = changeCase.upperCase(s); -s = changeCase.lower(s); -s = changeCase.lowerCase(s); -s = changeCase.camel(s); -s = changeCase.camelCase(s); -s = changeCase.snake(s); -s = changeCase.snakeCase(s); -s = changeCase.title(s); -s = changeCase.titleCase(s); -s = changeCase.param(s); -s = changeCase.paramCase(s); -s = changeCase.pascal(s); -s = changeCase.pascalCase(s); -s = changeCase.constant(s); -s = changeCase.constantCase(s); -s = changeCase.sentence(s); -s = changeCase.sentenceCase(s); -b = changeCase.isUpper(s); -b = changeCase.isUpperCase(s); -b = changeCase.isLower(s); -b = changeCase.isLowerCase(s); -s = changeCase.ucFirst(s); -s = changeCase.upperCaseFirst(s); -s = changeCase.lcFirst(s); -s = changeCase.lowerCaseFirst(s); diff --git a/change-case/index.d.ts b/change-case/index.d.ts deleted file mode 100644 index 590597d621..0000000000 --- a/change-case/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Type definitions for change-case -// Project: https://github.com/blakeembrey/change-case -// Definitions by: Asana -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export function dot(s: string): string; -export function dotCase(s: string): string; -export function swap(s: string): string; -export function swapCase(s: string): string; -export function path(s: string): string; -export function pathCase(s: string): string; -export function upper(s: string): string; -export function upperCase(s: string): string; -export function lower(s: string): string; -export function lowerCase(s: string): string; -export function camel(s: string): string; -export function camelCase(s: string): string; -export function snake(s: string): string; -export function snakeCase(s: string): string; -export function title(s: string): string; -export function titleCase(s: string): string; -export function param(s: string): string; -export function paramCase(s: string): string; -export function pascal(s: string): string; -export function pascalCase(s: string): string; -export function constant(s: string): string; -export function constantCase(s: string): string; -export function sentence(s: string): string; -export function sentenceCase(s: string): string; -export function isUpper(s: string): boolean; -export function isUpperCase(s: string): boolean; -export function isLower(s: string): boolean; -export function isLowerCase(s: string): boolean; -export function ucFirst(s: string): string; -export function upperCaseFirst(s: string): string; -export function lcFirst(s: string): string; -export function lowerCaseFirst(s: string): string; diff --git a/change-emitter/tsconfig.json b/change-emitter/tsconfig.json index 83453a3874..729895e968 100644 --- a/change-emitter/tsconfig.json +++ b/change-emitter/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chart.js/index.d.ts b/chart.js/index.d.ts index 9bf41eeaae..e9186035c7 100644 --- a/chart.js/index.d.ts +++ b/chart.js/index.d.ts @@ -392,7 +392,7 @@ interface RadialLinearScale { } declare class Chart { - constructor (context: CanvasRenderingContext2D, options: ChartConfiguration); + constructor (context: CanvasRenderingContext2D | HTMLCanvasElement, options: ChartConfiguration); config: ChartConfiguration; destroy: () => {}; update: (duration?: any, lazy?: any) => {}; diff --git a/chart.js/tsconfig.json b/chart.js/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/chart.js/tsconfig.json +++ b/chart.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chartist/index.d.ts b/chartist/index.d.ts index ed6c10ac67..f2a74d7c31 100644 --- a/chartist/index.d.ts +++ b/chartist/index.d.ts @@ -423,7 +423,7 @@ declare namespace Chartist { /** * This method will append an element to the current element as a child. */ - append(): IChartistSvg; + append(element: IChartistSvg, insertFirst?: boolean): IChartistSvg; /** * Returns an array of class names that are attached to the current wrapper element. This method can not be chained further. diff --git a/chartist/tsconfig.json b/chartist/tsconfig.json index f83ec6193e..b5d5a88498 100644 --- a/chartist/tsconfig.json +++ b/chartist/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chartjs/tsconfig.json b/chartjs/tsconfig.json index 41b5e33af8..5d31ea6aa4 100644 --- a/chartjs/tsconfig.json +++ b/chartjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cheap-ruler/tsconfig.json b/cheap-ruler/tsconfig.json index 5ad05276b4..e84a59808f 100644 --- a/cheap-ruler/tsconfig.json +++ b/cheap-ruler/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/checksum/tsconfig.json b/checksum/tsconfig.json index 654e47bfce..1f6ac88a01 100644 --- a/checksum/tsconfig.json +++ b/checksum/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cheerio/tsconfig.json b/cheerio/tsconfig.json index de4915dac3..9650ec4b5c 100644 --- a/cheerio/tsconfig.json +++ b/cheerio/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chocolatechipjs/index.d.ts b/chocolatechipjs/index.d.ts index 9ac2ae8c52..f1e0701e39 100644 --- a/chocolatechipjs/index.d.ts +++ b/chocolatechipjs/index.d.ts @@ -1359,10 +1359,6 @@ interface fetch { }): Promise; } -interface XMLHttpRequest { - responseURL: string; -} - /** * Headers Interface. This defines the methods exposed by the Headers object. */ diff --git a/chocolatechipjs/tsconfig.json b/chocolatechipjs/tsconfig.json index 2ab103b1e2..f2b634193f 100644 --- a/chocolatechipjs/tsconfig.json +++ b/chocolatechipjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chokidar/index.d.ts b/chokidar/index.d.ts index aa0dd27ef5..2fcfb22eaa 100644 --- a/chokidar/index.d.ts +++ b/chokidar/index.d.ts @@ -5,20 +5,24 @@ /// -declare module "fs" +declare module "chokidar" { - interface FSWatcher + export class FSWatcher { + constructor(options?: WatchOptions); add(fileDirOrGlob:string):void; add(filesDirsOrGlobs:Array):void; unwatch(fileDirOrGlob:string):void; unwatch(filesDirsOrGlobs:Array):void; getWatched():any; + on(event: 'add', fn: (path: string, stats?: fs.Stats) => void): this; + on(event: 'change', fn: (path: string, stats?: fs.Stats) => void): this; + on(event: 'unlink', fn: (path: string) => void): this; + on(event: 'raw', fn: (event: Event, path:string, details:any) => void): this; + on(event: string, fn: (path: string) => void): this; + close(): this; } -} -declare module "chokidar" -{ interface WatchOptions { persistent?:boolean; @@ -39,6 +43,6 @@ declare module "chokidar" import fs = require("fs"); - function watch(fileDirOrGlob:string, options?:WatchOptions):fs.FSWatcher; - function watch(filesDirsOrGlobs:Array, options?:WatchOptions):fs.FSWatcher; + export function watch(fileDirOrGlob:string, options?:WatchOptions):FSWatcher; + export function watch(filesDirsOrGlobs:Array, options?:WatchOptions):FSWatcher; } diff --git a/chokidar/tsconfig.json b/chokidar/tsconfig.json index e41cc15819..c456984842 100644 --- a/chokidar/tsconfig.json +++ b/chokidar/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chosen/index.d.ts b/chosen/index.d.ts index 4f413a39de..c7ffa437bc 100644 --- a/chosen/index.d.ts +++ b/chosen/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Chosen.JQuery 1.6.1 +// Type definitions for Chosen.JQuery 1.6.1 // Project: http://harvesthq.github.com/chosen/ // Definitions by: Boris Yankov , denis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/chosen/tsconfig.json b/chosen/tsconfig.json index cdd20f987e..0e03fa7164 100644 --- a/chosen/tsconfig.json +++ b/chosen/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chroma-js/tsconfig.json b/chroma-js/tsconfig.json index 08c8a1fcbe..5dc7522d18 100644 --- a/chroma-js/tsconfig.json +++ b/chroma-js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chrome/index.d.ts b/chrome/index.d.ts index af3dbdc15d..942c5ef5eb 100644 --- a/chrome/index.d.ts +++ b/chrome/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Chrome extension development +// Type definitions for Chrome extension development // Project: http://developer.chrome.com/extensions/ // Definitions by: Matthew Kimber , otiai10 , couven92 , RReverser // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -1617,7 +1617,7 @@ declare namespace chrome.devtools.inspectedWindow { /** Optional. When true, the loader will ignore the cache for all inspected page resources loaded before the load event is fired. The effect is similar to pressing Ctrl+Shift+R in the inspected window or within the Developer Tools window. */ ignoreCache?: boolean; /** Optional. If specified, the script will be injected into every frame of the inspected page immediately upon load, before any of the frame's scripts. The script will not be injected after subsequent reloads—for example, if the user presses Ctrl+R. */ - injectedScript?: boolean; + injectedScript?: string; /** * Optional. * If specified, this script evaluates into a function that accepts three string arguments: the source to preprocess, the URL of the source, and a function name if the source is an DOM event handler. The preprocessorerScript function should return a string to be compiled by Chrome in place of the input source. In the case that the source is a DOM event handler, the returned source must compile to a single JS function. diff --git a/chrome/tsconfig.json b/chrome/tsconfig.json index f203aa322a..385e3c3ccf 100644 --- a/chrome/tsconfig.json +++ b/chrome/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ diff --git a/chui/tsconfig.json b/chui/tsconfig.json index 5b444a12d5..513422c456 100644 --- a/chui/tsconfig.json +++ b/chui/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/chunked-dc/chunked-dc-tests.ts b/chunked-dc/chunked-dc-tests.ts index 304d26e952..8e1ee9f00f 100644 --- a/chunked-dc/chunked-dc-tests.ts +++ b/chunked-dc/chunked-dc-tests.ts @@ -1,5 +1,3 @@ -/// - // Chunker let chunker = new Chunker(1337, Uint8Array.of(1,2,3), 2); diff --git a/chunked-dc/chunked-dc.tscparams b/chunked-dc/chunked-dc.tscparams deleted file mode 100644 index ed262d8039..0000000000 --- a/chunked-dc/chunked-dc.tscparams +++ /dev/null @@ -1 +0,0 @@ ---target es2015 --noImplicitAny diff --git a/chunked-dc/chunked-dc.d.ts b/chunked-dc/index.d.ts similarity index 100% rename from chunked-dc/chunked-dc.d.ts rename to chunked-dc/index.d.ts diff --git a/chunked-dc/tsconfig.json b/chunked-dc/tsconfig.json new file mode 100644 index 0000000000..20ce90a8c3 --- /dev/null +++ b/chunked-dc/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chunked-dc-tests.ts" + ] +} \ No newline at end of file diff --git a/circular-json/tsconfig.json b/circular-json/tsconfig.json index a7b37a3fe5..b809a6907a 100644 --- a/circular-json/tsconfig.json +++ b/circular-json/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ckeditor/index.d.ts b/ckeditor/index.d.ts index 72e56cd253..f95875501c 100644 --- a/ckeditor/index.d.ts +++ b/ckeditor/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for CKEditor +// Type definitions for CKEditor // Project: http://ckeditor.com/ // Definitions by: Ondrej Sevcik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/ckeditor/tsconfig.json b/ckeditor/tsconfig.json index 13406465bf..575936ac28 100644 --- a/ckeditor/tsconfig.json +++ b/ckeditor/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/classnames/index.d.ts b/classnames/index.d.ts index 7536aac170..22d9803399 100644 --- a/classnames/index.d.ts +++ b/classnames/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Dave Keen , Adi Dahiya , Jason Killian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null; +declare type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | false; interface ClassDictionary { [id: string]: boolean | undefined | null; diff --git a/classnames/tsconfig.json b/classnames/tsconfig.json index 3da0da12c0..e1958c6b84 100644 --- a/classnames/tsconfig.json +++ b/classnames/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cldrjs/tsconfig.json b/cldrjs/tsconfig.json index a0464ae7a3..1eb80c431b 100644 --- a/cldrjs/tsconfig.json +++ b/cldrjs/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/clean-css/tsconfig.json b/clean-css/tsconfig.json index a4e5cccfbc..8a96d9125b 100644 --- a/clean-css/tsconfig.json +++ b/clean-css/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cli-color/index.d.ts b/cli-color/index.d.ts index fdb0c471d1..a857ced28a 100644 --- a/cli-color/index.d.ts +++ b/cli-color/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cli-color 0.3.2 +// Type definitions for cli-color 0.3.2 // Project: https://github.com/medikoo/cli-color // Definitions by: Joel Spadin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/cli-color/tsconfig.json b/cli-color/tsconfig.json index 4309611b76..d084404c17 100644 --- a/cli-color/tsconfig.json +++ b/cli-color/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cli/tsconfig.json b/cli/tsconfig.json index a2e4a6854a..18028897c9 100644 --- a/cli/tsconfig.json +++ b/cli/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cliff/tsconfig.json b/cliff/tsconfig.json index 3543a3aa8d..d0dbd8162c 100644 --- a/cliff/tsconfig.json +++ b/cliff/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/clipboard-js/clipboard-js-tests.ts b/clipboard-js/clipboard-js-tests.ts index 93adfda3a5..ef1bfbdf5d 100644 --- a/clipboard-js/clipboard-js-tests.ts +++ b/clipboard-js/clipboard-js-tests.ts @@ -1,5 +1,3 @@ -/// - clipboard.copy("Hello World"); clipboard.copy(document.body).then(() => console.log("success")); diff --git a/clipboard-js/clipboard-js.d.ts b/clipboard-js/index.d.ts similarity index 88% rename from clipboard-js/clipboard-js.d.ts rename to clipboard-js/index.d.ts index fafc44ef36..8c71b8ed7e 100644 --- a/clipboard-js/clipboard-js.d.ts +++ b/clipboard-js/index.d.ts @@ -13,6 +13,5 @@ declare namespace clipboard { declare var clipboard: clipboard.IClipboardJsStatic; -declare module 'clipboard-js' { - export = clipboard; -} +export = clipboard; +export as namespace clipboard; diff --git a/clipboard-js/tsconfig.json b/clipboard-js/tsconfig.json new file mode 100644 index 0000000000..d183b6762a --- /dev/null +++ b/clipboard-js/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "clipboard-js-tests.ts" + ] +} \ No newline at end of file diff --git a/clipboard/clipboard-tests.ts b/clipboard/clipboard-tests.ts index c6c7b756cb..7521c651dd 100644 --- a/clipboard/clipboard-tests.ts +++ b/clipboard/clipboard-tests.ts @@ -1,4 +1,4 @@ - +import * as Clipboard from 'clipboard'; var cb1 = new Clipboard('.btn'); var cb2 = new Clipboard(document.getElementById('id'), { diff --git a/clipboard/index.d.ts b/clipboard/index.d.ts index d4b014e2f3..0757eb1208 100644 --- a/clipboard/index.d.ts +++ b/clipboard/index.d.ts @@ -3,54 +3,56 @@ // Definitions by: Andrei Kurosh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare class Clipboard { - constructor(selector: (string | Element | NodeListOf), options?: ClipboardOptions); - - /** - * Subscribes to events that indicate the result of a copy/cut operation. - * @param type {String} Event type ('success' or 'error'). - * @param handler Callback function. - */ - on(type: "success", handler: (e: ClipboardEvent) => void): this; - on(type: "error", handler: (e: ClipboardEvent) => void): this; - on(type: string, handler: (e: ClipboardEvent) => void): this; - - /** - * Clears all event bindings. - */ - destroy(): void; -} - -interface ClipboardOptions { - /** - * Overwrites default command ('cut' or 'copy'). - * @param {Element} elem Current element - * @returns {String} Only 'cut' or 'copy'. - */ - action?: (elem: Element) => string; - - /** - * Overwrites default target input element. - * @param {Element} elem Current element - * @returns {Element} element to use. - */ - target?: (elem: Element) => Element; - - /** - * Returns the explicit text to copy. - * @param {Element} elem Current element - * @returns {String} Text to be copied. - */ - text?: (elem: Element) => string; -} - -interface ClipboardEvent { - action: string; - text: string; - trigger: Element; - clearSelection(): void; -} - declare module 'clipboard' { + class Clipboard { + constructor(selector: (string | Element | NodeListOf), options?: Clipboard.Options); + + /** + * Subscribes to events that indicate the result of a copy/cut operation. + * @param type {String} Event type ('success' or 'error'). + * @param handler Callback function. + */ + on(type: "success", handler: (e: Clipboard.Event) => void): this; + on(type: "error", handler: (e: Clipboard.Event) => void): this; + on(type: string, handler: (e: Clipboard.Event) => void): this; + + /** + * Clears all event bindings. + */ + destroy(): void; + } + + namespace Clipboard { + interface Options { + /** + * Overwrites default command ('cut' or 'copy'). + * @param {Element} elem Current element + * @returns {String} Only 'cut' or 'copy'. + */ + action?: (elem: Element) => string; + + /** + * Overwrites default target input element. + * @param {Element} elem Current element + * @returns {Element} element to use. + */ + target?: (elem: Element) => Element; + + /** + * Returns the explicit text to copy. + * @param {Element} elem Current element + * @returns {String} Text to be copied. + */ + text?: (elem: Element) => string; + } + + interface Event { + action: string; + text: string; + trigger: Element; + clearSelection(): void; + } + } + export = Clipboard; } diff --git a/clipboard/tsconfig.json b/clipboard/tsconfig.json index 825aea90c9..8aac4fe040 100644 --- a/clipboard/tsconfig.json +++ b/clipboard/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/clone/tsconfig.json b/clone/tsconfig.json index 6fc005a1a4..353f9f87cc 100644 --- a/clone/tsconfig.json +++ b/clone/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/closure-compiler/tsconfig.json b/closure-compiler/tsconfig.json index 02996782a1..6bc431b0da 100644 --- a/closure-compiler/tsconfig.json +++ b/closure-compiler/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/co-body/tsconfig.json b/co-body/tsconfig.json index be5ee22788..b0a4ebc5cf 100644 --- a/co-body/tsconfig.json +++ b/co-body/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/co-views/tsconfig.json b/co-views/tsconfig.json index e5cd75aeff..359d264aed 100644 --- a/co-views/tsconfig.json +++ b/co-views/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/code/code-tests.ts b/code/code-tests.ts new file mode 100644 index 0000000000..ea956c6c2c --- /dev/null +++ b/code/code-tests.ts @@ -0,0 +1,162 @@ +import { expect, settings, fail, count, incomplete, thrownAt } from "code"; + +expect(10).to.be.above(5); +expect("abc").to.be.a.string(); +expect([1, 2]).to.be.an.array(); +expect(20).to.be.at.least(20); +expect("abc").to.have.length(3); +expect("abc").to.be.a.string().and.contain(["a", "b"]); +expect(6).to.be.in.range(5, 6); + +expect(10).to.not.be.above(20); +expect([1, 2, 3]).to.shallow.include(3); +expect([1, 1, 2]).to.only.include([1, 2]); +expect([1, 2]).to.once.include([1, 2]); +expect([1, 2, 3]).to.part.include([1, 4]); + +expect(10, "Age").to.be.above(5); + +const func = function () { return arguments; }; +expect(func()).to.be.arguments(); + +expect([1, 2]).to.be.an.array(); + +expect(true).to.be.a.boolean(); + +expect(new Date()).to.be.a.date(); + +const err = new Error("Oops an error occured."); +expect(err).to.be.an.error(); +expect(err).to.be.an.error(Error); +expect(err).to.be.an.error("Oops an error occured."); +expect(err).to.be.an.error(Error, /occured/); + +expect(function () { }).to.be.a.function(); + +expect(123).to.be.a.number(); + +expect(/abc/).to.be.a.regexp(); + +expect("abc").to.be.a.string(); + +expect({ a: "1" }).to.be.an.object(); + +expect(true).to.be.true(); + +expect(false).to.be.false(); + +expect(null).to.be.null(); + +expect(undefined).to.be.undefined(); + +expect("abc").to.include("ab"); +expect("abc").to.only.include("abc"); +expect("aaa").to.only.include("a"); +expect("abc").to.once.include("b"); +expect("abc").to.include(["a", "c"]); +expect("abc").to.part.include(["a", "d"]); + +expect([1, 2, 3]).to.include(1); +expect([{ a: 1 }]).to.include({ a: 1 }); +expect([1, 2, 3]).to.include([1, 2]); +expect([{ a: 1 }]).to.include([{ a: 1 }]); +expect([1, 1, 2]).to.only.include([1, 2]); +expect([1, 2]).to.once.include([1, 2]); +expect([1, 2, 3]).to.part.include([1, 4]); +expect([[1], [2]]).to.include([[1]]); + +interface TestType { + a: number; + b?: number; + c?: number; + d?: number; +} + +interface TestType2 { + a: number[]; + b?: number[]; + c: number[]; +} + +expect({ a: 1, b: 2, c: 3 }).to.include("a"); +expect({ a: 1, b: 2, c: 3 }).to.include(["a", "c"]); +expect({ a: 1, b: 2, c: 3 }).to.only.include(["a", "b", "c"]); +expect({ a: 1, b: 2, c: 3 }).to.include({ a: 1 }); +expect({ a: 1, b: 2, c: 3 }).to.include({ a: 1 }); +expect({ a: 1, b: 2, c: 3 }).to.include({ a: 1, c: 3 }); +expect({ a: 1, b: 2, c: 3 }).to.part.include({ a: 1, d: 4 }); +expect({ a: 1, b: 2, c: 3 }).to.part.include({ a: 1, d: 4 }); +expect({ a: 1, b: 2, c: 3 }).to.only.include({ a: 1, b: 2, c: 3 }); +expect({ a: [1], b: [2], c: [3] }).to.include({ a: [1], c: [3] }); +expect({ a: [1], b: [2], c: [3] }).to.include({ a: [1], c: [3] }); + +expect("https://example.org/secure").to.startWith("https://"); + +expect("http://example.org/relative").to.endWith("/relative"); + +expect(4).to.exist(); +expect(null).to.not.exist(); + +expect("abc").to.be.empty(); + +expect("abcd").to.have.length(4); + +expect(5).to.equal(5); +expect({ a: 1 }).to.equal({ a: 1 }); + +expect(Object.create(null)).to.equal({}, { prototype: false }); + +expect(5).to.shallow.equal(5); +expect({ a: 1 }).to.shallow.equal({ a: 1 }); + +expect(10).to.be.above(5); + +expect(10).to.be.at.least(10); + +expect(10).to.be.below(20); + +expect(10).to.be.at.most(10); + +expect(10).to.be.within(10, 20); +expect(20).to.be.within(10, 20); + +expect(15).to.be.between(10, 20); + +expect(10).to.be.about(9, 1); + +expect(new Date()).to.be.an.instanceof(Date); + +expect("a5").to.match(/\w\d/); +expect(["abc", "def"]).to.match(/^[\w\d,]*$/); +expect(1).to.match(/^\d$/); + +expect("x").to.satisfy(value => value === "x"); + +class CustomError extends Error { + call: (message: string) => Error; +} + +const throws = function () { + + throw new CustomError("Oh no!"); +}; + +expect(throws).to.throw(CustomError, "Oh no!"); + +fail("This should not occur"); + +expect(count()).to.be.a.number(); + +expect(incomplete()).to.be.null().and.not.be.an.array(); + +const error = thrownAt(new Error("oops")); +expect(error).to.not.be.undefined(); +expect(error.column).to.exist(); + +const foo = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; +settings.truncateMessages = false; +expect(foo).to.equal([]); + +const bar = Object.create(null); +settings.comparePrototypes = false; +expect(bar).to.equal({}); diff --git a/code/index.d.ts b/code/index.d.ts new file mode 100644 index 0000000000..174215f5d8 --- /dev/null +++ b/code/index.d.ts @@ -0,0 +1,188 @@ +// Type definitions for code 4.0.0 +// Project: https://github.com/hapijs/code +// Definitions by: Prashant Tiwari +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** Generates an assertion object. */ +export function expect(value: T | T[], prefix?: string): AssertionChain; +/** Makes the test fail with the given message. */ +export function fail(message: string): void; +/** Returns the total number of assertions created using the expect() method. */ +export function count(): number; +/** Returns an array of the locations where incomplete assertions were declared or null if no incomplete assertions found. */ +export function incomplete(): Array | null; +/** Returns the filename, line number, and column number of where the error was created. */ +export function thrownAt(error?: Error): CodeError; +/** Configure code. */ +export const settings: Settings; + +type AssertionChain = Assertion & Expectation; + +interface Assertion extends Grammar, Flags { } + +interface Expectation extends Types, Values { } + +interface Grammar { + /** Connecting word. */ + a: AssertionChain; + /** Connecting word. */ + an: AssertionChain; + /** Connecting word. */ + and: AssertionChain; + /** Connecting word. */ + at: AssertionChain; + /** Connecting word. */ + be: AssertionChain; + /** Connecting word. */ + have: AssertionChain; + /** Connecting word. */ + in: AssertionChain; + /** Connecting word. */ + to: AssertionChain; +} + +interface Flags { + /** Inverses the expected result of any assertion */ + not: AssertionChain; + /** + * Requires that inclusion matches appear only once in the provided value. + * Used by include(). + */ + once: AssertionChain; + /** + * Requires that only the provided elements appear in the provided value. + * Used by include(). + */ + only: AssertionChain; + /** + * Allows a partial match when asserting inclusion + * Used by include(). Defaults to false. + */ + part: AssertionChain; + /** + * Performs a comparison using strict equality (===). + * Code defaults to deep comparison. Used by equal() and include(). + */ + shallow: AssertionChain; +} + +interface Types { + /** Asserts that the reference value is an arguments object. */ + arguments(): AssertionChain; + /** Asserts that the reference value is an Array. */ + array(): AssertionChain; + /** Asserts that the reference value is a boolean. */ + boolean(): AssertionChain; + /** Asserts that the reference value is a Buffer. */ + buffer(): AssertionChain; + /** Asserts that the reference value is a Date. */ + date(): AssertionChain; + /** Asserts that the reference value is an error. */ + error(type?: Object, message?: string | RegExp): AssertionChain; + /** Asserts that the reference value is a function. */ + function(): AssertionChain; + /** Asserts that the reference value is a number. */ + number(): AssertionChain; + /** Asserts that the reference value is a RegExp. */ + regexp(): AssertionChain; + /** Asserts that the reference value is a string. */ + string(): AssertionChain; + /** Asserts that the reference value is an object (excluding array, buffer, or other native objects). */ + object(): AssertionChain; +} + +interface Values { + /** Asserts that the reference value is true. */ + true(): AssertionChain; + /** Asserts that the reference value is false. */ + false(): AssertionChain; + /** Asserts that the reference value is null. */ + null(): AssertionChain; + /** Asserts that the reference value is undefined. */ + undefined(): AssertionChain; + /** Asserts that the reference value (a string, array, or object) includes the provided values. */ + include(values: string | string[] | T | T[]): AssertionChain; + /** Asserts that the reference value (a string, array, or object) includes the provided values. */ + includes(values: string | string[] | T | T[]): AssertionChain; + /** Asserts that the reference value (a string, array, or object) includes the provided values. */ + contain(values: string | string[] | T | T[]): AssertionChain; + /** Asserts that the reference value (a string, array, or object) includes the provided values. */ + contains(values: string | string[] | T | T[]): AssertionChain; + /** Asserts that the reference value (a string) starts with the provided value. */ + startWith(value: string): AssertionChain; + /** Asserts that the reference value (a string) starts with the provided value. */ + startsWith(value: string): AssertionChain; + /** Asserts that the reference value (a string) ends with the provided value. */ + endWith(value: string): AssertionChain; + /** Asserts that the reference value (a string) ends with the provided value. */ + endsWith(value: string): AssertionChain; + /** Asserts that the reference value exists (not null or undefined). */ + exist(): AssertionChain; + /** Asserts that the reference value exists (not null or undefined). */ + exists(): AssertionChain; + /** Asserts that the reference value has a length property equal to zero or an object with no keys. */ + empty(): AssertionChain; + /** Asserts that the reference value has a length property matching the provided size or an object with the specified number of keys. */ + length(size: number): AssertionChain; + /** Asserts that the reference value equals the provided value. */ + equal(value: T, options?: any): AssertionChain; + /** Asserts that the reference value equals the provided value. */ + equals(value: T, options?: any): AssertionChain; + /** Asserts that the reference value is greater than (>) the provided value. */ + above(value: T): AssertionChain; + /** Asserts that the reference value is greater than (>) the provided value. */ + greaterThan(value: T): AssertionChain; + /** Asserts that the reference value is at least (>=) the provided value. */ + least(value: T): AssertionChain; + /** Asserts that the reference value is at least (>=) the provided value. */ + min(value: T): AssertionChain; + /** Asserts that the reference value is less than (<) the provided value. */ + below(value: T): AssertionChain; + /** Asserts that the reference value is less than (<) the provided value. */ + lessThan(value: T): AssertionChain; + /** Asserts that the reference value is at most (<=) the provided value. */ + most(value: T): AssertionChain; + /** Asserts that the reference value is at most (<=) the provided value. */ + max(value: T): AssertionChain; + /** Asserts that the reference value is within (from <= value <= to) the provided values. */ + within(from: T, to: T): AssertionChain; + /** Asserts that the reference value is within (from <= value <= to) the provided values. */ + range(from: T, to: T): AssertionChain; + /** Asserts that the reference value is between but not equal (from < value < to) the provided values. */ + between(from: T, to: T): AssertionChain; + /** Asserts that the reference value is about the provided value within a delta margin of difference. */ + about(value: number, delta: number): AssertionChain; + /** Asserts that the reference value has the provided instanceof value. */ + instanceof(type: Object): AssertionChain; + /** Asserts that the reference value has the provided instanceof value. */ + instanceOf(type: Object): AssertionChain; + /** Asserts that the reference value's toString() representation matches the provided regular expression. */ + match(regex: RegExp): AssertionChain; + /** Asserts that the reference value's toString() representation matches the provided regular expression. */ + matches(regex: RegExp): AssertionChain; + /** Asserts that the reference value satisfies the provided validator function. */ + satisfy(validator: (value: T) => boolean): AssertionChain; + /** Asserts that the reference value satisfies the provided validator function. */ + satisfies(validator: (value: T) => boolean): AssertionChain; + /** Asserts that the function reference value throws an exception when called. */ + throw(type: Object, message: string | RegExp): AssertionChain; +} + +interface Settings { + /** + * Truncate long assertion error messages for readability? + * Defaults to true. + */ + truncateMessages?: boolean; + /** + * Ignore object prototypes when doing a deep comparison? + * Defaults to false. + */ + comparePrototypes?: boolean; +} + +interface CodeError { + filename: string; + line: string; + column: string; +} diff --git a/code/tsconfig.json b/code/tsconfig.json new file mode 100644 index 0000000000..6846645005 --- /dev/null +++ b/code/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "code-tests.ts" + ] +} \ No newline at end of file diff --git a/codemirror/codemirror-tests.ts b/codemirror/codemirror-tests.ts index c7b4e32ac6..b46604b1bb 100644 --- a/codemirror/codemirror-tests.ts +++ b/codemirror/codemirror-tests.ts @@ -48,5 +48,9 @@ myCodeMirror.getValue(); myCodeMirror.getValue("foo") myCodeMirror.setValue("bar"); -CodeMirror.registerHelper("lint", "javascript", {}); +myCodeMirror.on( + "renderLine", + (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => { } +); +CodeMirror.registerHelper("lint", "javascript", {}); diff --git a/codemirror/index.d.ts b/codemirror/index.d.ts index 708b32812e..83c45e93ab 100644 --- a/codemirror/index.d.ts +++ b/codemirror/index.d.ts @@ -393,8 +393,8 @@ declare namespace CodeMirror { /** Fired whenever a line is (re-)rendered to the DOM. Fired right after the DOM element is built, before it is added to the document. The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */ - on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; - off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; + on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => void ): void; + off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => void ): void; /** Expose the state object, so that the Editor.state.completionActive property is reachable*/ state: any; @@ -1240,4 +1240,3 @@ declare namespace CodeMirror { } } } - diff --git a/codemirror/tsconfig.json b/codemirror/tsconfig.json index 3e19f69385..a2002ceec6 100644 --- a/codemirror/tsconfig.json +++ b/codemirror/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/codependency/codependency-tests.ts b/codependency/codependency-tests.ts new file mode 100644 index 0000000000..46f2db8d6d --- /dev/null +++ b/codependency/codependency-tests.ts @@ -0,0 +1,11 @@ +/// +/// + +let requirePeer = codependency.register(module), package: any; + requirePeer = codependency.register(module, {index: ["dependencies", "devDependencies"]}); + requirePeer = codependency.get("some-middleware"); + package = requirePeer("some-peer-dependency-package"); + package = requirePeer("some-peer-dependency-package", {optional: true}); + package = requirePeer("some-peer-dependency-package", {dontThrow: true}); + package = requirePeer("some-peer-dependency-package", {optional: true, dontThrow: true}); + package = requirePeer.resolve("peer-package-name"); \ No newline at end of file diff --git a/codependency/index.d.ts b/codependency/index.d.ts new file mode 100644 index 0000000000..0376bee4bb --- /dev/null +++ b/codependency/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for codependency v0.1.3 +// Project: https://github.com/Wizcorp/codependency +// Definitions by: Morgan Benton +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export as namespace codependency; + +interface DependencyInfo { + supportedRange: string|null; + installedVersion: string|null; + isInstalled: boolean|null; + isValid: boolean|null; + pkgPath: string; +} + +interface RequirePeerFunctionOptions { + optional?: boolean; + dontThrow?: boolean; +} + +interface RequirePeerFunction { + (name: string, options?: RequirePeerFunctionOptions): any; + resolve: (name: string) => DependencyInfo; +} + +export function register(baseModule: NodeModule, options?: {index: string[]}): RequirePeerFunction; +export function get(middlewareName: string): RequirePeerFunction; \ No newline at end of file diff --git a/codependency/package.json b/codependency/package.json new file mode 100644 index 0000000000..2fa5bde2e9 --- /dev/null +++ b/codependency/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@types/node": "^6.0.0" + } +} \ No newline at end of file diff --git a/codependency/tsconfig.json b/codependency/tsconfig.json new file mode 100644 index 0000000000..226c3226a8 --- /dev/null +++ b/codependency/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "codependency-tests.ts" + ] +} \ No newline at end of file diff --git a/coffeeify/tsconfig.json b/coffeeify/tsconfig.json index 980d12eccc..83d510ff81 100644 --- a/coffeeify/tsconfig.json +++ b/coffeeify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/color/color-tests.ts b/color/color-tests.ts new file mode 100644 index 0000000000..1b2d9369e0 --- /dev/null +++ b/color/color-tests.ts @@ -0,0 +1,79 @@ +import * as Color from "color" + +var color: Color.Color = Color("white") +var colorOther: Color.Color = Color("black") + +var colorRGB: Color.Color = color.rgb(0, 0, 0) +var colorRGB: Color.Color = color.rgb([0, 0, 0]) +var rgb: Color.RGBColor = color.rgb() + +var colorHSL: Color.Color = color.hsl([0, 0, 0]) +var hsl: Color.HSLColor = color.hsl() + +var colorHSV: Color.Color = color.hsv([0, 0, 0]) +var hsv: Color.HSVColor = color.hsv() + +var colorHBW: Color.Color = color.hbw([0, 0, 0]) +var hbw: Color.HBWColor = color.hbw() + +var colorCMYK: Color.Color = color.cmyk([0, 0, 0, 0]) +var cmyk: Color.CMYKColor = color.cmyk() + +var hex: string = color.hexString() +var percent: string = color.percentString() +var keyword: string | void = color.keyword() +var alpha: number = color.alpha() +var red: number = color.red() +var green: number = color.green() +var blue: number = color.blue() +var hue: number = color.hue() +var saturation: number = color.saturation() +var lightness: number = color.lightness() +var saturationv: number = color.saturationv() +var value: number = color.value() +var whiteness: number = color.whiteness() +var blackness: number = color.blackness() +var cyan: number = color.cyan() +var magenta: number = color.magenta() +var yellow: number = color.yellow() +var black: number = color.black() +var luminosity: number = color.luminosity() +var contrast: number = color.contrast(colorOther) +var dark: boolean = color.dark() +var light: boolean = color.light() +var level: string = color.level(colorOther) + +var chain: Color.Color = color + .rgb(0, 0, 0) + .hsl([0, 0, 0]) + .hsv([0, 0, 0]) + .hbw([0, 0, 0]) + .cmyk([0, 0, 0 ,0]) + .alpha(0) + .red(0) + .green(0) + .blue(0) + .hue(0) + .saturation(0) + .lightness(0) + .saturationv(0) + .value(0) + .whiteness(0) + .blackness(0) + .cyan(0) + .magenta(0) + .yellow(0) + .black(0) + .negate() + .lighten(0) + .darken(0) + .saturate(0) + .desaturate(0) + .greyscale() + .whiten(0) + .blacken(0) + .clearer(0) + .opaquer(0) + .rotate(0) + .mix(colorOther, 0) + .clone() diff --git a/color/index.d.ts b/color/index.d.ts new file mode 100644 index 0000000000..0395cd1bf9 --- /dev/null +++ b/color/index.d.ts @@ -0,0 +1,161 @@ +// Type definitions for color v0.12.0 +// Project: https://github.com/qix-/color +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace Color { + + interface RGBColor { + r: number + g: number + b: number + a?: number + } + + interface FullRGBColor { + red: number + green: number + blue: number + alpha?: number + } + + interface HSLColor { + h: number + s: number + l: number + a?: number + } + + interface FullHSLColor { + hue: number + saturation: number + lightness: number + alpha?: number + } + + interface HSVColor { + h: number + s: number + v: number + } + + interface FullHSVColor { + hue: number + saturation: number + value: number + } + + interface HBWColor { + h: number + b: number + w: number + } + + interface FullHBWColor { + hue: number + whiteness: number + blackness: number + } + + interface CMYKColor { + c: number + m: number + y: number + k: number + } + + interface FullCMYKColor { + cyan: number + magenta: number + yellow: number + black: number + } + + type ColorParam = string | RGBColor | FullRGBColor | HSLColor | FullHSLColor | HSVColor + | FullHSVColor | HBWColor | FullHBWColor | CMYKColor | FullCMYKColor + + interface Color { + (color: ColorParam | Color) : Color + rgb(values: Array): Color + rgb(r: number, g: number, b: number, a?: number): Color + rgb(values: RGBColor): Color + rgb(values: FullRGBColor): Color + rgb(): RGBColor + rgbArray(): Array + rgbString(): string + rgbaString(): string + rgbNumber(): number + hsl(values: Array): Color + hsl(): HSLColor + hslArray(): Array + hslString(): string + hslaString(): string + hsv(values: Array): Color + hsv(): HSVColor + hsvArray(): Array + hsvString(): string + hbw(values: Array): Color + hbw(): HBWColor + hbwArray(): Array + hbwString(): string + cmyk(values: Array): Color + cmyk(): CMYKColor + cmykArray(): Array + cmykString(): string + hexString(): string + percentString(): string + keyword(): string | void + alpha(alpha: number): Color + alpha(): number + red(red: number): Color + red(): number + green(green: number): Color + green(): number + blue(blue: number): Color + blue(): number + hue(hue: number): Color + hue(): number + saturation(saturation: number): Color + saturation(): number + lightness(lightness: number): Color + lightness(): number + saturationv(saturationv: number): Color + saturationv(): number + value(value: number): Color + value(): number + whiteness(whiteness: number): Color + whiteness(): number + blackness(blackness: number): Color + blackness(): number + cyan(cyan: number): Color + cyan(): number + magenta(magenta: number): Color + magenta(): number + yellow(yellow: number): Color + yellow(): number + black(black: number): Color + black(): number + luminosity(): number + contrast(color: Color): number + dark(): boolean + light(): boolean + negate(): Color + lighten(value: number): Color + darken(value: number): Color + saturate(value: number): Color + desaturate(value: number): Color + greyscale(): Color + whiten(value: number): Color + blacken(value: number): Color + clearer(value: number): Color + opaquer(value: number): Color + rotate(value: number): Color + mix(color: Color, value?: number): Color + level(color: Color): string + clone(): Color + } +} + +declare const Color: Color.Color; +export = Color; +export as namespace Color; diff --git a/color/tsconfig.json b/color/tsconfig.json new file mode 100644 index 0000000000..ea7d415a15 --- /dev/null +++ b/color/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "color-tests.ts" + ] +} \ No newline at end of file diff --git a/colorbrewer/tsconfig.json b/colorbrewer/tsconfig.json index e47c32539d..d8afd009e6 100644 --- a/colorbrewer/tsconfig.json +++ b/colorbrewer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/colors/tsconfig.json b/colors/tsconfig.json index 907b57cf82..5630227201 100644 --- a/colors/tsconfig.json +++ b/colors/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/com.darktalker.cordova.screenshot/tsconfig.json b/com.darktalker.cordova.screenshot/tsconfig.json index 0b1d4ae264..a53a1e22ca 100644 --- a/com.darktalker.cordova.screenshot/tsconfig.json +++ b/com.darktalker.cordova.screenshot/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "com.darktalker.cordova.screenshot-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "com.darktalker.cordova.screenshot-tests.ts" + ] +} \ No newline at end of file diff --git a/combokeys/tsconfig.json b/combokeys/tsconfig.json index 724b9bf98a..a28720760d 100644 --- a/combokeys/tsconfig.json +++ b/combokeys/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cometd/tsconfig.json b/cometd/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/cometd/tsconfig.json +++ b/cometd/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/commander/commander-tests.ts b/commander/commander-tests.ts index f6f3918f6a..78bd873782 100644 --- a/commander/commander-tests.ts +++ b/commander/commander-tests.ts @@ -79,6 +79,13 @@ program console.log('unknown option is allowed'); }); +program + .version('0.0.1') + .arguments(' [env]') + .action(function (cmd, env) { + console.log(cmd, env); + }); + program.parse(process.argv); console.log('stuff'); diff --git a/commander/index.d.ts b/commander/index.d.ts index e082fcebb2..15a3246710 100644 --- a/commander/index.d.ts +++ b/commander/index.d.ts @@ -74,6 +74,11 @@ declare namespace commander { */ command(name:string, desc?:string, opts?: any):ICommand; + /** + * Set / get the arguments usage `str`. + */ + arguments(str: string):ICommand; + /** * Add an implicit `help [cmd]` subcommand * which invokes `--help` for the given command. diff --git a/commander/tsconfig.json b/commander/tsconfig.json index 62ee13de7a..8e9c0176c6 100644 --- a/commander/tsconfig.json +++ b/commander/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/commangular/commangular.d.ts b/commangular/index.d.ts similarity index 100% rename from commangular/commangular.d.ts rename to commangular/index.d.ts diff --git a/commangular/tsconfig.json b/commangular/tsconfig.json index e52f7e1a12..fa86db21ae 100644 --- a/commangular/tsconfig.json +++ b/commangular/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "commangular.d.ts", + "index.d.ts", "commangular-mock.d.ts" ] } \ No newline at end of file diff --git a/common-tags/tsconfig.json b/common-tags/tsconfig.json index 34cf9e3e14..459ad8d20c 100644 --- a/common-tags/tsconfig.json +++ b/common-tags/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/commonmark/tsconfig.json b/commonmark/tsconfig.json index 2dec80d56a..0b9f1c06f0 100644 --- a/commonmark/tsconfig.json +++ b/commonmark/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/compare-version/tsconfig.json b/compare-version/tsconfig.json index b8835e1bf8..5b01fa2c88 100644 --- a/compare-version/tsconfig.json +++ b/compare-version/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/complex/tsconfig.json b/complex/tsconfig.json index 1342a9f58b..b958f7df69 100644 --- a/complex/tsconfig.json +++ b/complex/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/component-emitter/tsconfig.json b/component-emitter/tsconfig.json index 7b2b1fbb8a..f06aef9ef2 100644 --- a/component-emitter/tsconfig.json +++ b/component-emitter/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/compose-function/tsconfig.json b/compose-function/tsconfig.json index a3be8fa68b..2540821315 100644 --- a/compose-function/tsconfig.json +++ b/compose-function/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/compression/tsconfig.json b/compression/tsconfig.json index c5d4ea4a06..ad43e60acf 100644 --- a/compression/tsconfig.json +++ b/compression/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/concaveman/tsconfig.json b/concaveman/tsconfig.json index e888616615..7c9242a551 100644 --- a/concaveman/tsconfig.json +++ b/concaveman/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/confidence/tsconfig.json b/confidence/tsconfig.json index 2366ee68a5..5ed4a5fe05 100644 --- a/confidence/tsconfig.json +++ b/confidence/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/config/index.d.ts b/config/index.d.ts index a9cb505f0e..98dda3448a 100644 --- a/config/index.d.ts +++ b/config/index.d.ts @@ -31,6 +31,9 @@ declare namespace c { // Get the current value of a config environment variable getEnv(varName: string): string; + + // Return the config for the project based on directory param if not directory then return default one (config). + loadFileConfigs(configDir: string): any; } interface IConfig { diff --git a/config/tsconfig.json b/config/tsconfig.json index a44ff0d3e7..ce63061849 100644 --- a/config/tsconfig.json +++ b/config/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/configstore/tsconfig.json b/configstore/tsconfig.json index d107475403..a67444aa3d 100644 --- a/configstore/tsconfig.json +++ b/configstore/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/confit/tsconfig.json b/confit/tsconfig.json index 5de137412e..d035477089 100644 --- a/confit/tsconfig.json +++ b/confit/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/connect-flash/tsconfig.json b/connect-flash/tsconfig.json index 34bc1f8ca0..7fe8912d21 100644 --- a/connect-flash/tsconfig.json +++ b/connect-flash/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/connect-livereload/tsconfig.json b/connect-livereload/tsconfig.json index 4f8d452cbc..41a8b4caeb 100644 --- a/connect-livereload/tsconfig.json +++ b/connect-livereload/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/connect-modrewrite/tsconfig.json b/connect-modrewrite/tsconfig.json index cdbb5b57a6..74d78a7d05 100644 --- a/connect-modrewrite/tsconfig.json +++ b/connect-modrewrite/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/connect-mongo/index.d.ts b/connect-mongo/index.d.ts index df6a79b5ed..b469d08d00 100644 --- a/connect-mongo/index.d.ts +++ b/connect-mongo/index.d.ts @@ -74,6 +74,7 @@ declare namespace connectMongo { * (Default: 10) */ autoRemoveInterval?: number; + /** * don't save session if unmodified */ diff --git a/connect-mongo/tsconfig.json b/connect-mongo/tsconfig.json index 3048900aff..b9173e6bde 100644 --- a/connect-mongo/tsconfig.json +++ b/connect-mongo/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/connect-redis/connect-redis-tests.ts b/connect-redis/connect-redis-tests.ts index 73e0e4d8f7..ed21f3b4be 100644 --- a/connect-redis/connect-redis-tests.ts +++ b/connect-redis/connect-redis-tests.ts @@ -1,4 +1,3 @@ -/// /// import * as connectRedis from "connect-redis"; diff --git a/connect-redis/connect-redis.d.ts b/connect-redis/index.d.ts similarity index 100% rename from connect-redis/connect-redis.d.ts rename to connect-redis/index.d.ts diff --git a/connect-redis/tsconfig.json b/connect-redis/tsconfig.json index 441b3c70c6..6217f24b07 100644 --- a/connect-redis/tsconfig.json +++ b/connect-redis/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "connect-redis.d.ts", + "index.d.ts", "connect-redis-tests.ts" ] -} +} \ No newline at end of file diff --git a/connect-slashes/tsconfig.json b/connect-slashes/tsconfig.json index 79fe5a883b..4388cfb9bf 100644 --- a/connect-slashes/tsconfig.json +++ b/connect-slashes/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/connect-timeout/tsconfig.json b/connect-timeout/tsconfig.json index 01feb5bd3a..ccff02eeb3 100644 --- a/connect-timeout/tsconfig.json +++ b/connect-timeout/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/connect/tsconfig.json b/connect/tsconfig.json index 733e539a82..590831c9d8 100644 --- a/connect/tsconfig.json +++ b/connect/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/console-stamp/tsconfig.json b/console-stamp/tsconfig.json index c66dbd5607..1dfa069297 100644 --- a/console-stamp/tsconfig.json +++ b/console-stamp/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/consolidate/tsconfig.json b/consolidate/tsconfig.json index 10f98b21f8..e7ba412b66 100644 --- a/consolidate/tsconfig.json +++ b/consolidate/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/constant-case/constant-case-tests.ts b/constant-case/constant-case-tests.ts deleted file mode 100644 index ddb5c57e66..0000000000 --- a/constant-case/constant-case-tests.ts +++ /dev/null @@ -1,8 +0,0 @@ - -import constantCase = require('constant-case'); - -console.log(constantCase('string')); // => "STRING" -console.log(constantCase('PascalCase')); // => "PASCAL_CASE" - -console.log(constantCase('myString', 'tr')); // => "MY_STRİNG" - diff --git a/constant-case/index.d.ts b/constant-case/index.d.ts deleted file mode 100644 index 7ae0536e74..0000000000 --- a/constant-case/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for constant-case -// Project: https://github.com/blakeembrey/constant-case -// Definitions by: Sam Saint-Pettersen -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare function constantCase(string: string, locale?: string): string; -export = constantCase; diff --git a/consul/tsconfig.json b/consul/tsconfig.json index 3312219b73..838c80f127 100644 --- a/consul/tsconfig.json +++ b/consul/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/content-disposition/content-disposition-tests.ts b/content-disposition/content-disposition-tests.ts new file mode 100644 index 0000000000..4c4125fa2a --- /dev/null +++ b/content-disposition/content-disposition-tests.ts @@ -0,0 +1,10 @@ +import contentDisposition = require("content-disposition"); + +const noParams = contentDisposition(); +const withFilenameNoOptions = contentDisposition("EURO rates.txt"); +const withFilenameAndOptions = contentDisposition("€ rates.txt", { type: "attachment", fallback: "EURO rates.txt" }); +const noFilename = contentDisposition(undefined, { type: "attachment", fallback: true }); + +const res = contentDisposition.parse('attachment; filename="EURO rates.txt"'); +const type = res.type; +const parameters = res.parameters; diff --git a/content-disposition/index.d.ts b/content-disposition/index.d.ts new file mode 100644 index 0000000000..56ea66f8ca --- /dev/null +++ b/content-disposition/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for content-disposition 0.5 +// Project: https://github.com/jshttp/content-disposition +// Definitions by: Stefan Reichel +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace contentDisposition { + export interface ContentDisposition { + type: string; + parameters: any; + } + + export interface Options { + type?: string; + fallback?: string | boolean; + } + + export function parse(contentDispositionHeader: string): ContentDisposition; +} + +declare function contentDisposition(): string; +declare function contentDisposition(filename: undefined, options: contentDisposition.Options): string; +declare function contentDisposition(filename: string, options?: contentDisposition.Options): string; + +export = contentDisposition; diff --git a/content-disposition/tsconfig.json b/content-disposition/tsconfig.json new file mode 100644 index 0000000000..b73c153fb2 --- /dev/null +++ b/content-disposition/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "content-disposition-tests.ts" + ] +} \ No newline at end of file diff --git a/content-disposition/tslint.json b/content-disposition/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/content-disposition/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/content-type/tsconfig.json b/content-type/tsconfig.json index ae9c720e39..539d27124d 100644 --- a/content-type/tsconfig.json +++ b/content-type/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/contentful-resolve-response/tsconfig.json b/contentful-resolve-response/tsconfig.json index 35c1382a6c..28d65f4d1d 100644 --- a/contentful-resolve-response/tsconfig.json +++ b/contentful-resolve-response/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/contextjs/tsconfig.json b/contextjs/tsconfig.json index e02db0974f..bfd596b5e7 100644 --- a/contextjs/tsconfig.json +++ b/contextjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/continuation-local-storage/continuation-local-storage-tests.ts b/continuation-local-storage/continuation-local-storage-tests.ts new file mode 100644 index 0000000000..3d85886d73 --- /dev/null +++ b/continuation-local-storage/continuation-local-storage-tests.ts @@ -0,0 +1,466 @@ +import * as cls from 'continuation-local-storage'; + +import EventEmitter = NodeJS.EventEmitter; + +class Test { + test(topic: string, callback: (t: Test) => any): any {} + plan(n: number): any {} + equal(a: any, b: any, c?: any): any {} + ok(a: any, b: any): any {} + notOk(a: any, b: any): any {} + comment(a: any): any {} + end(): any {} + doesNotThrow(a: any): any {} + throws(a: any): any {} +} + +function test(topic: string, callback: (t: Test) => any) { +} + +// from test/async-context.tap.js +test("asynchronously propagating state with local-context-domains", function (t) { + t.plan(2); + + var namespace = cls.createNamespace('namespace'); + // t.ok(process.namespaces.namespace, "namespace has been created"); + + namespace.run(function () { + namespace.set('test', 1337); + t.equal(namespace.get('test'), 1337, "namespace is working"); + }); +}); + +// from test/async-no-run-queue-multiple.tap.js + +test("minimized test case that caused #6011 patch to fail", function (t) { + t.plan(3); + + console.log('+'); + // when the flaw was in the patch, commenting out this line would fix things: + process.nextTick(function () { console.log('!'); }); + + var n = cls.createNamespace("test"); + t.ok(!n.get('state'), "state should not yet be visible"); + + n.run(function () { + n.set('state', true); + t.ok(n.get('state'), "state should be visible"); + + process.nextTick(function () { + t.ok(n.get('state'), "state should be visible"); + }); + }); +}); + +// from test/bind-emitter.tap.js +test("event emitters bound to CLS context", function (t) { + t.plan(13); + + t.test("handler registered in context, emit out of context", function (t) { + t.plan(1); + + var n = cls.createNamespace('in') + , ee = new EventEmitter() + ; + + n.run(function () { + n.set('value', 'hello'); + n.bindEmitter(ee); + ee.on('event', function () { + t.equal(n.get('value'), 'hello', "value still set in EE."); + cls.destroyNamespace('in'); + }); + }); + + ee.emit('event'); + }); + + t.test("once handler registered in context", function (t) { + t.plan(1); + + var n = cls.createNamespace('inOnce') + , ee = new EventEmitter() + ; + + n.run(function () { + n.set('value', 'hello'); + n.bindEmitter(ee); + ee.once('event', function () { + t.equal(n.get('value'), 'hello', "value still set in EE."); + cls.destroyNamespace('inOnce'); + }); + }); + + ee.emit('event'); + }); + + t.test("handler registered out of context, emit in context", function (t) { + t.plan(1); + + var n = cls.createNamespace('out') + , ee = new EventEmitter() + ; + + ee.on('event', function () { + t.equal(n.get('value'), 'hello', "value still set in EE."); + cls.destroyNamespace('out'); + }); + + n.run(function () { + n.set('value', 'hello'); + n.bindEmitter(ee); + + ee.emit('event'); + }); + }); + + t.test("once handler registered out of context", function (t) { + t.plan(1); + + var n = cls.createNamespace('outOnce') + , ee = new EventEmitter() + ; + + ee.once('event', function () { + t.equal(n.get('value'), 'hello', "value still set in EE."); + cls.destroyNamespace('outOnce'); + }); + + n.run(function () { + n.set('value', 'hello'); + n.bindEmitter(ee); + + ee.emit('event'); + }); + }); + + t.test("handler registered out of context, emit out of context", function (t) { + t.plan(1); + + var n = cls.createNamespace('out') + , ee = new EventEmitter() + ; + + ee.on('event', function () { + t.equal(n.get('value'), undefined, "no context."); + cls.destroyNamespace('out'); + }); + + n.run(function () { + n.set('value', 'hello'); + n.bindEmitter(ee); + }); + + ee.emit('event'); + }); + + t.test("once handler registered out of context on Readable", function (t) { + var Readable = require('stream').Readable; + + if (Readable) { + t.plan(12); + + var n = cls.createNamespace('outOnceReadable') + , re = new Readable() + ; + + re._read = function () {}; + + t.ok(n.name, "namespace has a name"); + t.equal(n.name, 'outOnceReadable', "namespace has a name"); + + re.once('data', function (data: any) { + t.equal(n.get('value'), 'hello', "value still set in EE"); + t.equal(data, 'blah', "emit still works"); + cls.destroyNamespace('outOnceReadable'); + }); + + n.run(function () { + n.set('value', 'hello'); + + t.notOk(re.emit.__wrapped, "emit is not wrapped"); + t.notOk(re.on.__wrapped, "on is not wrapped"); + t.notOk(re.addListener.__wrapped, "addListener is not wrapped"); + + n.bindEmitter(re); + + t.ok(re.emit.__wrapped, "emit is wrapped"); + t.ok(re.on.__wrapped, "on is wrapped"); + t.ok(re.addListener.__wrapped, "addListener is wrapped"); + + t.equal(typeof re._events.data, 'function', 'only the one data listener'); + t.notOk(re._events.data['context@outOnceReadable'], "context isn't on listener"); + + re.emit('data', 'blah'); + }); + } + else { + t.comment("this test requires node 0.10+"); + t.end(); + } + }); + + t.test("emitter with newListener that removes handler", function (t) { + t.plan(3); + + var n = cls.createNamespace('newListener') + , ee = new EventEmitter() + ; + + // add monkeypatching to ee + n.bindEmitter(ee); + + function listen() { + ee.on('data', function (chunk: any) { + t.equal(chunk, 'chunk', 'listener still works'); + }); + } + + ee.on('newListener', function handler(event: any) { + if (event !== 'data') return; + + this.removeListener('newListener', handler); + t.notOk(this.listeners('newListener').length, 'newListener was removed'); + process.nextTick(listen); + }); + + ee.on('drain', function (chunk: any) { + process.nextTick(function () { + ee.emit('data', chunk); + }); + }); + + ee.on('data', function (chunk: any) { + t.equal(chunk, 'chunk', 'got data event'); + cls.destroyNamespace('newListener'); + }); + + ee.emit('drain', 'chunk'); + }); + + t.test("handler registered in context on Readable", function (t) { + var Readable = require('stream').Readable; + + if (Readable) { + t.plan(12); + + var n = cls.createNamespace('outOnReadable') + , re = new Readable() + ; + + re._read = function () {}; + + t.ok(n.name, "namespace has a name"); + t.equal(n.name, 'outOnReadable', "namespace has a name"); + + n.run(function () { + n.set('value', 'hello'); + + n.bindEmitter(re); + + t.ok(re.emit.__wrapped, "emit is wrapped"); + t.ok(re.on.__wrapped, "on is wrapped"); + t.ok(re.addListener.__wrapped, "addListener is wrapped"); + + re.on('data', function (data: any) { + t.equal(n.get('value'), 'hello', "value still set in EE"); + t.equal(data, 'blah', "emit still works"); + cls.destroyNamespace('outOnReadable'); + }); + }); + + t.ok(re.emit.__wrapped, "emit is still wrapped"); + t.ok(re.on.__wrapped, "on is still wrapped"); + t.ok(re.addListener.__wrapped, "addListener is still wrapped"); + + t.equal(typeof re._events.data, 'function', 'only the one data listener'); + t.ok(re._events.data['cls@contexts']['context@outOnReadable'], + "context is bound to listener"); + + re.emit('data', 'blah'); + } + else { + t.comment("this test requires node 0.10+"); + t.end(); + } + }); + + t.test("handler added but used entirely out of context", function (t) { + t.plan(2); + + var n = cls.createNamespace('none') + , ee = new EventEmitter() + ; + + n.run(function () { + n.set('value', 'hello'); + n.bindEmitter(ee); + }); + + ee.on('event', function () { + t.ok(n, "n is set"); + t.notOk(n.get('value'), "value shouldn't be visible"); + cls.destroyNamespace('none'); + }); + + ee.emit('event'); + }); + + t.test("handler added but no listeners registered", function (t) { + t.plan(3); + + var http = require('http') + , n = cls.createNamespace('no_listener') + ; + + // only fails on Node < 0.10 + var server = http.createServer(function (req: any, res: any) { + n.bindEmitter(req); + + t.doesNotThrow(function () { + req.emit('event'); + }); + + res.writeHead(200, {"Content-Length" : 4}); + res.end('WORD'); + }); + server.listen(8080); + + http.get('http://localhost:8080/', function (res: any) { + t.equal(res.statusCode, 200, "request came back OK"); + + res.setEncoding('ascii'); + res.on('data', function (body: any) { + t.equal(body, 'WORD'); + + server.close(); + cls.destroyNamespace('no_listener'); + }); + }); + }); + + t.test("listener with parameters added but not bound to context", function (t) { + t.plan(2); + + var ee = new EventEmitter() + , n = cls.createNamespace('param_list') + ; + + function sent(value: any) { + t.equal(value, 3, "sent value is correct"); + cls.destroyNamespace('param_list'); + } + + ee.on('send', sent); + n.bindEmitter(ee); + t.doesNotThrow(function () { + ee.emit('send', 3); + }); + }); + + t.test("listener that throws doesn't leave removeListener wrapped", function (t) { + t.plan(4); + + var ee = new EventEmitter() + , n = cls.createNamespace('kaboom') + ; + + n.bindEmitter(ee); + + function kaboom() { + throw new Error('whoops'); + } + + n.run(function () { + ee.on('bad', kaboom); + + t.throws(function () { ee.emit('bad'); }); + t.equal(typeof ee.removeListener, 'function', 'removeListener is still there'); + // t.notOk(ee.removeListener.__wrapped, "removeListener got unwrapped"); + // t.equal(ee._events.bad, kaboom, "listener isn't still bound"); + cls.destroyNamespace('kaboom'); + }); + }); + + t.test("emitter bound to multiple namespaces handles them correctly", function (t) { + t.plan(8); + + var ee = new EventEmitter() + , ns1 = cls.createNamespace('1') + , ns2 = cls.createNamespace('2') + ; + + // emulate an incoming data emitter + setTimeout(function () { + ee.emit('data', 'hi'); + }, 10); + + t.doesNotThrow(function () { ns1.bindEmitter(ee); }); + t.doesNotThrow(function () { ns2.bindEmitter(ee); }); + + ns1.run(function () { + ns2.run(function () { + ns1.set('name', 'tom1'); + ns2.set('name', 'tom2'); + + t.doesNotThrow(function () { ns1.bindEmitter(ee); }); + t.doesNotThrow(function () { ns2.bindEmitter(ee); }); + + ns1.run(function () { + process.nextTick(function () { + t.equal(ns1.get('name'), 'tom1', "ns1 value correct"); + t.equal(ns2.get('name'), 'tom2', "ns2 value correct"); + + ns1.set('name', 'bob'); + ns2.set('name', 'alice'); + + ee.on('data', function () { + t.equal(ns1.get('name'), 'bob', "ns1 value bound onto emitter"); + t.equal(ns2.get('name'), 'alice', "ns2 value bound onto emitter"); + }); + }); + }); + }); + }); + }); +}); + + +// from test/bind.tap.js + +// multiple contexts in use +test("simple tracer built on contexts", function (t) { + var tracer = cls.createNamespace('tracer'); + + class Trace { + harvester: any; + constructor(harvester: any) { + this.harvester = harvester; + } + runHandler(callback: any) { + var wrapped = tracer.bind(function () { + callback(); + this.harvester.emit('finished', tracer.get('transaction')); + }.bind(this)); + wrapped(); + } + } + + t.plan(6); + + var harvester = new EventEmitter(); + var trace = new Trace(harvester); + + harvester.on('finished', function (transaction: any) { + t.ok(transaction, "transaction should have been passed in"); + t.equal(transaction.status, 'ok', "transaction should have finished OK"); + // t.equal(Object.keys(process.namespaces).length, 1, "Should only have one namespace."); + }); + + trace.runHandler(function inScope() { + t.ok(tracer.active, "tracer should have an active context"); + tracer.set('transaction', {status : 'ok'}); + t.ok(tracer.get('transaction'), "can retrieve newly-set value"); + t.equal(tracer.get('transaction').status, 'ok', "value should be correct"); + }); +}); diff --git a/continuation-local-storage/index.d.ts b/continuation-local-storage/index.d.ts new file mode 100644 index 0000000000..131f9c748c --- /dev/null +++ b/continuation-local-storage/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for continuation-local-storage v3.2.0 +// Project: https://github.com/othiym23/node-continuation-local-storage +// Definitions by: Jang-Ho Hwang , Kei Son +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export type Context = any; + +export interface Namespace { + active(): Context; + set(key: string, value: T): T; + get(key: string): any; + run(callback: any): void; + runAndReturn(callback: any): any; + bind(callback: any, context?: Context): any; + bindEmitter(emitter: NodeJS.EventEmitter): any; + createContext(): Context; + name: string; + context: Context; +} +export function createNamespace(name: string): Namespace; +export function getNamespace(name: string): Namespace; +export function destroyNamespace(name: string): void; +export function reset(): void; + +// declare namespace process { +// var namespaces: ContinuationLocalStorage.Namespace[]; +// } diff --git a/continuation-local-storage/tsconfig.json b/continuation-local-storage/tsconfig.json new file mode 100644 index 0000000000..3c347ff1d4 --- /dev/null +++ b/continuation-local-storage/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "continuation-local-storage-tests.ts" + ] +} \ No newline at end of file diff --git a/convert-source-map/index.d.ts b/convert-source-map/index.d.ts index 22fda2b62b..cc870fed66 100644 --- a/convert-source-map/index.d.ts +++ b/convert-source-map/index.d.ts @@ -1,26 +1,27 @@ -// Type definitions for convert-source-map +// Type definitions for convert-source-map v1.3.0 // Project: https://github.com/thlorenz/convert-source-map -// Definitions by: Andrew Gaspar +// Definitions by: Andrew Gaspar , Melvin Groenhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - export interface SourceMapConverter { toObject(): any; toJSON(space?: any): string; toBase64(): string; - toComment(): string; - - addProperty(key: string, value: any): SourceMapConverter; - setProperty(key: string, value: any): SourceMapConverter; - + toComment(options?: { multiline?: boolean; }): string; + addProperty(key: string, value: any): this; + setProperty(key: string, value: any): this; getProperty(key: string): any; } -export declare function removeComments(src: string): string; -export declare var commentRegex: RegExp; - export declare function fromObject(obj: any): SourceMapConverter; export declare function fromJSON(json: string): SourceMapConverter; export declare function fromBase64(base64: string): SourceMapConverter; export declare function fromComment(comment: string): SourceMapConverter; -export declare function fromSource(source: string): SourceMapConverter; +export declare function fromMapFileComment(comment: string, mapFileDir: string): SourceMapConverter; +export declare function fromSource(source: string, largeSource?: boolean): SourceMapConverter | null; +export declare function fromMapFileSource(source: string, mapFileDir: string): SourceMapConverter | null; +export declare function removeComments(src: string): string; +export declare function removeMapFileComments(src: string): string; +export declare function generateMapFileComment(file: string, options?: { multiline?: boolean; }): string; +export declare var commentRegex: RegExp; +export declare var mapFileCommentRegex: RegExp; diff --git a/convert-source-map/tsconfig.json b/convert-source-map/tsconfig.json index dc151d28ad..7b48bb5851 100644 --- a/convert-source-map/tsconfig.json +++ b/convert-source-map/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/convict/tsconfig.json b/convict/tsconfig.json index d1dc4ba073..62461c8840 100644 --- a/convict/tsconfig.json +++ b/convict/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cookie-parser/tsconfig.json b/cookie-parser/tsconfig.json index 0dc9bb4124..f31c6d69e3 100644 --- a/cookie-parser/tsconfig.json +++ b/cookie-parser/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cookie-session/tsconfig.json b/cookie-session/tsconfig.json index ad0b573a21..6649ef38bc 100644 --- a/cookie-session/tsconfig.json +++ b/cookie-session/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cookie/tsconfig.json b/cookie/tsconfig.json index 1273280701..d446f9b766 100644 --- a/cookie/tsconfig.json +++ b/cookie/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cookiejs/tsconfig.json b/cookiejs/tsconfig.json index 49aa749ae4..00349ecb29 100644 --- a/cookiejs/tsconfig.json +++ b/cookiejs/tsconfig.json @@ -3,13 +3,14 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", - "typesSearchPaths": [ + "typeRoots": [ "../" ], + "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true }, "files": [ diff --git a/cookies/tsconfig.json b/cookies/tsconfig.json index bab7dc1f79..ee39b1bfec 100644 --- a/cookies/tsconfig.json +++ b/cookies/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/copy-paste/tsconfig.json b/copy-paste/tsconfig.json index 242d037af7..d0b1a06fce 100644 --- a/copy-paste/tsconfig.json +++ b/copy-paste/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/copy-webpack-plugin/copy-webpack-plugin-tests.ts b/copy-webpack-plugin/copy-webpack-plugin-tests.ts new file mode 100644 index 0000000000..022a734261 --- /dev/null +++ b/copy-webpack-plugin/copy-webpack-plugin-tests.ts @@ -0,0 +1,72 @@ +import { Configuration } from 'webpack' +import * as CopyWebpackPlugin from 'copy-webpack-plugin' + +const c: Configuration = { + plugins: [ + new CopyWebpackPlugin([ + // {output}/file.txt + { from: 'from/file.txt' }, + + // {output}/to/file.txt + { from: 'from/file.txt', to: 'to/file.txt' }, + + // {output}/to/directory/file.txt + { from: 'from/file.txt', to: 'to/directory' }, + + // Copy directory contents to {output}/ + { from: 'from/directory' }, + + // Copy directory contents to {output}/to/directory/ + { from: 'from/directory', to: 'to/directory' }, + + // Copy glob results to /absolute/path/ + { from: 'from/directory/**/*', to: '/absolute/path' }, + + // Copy glob results (with dot files) to /absolute/path/ + { + from: { + glob:'from/directory/**/*', + dot: true, + }, + to: '/absolute/path' + }, + + // Copy glob results, relative to context + { + context: 'from/directory', + from: '**/*', + to: '/absolute/path' + }, + + // {output}/file/without/extension + { + from: 'path/to/file.txt', + to: 'file/without/extension', + toType: 'file' + }, + + // {output}/directory/with/extension.ext/file.txt + { + from: 'path/to/file.txt', + to: 'directory/with/extension.ext', + toType: 'dir' + }, + ], { + ignore: [ + // Doesn't copy any files with a txt extension + '*.txt', + + // Doesn't copy any file, even if they start with a dot + '**/*', + + // Doesn't copy any file, except if they start with a dot + { glob: '**/*', dot: false } + ], + + // By default, we only copy modified files during + // a watch or webpack-dev-server build. Setting this + // to `true` copies all files. + copyUnmodified: true, + }) + ] +} diff --git a/copy-webpack-plugin/index.d.ts b/copy-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..11a3a30dd9 --- /dev/null +++ b/copy-webpack-plugin/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for copy-webpack-plugin v4.0.0 +// Project: https://github.com/kevlened/copy-webpack-plugin +// Definitions by: flying-sheep +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Plugin } from 'webpack' +import { IOptions } from 'minimatch' + +interface MiniMatchGlob extends IOptions { + glob: string +} + +interface CopyPattern { + /** File source path or glob */ + from: string | MiniMatchGlob + /** + * Path or webpack file-loader patterns. defaults: + * output root if `from` is file or dir. + * resolved glob path if `from` is glob. + */ + to?: string + /** + * How to interpret `to`. defaults: + * 'file' if to has extension or from is file. + * 'dir' if from is directory, to has no extension or ends in '/'. + * 'template' if to contains a template pattern. + */ + toType?: 'file' | 'dir' | 'template' + /** A path that determines how to interpret the `from` path. (default: `compiler.options.context`) */ + context?: string + /** + * Removes all directory references and only copies file names. + * + * If files have the same name, the result is non-deterministic. (default: `false`) + */ + flatten?: boolean + /** Additional globs to ignore for this pattern. (default: `[]`) */ + ignore?: Array + /** Function that modifies file contents before writing to webpack. (default: `(content, path) => content`) */ + transform?: (content: string, path: string) => string + /** Overwrites files already in `compilation.assets` (usually added by other plugins; default: `false`) */ + force?: boolean +} + +interface CopyWebpackPluginConfiguration { + /** Array of globs to ignore. (applied to from; default: `[]`) */ + ignore?: Array + /** Copies files, regardless of modification when using `watch` or `webpack-dev-server`. All files are copied on first build, regardless of this option. (default: `false`) */ + copyUnmodified?: boolean + /** Debug level. warning: only warnings, info/true: file location and read info, debug: very detailed debugging info. (default: `'warning'`) */ + debug?: 'warning' | 'info'|true | 'debug' +} + +interface CopyWebpackPlugin { + new (patterns?: CopyPattern[], options?: CopyWebpackPluginConfiguration): Plugin +} + +declare const copyWebpackPlugin: CopyWebpackPlugin +export = copyWebpackPlugin diff --git a/copy-webpack-plugin/tsconfig.json b/copy-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..aec2166153 --- /dev/null +++ b/copy-webpack-plugin/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "copy-webpack-plugin-tests.ts" + ] +} \ No newline at end of file diff --git a/cordova-ionic/tsconfig.json b/cordova-ionic/tsconfig.json index cf1e1c9d4a..08f11aa218 100644 --- a/cordova-ionic/tsconfig.json +++ b/cordova-ionic/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-app-version/index.d.ts b/cordova-plugin-app-version/index.d.ts index ac250ae765..e295724474 100644 --- a/cordova-plugin-app-version/index.d.ts +++ b/cordova-plugin-app-version/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cordova-plugin-app-version v0.1.7 +// Type definitions for cordova-plugin-app-version v0.1.7 // Project: https://github.com/whiteoctober/cordova-plugin-app-version // Definitions by: Markus Wagner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/cordova-plugin-app-version/tsconfig.json b/cordova-plugin-app-version/tsconfig.json index 53ddf5fc2d..197a02f884 100644 --- a/cordova-plugin-app-version/tsconfig.json +++ b/cordova-plugin-app-version/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-background-mode/tsconfig.json b/cordova-plugin-background-mode/tsconfig.json index 1f1a47e291..52a1b601d8 100644 --- a/cordova-plugin-background-mode/tsconfig.json +++ b/cordova-plugin-background-mode/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-battery-status/tsconfig.json b/cordova-plugin-battery-status/tsconfig.json index b781800488..8b8d0dd9a0 100644 --- a/cordova-plugin-battery-status/tsconfig.json +++ b/cordova-plugin-battery-status/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-ble-central/cordova-plugin-ble-central-tests.ts b/cordova-plugin-ble-central/cordova-plugin-ble-central-tests.ts new file mode 100644 index 0000000000..6e4317ac9d --- /dev/null +++ b/cordova-plugin-ble-central/cordova-plugin-ble-central-tests.ts @@ -0,0 +1,119 @@ +var log = (msg : string) => {}; +var devices: BLECentralPlugin.PeripheralData[] = []; +var demoDevice :BLECentralPlugin.PeripheralData = { + "name": "Battery Demo", + "id": "20:FF:D0:FF:D1:C0", + "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121], + "rssi": -55 +}; + +devices.push(demoDevice); +var demoExtendedData : BLECentralPlugin.PeripheralDataExtended = { + "name": "Battery Demo", + "id": "20:FF:D0:FF:D1:C0", + "advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121], + "rssi": -55, + "services": [ + "1800", + "1801", + "180f" + ], + "characteristics": [ + { + "service": "1800", + "characteristic": "2a00", + "properties": [ + "Read" + ] + }, + { + "service": "1800", + "characteristic": "2a01", + "properties": [ + "Read" + ] + }, + { + "service": "1801", + "characteristic": "2a05", + "properties": [ + "Read" + ] + }, + { + "service": "180f", + "characteristic": "2a19", + "properties": [ + "Read" + ], + "descriptors": [ + { + "uuid": "2901" + }, + { + "uuid": "2904" + } + ] + } + ] +}; + + +//get updates about the bluethooth states +ble.startStateNotifications((state) => log(`BLE state ${state}`)); + +ble.isEnabled(()=> log(`bluetooth is enabled`), ()=>log(`bluetooth is not enabled`)); + +//here we try to enable bluetooth +ble.enable(() => log(`yes it worked, or it was already enabled `), () => log(`nope it didn't work, the user pressed cancel, or we are in iOS`)); + +ble.showBluetoothSettings(() => log(`yes it worked`), () => log(`nope it didn't work`)) + +//stop getting updates about the bluethooth states +ble.stopStateNotifications() + +//scan 5 seconds +ble.scan([], 5000, (data) => { devices.push(data); }, ()=> log('couldn\'t connect') ); + +//scan continously +ble.startScan([], (data) => { devices.push(data); }, ()=> log('couldn\'t connect') ) + +////scan continously +ble.startScanWithOptions([], {reportDuplicates:false }, (data) => { devices.push(data); }, ()=> log('couldn\'t connect') ) + +//stop scanning +ble.stopScan(()=> log('all good'), ()=> log('couldn\'t stop scanning')); + +//are we conenected to that device? +ble.isConnected(demoDevice.id, () => log(`already connected to this device`), ()=> log(`not yet connected to that device`)); + +//connect to a specific device +var extendedData : BLECentralPlugin.PeripheralDataExtended; +ble.connect(demoDevice.id, (data)=> extendedData = data, () => log(`couldn't connect to the device`) ); + +//read some data from a characteristic +var charsOfOneOfItsServices = demoExtendedData.characteristics.filter((value) => value.service == demoExtendedData.services[0]); +ble.read(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, (data) => log(`we've received some data`), ()=> log(`couldn't read any data`)); + +//read the rssi +ble.readRSSI(demoDevice.id, (rssi)=>log(`Device ${demoDevice.name} has an RSSI of ${rssi}`)); + +var notificationsReceived : number = 0; +//get notified of changes for that characteristic +ble.startNotification(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, (data)=> notificationsReceived++, ()=> log(`darn`)); + +//write some data +ble.write(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, new ArrayBuffer(40), ()=> log(`all good`), ()=> log(`could't write`)); +//write some data without getting notified +ble.writeWithoutResponse(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, new ArrayBuffer(40), ()=> log(`all good`), ()=> log(`could't write`)); + +//stop getting notified of changes. +ble.stopNotification(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic); + +//notificationsReceived == 1 + +//just disconnect +ble.disconnect(demoDevice.id); + + + diff --git a/cordova-plugin-ble-central/index.d.ts b/cordova-plugin-ble-central/index.d.ts new file mode 100644 index 0000000000..ccf2396833 --- /dev/null +++ b/cordova-plugin-ble-central/index.d.ts @@ -0,0 +1,108 @@ +// Type definitions for cordova-plugin-ble-central 1.1.2 +// Project: https://github.com/don/cordova-plugin-ble-central +// Definitions by: Gidon Junge +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare namespace BLECentralPlugin { + + interface PeripheralCharacteristic { + service: string; + characteristic: string; + properties: string[]; + descriptors?: any[]; + } + + interface PeripheralData { + name: string; + id: string; + rssi: number + advertising: ArrayBuffer|any; + } + + + interface PeripheralDataExtended extends PeripheralData{ + services: string[]; + characteristics: PeripheralCharacteristic[] + } + + + + + interface StartScanOptions { + reportDuplicates?: boolean; + } + + export interface BLECentralPluginStatic { + scan(services: string[], seconds: number, success : (data: PeripheralData) => any): void; + scan(services: string[], seconds: number, success : (data: PeripheralData) => any, failure : () => any): void; + + startScan(services: string[], success: (data: PeripheralData) => any): void; + startScan(services: string[], success: (data: PeripheralData) => any, failure: () => any): void; + + startScanWithOptions(services: string[], options: StartScanOptions, success: (data: PeripheralData) => any): void; + startScanWithOptions(services: string[], options: StartScanOptions, success: (data: PeripheralData) => any, failure: () => any): void; + + stopScan(): void; + stopScan(success: () => any): void; + stopScan(success: () => any, failure: () => any): void; + + connect(device_id:string, success: (data: PeripheralDataExtended) => any, failure: () => any): void; + + disconnect(device_id:string): void; + disconnect(device_id:string, success: () => any): void; + disconnect(device_id:string, success: () => any, failure: () => any): void; + + read(device_id: string, service_uuid:string, characteristic_uuid:string): void; + read(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any): void; + read(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any, failure: () => any): void; + + write(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer): void; + write(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any): void; + write(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any, failure: () => any): void; + + /* Writes data to a characteristic without a response from the peripheral. You are not notified if the write fails in the BLE stack. + The success callback is be called when the characteristic is written.*/ + writeWithoutResponse(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer): void; + writeWithoutResponse(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any): void; + writeWithoutResponse(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any, failure: () => any): void; + + /* Register to be notified when the value of a characteristic changes. */ + startNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any): void; + startNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any, failure: () => any): void; + + stopNotification(device_id: string, service_uuid:string, characteristic_uuid:string): void; + stopNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: () => any): void; + stopNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: () => any, failure: () => any): void; + + /* Reports if bluetooth is enabled. */ + isEnabled(success: () => any , failure: () => any): void; + + /* Calls the success callback when the peripheral is connected and the failure callback when not connected. */ + isConnected(device_id: string, success: () => any): void; + isConnected(device_id: string, success: () => any, failure: () => any): void; + + startStateNotifications(success: (state: string) => any): void; + startStateNotifications(success: (state: string) => any, failure: () => any): void; + + stopStateNotifications(): void; + stopStateNotifications(success: () => any): void; + stopStateNotifications(success: () => any, failure: () => any): void; + + /* Opens the Bluetooth settings for the operating systems. + [iOS] showBluetoothSettings is not supported on iOS. */ + showBluetoothSettings(): void; + showBluetoothSettings(success: () => any): void; + showBluetoothSettings(success: () => any, failure: () => any): void; + + /* Enable Bluetooth on the device. + [iOS] enable is not supported on iOS. */ + enable(success: () => any, failure: () => any): void; + + + readRSSI(device_id:string, success: (rssi: number) => any): void; + readRSSI(device_id:string, success: (rssi: number) => any, failure: () => any): void; + } +} + +declare var ble: BLECentralPlugin.BLECentralPluginStatic; \ No newline at end of file diff --git a/cordova-plugin-ble-central/tsconfig.json b/cordova-plugin-ble-central/tsconfig.json new file mode 100644 index 0000000000..f5e39c3e42 --- /dev/null +++ b/cordova-plugin-ble-central/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cordova-plugin-ble-central-tests.ts" + ] +} \ No newline at end of file diff --git a/cordova-plugin-camera/tsconfig.json b/cordova-plugin-camera/tsconfig.json index fd82d2283c..de59057b16 100644 --- a/cordova-plugin-camera/tsconfig.json +++ b/cordova-plugin-camera/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-contacts/tsconfig.json b/cordova-plugin-contacts/tsconfig.json index 150cbbc01b..7a2cdd8a71 100644 --- a/cordova-plugin-contacts/tsconfig.json +++ b/cordova-plugin-contacts/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-device-motion/tsconfig.json b/cordova-plugin-device-motion/tsconfig.json index 38d054da74..7103a190fb 100644 --- a/cordova-plugin-device-motion/tsconfig.json +++ b/cordova-plugin-device-motion/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-device-orientation/tsconfig.json b/cordova-plugin-device-orientation/tsconfig.json index cbbd8fcb7c..2cb3f53eba 100644 --- a/cordova-plugin-device-orientation/tsconfig.json +++ b/cordova-plugin-device-orientation/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-device/tsconfig.json b/cordova-plugin-device/tsconfig.json index 2382a3c48b..770035677b 100644 --- a/cordova-plugin-device/tsconfig.json +++ b/cordova-plugin-device/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-dialogs/tsconfig.json b/cordova-plugin-dialogs/tsconfig.json index 8a06fc75a3..5b58970648 100644 --- a/cordova-plugin-dialogs/tsconfig.json +++ b/cordova-plugin-dialogs/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-email-composer/tsconfig.json b/cordova-plugin-email-composer/tsconfig.json index effbcc48d8..dbf1e20d04 100644 --- a/cordova-plugin-email-composer/tsconfig.json +++ b/cordova-plugin-email-composer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-file-transfer/tsconfig.json b/cordova-plugin-file-transfer/tsconfig.json index a4d326b967..fa23de9d32 100644 --- a/cordova-plugin-file-transfer/tsconfig.json +++ b/cordova-plugin-file-transfer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-file/tsconfig.json b/cordova-plugin-file/tsconfig.json index 62e93d809e..2d6757de6f 100644 --- a/cordova-plugin-file/tsconfig.json +++ b/cordova-plugin-file/tsconfig.json @@ -3,16 +3,18 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", "cordova-plugin-file-tests.ts" ] -} +} \ No newline at end of file diff --git a/cordova-plugin-globalization/tsconfig.json b/cordova-plugin-globalization/tsconfig.json index c743a2a3ee..b8578ee58a 100644 --- a/cordova-plugin-globalization/tsconfig.json +++ b/cordova-plugin-globalization/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-ibeacon/index.d.ts b/cordova-plugin-ibeacon/index.d.ts index f33cc62c73..bfbfe607d4 100644 --- a/cordova-plugin-ibeacon/index.d.ts +++ b/cordova-plugin-ibeacon/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cordova-plugin-ibeacon v3.3.0 +// Type definitions for cordova-plugin-ibeacon v3.3.0 // Project: https://github.com/petermetz/cordova-plugin-ibeacon // Definitions by: Markus Wagner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/cordova-plugin-ibeacon/tsconfig.json b/cordova-plugin-ibeacon/tsconfig.json index e5c465fd8a..70ae7003fc 100644 --- a/cordova-plugin-ibeacon/tsconfig.json +++ b/cordova-plugin-ibeacon/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-inappbrowser/tsconfig.json b/cordova-plugin-inappbrowser/tsconfig.json index 171d99407e..a07866f8cc 100644 --- a/cordova-plugin-inappbrowser/tsconfig.json +++ b/cordova-plugin-inappbrowser/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-insomnia/index.d.ts b/cordova-plugin-insomnia/index.d.ts index 2d3ca2e9e4..3b5fbd9e4d 100644 --- a/cordova-plugin-insomnia/index.d.ts +++ b/cordova-plugin-insomnia/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Insomnia-PhoneGap-Plugin v4.0.1 +// Type definitions for Insomnia-PhoneGap-Plugin v4.0.1 // Project: https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin/ // Definitions by: Markus Wagner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/cordova-plugin-insomnia/tsconfig.json b/cordova-plugin-insomnia/tsconfig.json index 65a5b704cb..c718b88f82 100644 --- a/cordova-plugin-insomnia/tsconfig.json +++ b/cordova-plugin-insomnia/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-keyboard/tsconfig.json b/cordova-plugin-keyboard/tsconfig.json index 00a8c3f7c5..055b29f90d 100644 --- a/cordova-plugin-keyboard/tsconfig.json +++ b/cordova-plugin-keyboard/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-mapsforge/tsconfig.json b/cordova-plugin-mapsforge/tsconfig.json index c564be8d68..c6c33ecb36 100644 --- a/cordova-plugin-mapsforge/tsconfig.json +++ b/cordova-plugin-mapsforge/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-media-capture/tsconfig.json b/cordova-plugin-media-capture/tsconfig.json index f3ded32580..08a872e71c 100644 --- a/cordova-plugin-media-capture/tsconfig.json +++ b/cordova-plugin-media-capture/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "index.d.ts", "cordova-plugin-media-capture-tests.ts" ] -} +} \ No newline at end of file diff --git a/cordova-plugin-media/tsconfig.json b/cordova-plugin-media/tsconfig.json index 7875dd04a0..aab9a54f98 100644 --- a/cordova-plugin-media/tsconfig.json +++ b/cordova-plugin-media/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-ms-adal/tsconfig.json b/cordova-plugin-ms-adal/tsconfig.json index 069dda6589..cfe65b091f 100644 --- a/cordova-plugin-ms-adal/tsconfig.json +++ b/cordova-plugin-ms-adal/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-network-information/tsconfig.json b/cordova-plugin-network-information/tsconfig.json index 045c48e109..a17dfe6bb3 100644 --- a/cordova-plugin-network-information/tsconfig.json +++ b/cordova-plugin-network-information/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-ouralabs/tsconfig.json b/cordova-plugin-ouralabs/tsconfig.json index b91fa38b58..95f5b51784 100644 --- a/cordova-plugin-ouralabs/tsconfig.json +++ b/cordova-plugin-ouralabs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-qrscanner/tsconfig.json b/cordova-plugin-qrscanner/tsconfig.json index 6f43f4ae6e..80c1eef44e 100644 --- a/cordova-plugin-qrscanner/tsconfig.json +++ b/cordova-plugin-qrscanner/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-spinner/tsconfig.json b/cordova-plugin-spinner/tsconfig.json index 8378379bc7..cd075a5398 100644 --- a/cordova-plugin-spinner/tsconfig.json +++ b/cordova-plugin-spinner/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova-plugin-splashscreen/tsconfig.json b/cordova-plugin-splashscreen/tsconfig.json index 032aed70bc..1c161dd254 100644 --- a/cordova-plugin-splashscreen/tsconfig.json +++ b/cordova-plugin-splashscreen/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-statusbar/tsconfig.json b/cordova-plugin-statusbar/tsconfig.json index c464e89096..7b7eec9d27 100644 --- a/cordova-plugin-statusbar/tsconfig.json +++ b/cordova-plugin-statusbar/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-vibration/tsconfig.json b/cordova-plugin-vibration/tsconfig.json index 8835563a00..14685dd5e7 100644 --- a/cordova-plugin-vibration/tsconfig.json +++ b/cordova-plugin-vibration/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-websql/tsconfig.json b/cordova-plugin-websql/tsconfig.json index 36e7e41481..cd6e3687e1 100644 --- a/cordova-plugin-websql/tsconfig.json +++ b/cordova-plugin-websql/tsconfig.json @@ -3,8 +3,10 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-x-socialsharing/index.d.ts b/cordova-plugin-x-socialsharing/index.d.ts index e99aa3a44f..e68a072ee2 100644 --- a/cordova-plugin-x-socialsharing/index.d.ts +++ b/cordova-plugin-x-socialsharing/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SocialSharing-PhoneGap-Plugin v5.0.12 +// Type definitions for SocialSharing-PhoneGap-Plugin v5.0.12 // Project: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin // Definitions by: Markus Wagner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/cordova-plugin-x-socialsharing/tsconfig.json b/cordova-plugin-x-socialsharing/tsconfig.json index 1c5e6b9eaa..55beb0246e 100644 --- a/cordova-plugin-x-socialsharing/tsconfig.json +++ b/cordova-plugin-x-socialsharing/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts b/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts new file mode 100644 index 0000000000..fec3c119d2 --- /dev/null +++ b/cordova.plugins.diagnostic/cordova.plugins.diagnostic-tests.ts @@ -0,0 +1,532 @@ +/// + +cordova.plugins.diagnostic.isLocationAvailable(function(available){ + console.log("Location is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isWifiAvailable(function(available){ + console.log("WiFi is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isCameraAvailable(function(available){ + console.log("Camera is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isBluetoothAvailable(function(available){ + console.log("Bluetooth is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.switchToLocationSettings(); +cordova.plugins.diagnostic.switchToMobileDataSettings(); +cordova.plugins.diagnostic.switchToBluetoothSettings(); +cordova.plugins.diagnostic.switchToWifiSettings(); + +cordova.plugins.diagnostic.isWifiEnabled(function(enabled){ + console.log("WiFi is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.setWifiState(function(){ + console.log("Wifi was enabled"); + }, function(error){ + console.error("The following error occurred: "+error); + }, true +); + +cordova.plugins.diagnostic.setBluetoothState(function(){ + console.log("Bluetooth was enabled"); + }, function(error){ + console.error("The following error occurred: "+error); + }, true +); + +cordova.plugins.diagnostic.isLocationEnabled(function(enabled){ + console.log("Location setting is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isLocationAuthorized(function(enabled){ + console.log("Location authorization is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getLocationAuthorizationStatus(function(status){ + switch(status){ + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission not requested"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied"); + break; + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted always"); + break; + case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE: + console.log("Permission granted only when in use"); + break; + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestLocationAuthorization(function(status){ + switch(status){ + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission not requested"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied"); + break; + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted always"); + break; + case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE: + console.log("Permission granted only when in use"); + break; + } +}, function(error){ + console.error(error); +}, cordova.plugins.diagnostic.locationAuthorizationMode.ALWAYS); + +cordova.plugins.diagnostic.isCameraPresent(function(present){ + console.log("Camera is " + (present ? "present" : "absent")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isCameraAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to the camera"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getCameraAuthorizationStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Camera use is authorized"); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestCameraAuthorization(function(status){ + console.log("Authorization request for camera use was " + (status == cordova.plugins.diagnostic.permissionStatus.GRANTED ? "granted" : "denied")); +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isMicrophoneAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to the microphone"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getMicrophoneAuthorizationStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Microphone use is authorized"); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestMicrophoneAuthorization(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Microphone use is authorized"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isContactsAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to contacts"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getContactsAuthorizationStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Contacts use is authorized"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.requestContactsAuthorization(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Contacts use is authorized"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isCalendarAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to calendar"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getCalendarAuthorizationStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Calendar use is authorized"); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestCalendarAuthorization(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Calendar use is authorized"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.switchToSettings(function(){ + console.log("Successfully switched to Settings app"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getBluetoothState(function(state){ + if(state === cordova.plugins.diagnostic.bluetoothState.POWERED_ON){ + console.log("Bluetooth is able to connect"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.registerBluetoothStateChangeHandler(function(state){ + if(state === cordova.plugins.diagnostic.bluetoothState.POWERED_ON){ + console.log("Bluetooth is able to connect"); + } +}); + +cordova.plugins.diagnostic.registerLocationStateChangeHandler(function(state){ + if((device.platform === "Android" && state !== cordova.plugins.diagnostic.locationMode.LOCATION_OFF) + || (device.platform === "iOS") && ( state === cordova.plugins.diagnostic.permissionStatus.GRANTED + || state === cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE + )){ + console.log("Location is available"); + } +}); + +cordova.plugins.diagnostic.getLocationMode(function(locationMode){ + switch(locationMode){ + case cordova.plugins.diagnostic.locationMode.HIGH_ACCURACY: + console.log("High accuracy"); + break; + case cordova.plugins.diagnostic.locationMode.BATTERY_SAVING: + console.log("Battery saving"); + break; + case cordova.plugins.diagnostic.locationMode.DEVICE_ONLY: + console.log("Device only"); + break; + case cordova.plugins.diagnostic.locationMode.LOCATION_OFF: + console.log("Location off"); + break; + } +},function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isGpsLocationAvailable(function(available){ + console.log("GPS location is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isGpsLocationEnabled(function(enabled){ + console.log("GPS location is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isNetworkLocationAvailable(function(available){ + console.log("Network location is " + (available ? "available" : "not available")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isNetworkLocationEnabled(function(enabled){ + console.log("Network location is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getLocationMode(function(locationMode){ + switch(locationMode){ + case cordova.plugins.diagnostic.locationMode.HIGH_ACCURACY: + console.log("High accuracy"); + break; + case cordova.plugins.diagnostic.locationMode.BATTERY_SAVING: + console.log("Battery saving"); + break; + case cordova.plugins.diagnostic.locationMode.DEVICE_ONLY: + console.log("Device only"); + break; + case cordova.plugins.diagnostic.locationMode.LOCATION_OFF: + console.log("Location off"); + break; + } +},function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getPermissionAuthorizationStatus(function(status){ + switch(status){ + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted to use the camera"); + break; + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission to use the camera has not been requested yet"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied to use the camera - ask again?"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS: + console.log("Permission permanently denied to use the camera - guess we won't be using it then!"); + break; + } +}, function(error){ + console.error("The following error occurred: "+error); +}, cordova.plugins.diagnostic.permission.CAMERA); + +cordova.plugins.diagnostic.getPermissionsAuthorizationStatus(function(statuses){ + for (var permission in statuses){ + switch(statuses[permission]){ + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted to use "+permission); + break; + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission to use "+permission+" has not been requested yet"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied to use "+permission+" - ask again?"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS: + console.log("Permission permanently denied to use "+permission+" - guess we won't be using it then!"); + break; + } + } +}, function(error){ + console.error("The following error occurred: "+error); +},[ + cordova.plugins.diagnostic.permission.ACCESS_FINE_LOCATION, + cordova.plugins.diagnostic.permission.ACCESS_COARSE_LOCATION +]); + +cordova.plugins.diagnostic.requestRuntimePermission(function(status){ + switch(status){ + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted to use the camera"); + break; + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission to use the camera has not been requested yet"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied to use the camera - ask again?"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS: + console.log("Permission permanently denied to use the camera - guess we won't be using it then!"); + break; + } +}, function(error){ + console.error("The following error occurred: "+error); +}, cordova.plugins.diagnostic.permission.CAMERA); + +cordova.plugins.diagnostic.requestRuntimePermissions(function(statuses){ + for (var permission in statuses){ + switch(statuses[permission]){ + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted to use "+permission); + break; + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission to use "+permission+" has not been requested yet"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied to use "+permission+" - ask again?"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS: + console.log("Permission permanently denied to use "+permission+" - guess we won't be using it then!"); + break; + } + } +}, function(error){ + console.error("The following error occurred: "+error); +},[ + cordova.plugins.diagnostic.permission.ACCESS_FINE_LOCATION, + cordova.plugins.diagnostic.permission.ACCESS_COARSE_LOCATION +]); + +if(!cordova.plugins.diagnostic.isRequestingPermission()){ + console.log("Request some permissions"); +}else{ + cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(function(statuses){ + cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(null); // de-register handler after single call + console.log("Request some permissions"); + }); +} + +function onPermissionRequestComplete(statuses:any){ + console.info("Permission request complete"); + for (var permission in statuses){ + switch(statuses[permission]){ + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted to use "+permission); + break; + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission to use "+permission+" has not been requested yet"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied to use "+permission); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS: + console.log("Permission permanently denied to use "+permission); + break; + } + } + cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(null); // de-register handler +} +cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(onPermissionRequestComplete) + +cordova.plugins.diagnostic.isBluetoothEnabled(function(enabled){ + console.log("Bluetooth is " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.hasBluetoothSupport(function(supported){ + console.log("Bluetooth is " + (supported ? "supported" : "unsupported")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.hasBluetoothLESupport(function(supported){ + console.log("Bluetooth LE is " + (supported ? "supported" : "unsupported")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.hasBluetoothLEPeripheralSupport(function(supported){ + console.log("Bluetooth LE Peripheral Mode is " + (supported ? "supported" : "unsupported")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isCameraRollAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to the camera roll"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getCameraRollAuthorizationStatus(function(status){ + switch(status){ + case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED: + console.log("Permission not requested"); + break; + case cordova.plugins.diagnostic.permissionStatus.DENIED: + console.log("Permission denied"); + break; + case cordova.plugins.diagnostic.permissionStatus.GRANTED: + console.log("Permission granted"); + break; + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestCameraRollAuthorization(function(status){ + console.log("Authorization request for camera roll was " + (status == cordova.plugins.diagnostic.permissionStatus.GRANTED ? "granted" : "denied")); +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(enabled){ + console.log("Remote notifications are " + (enabled ? "enabled" : "disabled")); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isRegisteredForRemoteNotifications(function(registered){ + console.log("Device " + (registered ? "is" : "isn't") + " registered for remote notifications"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getRemoteNotificationTypes(function(types){ + for(var type in types){ + console.log(type + " is " + (types[type] ? "enabled" : "disabled")); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isRemindersAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "denied") + " access to reminders"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getRemindersAuthorizationStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Reminders authorization allowed"); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestRemindersAuthorization(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Reminders authorization allowed"); + } +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isBackgroundRefreshAuthorized(function(authorized){ + console.log("App is " + (authorized ? "authorized" : "not authorized") + " to perform background refresh"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.getBackgroundRefreshStatus(function(status){ + if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){ + console.log("Background refresh is allowed"); + } +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestBluetoothAuthorization(function(){ + console.log("Bluetooth authorization requested"); +}, function(error){ + console.error(error); +}); + +cordova.plugins.diagnostic.isMotionAvailable(function(available){ + console.log("Motion tracking is " + (available ? "available" : "not available") + " on this device"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.isMotionRequestOutcomeAvailable(function(available){ + console.log("Motion tracking request outcome is " + (available ? "available" : "not available") + " on this device"); +}, function(error){ + console.error("The following error occurred: "+error); +}); + +cordova.plugins.diagnostic.requestAndCheckMotionAuthorization(function(status){ + console.log("Motion authorization is " +status); +}, function(error){ + console.error(error); +}); \ No newline at end of file diff --git a/cordova.plugins.diagnostic/index.d.ts b/cordova.plugins.diagnostic/index.d.ts new file mode 100644 index 0000000000..381b61562e --- /dev/null +++ b/cordova.plugins.diagnostic/index.d.ts @@ -0,0 +1,738 @@ +// Type definitions for cordova.plugins.diagnostic v3.3.0 +// Project: https://github.com/dpa99c/cordova-diagnostic-plugin +// Definitions by: Dave Alden +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi + */ +interface Diagnostic { + + /** + * ANDROID ONLY + * "Dangerous" permissions that need to be requested at run-time (Android 6.0/API 23 and above) + * See http://developer.android.com/guide/topics/security/permissions.html#perm-groups + * @type {Object} + */ + permission?: any; + + /** + * ANDROID ONLY + * Permission groups indicate which associated permissions will also be requested if a given permission is requested. + * See http://developer.android.com/guide/topics/security/permissions.html#perm-groups + * @type {Object} + */ + permissionGroups?: any; + + /** + * ANDROID and iOS ONLY + * Constants for requesting and reporting the various permission states. + * @type {Object} + */ + permissionStatus?: any; + + /** + * iOS ONLY + * Location authorization mode + * @type {Object} + */ + locationAuthorizationMode?: any; + + + /** + * ANDROID ONLY + * Constants for the various location modes on Android. + * @type {Object} + */ + locationMode?: any; + + /** + * ANDROID and iOS ONLY + * Constants for the various Bluetooth hardware states. + * @type {Object} + */ + bluetoothState?: any; + + + /** + * Checks if app is able to access device location. + * @param successCallback + * @param errorCallback + */ + isLocationAvailable: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * Checks if Wifi is available. + * On iOS this returns true if the device is connected to a network by WiFi. + * On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled, and is the same as isWifiEnabled() + * @param successCallback + * @param errorCallback + */ + isWifiAvailable: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * Checks if camera is available. + * On Android & iOS this returns true if the device has a camera AND the application is authorized to use it. + * On Windows 10 Mobile this returns true if the device has a rear-facing camera. + * @param successCallback + * @param errorCallback + */ + isCameraAvailable: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * Checks if Bluetooth is available to the app. + * Returns true if the device has Bluetooth capabilities AND if Bluetooth setting is switched on (same on Android, iOS and Windows 10 Mobile) + * @param successCallback + * @param errorCallback + */ + isBluetoothAvailable: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and WINDOWS ONLY + * Displays the device location settings to allow user to enable location services/change location mode. + */ + switchToLocationSettings?: () => void; + + /** + * ANDROID and WINDOWS ONLY + * Displays mobile settings to allow user to enable mobile data. + */ + switchToMobileDataSettings?: () => void; + + /** + * ANDROID and WINDOWS ONLY + * Displays Bluetooth settings to allow user to enable Bluetooth. + */ + switchToBluetoothSettings?: () => void; + + /** + * ANDROID and WINDOWS ONLY + * Displays WiFi settings to allow user to enable WiFi. + */ + switchToWifiSettings?: () => void; + + /** + * ANDROID and WINDOWS ONLY + * Returns true if the WiFi setting is set to enabled, and is the same as isWifiAvailable() + * @param successCallback + * @param errorCallback + */ + isWifiEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and WINDOWS ONLY + * Enables/disables WiFi on the device. + * @param successCallback + * @param errorCallback + * @param state + */ + setWifiState?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void, + state: boolean + ) => void; + + /** + * ANDROID and WINDOWS ONLY + * Enables/disables Bluetooth on the device. + * @param successCallback + * @param errorCallback + * @param state + */ + setBluetoothState?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void, + state: boolean + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns true if the device setting for location is on. + * On Android this returns true if Location Mode is switched on. + * On iOS this returns true if Location Services is switched on. + * @param successCallback + * @param errorCallback + */ + isLocationEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Checks if the application is authorized to use location. + * @param successCallback + * @param errorCallback + */ + isLocationAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the location authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getLocationAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Requests location authorization for the application. + * @param successCallback + * @param errorCallback + * @param mode - (iOS-only / optional) location authorization mode specified as a locationAuthorizationMode constant. If not specified, defaults to WHEN_IN_USE. + */ + requestLocationAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void, + mode?: string + ) => void; + + + /** + * ANDROID and iOS ONLY + * Checks if camera hardware is present on device. + * @param successCallback + * @param errorCallback + */ + isCameraPresent?: ( + successCallback: (present: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Checks if the application is authorized to use the camera. + * @param successCallback + * @param errorCallback + */ + isCameraAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the camera authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getCameraAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Requests camera authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestCameraAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Checks if the application is authorized to use the microphone. + * @param successCallback + * @param errorCallback + */ + isMicrophoneAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the microphone authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getMicrophoneAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Requests microphone authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestMicrophoneAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Checks if the application is authorized to use contacts (address book). + * @param successCallback + * @param errorCallback + */ + isContactsAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the contacts authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getContactsAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Requests contacts authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestContactsAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Checks if the application is authorized to use the calendar. + * @param successCallback + * @param errorCallback + */ + isCalendarAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the calendar authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getCalendarAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Requests calendar authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestCalendarAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Opens settings page for this app. + * On Android, this opens the "App Info" page in the Settings app. + * On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback. + */ + switchToSettings?: ( + successCallback: () => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Returns the state of Bluetooth on the device. + * @param successCallback + * @param errorCallback + */ + getBluetoothState?: ( + successCallback: (state: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Registers a function to be called when a change in Bluetooth state occurs. Pass in a falsey value to de-register the currently registered function. + * @param successCallback + */ + registerBluetoothStateChangeHandler?: ( + successCallback: (state: string) => void + ) => void; + + /** + * ANDROID and iOS ONLY + * Registers a function to be called when a change in Location state occurs. Pass in a falsey value to de-register the currently registered function. + * On Android, this occurs when the Location Mode is changed. + * On iOS, this occurs when location authorization status is changed. This can be triggered either by the user's response to a location permission authorization dialog, by the user turning on/off Location Services, or by the user changing the Location authorization state specifically for your app. + * @param successCallback + */ + registerLocationStateChangeHandler?: ( + successCallback: (state: string) => void + ) => void; + + + /** + * ANDROID ONLY + * Checks if high-accuracy locations are available to the app from GPS hardware. + * Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location. + * @param successCallback + * @param errorCallback + */ + isGpsLocationAvailable?: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device location setting is set to return high-accuracy locations from GPS hardware. + * Returns true if Location mode is enabled and is set to either Device only or High accuracy + * @param successCallback + * @param errorCallback + */ + isGpsLocationEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points. + * Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location. + * @param successCallback + * @param errorCallback + */ + isNetworkLocationAvailable?: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device location setting is set to return high-accuracy locations from GPS hardware. + * Returns true if Location mode is enabled and is set to either Battery saving or High accuracy + * @param successCallback + * @param errorCallback + */ + isNetworkLocationEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Returns the current location mode setting for the device. + * @param successCallback + * @param errorCallback + */ + getLocationMode?: ( + successCallback: (mode: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Returns the current authorisation status for a given permission. + * @param successCallback + * @param errorCallback + * @param permission + */ + getPermissionAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void, + permission: string + ) => void; + + /** + * ANDROID ONLY + * Returns the current authorisation status for multiple permissions. + * @param successCallback + * @param errorCallback + * @param permissions + */ + getPermissionsAuthorizationStatus?: ( + successCallback: (status: string[]) => void, + errorCallback: (error: string) => void, + permissions: string[] + ) => void; + + /** + * ANDROID ONLY + * Requests app to be granted authorisation for a runtime permission. + * @param successCallback + * @param errorCallback + * @param permission + */ + requestRuntimePermission?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void, + permission: string + ) => void; + + /** + * ANDROID ONLY + * Requests app to be granted authorisation for multiple runtime permissions. + * @param successCallback + * @param errorCallback + * @param permissions + */ + requestRuntimePermissions?: ( + successCallback: (status: string[]) => void, + errorCallback: (error: string) => void, + permissions: string[] + ) => void; + + /** + * ANDROID ONLY + * Indicates if the plugin is currently requesting a runtime permission via the native API. + */ + isRequestingPermission?: () => boolean; + + /** + * ANDROID ONLY + * Registers a function to be called when a runtime permission request has completed. Pass in a falsey value to de-register the currently registered function. + * @param successCallback + */ + registerPermissionRequestCompleteHandler?: ( + successCallback: (statuses: any) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device setting for Bluetooth is switched on. + * @param successCallback + * @param errorCallback + */ + isBluetoothEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device has Bluetooth capabilities. + * @param successCallback + * @param errorCallback + */ + hasBluetoothSupport?: ( + successCallback: (supported: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device has Bluetooth Low Energy (LE) capabilities. + * @param successCallback + * @param errorCallback + */ + hasBluetoothLESupport?: ( + successCallback: (supported: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * ANDROID ONLY + * Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode. + * @param successCallback + * @param errorCallback + */ + hasBluetoothLEPeripheralSupport?: ( + successCallback: (supported: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if the application is authorized to use the Camera Roll in Photos app. + * @param successCallback + * @param errorCallback + */ + isCameraRollAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Returns the authorization status for the application to use the Camera Roll in Photos app. + * @param successCallback + * @param errorCallback + */ + getCameraRollAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Requests camera roll authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestCameraRollAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if remote (push) notifications are enabled. + * @param successCallback + * @param errorCallback + */ + isRemoteNotificationsEnabled?: ( + successCallback: (enabled: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Indicates if the app is registered for remote (push) notifications on the device. + * @param successCallback + * @param errorCallback + */ + isRegisteredForRemoteNotifications?: ( + successCallback: (registered: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Indicates the current setting of notification types for the app in the Settings app. + * @param successCallback + * @param errorCallback + */ + getRemoteNotificationTypes?: ( + successCallback: (types: any) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if the application is authorized to use reminders. + * @param successCallback + * @param errorCallback + */ + isRemindersAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Returns the reminders authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getRemindersAuthorizationStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Requests reminders authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestRemindersAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if the application is authorized for background refresh. + * @param successCallback + * @param errorCallback + */ + isBackgroundRefreshAuthorized?: ( + successCallback: (authorized: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Returns the background refresh authorization status for the application. + * @param successCallback + * @param errorCallback + */ + getBackgroundRefreshStatus?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Requests Bluetooth authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestBluetoothAuthorization?: ( + successCallback: () => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if motion tracking is available on the current device. + * @param successCallback + * @param errorCallback + */ + isMotionAvailable?: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Checks if it's possible to determine the outcome of a motion authorization request on the current device. + * @param successCallback + * @param errorCallback + */ + isMotionRequestOutcomeAvailable?: ( + successCallback: (available: boolean) => void, + errorCallback: (error: string) => void + ) => void; + + /** + * iOS ONLY + * Requests and checks motion authorization for the application. + * @param successCallback + * @param errorCallback + */ + requestAndCheckMotionAuthorization?: ( + successCallback: (status: string) => void, + errorCallback: (error: string) => void + ) => void; +} + +interface CordovaPlugins { + diagnostic: Diagnostic +} \ No newline at end of file diff --git a/cordova.plugins.diagnostic/tsconfig.json b/cordova.plugins.diagnostic/tsconfig.json new file mode 100644 index 0000000000..382c85a216 --- /dev/null +++ b/cordova.plugins.diagnostic/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cordova.plugins.diagnostic-tests.ts" + ] +} \ No newline at end of file diff --git a/cordova/tsconfig.json b/cordova/tsconfig.json index 417dadb8b6..fefe6b3f5e 100644 --- a/cordova/tsconfig.json +++ b/cordova/tsconfig.json @@ -3,13 +3,15 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordovarduino/tsconfig.json b/cordovarduino/tsconfig.json index cebcbb3a26..528ac2324b 100644 --- a/cordovarduino/tsconfig.json +++ b/cordovarduino/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/core-decorators/tsconfig.json b/core-decorators/tsconfig.json index f77ed02af3..dea6ef9a2e 100644 --- a/core-decorators/tsconfig.json +++ b/core-decorators/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "experimentalDecorators": true, diff --git a/core-js/core-js-tests.ts b/core-js/core-js-tests.ts index 6b4c03352c..08370370a0 100644 --- a/core-js/core-js-tests.ts +++ b/core-js/core-js-tests.ts @@ -334,15 +334,15 @@ b = Reflect.setPrototypeOf(a, a); // ############################################################################################# // ECMAScript 7 -// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad, +// Modules: es7.array.includes, es7.string.at, ees7.string.pad-start, es7.string.pad-end, // es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape, // es7.map.to-json, and es7.set.to-json // ############################################################################################# b = arrayOfPoint.includes(point, i); s = s.at(i); -s = s.lpad(i, s); -s = s.rpad(i, s); +s = s.padStart(i, s); +s = s.padEnd(i, s); arrayOfAny = Object.values(a); arrayOfStringAny = Object.entries(a); pdm = Object.getOwnPropertyDescriptors(a); diff --git a/core-js/index.d.ts b/core-js/index.d.ts index 1ad88ff41a..7dda59aab3 100644 --- a/core-js/index.d.ts +++ b/core-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for core-js v0.9.7 +// Type definitions for core-js v0.9.7 // Project: https://github.com/zloirock/core-js/ // Definitions by: Ron Buckton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -890,7 +890,7 @@ declare namespace Reflect { // ############################################################################################# // ECMAScript 7 -// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad, +// Modules: es7.array.includes, es7.string.at, es7.string.pad-start, es7.string.pad-end, // es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape, // es7.map.to-json, and es7.set.to-json // ############################################################################################# @@ -901,8 +901,8 @@ interface Array { interface String { at(index: number): string; - lpad(length: number, fillStr?: string): string; - rpad(length: number, fillStr?: string): string; + padStart(length: number, fillStr?: string): string; + padEnd(length: number, fillStr?: string): string; } interface ObjectConstructor { diff --git a/core-js/tsconfig.json b/core-js/tsconfig.json index 49da14645c..51105b11d0 100644 --- a/core-js/tsconfig.json +++ b/core-js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es5", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cors/tsconfig.json b/cors/tsconfig.json index a839cd6e4b..ac0afad95c 100644 --- a/cors/tsconfig.json +++ b/cors/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/couchbase/tsconfig.json b/couchbase/tsconfig.json index 395e25b26d..6dc373810d 100644 --- a/couchbase/tsconfig.json +++ b/couchbase/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/countdown/tsconfig.json b/countdown/tsconfig.json index d2d63f03e4..38f2bcd0ef 100644 --- a/countdown/tsconfig.json +++ b/countdown/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cradle/tsconfig.json b/cradle/tsconfig.json index 6bae8acf65..1922ab89f1 100644 --- a/cradle/tsconfig.json +++ b/cradle/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/create-error/tsconfig.json b/create-error/tsconfig.json index 26a4fc8aea..9dfbe8f269 100644 --- a/create-error/tsconfig.json +++ b/create-error/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/createjs-lib/tsconfig.json b/createjs-lib/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/createjs-lib/tsconfig.json +++ b/createjs-lib/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/createjs/tsconfig.json b/createjs/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/createjs/tsconfig.json +++ b/createjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/credential/tsconfig.json b/credential/tsconfig.json index 1c1c96f1d2..eab2b08998 100644 --- a/credential/tsconfig.json +++ b/credential/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/credit-card-type/credit-card-type-tests.ts b/credit-card-type/credit-card-type-tests.ts new file mode 100644 index 0000000000..de2c6fade4 --- /dev/null +++ b/credit-card-type/credit-card-type-tests.ts @@ -0,0 +1,5 @@ +import * as creditCardType from "credit-card-type" + +var cardTypes: Array = creditCardType("") +var cardInfo: creditCardType.CreditCardTypeInfo = creditCardType.getTypeInfo("") +var types: { [type: string]: string } = creditCardType.types diff --git a/credit-card-type/index.d.ts b/credit-card-type/index.d.ts new file mode 100644 index 0000000000..59886b5e60 --- /dev/null +++ b/credit-card-type/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for Credit Card Type v5.0.0 +// Project: https://github.com/braintree/credit-card-type +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace creditCardType { + + type CardBrand = "american-express" | "diners-club" | "discover" | "jcb" | "maestro" | "master-card" | "unionpay" | "visa" + + interface CreditCardTypeInfo { + niceType?: string + type?: CardBrand + pattern?: RegExp + gaps?: Array + lengths?: Array + code?: { + name?: string + size?: number + } + } + + interface CreditCardType { + (number: string): Array + getTypeInfo (type: string): CreditCardTypeInfo + types: { [type: string]: string } + } +} + +declare const creditCardType: creditCardType.CreditCardType +export = creditCardType diff --git a/credit-card-type/tsconfig.json b/credit-card-type/tsconfig.json new file mode 100644 index 0000000000..44fe61b454 --- /dev/null +++ b/credit-card-type/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "credit-card-type-tests.ts" + ] +} \ No newline at end of file diff --git a/cron/tsconfig.json b/cron/tsconfig.json index 2bd99b7b17..661924d57c 100644 --- a/cron/tsconfig.json +++ b/cron/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cropperjs/tsconfig.json b/cropperjs/tsconfig.json index b93706f24b..ffc9bb4832 100644 --- a/cropperjs/tsconfig.json +++ b/cropperjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/croppie/croppie-tests.ts b/croppie/croppie-tests.ts new file mode 100644 index 0000000000..92f6d5ca18 --- /dev/null +++ b/croppie/croppie-tests.ts @@ -0,0 +1,26 @@ +import Croppie from 'croppie'; + +const c = new Croppie(document.getElementById('item'), { + boundary: { width: 300, height: 300 }, + viewport: { width: 100, height: 100 }, + showZoomer: false, + enableOrientation: false, +}); + + +c.bind({ + url: 'demo/demo-2.jpg', + orientation: 4, + zoom: 0, +}); + +c.rotate(90); + +c.setZoom(0.5); + +c.result({ type: 'blob' }).then(blob => { + let x: Blob; + x = blob; +}); + +c.destroy(); diff --git a/croppie/index.d.ts b/croppie/index.d.ts new file mode 100644 index 0000000000..afd0c0112c --- /dev/null +++ b/croppie/index.d.ts @@ -0,0 +1,52 @@ +// Type definitions for croppie 2.4 +// Project: https://github.com/Foliotek/Croppie +// Definitions by: Connor Peet +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default class Croppie { + constructor(container: HTMLElement, options?: CroppieOptions); + + bind(options: { + url: string, + points?: number[], + orientation?: number, + zoom?: number, + useCanvas?: boolean, + }): Promise; + + result(options: ResultOptions & { type: 'base64' }): Promise; + result(options: ResultOptions & { type: 'html' }): Promise; + result(options: ResultOptions & { type: 'blob' }): Promise; + result(options: ResultOptions & { type: 'canvas' }): Promise; + result(options?: ResultOptions): Promise; + + rotate(degrees: 90 | 180 | 270 | -90 | -180 | -270): void; + + setZoom(zoom: number): void; + + destroy(): void; +} + + +export type CropType = 'square' | 'circle'; + +export type Format = 'jpeg' | 'png' | 'webp'; + +export interface ResultOptions { + size?: 'viewport' | 'original' | { width: number, height: number }; + format?: Format; + quality?: number; + circle?: boolean; +} + +export interface CroppieOptions { + boundary?: { width: number, height: number }; + customClass?: string; + enableExif?: boolean; + enableOrientation?: boolean; + enableZoom?: boolean; + enforceBoundary?: boolean; + mouseWheelZoom?: boolean; + showZoomer?: boolean; + viewport?: { width: number, height: number, type?: CropType }; +} diff --git a/croppie/tsconfig.json b/croppie/tsconfig.json new file mode 100644 index 0000000000..7d8a49376a --- /dev/null +++ b/croppie/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "croppie-tests.ts" + ] +} \ No newline at end of file diff --git a/croppie/tslint.json b/croppie/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/croppie/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/cross-storage/tsconfig.json b/cross-storage/tsconfig.json index 39931ed517..b0f12d2d0c 100644 --- a/cross-storage/tsconfig.json +++ b/cross-storage/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/crossfilter/tsconfig.json b/crossfilter/tsconfig.json index a900103926..0bf6022be6 100644 --- a/crossfilter/tsconfig.json +++ b/crossfilter/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/crossroads/tsconfig.json b/crossroads/tsconfig.json index 45d103844b..2c871a9749 100644 --- a/crossroads/tsconfig.json +++ b/crossroads/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/crypto-js/tsconfig.json b/crypto-js/tsconfig.json index cfd1f83e09..a258e681fc 100644 --- a/crypto-js/tsconfig.json +++ b/crypto-js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cryptojs/tsconfig.json b/cryptojs/tsconfig.json index 0bca72a982..10bbd0e5f3 100644 --- a/cryptojs/tsconfig.json +++ b/cryptojs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cson/tsconfig.json b/cson/tsconfig.json index e530a33c3a..c8bba3d4b2 100644 --- a/cson/tsconfig.json +++ b/cson/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/css-modules-require-hook/tsconfig.json b/css-modules-require-hook/tsconfig.json index d97a33fa46..42812bcc66 100644 --- a/css-modules-require-hook/tsconfig.json +++ b/css-modules-require-hook/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/css/tsconfig.json b/css/tsconfig.json index e1a3d498de..54cbf6833c 100644 --- a/css/tsconfig.json +++ b/css/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cssbeautify/tsconfig.json b/cssbeautify/tsconfig.json index a7b504a16b..6d7988ae44 100644 --- a/cssbeautify/tsconfig.json +++ b/cssbeautify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "index.d.ts", "cssbeautify-tests.ts" ] -} +} \ No newline at end of file diff --git a/csurf/index.d.ts b/csurf/index.d.ts index 011b10a7f1..53b86392f1 100644 --- a/csurf/index.d.ts +++ b/csurf/index.d.ts @@ -12,7 +12,7 @@ declare namespace Express { } declare module "csurf" { - import express = require('express'); + import express = require('express-serve-static-core'); function csurf(options?: { value?: (req: express.Request) => string; diff --git a/csurf/tsconfig.json b/csurf/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/csurf/tsconfig.json +++ b/csurf/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/csv-parse/csv-parse-tests.ts b/csv-parse/csv-parse-tests.ts index 3f552f1319..21df979d82 100644 --- a/csv-parse/csv-parse-tests.ts +++ b/csv-parse/csv-parse-tests.ts @@ -1,5 +1,3 @@ -/// - import parse = require('csv-parse'); function callbackAPITest() { @@ -38,7 +36,7 @@ import fs = require('fs'); function pipeFunctionTest() { var transform = require('stream-transform'); - + var output:any = []; var parser = parse({delimiter: ':'}) var input = fs.createReadStream('/etc/passwd'); diff --git a/csv-parse/csv-parse.d.ts b/csv-parse/index.d.ts similarity index 100% rename from csv-parse/csv-parse.d.ts rename to csv-parse/index.d.ts diff --git a/csv-parse/tsconfig.json b/csv-parse/tsconfig.json index 9e359a8737..2f7c1d736b 100644 --- a/csv-parse/tsconfig.json +++ b/csv-parse/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "csv-parse.d.ts", + "index.d.ts", "csv-parse-tests.ts" ] } \ No newline at end of file diff --git a/csv-stringify/index.d.ts b/csv-stringify/index.d.ts index 21f1c1a399..6525bd9e15 100644 --- a/csv-stringify/index.d.ts +++ b/csv-stringify/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for csv-stringify 0.0.6 +// Type definitions for csv-stringify 0.0.6 // Project: https://github.com/wdavidw/node-csv-stringify // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/csv-stringify/tsconfig.json b/csv-stringify/tsconfig.json index 725039e540..3d5cea5c60 100644 --- a/csv-stringify/tsconfig.json +++ b/csv-stringify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cucumber/tsconfig.json b/cucumber/tsconfig.json index fca28f2311..992cca7723 100644 --- a/cucumber/tsconfig.json +++ b/cucumber/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cuid/tsconfig.json b/cuid/tsconfig.json index 6834ca0c7c..a53e95b748 100644 --- a/cuid/tsconfig.json +++ b/cuid/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/custom-error-generator/tsconfig.json b/custom-error-generator/tsconfig.json index 3c24b09b02..a7d6a412db 100644 --- a/custom-error-generator/tsconfig.json +++ b/custom-error-generator/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/cybozulabs-md5/tsconfig.json b/cybozulabs-md5/tsconfig.json index eeac3d87b3..68a7e48345 100644 --- a/cybozulabs-md5/tsconfig.json +++ b/cybozulabs-md5/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/d3-array/index.d.ts b/d3-array/index.d.ts index 998058dbf4..1d1aae3b67 100644 --- a/d3-array/index.d.ts +++ b/d3-array/index.d.ts @@ -195,10 +195,9 @@ export interface Bisector { right: (array: T[], x: U, lo?: number, hi?: number) => number; } +export function bisector(comparator: (a: T, b: U) => number): Bisector; export function bisector(accessor: (x: T) => U): Bisector; -export function bisector(comparator: (a: T, b: U) => number): Bisector - // NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. /** * Compares two primitive values for sorting (in ascending order). diff --git a/d3-array/tsconfig.json b/d3-array/tsconfig.json index 21388bf158..d9e272054d 100644 --- a/d3-array/tsconfig.json +++ b/d3-array/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-array-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-array-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-axis/d3-axis-tests.ts b/d3-axis/d3-axis-tests.ts index a95c58c8b3..1aa50ba641 100644 --- a/d3-axis/d3-axis-tests.ts +++ b/d3-axis/d3-axis-tests.ts @@ -8,16 +8,20 @@ import * as d3Axis from 'd3-axis'; import { + scaleBand, + ScaleBand, scaleLinear, ScaleLinear, scaleOrdinal, ScaleOrdinal, + scalePoint, + ScalePoint, scalePow, ScalePower, scaleTime, - ScaleTime, + ScaleTime } from 'd3-scale'; -import { Selection } from 'd3-selection'; +import { select, Selection } from 'd3-selection'; import { Transition } from 'd3-transition'; import { timeMinute } from 'd3-time'; import { format } from 'd3-format'; @@ -41,15 +45,18 @@ let axisScaleString: d3Axis.AxisScale; axisScaleNumber = scaleLinear(); axisScaleDate = scaleTime(); axisScaleString = scaleOrdinal(); - +axisScaleNumber = scaleBand(); +axisScaleNumber = scalePoint(); +axisScaleString = scaleBand(); +axisScaleString = scalePoint(); // -------------------------------------------------------------------------- // Test AxisContainerElement // -------------------------------------------------------------------------- let containerElement: d3Axis.AxisContainerElement; -let svg: SVGSVGElement, - g: SVGGElement, - canvas: HTMLCanvasElement; +const svg: SVGSVGElement = select('svg').node() !; //mock +const g: SVGGElement = select('g').node() !; //mock +const canvas: HTMLCanvasElement = select('canvas').node() !; //mock containerElement = svg; containerElement = g; @@ -60,7 +67,7 @@ containerElement = g; // -------------------------------------------------------------------------- let topAxis: d3Axis.Axis = d3Axis.axisTop(scaleLinear()); -let rightAxis: d3Axis.Axis = d3Axis.axisRight(scaleTime()); +let rightAxis: d3Axis.Axis = d3Axis.axisRight(scaleTime()); let bottomAxis: d3Axis.Axis = d3Axis.axisBottom(scaleOrdinal()); let leftAxis: d3Axis.Axis = d3Axis.axisLeft(scaleLinear()); @@ -95,7 +102,7 @@ topAxis = topAxis.tickArguments([20, 's']); rightAxis = rightAxis.tickArguments([timeMinute.every(5)]); -let tickArguments: Array = leftAxis.tickArguments(); +let tickArguments: any[] = leftAxis.tickArguments(); // tickValues(...) ---------------------------------------------------------------- @@ -105,15 +112,17 @@ bottomAxis = bottomAxis.tickValues(['strongly negative', 'strongly positive']); leftAxis = leftAxis.tickValues(null); -let tickValues: Array = rightAxis.tickValues(); +let tickValues: Date[] | null = rightAxis.tickValues(); // tickFormat(...) ---------------------------------------------------------------- topAxis = topAxis.tickFormat(format(',.0f')); topAxis = topAxis.tickFormat(null); -let formatFn: (domainValue: string) => string = bottomAxis.tickFormat(); +let formatFn: ((domainValue: string, index: number) => string) | null = bottomAxis.tickFormat(); +bottomAxis.tickFormat(function (d, i) { return '#' + i; }); +bottomAxis.tickFormat(function (d) { return d + '!'; }); // tickSize(...) ---------------------------------------------------------------- rightAxis = rightAxis.tickSize(5); @@ -138,19 +147,19 @@ num = rightAxis.tickPadding(); // Test Apply Axis // -------------------------------------------------------------------------- -let gSelection: Selection; +let gSelection: Selection = select('g'); let gTransition = gSelection.transition(); gSelection.call(topAxis); gTransition.call(topAxis); -let svgSelection: Selection; +let svgSelection: Selection = select('g'); let svgTransition = svgSelection.transition(); svgSelection.call(leftAxis); svgTransition.call(leftAxis); -let canvasSelection: Selection; +let canvasSelection: Selection = select('canvas'); let canvasTransition = canvasSelection.transition(); // canvasSelection.call(rightAxis); // fails, incompatible context container element diff --git a/d3-axis/index.d.ts b/d3-axis/index.d.ts index e663743d44..cd8ed94714 100644 --- a/d3-axis/index.d.ts +++ b/d3-axis/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-axis module v1.0.3 +// Type definitions for D3JS d3-axis module 1.0 // Project: https://github.com/d3/d3-axis/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.4 + import { Selection, TransitionLike } from 'd3-selection'; // -------------------------------------------------------------------------- @@ -31,13 +33,16 @@ export interface AxisTimeInterval { * for axis to use the scale without error */ export interface AxisScale { - (x: Domain): number; - domain(): Array; - range(): Array; - copy(): AxisScale; + (x: Domain): number | undefined; + domain(): Domain[]; + range(): number[]; + copy(): this; bandwidth?(): number; - ticks?(count: number | AxisTimeInterval): Array | Array; - tickFormat?(count: number | AxisTimeInterval, specifier?: string): ((d: number) => string) | ((d: Date) => string); + // TODO: Reconsider the below, note that the compiler does not differentiate the overloads w.r.t. optionality + // ticks?(count?: number): Domain[]; + // ticks?(count?: AxisTimeInterval): Date[]; + // tickFormat?(count?: number, specifier?: string): ((d: number) => string); + // tickFormat?(count?: number | AxisTimeInterval, specifier?: string): ((d: Date) => string); } /** @@ -170,15 +175,16 @@ export interface Axis { /** * Returns the currently set tick format function, which defaults to null. */ - tickFormat(): ((domainValue: Domain) => string) | null; + tickFormat(): ((domainValue: Domain, index: number) => string) | null; /** * Sets the tick format function and returns the axis. * * @param format A function mapping a value from the axis Domain to a formatted string - * for display purposes. + * for display purposes. When invoked, the format function is also passed a second argument representing the zero-based index + * of the tick label in the array of generated tick labels. */ - tickFormat(format: (domainValue: Domain) => string): this; + tickFormat(format: (domainValue: Domain, index: number) => string): this; /** * Reset the tick format function. A null format indicates that the scale’s diff --git a/d3-axis/tsconfig.json b/d3-axis/tsconfig.json index b568e25181..40e3b568f4 100644 --- a/d3-axis/tsconfig.json +++ b/d3-axis/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-axis-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-axis-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-axis/tslint.json b/d3-axis/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-axis/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3-box/d3-box-tests.ts b/d3-box/d3-box-tests.ts index 191962ff13..ab5ca799ba 100644 --- a/d3-box/d3-box-tests.ts +++ b/d3-box/d3-box-tests.ts @@ -1,6 +1,3 @@ -/// -/// - // Inspired by http://bl.ocks.org/mbostock/4061502 function iqr(k: number) { diff --git a/d3-box/d3-box.d.ts b/d3-box/index.d.ts similarity index 93% rename from d3-box/d3-box.d.ts rename to d3-box/index.d.ts index 4bc837df31..fdc304a68e 100644 --- a/d3-box/d3-box.d.ts +++ b/d3-box/index.d.ts @@ -3,9 +3,9 @@ // Definitions by: Linkun Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as d3 from "d3"; -declare namespace d3 { +declare module "d3" { export function box(): Box; interface Box { diff --git a/d3-box/package.json b/d3-box/package.json new file mode 100644 index 0000000000..ca67ffd471 --- /dev/null +++ b/d3-box/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@types/d3": "^3.5.36" + } +} \ No newline at end of file diff --git a/protractor/tsconfig.json b/d3-box/tsconfig.json similarity index 62% rename from protractor/tsconfig.json rename to d3-box/tsconfig.json index 46e32cb409..7d303bdd61 100644 --- a/protractor/tsconfig.json +++ b/d3-box/tsconfig.json @@ -3,14 +3,13 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "types": ["selenium-webdriver"], + "noImplicitThis": true, + "strictNullChecks": true, "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "angular-protractor-tests.ts" + "d3-box-tests.ts" ] -} +} \ No newline at end of file diff --git a/d3-brush/d3-brush-tests.ts b/d3-brush/d3-brush-tests.ts index c0598f82dd..eca4a8ef91 100644 --- a/d3-brush/d3-brush-tests.ts +++ b/d3-brush/d3-brush-tests.ts @@ -32,7 +32,7 @@ let brushY: d3Brush.BrushBehavior = d3Brush.brushY(); // extent() ---------------------------------------------------------------------- -let extent: (this: SVGGElement, d: BrushDatum, i: number, group: Array | ArrayLike) => [[number, number], [number, number]]; +let extent: (this: SVGGElement, d: BrushDatum, i: number, group: SVGGElement[] | ArrayLike) => [[number, number], [number, number]]; extent = brush.extent(); // chainable with array @@ -50,13 +50,13 @@ brush = brush.extent(function (d, i, group) { brush = brush.filter(function (d, i, group) { // Cast d3 event to D3ZoomEvent to be used in filter logic - let e = >event; + let e = > event; console.log('Owner SVG Element of svg group: ', this.ownerSVGElement); // this is of type SVGGElement return e.sourceEvent.type !== 'zoom' || !d.filterZoomEvent; // datum type is BrushDatum (as propagated to SVGGElement with brush event attached) }); -let filterFn: (this: SVGGElement, d?: BrushDatum, index?: number, group?: Array) => boolean; +let filterFn: (this: SVGGElement, d: BrushDatum, index: number, group: SVGGElement[]) => boolean; filterFn = brush.filter(); // handleSize() ---------------------------------------------------------------- @@ -67,9 +67,13 @@ let handleSize: number = brush.handleSize(); // on() ------------------------------------------------------------------------ -let brushed: (this: SVGGElement, datum: BrushDatum, index: number, group: Array | ArrayLike) => void; -let wrongHandler1: (this: SVGSVGElement, datum: BrushDatum, index: number, group: Array | ArrayLike) => void; -let wrongHandler2: (this: SVGGElement, datum: { test: string }, index: number, group: Array | ArrayLike) => void; +let brushed: ((this: SVGGElement, datum: BrushDatum, index: number, group: SVGGElement[] | ArrayLike) => void) | undefined; +brushed = function (d, i, group) { + // do anything +}; + +let wrongHandler1: (this: SVGSVGElement, datum: BrushDatum, index: number, group: SVGSVGElement[] | ArrayLike) => void; +let wrongHandler2: (this: SVGGElement, datum: { test: string }, index: number, group: SVGGElement[] | ArrayLike) => void; // chainable brush = brush.on('end', brushed); @@ -83,7 +87,11 @@ brushed = brush.on('end'); brush = brush.on('end', null); // re-apply -brush.on('end', function (d, i, group) { +brush.on('end', function (d, i, g) { + let that: SVGGElement = this; + let datum: BrushDatum = d; + let index: number = i; + let group: SVGGElement[] | ArrayLike = g; console.log('Owner SVG Element of svg group: ', this.ownerSVGElement); // this is of type SVGGElement console.log('Extent as per data: ', d.extent); // datum of type BrushDatum // do anything @@ -127,7 +135,7 @@ let gTransition = g.transition(); brush.move(g, [[10, 10], [50, 50]]); // two-dimensional brush brush.move(g, function (d, i, group) { console.log('Owner SVG Element of svg group: ', this.ownerSVGElement); // this is of type SVGGElement - let selection: [[number, number], [number, number]]; + let selection: [[number, number], [number, number]] = [[0, 0], [0, 0]]; selection[0][0] = d.extent[0][0] + 10; // datum type is brushDatum selection[0][1] = d.extent[0][1] + 10; selection[1][0] = d.extent[0][0] + 40; @@ -139,7 +147,7 @@ brush.move(g, function (d, i, group) { brush.move(gTransition, [[10, 10], [50, 50]]); // two-dimensional brush brush.move(gTransition, function (d, i, group) { console.log('Owner SVG Element of svg group: ', this.ownerSVGElement); // this is of type SVGGElement - let selection: [[number, number], [number, number]]; + let selection: [[number, number], [number, number]] = [[0, 0], [0, 0]]; selection[0][0] = d.extent[0][0] + 10; // datum type is brushDatum selection[0][1] = d.extent[0][1] + 10; selection[1][0] = d.extent[0][0] + 40; @@ -154,7 +162,7 @@ let gXTransition = gX.transition(); brush.move(gX, [10, 40]); // two-dimensional brush brush.move(gX, function (d, i, group) { console.log('Owner SVG Element of svg group: ', this.ownerSVGElement); // this is of type SVGGElement - let selection: [number, number]; + let selection: [number, number] = [0, 0]; selection[0] = d.extent[0][0] + 10; // datum type is brushDatum selection[1] = d.extent[0][0] + 40; return selection; @@ -164,7 +172,7 @@ brush.move(gX, function (d, i, group) { brush.move(gXTransition, [10, 40]); // two-dimensional brush brush.move(gXTransition, function (d, i, group) { console.log('Owner SVG Element of svg group: ', this.ownerSVGElement); // this is of type SVGGElement - let selection: [number, number]; + let selection: [number, number] = [0, 0]; selection[0] = d.extent[0][0] + 10; // datum type is brushDatum selection[1] = d.extent[0][0] + 40; return selection; @@ -176,7 +184,7 @@ brush.move(gXTransition, function (d, i, group) { // ----------------------------------------------------------------------------- -let e: d3Brush.D3BrushEvent; +let e: d3Brush.D3BrushEvent = event; let target: d3Brush.BrushBehavior = e.target; diff --git a/d3-brush/index.d.ts b/d3-brush/index.d.ts index fc2fcb739d..5c89465bce 100644 --- a/d3-brush/index.d.ts +++ b/d3-brush/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-brush module v1.0.2 +// Type definitions for D3JS d3-brush module 1.0 // Project: https://github.com/d3/d3-brush/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.3 + import { ArrayLike, Selection, TransitionLike, ValueFn } from 'd3-selection'; /** @@ -159,7 +161,7 @@ export interface BrushBehavior { * start (at the start of a brush gesture, such as on mousedown), brush (when the brush moves, such as on mousemove), or * end (at the end of a brush gesture, such as on mouseup.) */ - on(typenames: string): ValueFn; + on(typenames: string): ValueFn | undefined; /** * Removes the current event listeners for the specified typenames, if any. * diff --git a/d3-brush/tsconfig.json b/d3-brush/tsconfig.json index 7e30cb98d8..6d8656f23b 100644 --- a/d3-brush/tsconfig.json +++ b/d3-brush/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-brush-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-brush-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-brush/tslint.json b/d3-brush/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-brush/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3-chord/d3-chord-tests.ts b/d3-chord/d3-chord-tests.ts index d322e8a843..b2dd960b79 100644 --- a/d3-chord/d3-chord-tests.ts +++ b/d3-chord/d3-chord-tests.ts @@ -15,10 +15,10 @@ import { ascending } from 'd3-array'; // Preparatory Steps // --------------------------------------------------------------------- -let context: CanvasRenderingContext2D; +let context: CanvasRenderingContext2D | null= document.querySelector('canvas')!.getContext('2d'); let chords: d3Chord.Chords; -let chordGroups: Array; +let chordGroups: d3Chord.ChordGroup[]; let chord: d3Chord.Chord; let chordSubgroup: d3Chord.ChordSubgroup; @@ -30,7 +30,7 @@ let matrix: number[][] = [ [1013, 990, 940, 6907] ]; // From Circos Table Viewer example http://mkweb.bcgsc.ca/circos/guide/tables/ -let comparatorFn: (a: number, b: number) => number; +let comparatorFn: ((a: number, b: number) => number) | null; let subgroupAccessor: (this: SVGPathElement, d: d3Chord.Chord, ...args: any[]) => d3Chord.ChordSubgroup; let numAccessor: (this: SVGPathElement, d: d3Chord.ChordSubgroup, ...args: any[]) => number; @@ -39,27 +39,6 @@ let numAccessor: (this: SVGPathElement, d: d3Chord.ChordSubgroup, ...args: any[] // Test Chord // --------------------------------------------------------------------- -// Test supporting interfaces ========================================== - - -let length: number = chords.length; - -chordGroups = chords.groups; - -num = chordGroups[0].startAngle; -num = chordGroups[0].endAngle; -num = chordGroups[0].value; -num = chordGroups[0].index; - -chord = chords[0]; - -chordSubgroup = chord.source; -chordSubgroup = chord.target; - -num = chordSubgroup.startAngle; -num = chordSubgroup.endAngle; -num = chordSubgroup.value; -num = chordSubgroup.index; // chord() create ChordLayout generator =============================== @@ -96,13 +75,37 @@ comparatorFn = chordLayout.sortChords(); chords = chordLayout(matrix); + +// Test supporting interfaces ========================================== + + +let length: number = chords.length; + +chordGroups = chords.groups; + +num = chordGroups[0].startAngle; +num = chordGroups[0].endAngle; +num = chordGroups[0].value; +num = chordGroups[0].index; + +chord = chords[0]; + +chordSubgroup = chord.source; +chordSubgroup = chord.target; + +num = chordSubgroup.startAngle; +num = chordSubgroup.endAngle; +num = chordSubgroup.value; +num = chordSubgroup.index; + + // --------------------------------------------------------------------- // Test Ribbon // --------------------------------------------------------------------- // ribbon() create RibbonGenerator ===================================== -let canvasRibbon: d3Chord.RibbonGenerator; +let canvasRibbon: d3Chord.RibbonGenerator; canvasRibbon = d3Chord.ribbon(); let svgRibbon: d3Chord.RibbonGenerator; @@ -113,7 +116,10 @@ svgRibbon = d3Chord.ribbon // context() ----------------------------------------------------------- -canvasRibbon = canvasRibbon.context(context); +if (context) { + canvasRibbon = canvasRibbon.context(context); +} + context = canvasRibbon.context(); svgRibbon = svgRibbon.context(null); @@ -172,7 +178,19 @@ numAccessor = svgRibbon.endAngle(); // Use RibbonGenerator ================================================= // use canvas -canvasRibbon(chords[0]); // render ribbon for first chord +let ribbon: d3Chord.Ribbon = { + source: {startAngle: 0.7524114, endAngle: 1.1212972, radius: 240}, + target: {startAngle: 1.8617078, endAngle: 1.9842927, radius: 240} +}; + +canvasRibbon(ribbon); // render ribbon for first chord + +// The below fails explicitly, as standard ChordSubgroup objects for source and target are missing "radius" property assumed in default +// radius accessor. Given the internals of d3 this would lead to a "NaN" radius. So using static typing to raise this to +// awareness seems appropriate. The alternative, is to create RibbonGenerator using the generics to explictly set the types and +// then set the radius. Or, one could map a radius property into the Chords returned by the ChordLayout. + +// canvasRibbon(chords[0]); // fails, see above // use svg diff --git a/d3-chord/index.d.ts b/d3-chord/index.d.ts index 727ec0bea8..4696693d83 100644 --- a/d3-chord/index.d.ts +++ b/d3-chord/index.d.ts @@ -1,78 +1,401 @@ -// Type definitions for D3JS d3-chord module v1.0.2 +// Type definitions for D3JS d3-chord module 1.0 // Project: https://github.com/d3/d3-chord/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.3 + // --------------------------------------------------------------------- // Chord // --------------------------------------------------------------------- +/** + * A chord subgroup serving as source or target of a chord between two nodes i an j (where i may be equal to j). + */ export interface ChordSubgroup { + /** + * Start angle of the chord subgroup in radians + */ startAngle: number; + + /*** + * End angle of the chord subgroup in radians + */ endAngle: number; + + /** + * The flow value in matrix[i][j] from node i to node j + */ value: number; + + /** + * The node index i + */ index: number; + + /** + * The node index j + */ subindex: number; } +/** + * A chord represents the combined bidirectional flow between two nodes i and j (where i may be equal to j) + */ export interface Chord { + /** + * Chord subgroup constituting the sodurce of Chord + */ source: ChordSubgroup; + /** + * Chord subgroup constituting the Target of Chord + */ target: ChordSubgroup; } +/** + * A chord group for a given node i representing the combined outflow for node i, + * corresponding to the elements matrix[i][0 … n - 1]. + */ export interface ChordGroup { + /** + * The start angle of the chord group in radians + */ startAngle: number; + + /** + * The end angle of the chord group in radians + */ endAngle: number; + + /** + * The total outgoing flow value for node i + */ value: number; + + /** + * The node index i + */ index: number; } +/** + * An array of chords, where each chord represents the combined bidirectional flow between two nodes i and j (where i may be equal to j). + * The chords are based on a (n x n) matrix of flows between nodes. + * + * The chords are typically passed to d3.ribbon to display the network relationships. + * The returned array includes only chord objects for which the value matrix[i][j] or matrix[j][i] is non-zero. + * Furthermore, the returned array only contains unique chords: a given chord ij represents the bidirectional flow from i to j and from j to i, + * and does not contain a duplicate chord ji; i and j are chosen such that the chord’s source always represents the larger of matrix[i][j] and matrix[j][i]. + * In other words, chord.source.index equals chord.target.subindex, chord.source.subindex equals chord.target.index, + * chord.source.value is greater than or equal to chord.target.value, and chord.source.value is always greater than zero. + */ export interface Chords extends Array { - groups: Array; + /** + * An array of length n, where each group represents the combined outflow for node i, + * corresponding to the elements matrix[i][0 … n - 1] + */ + groups: ChordGroup[]; } +/** + * A D3 chord diagram Layout to visualize relationships or network flow with an aesthetically-pleasing circular layout. + * + * The relationships are represented as a square matrix of size n×n, where the matrix represents the directed flow amongst a network (a complete digraph) of n nodes. + */ export interface ChordLayout { + /** + * Computes the chord layout for the specified square matrix of size n×n, where the matrix represents the directed flow amongst a network (a complete digraph) of n nodes. + * + * @param matrix An (n x n) matrix representing the directed flow amongst a network (a complete digraph) of n nodes.The given matrix must be an array of length n, + * where each element matrix[i] is an array of n numbers, where each matrix[i][j] represents the flow from the ith node in the network to the jth node. + * Each number matrix[i][j] must be nonnegative, though it can be zero if there is no flow from node i to node j. + */ (matrix: number[][]): Chords; + + /** + * Returns the current pad angle in radians, which defaults to zero. + */ padAngle(): number; + /** + * Sets the pad angle between adjacent groups to the specified number in radians and returns this chord layout. + * + * The default is zero. + * + * @param angle Pad angle between adjecent groups in radians. + */ padAngle(angle: number): this; + + /** + * Returns the current group comparator, which defaults to null. + */ sortGroups(): ((a: number, b: number) => number) | null; + /** + * Removes the current group comparator and returns this chord layout. + * + * @param compare Use null to remove the current comparator function, if any. + */ sortGroups(compare: null): this; + /** + * Sets the group comparator to the specified function and returns this chord layout. + * + * If the group comparator is non-null, it is used to sort the groups by their total outflow. See also d3.ascending and d3.descending. + * + * @param compare A comparator function, e.g. d3.ascending or d3.descending. + */ sortGroups(compare: (a: number, b: number) => number): this; + + /** + * Returns the current subgroup comparator, which defaults to null. + */ sortSubgroups(): ((a: number, b: number) => number) | null; + /** + * Removes the current subgroup comparator and returns this chord layout. + * + * @param compare Use null to remove the current comparator function, if any. + */ sortSubgroups(compare: null): this; + /** + * Sets the subgroup comparator to the specified function and returns this chord layout. + * + * If the subgroup comparator is non-null, it is used to sort the subgroups corresponding to matrix[i][0 … n - 1] + * for a given group i by their total outflow. See also d3.ascending and d3.descending. + * + * @param compare A comparator function, e.g. d3.ascending or d3.descending. + */ sortSubgroups(compare: (a: number, b: number) => number): this; + + /** + * Returns the current chord comparator, which defaults to null. + */ sortChords(): ((a: number, b: number) => number) | null; + /** + * Removes the current chord comparator and returns this chord layout. + * + * @param compare Use null to remove the current comparator function, if any. + */ sortChords(compare: null): this; + /** + * Sets the chord comparator to the specified function and returns this chord layout. + * + * If the chord comparator is non-null, it is used to sort the chords by their combined flow; this only affects the z-order of the chords. + * See also d3.ascending and d3.descending. + * + * @param compare A comparator function, e.g. d3.ascending or d3.descending. + */ sortChords(compare: (a: number, b: number) => number): this; } +/** + * Constructs a new chord diagram layout with the default settings. + */ export function chord(): ChordLayout; // --------------------------------------------------------------------- // Ribbon // --------------------------------------------------------------------- +/** + * A minimal interface to support the default accessors used by RibbonGenerator for properties of + * source and target objects of a Ribbon. + * + * (Corresponds to ChordSubgroup) + */ +export interface RibbonSubgroup { + /** + * Start angle of the ribbon subgroup in radians + */ + startAngle: number; + /** + * End angle of the ribbon subgroup in radians + */ + endAngle: number; + /** + * Radius of the ribbon subgroup + */ + radius: number; +} -export interface RibbonGenerator { - (this: This, d: ChordDatum, ...args: any[]): string | undefined; - source(): (this: This, d: ChordDatum, ...args: any[]) => ChordSubgroupDatum; - source(source: (this: This, d: ChordDatum, ...args: any[]) => ChordSubgroupDatum): this; - target(): (this: This, d: ChordDatum, ...args: any[]) => ChordSubgroupDatum; - target(target: (this: This, d: ChordDatum, ...args: any[]) => ChordSubgroupDatum): this; - radius(): (this: This, d: ChordSubgroupDatum, ...args: any[]) => number; +/** + * A minimal interface to support the default source and target accessors used by RibbonGenerator. + * (Corresponds to Chord) + */ +export interface Ribbon { + /** + * Ribbon subgroup constituting the source of the Ribbon + */ + source: RibbonSubgroup; + /** + * Ribbon subgroup constituting the target of the Ribbon + */ + target: RibbonSubgroup; +} + +/** + * + * A ribbon generator to suport rendering of chords in a chord diagram. + * + * The first generic corresponds to the type of the "this" context within which the ribbon generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type representing a chord for which the ribbon is to be generated. The default type is Ribbon. + * + * The third generic corresponds to the datum type of the chord subgroup, i.e. source or target of the cord. The default type is RibbonSubgroup. + */ +export interface RibbonGenerator { + /** + * Generates a ribbon for the given arguments. + * + * IMPORTANT: If the ribbon generator has been configured with a rendering context, + * then the ribbon is rendered to this context as a sequence of path method calls and this function returns void. + * + * The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. + * All arguments passed into this function, will be passed to the accessor functions of the generator. + * + * @param d The datum representing the chord for which the ribbon is to be generated. + */ + (this: This, d: RibbonDatum, ...args: any[]): void; + /** + * Generates a ribbon for the given arguments. + * + * IMPORTANT: If the rendering context of the ribbon generator is null, + * then the ribbon is returned as a path data string. + * + * The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. + * All arguments passed into this function, will be passed to the accessor functions of the generator. + * + * @param d The datum representing the chord for which the ribbon is to be generated. + */ + (this: This, d: RibbonDatum, ...args: any[]): string | null; + + /** + * Returns the current source accessor, which defaults to a function returning the "source" property of the first argument passed into the accessor. + */ + source(): (this: This, d: RibbonDatum, ...args: any[]) => RibbonSubgroupDatum; + /** + * Sets the source accessor to the specified function and returns this ribbon generator. + * + * @param source An accessor function returning the source datum of the chord. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the ribbon generator. + */ + source(source: (this: This, d: RibbonDatum, ...args: any[]) => RibbonSubgroupDatum): this; + + /** + * Returns the current target accessor, which defaults to a function returning the "target" property of the first argument passed into the accessor. + */ + target(): (this: This, d: RibbonDatum, ...args: any[]) => RibbonSubgroupDatum; + /** + * Sets the target accessor to the specified function and returns this ribbon generator. + * + * @param target An accessor function returning the target datum of the chord. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the ribbon generator. + */ + target(target: (this: This, d: RibbonDatum, ...args: any[]) => RibbonSubgroupDatum): this; + + /** + * Returns the current radius accessor, which defaults to a function returning the "radius" property (assumed to be a number) of the source or + * target object returned by the source or target accessor, respectively. + */ + radius(): (this: This, d: RibbonSubgroupDatum, ...args: any[]) => number; + /** + * Sets the radius to a fixed number and returns this ribbon generator. + * + * @param radius A fixed numeric value for the radius. + */ radius(radius: number): this; - radius(radius: (this: This, d: ChordSubgroupDatum, ...args: any[]) => number): this; - startAngle(): (this: This, d: ChordSubgroupDatum, ...args: any[]) => number; + /** + * Sets the radius accessor to the specified function and returns this ribbon generator. + * + * @param radius An accessor function which is invoked for the source and target of the chord. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as the first argument the source or target object returned by the respective source or target accessor function of the generator. It is also passed any additional arguments that were passed + * into the generator, with the exception of the first element representing the chord datum itself. The function returns the radius value. + */ + radius(radius: (this: This, d: RibbonSubgroupDatum, ...args: any[]) => number): this; + + /** + * Returns the current start angle accessor, which defaults to a function returning the "startAngle" property (assumed to be a number in radians) of the source or + * target object returned by the source or target accessor, respectively. + */ + startAngle(): (this: This, d: RibbonSubgroupDatum, ...args: any[]) => number; + /** + * Sets the start angle to a fixed number in radians and returns this ribbon generator. + * + * @param angle A fixed numeric value for the start angle in radians. + */ startAngle(angle: number): this; - startAngle(angle: (this: This, d: ChordSubgroupDatum, ...args: any[]) => number): this; - endAngle(): (this: This, d: ChordSubgroupDatum, ...args: any[]) => number; + /** + * Sets the start angle accessor to the specified function and returns this ribbon generator. + * + * @param angle An accessor function which is invoked for the source and target of the chord. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as the first argument the source or target object returned by the respective source or target accessor function of the generator. It is also passed any additional arguments that were passed + * into the generator, with the exception of the first element representing the chord datum itself. The function returns the start angle in radians. + */ + startAngle(angle: (this: This, d: RibbonSubgroupDatum, ...args: any[]) => number): this; + + /** + * Returns the current end angle accessor, which defaults to a function returning the "endAngle" property (assumed to be a number in radians) of the source or + * target object returned by the source or target accessor, respectively. + */ + endAngle(): (this: This, d: RibbonSubgroupDatum, ...args: any[]) => number; + /** + * Sets the end angle to a fixed number in radians and returns this ribbon generator. + * + * @param angle A fixed numeric value for the end angle in radians. + */ endAngle(angle: number): this; - endAngle(angle: (this: This, d: ChordSubgroupDatum, ...args: any[]) => number): this; + /** + * Sets the end angle accessor to the specified function and returns this ribbon generator. + * + * @param angle An accessor function which is invoked for the source and target of the chord. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives as the first argument the source or target object returned by the respective source or target accessor function of the generator. It is also passed any additional arguments that were passed + * into the generator, with the exception of the first element representing the chord datum itself. The function returns the end angle in radians. + */ + endAngle(angle: (this: This, d: RibbonSubgroupDatum, ...args: any[]) => number): this; + + /** + * Returns the current rendering context, which defaults to null. + */ context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this ribbon generator. + * + * If the context is not null, then the generated ribbon is rendered to this context as a sequence of path method calls. + * + * @param context The rendering context. + */ context(context: CanvasRenderingContext2D): this; + /** + * Sets the rendering context to null and returns this ribbon generator. + * + * A path data string representing the generated ribbon will be returned when the generator is invoked with data. See also d3-path. + * + * @param context null, to remove rendering context. + */ context(context: null): this; } -export function ribbon(): RibbonGenerator; +/** + * Creates a new ribbon generator with the default settings. + */ +export function ribbon(): RibbonGenerator; +/** + * Creates a new ribbon generator with the default settings. + * + * Accessor functions must be configured for the ribbon generator, should the datum types differ from the defaults. + * + * The first generic corresponds to the datum type representing a chord for which the ribbon is to be generated. The default type is Chord. + * + * The second generic corresponds to the datum type of the chord subgroup, i.e. source or target of the cord. The default type is ChordSubgroup. + */ export function ribbon(): RibbonGenerator; +/** + * Creates a new ribbon generator with the default settings. + * + * Accessor functions must be configured for the ribbon generator, should the datum types differ from the defaults. + * + * The first generic corresponds to the type of the "this" context within which the ribbon generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type representing a chord for which the ribbon is to be generated. The default type is Chord. + * + * The third generic corresponds to the datum type of the chord subgroup, i.e. source or target of the cord. The default type is ChordSubgroup. + */ export function ribbon(): RibbonGenerator; diff --git a/d3-chord/tsconfig.json b/d3-chord/tsconfig.json index f549e0533c..629c95be8b 100644 --- a/d3-chord/tsconfig.json +++ b/d3-chord/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-chord-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-chord-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-chord/tslint.json b/d3-chord/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-chord/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3-collection/tsconfig.json b/d3-collection/tsconfig.json index bb31308ddc..abd7919662 100644 --- a/d3-collection/tsconfig.json +++ b/d3-collection/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-collection-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-collection-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-color/tsconfig.json b/d3-color/tsconfig.json index 6dd477889f..e2e62e5ac3 100644 --- a/d3-color/tsconfig.json +++ b/d3-color/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-color-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-color-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-dispatch/tsconfig.json b/d3-dispatch/tsconfig.json index 5da2fe1372..5329b9b870 100644 --- a/d3-dispatch/tsconfig.json +++ b/d3-dispatch/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-dispatch-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-dispatch-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-drag/d3-drag-tests.ts b/d3-drag/d3-drag-tests.ts index 461e39fdea..379647117b 100644 --- a/d3-drag/d3-drag-tests.ts +++ b/d3-drag/d3-drag-tests.ts @@ -38,9 +38,9 @@ interface CustomSubject { r: number; } -let svg: SVGSVGElement; +let svg: SVGSVGElement = select('svg').node()!; // mock -let circles: Selection; +let circles: Selection = select('svg').selectAll('circle'); // mock // ----------------------------------------------------------------------------- // Test Define DragBehavior @@ -63,7 +63,7 @@ circleCustomDrag = d3Drag.drag | NodeListOf) => d3Drag.DragContainerElement; +let containerAccessor: (this: SVGCircleElement, d: CircleDatum, i: number, group: SVGCircleElement[] | NodeListOf) => d3Drag.DragContainerElement; containerAccessor = function (d, i, group) { console.log('Node Id of circle: ', d.nodeId); @@ -91,7 +91,7 @@ containerAccessor = circleDrag.container(); // set and get filter --------------------------------------------------------- -let filterFn: (this: SVGCircleElement, datum: CircleDatum, index?: number, group?: Array | NodeListOf) => boolean; +let filterFn: (this: SVGCircleElement, datum: CircleDatum, index: number, group: SVGCircleElement[] | NodeListOf) => boolean; filterFn = function (d) { return (d.color !== 'green' && this.r.baseVal.value < 10) ? !event.button : true; // 'this' is SVGCircleElement and d is CircleDatum @@ -108,9 +108,13 @@ filterFn = circleDrag.filter(); // set and get subject --------------------------------------------------------- -circleCustomDrag.subject(function (d) { +circleCustomDrag.subject(function (d, i, g) { // Cast event type for completeness, otherwise event is of type any. - let e = >event; + let e = > event; + let that: SVGCircleElement = this; + let datum: CircleDatum = d; + let index: number = i; + let group: SVGCircleElement[] | ArrayLike = g; if (d == null) { return { x: e.x, y: e.y }; @@ -127,7 +131,7 @@ circleCustomDrag.subject(function (d) { }); // test getter -let subjectAccessor: (this: SVGCircleElement, datum?: CircleDatum, index?: number, group?: Array | NodeListOf) => CustomSubject | d3Drag.SubjectPosition; +let subjectAccessor: (this: SVGCircleElement, datum: CircleDatum, index: number, group: SVGCircleElement[] | NodeListOf) => CustomSubject | d3Drag.SubjectPosition; subjectAccessor = circleCustomDrag.subject(); @@ -135,14 +139,14 @@ subjectAccessor = circleCustomDrag.subject(); function dragstarted(this: SVGCircleElement, d: CircleDatum) { // cast d3 event to drag event. Otherwise, d3 event is currently defined as type 'any' - let e = >event; + let e = > event; e.sourceEvent.stopPropagation(); select(this).classed('dragging', true); } function dragged(this: SVGCircleElement, d: CircleDatum) { // cast d3 event to drag event. Otherwise, d3 event is currently defined as type 'any' - let e = >event; + let e = > event; select(this).attr('cx', d.x = e.x).attr('cy', d.y = e.y); } @@ -169,9 +173,9 @@ circleDrag = circleDrag // remove event listeners for a drag event type circleDrag.on('start.tmp', null); -let handler: (this: SVGCircleElement, d?: CircleDatum, i?: number, group?: Array | NodeListOf) => void = circleDrag.on('start'); -// let wrongHandler1: (this:SVGRectElement, d?:CircleDatum, i?: number, group?: Array | NodeListOf)=> void = circleDrag.on('start'); // fails, wrong dragged DOM event -// let wrongHandler2: (this:SVGCircleElement, d?:{test: number}, i?: number, group?: Array | NodeListOf)=> void = circleDrag.on('start'); // fails, handler with wrong datum type +let handler: ((this: SVGCircleElement, d: CircleDatum, i: number, group: SVGCircleElement[] | NodeListOf) => void) | undefined = circleDrag.on('start'); +// let wrongHandler1: ((this:SVGRectElement, d:CircleDatum, i: number, group: SVGRectElement[] | NodeListOf)=> void) | undefined = circleDrag.on('start'); // fails, wrong dragged DOM event +// let wrongHandler2: ((this:SVGCircleElement, d:{test: number}, i: number, group: SVGCircleElement[] | NodeListOf)=> void) | undefined = circleDrag.on('start'); // fails, handler with wrong datum type // ----------------------------------------------------------------------------- // Test Attach Drag Behavior @@ -179,7 +183,7 @@ let handler: (this: SVGCircleElement, d?: CircleDatum, i?: number, group?: Array circles.call(circleDrag); -let wrongSelection: Selection; +let wrongSelection: Selection = select('div'); // wrongSelection.call(circleDrag); // fails, as dragged elements are not of type specified for drag behavior @@ -188,7 +192,7 @@ let wrongSelection: Selection; // ----------------------------------------------------------------------------- -let e: d3Drag.D3DragEvent; +let e: d3Drag.D3DragEvent = event; circleDrag = e.target; // target return drag behavior @@ -214,15 +218,16 @@ e = e.on('drag', dragged); // e = e.on('drag', wrongDragHandler2); // fails, wrong this-type for DOM Element context handler = e.on('dragged'); -// let wrongHandler3: (this:SVGRectElement, d?:CircleDatum, i?: number, group?: Array | NodeListOf)=> void = e.on('dragged'); // fails, wrong dragged DOM event -// let wrongHandler4: (this:SVGCircleElement, d?:{test: number}, i?: number, group?: Array | NodeListOf)=> void = e.on('dragged'); // fails, handler with wrong datum type +// let wrongHandler3: ((this:SVGRectElement, d:CircleDatum, i: number, group: SVGRectElement[] | NodeListOf)=> void) | undefined = e.on('dragged'); // fails, wrong dragged DOM event +// let wrongHandler4: ((this:SVGCircleElement, d:{test: number}, i: number, group: SVGCircleElement[] | NodeListOf)=> void) | undefined = e.on('dragged'); // fails, handler with wrong datum type // ----------------------------------------------------------------------------- // Test dragDisable() and dragEnable() // ----------------------------------------------------------------------------- -let w: Window; +let w: Window = window; + d3Drag.dragDisable(w); d3Drag.dragEnable(w); diff --git a/d3-drag/index.d.ts b/d3-drag/index.d.ts index 60c140f313..d49e0bbc02 100644 --- a/d3-drag/index.d.ts +++ b/d3-drag/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-drag module v1.0.1 +// Type definitions for D3JS d3-drag module 1.0 // Project: https://github.com/d3/d3-drag/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.2 + import { ArrayLike, Selection, ValueFn } from 'd3-selection'; @@ -174,7 +176,7 @@ export interface DragBehavior; + on(typenames: string): ValueFn | undefined; /** * Remove the current event listeners for the specified typenames, if any, return the drag behavior. * @@ -297,7 +299,7 @@ export interface D3DragEvent; + on(typenames: string): ValueFn | undefined; /** * Remove the current event listeners for the specified typenames, if any, return the drag behavior. * diff --git a/d3-drag/tsconfig.json b/d3-drag/tsconfig.json index db3c1152ab..8c842c965b 100644 --- a/d3-drag/tsconfig.json +++ b/d3-drag/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-drag-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-drag-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-drag/tslint.json b/d3-drag/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-drag/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3-dsv/tsconfig.json b/d3-dsv/tsconfig.json index d03fd12e03..eb275db8e8 100644 --- a/d3-dsv/tsconfig.json +++ b/d3-dsv/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/d3-ease/tsconfig.json b/d3-ease/tsconfig.json index 169c7c92dc..dc6c989229 100644 --- a/d3-ease/tsconfig.json +++ b/d3-ease/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-ease-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-ease-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-force/d3-force-tests.ts b/d3-force/d3-force-tests.ts index eb06dae3fc..b760864079 100644 --- a/d3-force/d3-force-tests.ts +++ b/d3-force/d3-force-tests.ts @@ -26,8 +26,8 @@ interface SimLink extends d3Force.SimulationLinkDatum { } interface Graph { - nodes: Array; - links: Array; + nodes: SimNode[]; + links: SimLink[]; } @@ -47,18 +47,18 @@ let graph: Graph = { ] }; -let simNode: SimNode; +let simNode: SimNode | undefined; let simLink: SimLink; -let simNodes: Array; -let simLinks: Array; +let simNodes: SimNode[]; +let simLinks: SimLink[]; -let num: Number; +let num: number; -let canvas = document.querySelector('canvas'), - context = canvas.getContext('2d'), - width = canvas.width, - height = canvas.height; +let canvas = document.querySelector('canvas')!; +let context = canvas.getContext('2d'); +let width = canvas.width; +let height = canvas.height; // ------------------------------------------------------------------------------------- // Test Pre-Defined Forces @@ -108,14 +108,14 @@ forceCollide = d3Force.forceCollide(15); forceCollide = d3Force.forceCollide(function (node, index, nodes) { let n: SimNode = node; let i: number = index; - let ns: Array = nodes; + let ns: SimNode[] = nodes; return n.r; }); // Configure Collision force ----------------------------------------------------------- -let radiusAccessor: (node: SimNode, i: number, nodes: Array) => number; +let radiusAccessor: (node: SimNode, i: number, nodes: SimNode[]) => number; // radius @@ -123,7 +123,7 @@ forceCollide = forceCollide.radius(20); forceCollide = forceCollide.radius(function (node, index, nodes) { let n: SimNode = node; let i: number = index; - let ns: Array = nodes; + let ns: SimNode[] = nodes; return 2 * n.r; }); @@ -160,8 +160,8 @@ forceLink = d3Force.forceLink(graph.links); // Configure Link force ----------------------------------------------------------- -let linkNumberAccessor: (link: SimLink, i: number, links: Array) => number; -let nodeIdAccessor: (node: SimNode, i: number, nodes: Array) => number | string; +let linkNumberAccessor: (link: SimLink, i: number, links: SimLink[]) => number; +let nodeIdAccessor: (node: SimNode, i: number, nodes: SimNode[]) => number | string; // links @@ -174,7 +174,8 @@ simLink = simLinks[0]; simNode = (typeof simLink.source !== 'number' && typeof simLink.source !== 'string') ? simLink.source : undefined; simNode = (typeof simLink.target !== 'number' && typeof simLink.target !== 'string') ? simLink.target : undefined; -num = simLink.index; +let maybeNum: number | undefined = simLink.index; // Ex-ante type before initialization of links +num = simLink.index!; // Ex-post after link initialization, use ! non-null assertion operator to narrow to number num = simLink.value; num = simLink.d; @@ -186,7 +187,7 @@ num = simLink.s; forceLink = forceLink.id(function (node, index, nodes) { let n: SimNode = node; let i: number = index; - let ns: Array = nodes; + let ns: SimNode[] = nodes; return n.id; }); @@ -196,7 +197,7 @@ forceLink = forceLink.distance(50); forceLink = forceLink.distance(function (link, index, links) { let l: SimLink = link; let i: number = index; - let ls: Array = links; + let ls: SimLink[] = links; return l.d; }); @@ -208,7 +209,7 @@ forceLink = forceLink.strength(0.95); forceLink = forceLink.strength(function (link, index, links) { let l: SimLink = link; let i: number = index; - let ls: Array = links; + let ls: SimLink[] = links; return l.s; }); @@ -236,7 +237,7 @@ forceCharge = d3Force.forceManyBody(); // Configure ManyBody force ----------------------------------------------------------- -let simNodeNumberAccessor: (node: SimNode, i: number, nodes: Array) => number; +let simNodeNumberAccessor: (node: SimNode, i: number, nodes: SimNode[]) => number; // strength @@ -244,7 +245,7 @@ forceCharge = forceCharge.strength(-3000); forceCharge = forceCharge.strength(function (node, index, nodes) { let n: SimNode = node; let i: number = index; - let ns: Array = nodes; + let ns: SimNode[] = nodes; return -1000 * n.group; }); simNodeNumberAccessor = forceCharge.strength(); @@ -288,7 +289,7 @@ forcePosX = forcePosX.strength(0.2); forcePosX = forcePosX.strength(function (node, index, nodes) { let n: SimNode = node; let i: number = index; - let ns: Array = nodes; + let ns: SimNode[] = nodes; return 0.1 * n.group; }); simNodeNumberAccessor = forcePosX.strength(); @@ -299,7 +300,7 @@ forcePosX = forcePosX.x(100); forcePosX = forcePosX.x(function (node, index, nodes) { let n: SimNode = node; let i: number = index; - let ns: Array = nodes; + let ns: SimNode[] = nodes; let target: number; switch (n.group) { case 1: @@ -343,7 +344,7 @@ forcePosY = forcePosY.strength(0.2); forcePosY = forcePosY.strength(function (node, index, nodes) { let n: SimNode = node; let i: number = index; - let ns: Array = nodes; + let ns: SimNode[] = nodes; return 0.1 * n.group; }); simNodeNumberAccessor = forcePosY.strength(); @@ -354,7 +355,7 @@ forcePosY = forcePosY.y(100); forcePosY = forcePosY.y(function (node, index, nodes) { let n: SimNode = node; let i: number = index; - let ns: Array = nodes; + let ns: SimNode[] = nodes; let target: number; switch (n.group) { case 1: @@ -450,67 +451,82 @@ nodeLinkSimulation .force('charge', forceCharge) .force('center', forceCenter); +let maybeF: d3Force.Force | undefined; let f: d3Force.Force; // getter with generic force returned -f = nodeLinkSimulation.force('charge'); -f = nodeLinkSimulation.force('link'); +maybeF = nodeLinkSimulation.force('charge'); +maybeF = nodeLinkSimulation.force('link'); +// assuming certainty that force has been previously assigned +f = nodeLinkSimulation.force>('charge')!; + +// if force may not have been assigned for the name +maybeF = nodeLinkSimulation.force>('charge'); +// f = nodeLinkSimulation.force>('charge'); // fails, with strictNullChecks // getter with force type cast to improve return type specificity let fLink: d3Force.ForceLink; // Need explicit, careful type casting to a specific force type -fLink = nodeLinkSimulation.force>('link'); +fLink = nodeLinkSimulation.force>('link')!; // This is mainly an issue for ForceLinks, if once wants to get the links from an initialized force // or re-set new links for an initialized force, e.g.: -simLinks = nodeLinkSimulation.force>('link').links(); +simLinks = nodeLinkSimulation.force>('link')!.links(); -// fLink = nodeLinkSimulation.force('link'); // fails, as ForceLink specific properties are missing from 'generic' force +// fLink = nodeLinkSimulation.force('link')!; // fails, as ForceLink specific properties are missing from 'generic' force // on() -------------------------------------------------------------------------------- function drawLink(d: SimLink) { - let source: SimNode, target: SimNode; + let source: SimNode | undefined; + let target: SimNode | undefined; source = (typeof d.source !== 'string' && typeof d.source !== 'number') ? d.source : undefined; target = (typeof d.target !== 'string' && typeof d.target !== 'number') ? d.target : undefined; - if (source && target) { + if (context && source && source.x && source.y && target && target.x && target.y) { context.moveTo(source.x, source.y); context.lineTo(target.x, target.y); } } function drawNode(d: SimNode) { - context.moveTo(d.x + 3, d.y); - context.arc(d.x, d.y, 3, 0, 2 * Math.PI); + if (context && d.x && d.y) { + context.moveTo(d.x + 3, d.y); + context.arc(d.x, d.y, 3, 0, 2 * Math.PI); + } } nodeLinkSimulation = nodeLinkSimulation.on('tick', function ticked() { let that: d3Force.Simulation = this; - context.clearRect(0, 0, width, height); + if (context) { + context.clearRect(0, 0, width, height); - context.beginPath(); - graph.links.forEach(drawLink); - context.strokeStyle = '#aaa'; - context.stroke(); + context.beginPath(); + graph.links.forEach(drawLink); + context.strokeStyle = '#aaa'; + context.stroke(); - context.beginPath(); - graph.nodes.forEach(drawNode); - context.fill(); - context.strokeStyle = '#fff'; - context.stroke(); + context.beginPath(); + graph.nodes.forEach(drawNode); + context.fill(); + context.strokeStyle = '#fff'; + context.stroke(); + } }); // remove listener nodeSimulation = nodeSimulation.on('tick', null); +// get listener +let listener: ((this: d3Force.Simulation) => void) | undefined = nodeSimulation.on('tick'); + // Configure and Use Force Simulation =================================================== // restart() -------------------------------------------------------------------------- diff --git a/d3-force/index.d.ts b/d3-force/index.d.ts index cde2539150..6faa27449a 100644 --- a/d3-force/index.d.ts +++ b/d3-force/index.d.ts @@ -1,9 +1,11 @@ -// Type definitions for D3JS d3-force module v1.0.2 +// Type definitions for D3JS d3-force module 1.0 // Project: https://github.com/d3/d3-force/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.4 + // ----------------------------------------------------------------------- // Force Simulation // ----------------------------------------------------------------------- @@ -44,11 +46,11 @@ export interface SimulationNodeDatum { /** * Node’s fixed x-position (if position was fixed) */ - fx?: number | null | undefined; + fx?: number | null; /** * Node’s fixed y-position (if position was fixed) */ - fy?: number | null | undefined; + fy?: number | null; } /** @@ -114,7 +116,7 @@ export interface Simulation; + nodes(): NodeDatum[]; /** * Set the simulation’s nodes to the specified array of objects, initialize their positions and velocities if necessary, * and then re-initialize any bound forces; Returns the simulation. @@ -142,7 +144,7 @@ export interface Simulation): this; + nodes(nodesData: NodeDatum[]): this; /** * Return the current alpha of the simulation, which defaults to 1. @@ -225,7 +227,7 @@ export interface Simulation>(name: string): F | undefined; + force>(name: string): F| undefined; /** * Remove a previously registered force. * @@ -261,7 +263,7 @@ export interface Simulation) => void; + on(typenames: 'tick' | 'end' | string): ((this: Simulation) => void) | undefined; /** * Remove the current event listeners for the specified typenames, if any, return the simulation. * @@ -307,7 +309,7 @@ export interface Simulation(nodesData?: Array): Simulation; +export function forceSimulation(nodesData?: NodeDatum[]): Simulation; /** * Create a new simulation with the specified array of nodes and no forces. * If nodes is not specified, it defaults to the empty array. @@ -321,7 +323,7 @@ export function forceSimulation(nodesData * * @param nodesData Optional array of nodes data, defaults to empty array. */ -export function forceSimulation>(nodesData?: Array): Simulation; +export function forceSimulation>(nodesData?: NodeDatum[]): Simulation; // ---------------------------------------------------------------------- // Forces @@ -337,7 +339,7 @@ export function forceSimulation> { +export interface Force | undefined> { /** * Apply this force, optionally observing the specified alpha. * Typically, the force is applied to the array of nodes previously passed to force.initialize, @@ -351,7 +353,7 @@ export interface Force): void; + initialize?(nodes: NodeDatum[]): void; } @@ -368,6 +370,14 @@ export interface Force extends Force { + /** + * Assign the array of nodes to this force. This method is called when a force is bound to a simulation via simulation.force + * and when the simulation’s nodes change via simulation.nodes. + * + * A force may perform necessary work during initialization, such as evaluating per-node parameters, to avoid repeatedly performing work during each application of the force. + */ + initialize(nodes: NodeDatum[]): void; + /** * Return the current x-coordinate of the centering position, which defaults to zero. */ @@ -378,6 +388,7 @@ export interface ForceCenter extends Forc * @param x x-coordinate. */ x(x: number): this; + /** * Return the current y-coordinate of the centering position, which defaults to zero. */ @@ -418,10 +429,18 @@ export function forceCenter(x?: number, y * The generic refers to the type of data for a node. */ export interface ForceCollide extends Force { + /** + * Assign the array of nodes to this force. This method is called when a force is bound to a simulation via simulation.force + * and when the simulation’s nodes change via simulation.nodes. + * + * A force may perform necessary work during initialization, such as evaluating per-node parameters, to avoid repeatedly performing work during each application of the force. + */ + initialize(nodes: NodeDatum[]): void; + /** * Returns the current radius accessor function. */ - radius(): (node: NodeDatum, i: number, nodes: Array) => number; + radius(): (node: NodeDatum, i: number, nodes: NodeDatum[]) => number; /** * Set the radius used in collision detection to a constant number for each node. * @@ -444,7 +463,7 @@ export interface ForceCollide extends For * @param radius A radius accessor function which is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes. * The function returns a radius. */ - radius(radius: (node: NodeDatum, i: number, nodes: Array) => number): this; + radius(radius: (node: NodeDatum, i: number, nodes: NodeDatum[]) => number): this; /** * Return the current strength, which defaults to 0.7. @@ -514,7 +533,7 @@ export function forceCollide(radius: numb * @param radius A radius accessor function which is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes. * The function returns a radius. */ -export function forceCollide(radius: (node: NodeDatum, i: number, nodes: Array) => number): ForceCollide; +export function forceCollide(radius: (node: NodeDatum, i: number, nodes: NodeDatum[]) => number): ForceCollide; // Link ---------------------------------------------------------------- @@ -526,11 +545,19 @@ export function forceCollide(radius: (nod * The second generic refers to the type of data for a link. */ export interface ForceLink> extends Force { + /** + * Assign the array of nodes to this force. This method is called when a force is bound to a simulation via simulation.force + * and when the simulation’s nodes change via simulation.nodes. + * + * A force may perform necessary work during initialization, such as evaluating per-node parameters, to avoid repeatedly performing work during each application of the force. + */ + initialize(nodes: NodeDatum[]): void; + /** * Return the current array of links, which defaults to the empty array. * */ - links(): Array; + links(): LinkDatum[]; /** * Set the array of links associated with this force, recompute the distance and strength parameters for each link, and return this force. * @@ -546,12 +573,12 @@ export interface ForceLink): this; + links(links: LinkDatum[]): this; /** - * Return the current node id accessor, which defaults to the numeric index of the node. + * Return the current node id accessor, which defaults to the numeric node.index. */ - id(): (node: NodeDatum, i: number, nodesData: Array) => (string | number); + id(): (node: NodeDatum, i: number, nodesData: NodeDatum[]) => (string | number); /** * Set the node id accessor to the specified function and return this force. * @@ -559,18 +586,18 @@ export interface ForceLink) => string): this; + id(id: (node: NodeDatum, i: number, nodesData: NodeDatum[]) => string): this; /** * Return the current distance accessor, which defaults to implying a default distance of 30. */ - distance(): (link: LinkDatum, i: number, links: Array) => number; + distance(): (link: LinkDatum, i: number, links: LinkDatum[]) => number; /** * Set the distance accessor to use the specified constant number for all links, * re-evaluates the distance accessor for each link, and returns this force. @@ -595,13 +622,13 @@ export interface ForceLink) => number): this; + distance(distance: (link: LinkDatum, i: number, links: LinkDatum[]) => number): this; /** * Return the current strength accessor. * For details regarding the default behavior see: {@link https://github.com/d3/d3-force#link_strength} */ - strength(): (link: LinkDatum, i: number, links: Array) => number; + strength(): (link: LinkDatum, i: number, links: LinkDatum[]) => number; /** * Set the strenght accessor to use the specified constant number for all links, * re-evaluates the strength accessor for each link, and returns this force. @@ -626,7 +653,7 @@ export interface ForceLink) => number): this; + strength(strength: (link: LinkDatum, i: number, links: LinkDatum[]) => number): this; /** * Return the current iteration count which defaults to 1. @@ -665,7 +692,7 @@ export function forceLink>(links: Array): ForceLink; +export function forceLink>(links: LinksDatum[]): ForceLink; // Many Body ---------------------------------------------------------------- @@ -679,12 +706,20 @@ export function forceLink extends Force { + /** + * Assign the array of nodes to this force. This method is called when a force is bound to a simulation via simulation.force + * and when the simulation’s nodes change via simulation.nodes. + * + * A force may perform necessary work during initialization, such as evaluating per-node parameters, to avoid repeatedly performing work during each application of the force. + */ + initialize(nodes: NodeDatum[]): void; + /** * Return the current strength accessor. * * For details regarding the default behavior see: {@link https://github.com/d3/d3-force#manyBody_strength} */ - strength(): (d: NodeDatum, i: number, data: Array) => number; + strength(): (d: NodeDatum, i: number, data: NodeDatum[]) => number; /** * Set the strength accessor to the specified constant strength for all nodes, re-evaluates the strength accessor for each node, and * returns this force. @@ -719,7 +754,7 @@ export interface ForceManyBody extends Fo * @param strength A strength accessor function which is invoked for each node in the simulation, being passed the node, its zero-based index and the complete array of nodes. * The function returns the strength. */ - strength(strength: (d: NodeDatum, i: number, data: Array) => number): this; + strength(strength: (d: NodeDatum, i: number, data: NodeDatum[]) => number): this; /** * Return the current value of the Barnes–Hut approximation criterion , which defaults to 0.9 @@ -797,11 +832,18 @@ export function forceManyBody(): ForceMan * The generic refers to the type of data for a node. */ export interface ForceX extends Force { + /** + * Assign the array of nodes to this force. This method is called when a force is bound to a simulation via simulation.force + * and when the simulation’s nodes change via simulation.nodes. + * + * A force may perform necessary work during initialization, such as evaluating per-node parameters, to avoid repeatedly performing work during each application of the force. + */ + initialize(nodes: NodeDatum[]): void; /** * Returns the current strength accessor, which defaults to a constant strength for all nodes of 0.1. */ - strength(): (d: NodeDatum, i: number, data: Array) => number; + strength(): (d: NodeDatum, i: number, data: NodeDatum[]) => number; /** * Set the strength accessor to the specified constant strength for all nodes, re-evaluates the strength accessor for each node, and returns this force. * @@ -838,12 +880,12 @@ export interface ForceX extends Force) => number): this; + strength(strength: (d: NodeDatum, i: number, data: NodeDatum[]) => number): this; /** * Return the current x-accessor, which defaults to a function returning 0 for all nodes. */ - x(): (d: NodeDatum, i: number, data: Array) => number; + x(): (d: NodeDatum, i: number, data: NodeDatum[]) => number; /** * Set the x-coordinate accessor to the specified number, re-evaluates the x-accessor for each node, * and returns this force. @@ -868,7 +910,7 @@ export interface ForceX extends Force) => number): this; + x(x: (d: NodeDatum, i: number, data: NodeDatum[]) => number): this; } /** @@ -906,7 +948,7 @@ export function forceX(x: number): ForceX * @param x A x-coordinate accessor function which is invoked for each node in the simulation, being passed the node and its zero-based index. * The function returns the x-coordinate. */ -export function forceX(x: (d: NodeDatum, i: number, data: Array) => number): ForceX; +export function forceX(x: (d: NodeDatum, i: number, data: NodeDatum[]) => number): ForceX; /** * The y-positioning force pushes nodes towards a desired position along the given dimension with a configurable strength. @@ -916,10 +958,18 @@ export function forceX(x: (d: NodeDatum, * The generic refers to the type of data for a node. */ export interface ForceY extends Force { + /** + * Assign the array of nodes to this force. This method is called when a force is bound to a simulation via simulation.force + * and when the simulation’s nodes change via simulation.nodes. + * + * A force may perform necessary work during initialization, such as evaluating per-node parameters, to avoid repeatedly performing work during each application of the force. + */ + initialize(nodes: NodeDatum[]): void; + /** * Returns the current strength accessor, which defaults to a constant strength for all nodes of 0.1. */ - strength(): (d: NodeDatum, i: number, data: Array) => number; + strength(): (d: NodeDatum, i: number, data: NodeDatum[]) => number; /** * Set the strength accessor to the specified constant strength for all nodes, re-evaluates the strength accessor for each node, and returns this force. * @@ -956,12 +1006,12 @@ export interface ForceY extends Force) => number): this; + strength(strength: (d: NodeDatum, i: number, data: NodeDatum[]) => number): this; /** * Return the current y-accessor, which defaults to a function returning 0 for all nodes. */ - y(): (d: NodeDatum, i: number, data: Array) => number; + y(): (d: NodeDatum, i: number, data: NodeDatum[]) => number; /** * Set the y-coordinate accessor to the specified number, re-evaluates the y-accessor for each node, * and returns this force. @@ -986,7 +1036,7 @@ export interface ForceY extends Force) => number): this; + y(y: (d: NodeDatum, i: number, data: NodeDatum[]) => number): this; } /** @@ -1024,4 +1074,4 @@ export function forceY(y: number): ForceY * @param y A y-coordinate accessor function which is invoked for each node in the simulation, being passed the node and its zero-based index. * The function returns the y-coordinate. */ -export function forceY(y: (d: NodeDatum, i: number, data: Array) => number): ForceY; +export function forceY(y: (d: NodeDatum, i: number, data: NodeDatum[]) => number): ForceY; diff --git a/d3-force/tsconfig.json b/d3-force/tsconfig.json index 6f080970eb..8bb643a3e1 100644 --- a/d3-force/tsconfig.json +++ b/d3-force/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-force-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-force-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-force/tslint.json b/d3-force/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-force/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3-format/d3-format-tests.ts b/d3-format/d3-format-tests.ts index 67a32d6cc5..3fd5742997 100644 --- a/d3-format/d3-format-tests.ts +++ b/d3-format/d3-format-tests.ts @@ -64,7 +64,7 @@ num = d3Format.precisionRound(0.0005, 3000); // ---------------------------------------------------------------------- let decimal: '.' | ',' = localeDef.decimal; -let thousands: '.' | ',' | '\u00a0' = localeDef.thousands; +let thousands: '.' | ',' | '\u00a0' | "'" = localeDef.thousands; let grouping: Array = localeDef.grouping; let currency: [string, string] = localeDef.currency; diff --git a/d3-format/index.d.ts b/d3-format/index.d.ts index e2e14a6724..92197f6ab8 100644 --- a/d3-format/index.d.ts +++ b/d3-format/index.d.ts @@ -15,7 +15,7 @@ export interface FormatLocaleDefinition { * The group separator (e.g., ","). Note that the thousands property is a misnomer, as\ * the grouping definition allows groups other than thousands. */ - thousands: '.' | ',' | '\u00a0'; + thousands: '.' | ',' | '\u00a0' | "'"; /** * The array of group sizes (e.g., [3]), cycled as needed. */ diff --git a/d3-format/tsconfig.json b/d3-format/tsconfig.json index c3a8fe9353..44cf02f1d0 100644 --- a/d3-format/tsconfig.json +++ b/d3-format/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/d3-geo/d3-geo-tests.ts b/d3-geo/d3-geo-tests.ts index 2e9f3e8719..3d28bb610f 100644 --- a/d3-geo/d3-geo-tests.ts +++ b/d3-geo/d3-geo-tests.ts @@ -293,6 +293,12 @@ let multiString: GeoJSON.MultiLineString = graticuleGenerator(); let lines: GeoJSON.LineString[] = graticuleGenerator.lines(); let polygon2: GeoJSON.Polygon = graticuleGenerator.outline(); +// geoGraticule10() ===================================================== + +// test convenience function: + +multiString = d3Geo.geoGraticule10(); + // ---------------------------------------------------------------------- // Raw Projections // ---------------------------------------------------------------------- @@ -360,7 +366,7 @@ let clipAngle: number = constructedProjection.clipAngle(); constructedProjection = constructedProjection.clipAngle(null); constructedProjection = constructedProjection.clipAngle(45); -let clipExtent: [[number, number], [number, number]] = constructedProjection.clipExtent(); +let clipExtent: [[number, number], [number, number]] | null = constructedProjection.clipExtent(); constructedProjection = constructedProjection.clipExtent(null); constructedProjection = constructedProjection.clipExtent([[0, 0], [1, 1]]); @@ -416,14 +422,27 @@ conicConformal = conicConformal.fitSize([960, 500], samplePolygon); // inherited // GeoPath Generator // ---------------------------------------------------------------------- +let minimalRenderingContextMockUp: d3Geo.GeoContext = { + beginPath: () => { return; }, + moveTo: (x: number, y: number) => { return; }, + lineTo: (x: number, y: number) => { return; }, + arc: (x, y, radius, startAngle, endAngle) => { return; }, + closePath: () => { return; } +}; + // Create geoPath Generator ============================================= let geoPathCanvas: d3Geo.GeoPath; geoPathCanvas = d3Geo.geoPath(); +geoPathCanvas = d3Geo.geoPath(null); +geoPathCanvas = d3Geo.geoPath(null, null); +geoPathCanvas = d3Geo.geoPath(d3Geo.geoAzimuthalEqualArea()); +geoPathCanvas = d3Geo.geoPath(d3Geo.geoAzimuthalEqualArea(), minimalRenderingContextMockUp); let geoPathSVG: d3Geo.GeoPath>; geoPathSVG = d3Geo.geoPath>(); - +geoPathSVG = d3Geo.geoPath>(d3Geo.geoAzimuthalEqualArea()); +geoPathSVG = d3Geo.geoPath>(d3Geo.geoAzimuthalEqualArea(), null); // Configure geoPath Generator ========================================== // projection(...) ------------------------------------------------------ @@ -440,14 +459,8 @@ let geoPathConicProjection: d3Geo.GeoConicProjection = geoPathSVG.projection { return; }, - moveTo: (x: number, y: number) => { return; }, - lineTo: (x: number, y: number) => { return; }, - arc: (x, y, radius, startAngle, endAngle) => { return; }, - closePath: () => { return; } -}); +// minimal context interface (mockup) +geoPathCanvas = geoPathCanvas.context(minimalRenderingContextMockUp); let geoPathContext: d3Geo.GeoContext = geoPathCanvas.context(); @@ -461,13 +474,13 @@ let canvasContext: CanvasRenderingContext2D; geoPathCanvas = geoPathCanvas.context(canvasContext); canvasContext = geoPathCanvas.context(); -// canvasContext = geoPathSimple.context(); // fails without casting to CanvasRenderingContext2D -// canvasContext = geoPathSimple.context(); // fails as SampleProperties does not extend GeoCanvas +// canvasContext = geoPathCanvas.context(); // fails without casting to CanvasRenderingContext2D +// canvasContext = geoPathCanvas.context(); // fails as SampleProperties does not extend GeoCanvas // pointRadius(...) ------------------------------------------------------ geoPathCanvas = geoPathCanvas.pointRadius(5); -let geoPathCanvasPointRadiusAccessor: (this: any, d: d3Geo.GeoPermissibleObjects, ...args: any[]) => number = geoPathCanvas.pointRadius(); +let geoPathCanvasPointRadiusAccessor: ((this: any, d: d3Geo.GeoPermissibleObjects, ...args: any[]) => number) | number = geoPathCanvas.pointRadius(); geoPathSVG = geoPathSVG.pointRadius(function (datum) { let that: SVGPathElement = this; @@ -475,9 +488,9 @@ geoPathSVG = geoPathSVG.pointRadius(function (datum) { return datum.properties.name === 'Alabama' ? 10 : 15; }); -let geoPathSVGPointRadiusAccessor: (this: SVGPathElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number = geoPathSVG.pointRadius(); -// let geoPathSVGPointRadiusAccessorWrong1: (this: SVGCircleElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number = geoPathSVG.pointRadius(); // fails, mismatch in this context -// let geoPathSVGPointRadiusAccessorWrong2: (this: SVGPathElement, d: d3Geo.GeoGeometryObjects, ...args: any[]) => number = geoPathSVG.pointRadius(); // fails, mismatch in object datum type +let geoPathSVGPointRadiusAccessor: number | ((this: SVGPathElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number) = geoPathSVG.pointRadius(); +// let geoPathSVGPointRadiusAccessorWrong1: number | ((this: SVGCircleElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number) = geoPathSVG.pointRadius(); // fails, mismatch in this context +// let geoPathSVGPointRadiusAccessorWrong2: number | ((this: SVGPathElement, d: d3Geo.GeoGeometryObjects, ...args: any[]) => number) = geoPathSVG.pointRadius(); // fails, mismatch in object datum type // Use geoPath Generator ================================================ @@ -549,33 +562,8 @@ let svgCircleWrong: Selection; // svgPathWrong.attr('d', geoPathSVG); // fails, mismatch in datum type -// ---------------------------------------------------------------------- -// geoClipExtent -// ---------------------------------------------------------------------- -let geoClipExtent: d3Geo.GeoExtent = d3Geo.geoClipExtent(); -// extent(...) ---------------------------------------------------------- - -let extent2: [[number, number], [number, number]] = geoClipExtent.extent(); -geoClipExtent = geoClipExtent.extent([[0, 0], [960, 500]]); - -// stream(...) ---------------------------------------------------------- - -let stream: d3Geo.GeoStream; -stream = geoClipExtent.stream(stream); - -// ---------------------------------------------------------------------- -// Stream interface -// ---------------------------------------------------------------------- - -stream.point(0, 0); -stream.point(0, 0, 0); -stream.lineStart(); -stream.lineEnd(); -stream.polygonStart(); -stream.polygonEnd(); -stream.sphere(); // ---------------------------------------------------------------------- // Context interface @@ -611,6 +599,66 @@ customTransformProto = { let t: { stream: (s: d3Geo.GeoStream) => (CustomTranformProto & d3Geo.GeoStream) } = d3Geo.geoTransform(customTransformProto); + +// geoIdentity() ======================================================== + +let identityTransform: d3Geo.GeoIdentityTranform; + +identityTransform = d3Geo.geoIdentity(); + +scale = identityTransform.scale(); +identityTransform = identityTransform.scale(2); + +translate = identityTransform.translate(); +identityTransform = identityTransform.translate([10, 10]); + +clipExtent = identityTransform.clipExtent(); +identityTransform = identityTransform.clipExtent(null); +identityTransform = identityTransform.clipExtent([[0, 0], [100, 100]]); + +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], samplePolygon); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleSphere); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleGeometryCollection); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedGeometryCollection); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleFeature); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedFeature1); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedFeature2); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleFeatureCollection); +identityTransform = identityTransform.fitExtent([[0, 0], [960, 500]], sampleExtendedFeatureCollection); + +identityTransform = identityTransform.fitSize([960, 500], samplePolygon); +identityTransform = identityTransform.fitSize([960, 500], sampleSphere); +identityTransform = identityTransform.fitSize([960, 500], sampleGeometryCollection); +identityTransform = identityTransform.fitSize([960, 500], sampleExtendedGeometryCollection); +identityTransform = identityTransform.fitSize([960, 500], sampleFeature); +identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeature1); +identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeature2); +identityTransform = identityTransform.fitSize([960, 500], sampleFeatureCollection); +identityTransform = identityTransform.fitSize([960, 500], sampleExtendedFeatureCollection); + +let reflecting: boolean; + +identityTransform = identityTransform.reflectX(true); +// identityTransform = identityTransform.reflectX(5); // fails, wrong argument data type +reflecting = identityTransform.reflectX(); + +identityTransform = identityTransform.reflectY(true); +// identityTransform = identityTransform.reflectY(5); // fails, wrong argument data type +reflecting = identityTransform.reflectY(); + +// ---------------------------------------------------------------------- +// Stream interface +// ---------------------------------------------------------------------- +let stream: d3Geo.GeoStream; + +stream.point(0, 0); +stream.point(0, 0, 0); +stream.lineStart(); +stream.lineEnd(); +stream.polygonStart(); +stream.polygonEnd(); +stream.sphere(); + // geoStream(...) ======================================================== d3Geo.geoStream(samplePolygon, stream); diff --git a/d3-geo/index.d.ts b/d3-geo/index.d.ts index 94e48bd810..9ab3ae74cd 100644 --- a/d3-geo/index.d.ts +++ b/d3-geo/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3-geo module v1.2.4 +// Type definitions for D3JS d3-geo module v1.4.0 // Project: https://github.com/d3/d3-geo/ // Definitions by: Hugues Stefanski , Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,6 +14,9 @@ * beyond the GeoJSON geometries. */ export interface GeoSphere { + /** + * Sphere geometry type + */ type: 'Sphere'; } @@ -62,43 +65,165 @@ export type GeoPermissibleObjects = GeoGeometryObjects | ExtendedGeometryCollect // Spherical Math // ---------------------------------------------------------------------- -/**Returns the spherical area of the specified GeoJSON feature in steradians. */ +/** + * Returns the spherical area of the specified feature in steradians. + * (See also path.area, which computes the projected planar area.) + * + * @param feature A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ export function geoArea(feature: ExtendedFeature): number; +/** + * Returns the spherical area of the specified feature collection in steradians. + * (See also path.area, which computes the projected planar area.) + * + * @param feature A geographic feature collection supported by d3-geo (An extension of GeoJSON feature). + */ export function geoArea(feature: ExtendedFeatureCollection>): number; +/** + * Returns the spherical area of the specified GeoJson Geometry Object or GeoSphere object in steradians. + * (See also path.area, which computes the projected planar area.) + * + * @param feature A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ export function geoArea(feature: GeoGeometryObjects): number; +/** + * Returns the spherical area of the specified geographic geometry collection in steradians. + * (See also path.area, which computes the projected planar area.) + * + * @param feature A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ export function geoArea(feature: ExtendedGeometryCollection): number; -/**Returns the spherical bounding box for the specified GeoJSON feature. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. */ +/** + * Returns the spherical bounding box for the specified feature. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], + * where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. + * (Note that in projected planar coordinates, the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) + * + * @param feature A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ export function geoBounds(feature: ExtendedFeature): [[number, number], [number, number]]; +/** + * Returns the spherical bounding box for the specified feature collection. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], + * where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. + * (Note that in projected planar coordinates, the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) + * + * @param feature A geographic feature collection supported by d3-geo (An extension of GeoJSON feature). + */ export function geoBounds(feature: ExtendedFeatureCollection>): [[number, number], [number, number]]; +/** + * Returns the spherical bounding box for the specified GeoJson Geometry Object or GeoSphere object. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], + * where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. + * (Note that in projected planar coordinates, the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) + * + * @param feature A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ export function geoBounds(feature: GeoGeometryObjects): [[number, number], [number, number]]; +/** + * Returns the spherical bounding box for the specified geometry collection. The bounding box is represented by a two-dimensional array: [[left, bottom], [right, top]], + * where left is the minimum longitude, bottom is the minimum latitude, right is maximum longitude, and top is the maximum latitude. All coordinates are given in degrees. + * (Note that in projected planar coordinates, the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) + * + * @param feature A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ export function geoBounds(feature: ExtendedGeometryCollection): [[number, number], [number, number]]; -/**Returns the spherical centroid of the specified GeoJSON feature. See also path.centroid, which computes the projected planar centroid.*/ +/** + * Returns the spherical centroid of the specified feature in steradians. + * (See also path.centroid, which computes the projected planar centroid.) + * + * @param feature A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ export function geoCentroid(feature: ExtendedFeature): [number, number]; +/** + * Returns the spherical centroid of the specified feature collection in steradians. + * (See also path.centroid, which computes the projected planar centroid.) + * + * @param feature A geographic feature collection supported by d3-geo (An extension of GeoJSON feature). + */ export function geoCentroid(feature: ExtendedFeatureCollection>): [number, number]; +/** + * Returns the spherical centroid of the specified GeoJson Geometry Object or GeoSphere object in steradians. + * (See also path.centroid, which computes the projected planar centroid.) + * + * @param feature A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ export function geoCentroid(feature: GeoGeometryObjects): [number, number]; +/** + * Returns the spherical centroid of the specified geographic geometry collection in steradians. + * (See also path.centroid, which computes the projected planar centroid.) + * + * @param feature A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ export function geoCentroid(feature: ExtendedGeometryCollection): [number, number]; -/**Returns the great-arc distance in radians between the two points a and b. Each point must be specified as a two-element array [longitude, latitude] in degrees. */ +/** + * Returns the great-arc distance in radians between the two points a and b. + * Each point must be specified as a two-element array [longitude, latitude] in degrees. + * + * @param a Point specified as a two-element array [longitude, latitude] in degrees. + * @param b Point specified as a two-element array [longitude, latitude] in degrees. + */ export function geoDistance(a: [number, number], b: [number, number]): number; -/**Returns the great-arc length of the specified GeoJSON feature in radians.*/ +/** + * Returns the great-arc length of the specified feature in radians. + * + * @param feature A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ export function geoLength(feature: ExtendedFeature): number; +/** + * Returns the great-arc length of the specified feature collection in radians. + * + * @param feature A geographic feature collection supported by d3-geo (An extension of GeoJSON feature). + */ export function geoLength(feature: ExtendedFeatureCollection>): number; +/** + * Returns the great-arc length of the specified GeoJson Geometry Object or GeoSphere object in radians. + * +* @param feature A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ export function geoLength(feature: GeoGeometryObjects): number; +/** + * Returns the great-arc length of the specified geographic geometry collection in radians. + * + * @param feature A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ export function geoLength(feature: ExtendedGeometryCollection): number; -/**Returns an interpolator function given two points a and b. Each point must be specified as a two-element array [longitude, latitude] in degrees. */ +/** + * Returns an interpolator function given two points a and b. + * Each point must be specified as a two-element array [longitude, latitude] in degrees. + * + * @param a Point specified as a two-element array [longitude, latitude] in degrees. + * @param b Point specified as a two-element array [longitude, latitude] in degrees. + */ export function geoInterpolate(a: [number, number], b: [number, number]): (t: number) => [number, number]; - +/** + * A Geo Rotation + */ export interface GeoRotation { + /** + * Returns a new array [longitude, latitude] in degrees representing the rotated point of the given point. + * + * @param point The point must be specified as a two-element array [longitude, latitude] in degrees. + */ (point: [number, number]): [number, number]; + + /** + * Returns a new array [longitude, latitude] in degrees representing the point of the given rotated point; the inverse of rotation. + * + * @param point The rotated point must be specified as a two-element array [longitude, latitude] in degrees. + */ invert(point: [number, number]): [number, number]; } -/**Returns a rotation function for the given angles, which must be a two- or three-element array of numbers [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. */ +/** + * Returns a rotation function for the given angles. + * + * @param angles A two- or three-element array of numbers [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. + * (These correspond to yaw, pitch and roll.) If the rotation angle gamma is omitted, it defaults to 0. + */ export function geoRotation(angles: [number, number] | [number, number, number]): GeoRotation; @@ -108,251 +233,1240 @@ export function geoRotation(angles: [number, number] | [number, number, number]) // geoCircle ============================================================ +/** + * A new circle generator + * + * The first generic corresponds to the "this"-context within which the geo circle generator will be invoked. + * + * The second generic corresponds to the type of the Datum which will be passed into the geo circle generator. + */ export interface GeoCircleGenerator { - /**Returns a new GeoJSON geometry object of type “Polygon” approximating a circle on the surface of a sphere, with the current center, radius and precision. */ + /** + * Returns a new GeoJSON geometry object of type “Polygon” approximating a circle on the surface of a sphere, + * with the current center, radius and precision. Any arguments are passed to the accessors. + */ (this: This, d?: Datum, ...args: any[]): GeoJSON.Polygon; + + /** + * Returns the current center accessor, which defaults to a function returning [0, 0]. + */ center(): ((this: This, d: Datum, ...args: any[]) => [number, number]); + /** + * Sets the circle center to the specified point [longitude, latitude] in degrees, and returns this circle generator. + * + * @param center Center point specified as [longitude, latitude] in degrees. + */ center(center: [number, number]): this; + /** + * Sets the circle center to the specified center point accessor function, and returns this circle generator. + * + * @param center An accessor function which will be invoked whenever a circle is generated, being passed any arguments passed to the circle generator. + * It returns the center point specified as [longitude, latitude] in degrees. + */ center(center: ((this: This, d: Datum, ...args: any[]) => [number, number])): this; + /** + * Returns the current radius accessor, which defaults to a function returning 90. + */ radius(): ((this: This, d: Datum, ...args: any[]) => number); + /** + * Sets the circle radius to the specified angle in degrees, and returns this circle generator. + * + * @param radius Circle radius as the specified angle in degrees. + */ radius(radius: number): this; + /** + * Sets the circle radius to the specified radius accessor function, and returns this circle generator. + * + * @param radius An accessor function which will be invoked whenever a circle is generated, being passed any arguments passed to the circle generator. + * It returns the radius as the specified angle in degrees. + */ radius(radius: ((this: This, d: Datum, ...args: any[]) => number)): this; + /** + * Returns the current precision accessor, which defaults to a function returning 6. + */ precision(): ((this: This, d: Datum, ...args: any[]) => number); + /** + * Sets the circle precision to the specified angle in degrees, and returns this circle generator. + * + * Small circles do not follow great arcs and thus the generated polygon is only an approximation. + * Specifying a smaller precision angle improves the accuracy of the approximate polygon, but also increase the cost to generate and render it. + * + * @param precision Precision as specified angle in degrees. + */ precision(precision: number): this; + /** + * Sets the circle precision to the precision accessor function, and returns this circle generator. + * + * Small circles do not follow great arcs and thus the generated polygon is only an approximation. + * Specifying a smaller precision angle improves the accuracy of the approximate polygon, but also increase the cost to generate and render it. + * + * @param precision An accessor function which will be invoked whenever a circle is generated, being passed any arguments passed to the circle generator. + * It returns the precision as the specified angle in degrees. + */ precision(precision: (this: This, d: Datum, ...args: any[]) => number): this; } +/** + * Returns a new geo circle generator + */ export function geoCircle(): GeoCircleGenerator; +/** + * Returns a new geo circle generator + * + * The generic corresponds to the data type of the first argument passed into the geo circle generator and its accessor functions. + */ export function geoCircle(): GeoCircleGenerator; +/** + * Returns a new geo circle generator + * + * The first generic corresponds to the "this" context within which the geo circle generator and its accessors will be invoked. + * + * The second generic corresponds to the data type of the first argument passed into the geo circle generator and its accessor functions. + */ export function geoCircle(): GeoCircleGenerator; // geoGraticule ============================================================ +/** + * A Feature generator for graticules: a uniform grid of meridians and parallels for showing projection distortion. + * The default graticule has meridians and parallels every 10° between ±80° latitude; for the polar regions, there are meridians every 90°. + */ export interface GeoGraticuleGenerator { - /**Returns a GeoJSON MultiLineString geometry object representing all meridians and parallels for this graticule. */ + /** + * Returns a GeoJSON MultiLineString geometry object representing all meridians and parallels for this graticule. + */ (): GeoJSON.MultiLineString; + /** + * Returns an array of GeoJSON LineString geometry objects, one for each meridian or parallel for this graticule. + */ lines(): GeoJSON.LineString[]; + + /** + * Returns a GeoJSON Polygon geometry object representing the outline of this graticule, i.e. along the meridians and parallels defining its extent. + */ outline(): GeoJSON.Polygon; + + /** + * Returns the current minor extent, which defaults to ⟨⟨-180°, -80° - ε⟩, ⟨180°, 80° + ε⟩⟩. + */ extent(): [[number, number], [number, number]]; + /** + * Sets the major and minor extents of this graticule. + * + * @param extent Extent to use for major and minor extent of graticule. + */ extent(extent: [[number, number], [number, number]]): this; + + /** + * Returns the current major extent, which defaults to ⟨⟨-180°, -90° + ε⟩, ⟨180°, 90° - ε⟩⟩. + */ extentMajor(): [[number, number], [number, number]]; + /** + * Sets the major extent of this graticule. + * + * @param extent Major extent of graticule. + */ extentMajor(extent: [[number, number], [number, number]]): this; + + /** + * Returns the current minor extent, which defaults to ⟨⟨-180°, -80° - ε⟩, ⟨180°, 80° + ε⟩⟩. + */ extentMinor(): [[number, number], [number, number]]; + /** + * Sets the minor extent of this graticule. + * + * @param extent Minor extent of graticule. + */ extentMinor(extent: [[number, number], [number, number]]): this; + + /** + * Returns the current minor step, which defaults to ⟨10°, 10°⟩. + */ step(): [number, number]; + /** + * Sets the major and minor step for this graticule + * + * @param step Major and minor step to use for this graticule. + */ step(step: [number, number]): this; + + /** + * Returns the current major step, which defaults to ⟨90°, 360°⟩. + */ stepMajor(): [number, number]; + /** + * Sets the major step for this graticule. + * + * @param step Major step. + */ stepMajor(step: [number, number]): this; + + /** + * Returns the current major step, which defaults to ⟨10°, 10°⟩. + */ stepMinor(): [number, number]; + /** + * Sets the minor step for this graticule. + * + * @param step Minor step. + */ stepMinor(step: [number, number]): this; + + /** + * Returns the current precision, which defaults to 2.5°. + */ precision(): number; + /** + * Sets the precision for this graticule, in degrees. + * + * @param angle Precision in degrees. + */ precision(angle: number): this; } +/** + * Constructs a feature generator for creating graticules: a uniform grid of meridians and parallels for showing projection distortion. + * The default graticule has meridians and parallels every 10° between ±80° latitude; for the polar regions, there are meridians every 90°. + */ export function geoGraticule(): GeoGraticuleGenerator; +/** + * A convenience method for directly generating the default 10° global graticule as a GeoJSON MultiLineString geometry object. + */ +export function geoGraticule10(): GeoJSON.MultiLineString; + // ---------------------------------------------------------------------- // Projections // ---------------------------------------------------------------------- +/** + * A D3 geo stream. D3 transforms geometry using a sequence of function calls, rather than materializing intermediate representations, to minimize overhead. + * Streams must implement several methods to receive input geometry. Streams are inherently stateful; the meaning of a point depends on whether the point is inside of a line, + * and likewise a line is distinguished from a ring by a polygon. Despite the name “stream”, these method calls are currently synchronous. + */ export interface GeoStream { + /** + * Indicates the end of a line or ring. Within a polygon, indicates the end of a ring. + * Unlike GeoJSON, the redundant closing coordinate of a ring is not indicated via point, and instead is implied via lineEnd within a polygon. + */ lineEnd(): void; + + /** + * Indicates the start of a line or ring. Within a polygon, indicates the start of a ring. The first ring of a polygon is the exterior ring, and is typically clockwise. + * Any subsequent rings indicate holes in the polygon, and are typically counterclockwise. + */ lineStart(): void; + + /** + * Indicates a point with the specified coordinates x and y (and optionally z). The coordinate system is unspecified and implementation-dependent; + * for example, projection streams require spherical coordinates in degrees as input. Outside the context of a polygon or line, + * a point indicates a point geometry object (Point or MultiPoint). Within a line or polygon ring, the point indicates a control point. + * + * @param x x-coordinate of point. + * @param y y-coordinate of point. + * @param z Optional z-coordinate of point. + */ point(x: number, y: number, z?: number): void; + + /** + * Indicates the end of a polygon. + */ polygonEnd(): void; + + /** + * Indicates the start of a polygon. The first line of a polygon indicates the exterior ring, and any subsequent lines indicate interior holes. + */ polygonStart(): void; + + /** + * Indicates the sphere (the globe; the unit sphere centered at ⟨0,0,0⟩). + */ sphere?(): void; } -export interface GeoStreamWrapper { - stream(stream: GeoStream): GeoStream; -} +// geoStream(...) ======================================================= + +/** + * Streams the specified GeoJSON object to the specified projection stream. While both features and geometry objects are supported as input, + * the stream interface only describes the geometry, and thus additional feature properties are not visible to streams. + * + * @param object + * @param stream A projection stream. + */ +export function geoStream(object: ExtendedFeature, stream: GeoStream): void; + +/** + * Streams the specified GeoJSON object to the specified projection stream. While both features and geometry objects are supported as input, + * the stream interface only describes the geometry, and thus additional feature properties are not visible to streams. + * + * @param object + * @param stream A projection stream. + */ +export function geoStream(object: ExtendedFeatureCollection>, stream: GeoStream): void; + +/** + * Streams the specified GeoJSON object to the specified projection stream. While both features and geometry objects are supported as input, + * the stream interface only describes the geometry, and thus additional feature properties are not visible to streams. + * + * @param object + * @param stream A projection stream. + */ +export function geoStream(object: GeoGeometryObjects, stream: GeoStream): void; + +/** + * Streams the specified GeoJSON object to the specified projection stream. While both features and geometry objects are supported as input, + * the stream interface only describes the geometry, and thus additional feature properties are not visible to streams. + * + * @param object + * @param stream A projection stream. + */ +export function geoStream(object: ExtendedGeometryCollection, stream: GeoStream): void; + + + +// ---------------------------------------------------------------------- +// Projections +// ---------------------------------------------------------------------- + + + + +/** + * Raw projections are point transformation functions that are used to implement custom projections; they typically passed to d3.geoProjection or d3.geoProjectionMutator. + * They are exposed here to facilitate the derivation of related projections. + * Raw projections take spherical coordinates [lambda, phi] in radians (not degrees!) and return a point [x, y], typically in the unit square centered around the origin. + */ export interface GeoRawProjection { - (longitude: number, latitude: number): [number, number]; + /** + * Projects the specified point [lambda, phi] in radians, returning a new point [x, y] in unitless coordinates. + * @param lambda Spherical lambda coordinate in radians. + * @param phi Spherical phi coordinate in radians. + */ + (lambda: number, phi: number): [number, number]; + + /** + * Inverts the projected point [x, y] in unitless coordinates, returning an unprojected point in spherical coordinates [lambda, phi] in radians. + * @param x x-coordinate (unitless). + * @param y y-coordinate (unitless). + */ invert?(x: number, y: number): [number, number]; } +/** + * An object implementing a stream method + */ +export interface GeoStreamWrapper { + /** + * Returns a projection stream for the specified output stream. Any input geometry is projected before being streamed to the output stream. + * A typical projection involves several geometry transformations: the input geometry is first converted to radians, rotated on three axes, + * clipped to the small circle or cut along the antimeridian, and lastly projected to the plane with adaptive resampling, scale and translation. + * + * @param stream An input stream + */ + stream(stream: GeoStream): GeoStream; +} +/** + * A Geographic Projection to transform spherical polygonal geometry to planar polygonal geometry. + * D3 provides implementations of several classes of standard projections: + * + * - Azimuthal + * - Composite + * - Conic + * - Cylindrical + * + * For many more projections, see d3-geo-projection. You can implement custom projections using d3.geoProjection or d3.geoProjectionMutator. + */ export interface GeoProjection extends GeoStreamWrapper { - /**Returns a new array x, y representing the projected point of the given point. The point must be specified as a two-element array [longitude, latitude] in degrees. */ + /** + * Returns a new array [x, y] (typically in pixels) representing the projected point of the given point. + * The point must be specified as a two-element array [longitude, latitude] in degrees. + * May return null if the specified point has no defined projected position, such as when the point is outside the clipping bounds of the projection. + * + * @param point A point specified as a two-dimensional array [longitude, latitude] in degrees. + */ (point: [number, number]): [number, number] | null; + /** + * Returns the current center of the projection, which defaults to ⟨0°,0°⟩. + */ center(): [number, number]; + /** + * Sets the projection’s center to the specified center, + * a two-element array of longitude and latitude in degrees and returns the projection. + * The default is ⟨0°,0°⟩. + * + * @param point A point specified as a two-dimensional array [longitude, latitude] in degrees. + */ center(point: [number, number]): this; + /** + * Returns the current clip angle which defaults to null. + * + * null switches to antimeridian cutting rather than small-circle clipping. + */ clipAngle(): number | null; + /** + * Switches to antimeridian cutting rather than small-circle clipping. + * + * @param angle Set to null to switch to antimeridian cutting. + */ clipAngle(angle: null): this; + /** + * Sets the projection’s clipping circle radius to the specified angle in degrees and returns the projection. + * Small-circle clipping is independent of viewport clipping via projection.clipExtent. + * + * @param angle Angle in degrees. + */ clipAngle(angle: number): this; + /** + * Returns the current viewport clip extent which defaults to null. + */ clipExtent(): [[number, number], [number, number]] | null; + /** + * Sets the clip extent to null and returns the projection. + * With a clip extent of null, no viewport clipping is performed. + * + * Viewport clipping is independent of small-circle clipping via projection.clipAngle. + * + * @param extent Set to null to disable viewport clipping. + */ clipExtent(extent: null): this; + /** + * Sets the projection’s viewport clip extent to the specified bounds in pixels and returns the projection. + * The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom. + * + * Viewport clipping is independent of small-circle clipping via projection.clipAngle. + * + * @param extent The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom. + */ clipExtent(extent: [[number, number], [number, number]]): this; - /**Sets the projection’s scale and translate to fit the specified GeoJSON object in the center of the given extent. */ + /** + * Sets the projection’s scale and translate to fit the specified geographic feature in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). + */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection>): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this; - /**A convenience method for projection.fitExtent where the top-left corner of the extent is [0,0]. */ + /** + * Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ fitSize(size: [number, number], object: ExtendedFeature): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). + */ fitSize(size: [number, number], object: ExtendedFeatureCollection>): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ fitSize(size: [number, number], object: GeoGeometryObjects): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ fitSize(size: [number, number], object: ExtendedGeometryCollection): this; - /**Returns a new array [longitude, latitude] in degrees representing the unprojected point of the given projected point. */ + /** + * Returns a new array [longitude, latitude] in degrees representing the unprojected point of the given projected point. + * May return null if the specified point has no defined projected position, such as when the point is outside the clipping bounds of the projection. + * + * @param point The projected point, specified as a two-element array [x, y] (typically in pixels). + */ invert?(point: [number, number]): [number, number] | null; + /** + * Returns the projection’s current resampling precision which defaults to square root of 0.5. + * This value corresponds to the Douglas–Peucker distance. + */ precision(): number; + /** + * Sets the threshold for the projection’s adaptive resampling to the specified value in pixels and returns the projection. + * This value corresponds to the Douglas–Peucker distance. + * + * @param precision A numeric value in pixels to use as the threshold for the projection’s adaptive resampling. + */ precision(precision: number): this; + /** + * Returns the current rotation [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. + * (These correspond to yaw, pitch and roll.) which defaults [0, 0, 0]. + */ rotate(): [number, number, number]; + /** + * Sets the projection’s three-axis rotation to the specified angles, which must be a two- or three-element array of numbers. + * + * @param angles A two- or three-element array of numbers [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis. + * (These correspond to yaw, pitch and roll.) If the rotation angle gamma is omitted, it defaults to 0. + */ rotate(angles: [number, number] | [number, number, number]): this; + /** + * Returns the current scale factor; the default scale is projection-specific. + * + * The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections. + */ scale(): number; + /** + * Sets the projection’s scale factor to the specified value and returns the projection. + * The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections. + * + * @param scale Scale factor to be used for the projection; the default scale is projection-specific. + */ scale(scale: number): this; + /** + * Returns the current translation offset which defaults to [480, 250] and places ⟨0°,0°⟩ at the center of a 960×500 area. + * The translation offset determines the pixel coordinates of the projection’s center. + */ translate(): [number, number]; + /** + * Sets the projection’s translation offset to the specified two-element array [tx, ty] and returns the projection. + * The translation offset determines the pixel coordinates of the projection’s center. The default translation offset places ⟨0°,0°⟩ at the center of a 960×500 area. + * + * @param point A two-element array [tx, ty] specifying the translation offset. The default translation offset of defaults to [480, 250] places ⟨0°,0°⟩ at the center of a 960×500 area. + */ translate(point: [number, number]): this; } +/** + * A Conic Projection + */ export interface GeoConicProjection extends GeoProjection { - parallels(value: [number, number]): this; + + /** + * Return the standard parallels for the conic projection in degrees. + */ parallels(): [number, number]; + /** + * Set the standard parallels for the conic projection in degrees and return the projection. + * + * @param value A two-dimensional array representing the standard parallels in degrees. + */ + parallels(value: [number, number]): this; + } // geoPath ============================================================== +/** + * A minimal rendering context for a GeoPath generator. The minimum implemented + * methods are a subset of the CanvasRenderingContext2D API. + * + * For reference to the CanvasRenderingContext2D see https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D + */ export interface GeoContext { + + /** + * Adds an arc to the path with center point (x, y) and radius r starting at startAngle and ending at endAngle. + * The arc is drawn in clockwise directio by default. + * + * @param x x-coordinate of arc center point. + * @param y y-coordinate of arc center point. + * @param radius Radius of arc. + * @param startAngle The starting angle of the arc, measured clockwise from the positive x axis and expressed in radians. + * @param endAngle The end angle of the arc, measured clockwise from the positive x axis and expressed in radians. + * @param anticlockwise Optional boolean flag, if true the arc is drawn counter-clockwise between the two angles. + */ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + + /** + * Start a new path by emptying the list of sub-paths. + */ beginPath(): void; + + /** + * Causes the point of the pen to move back to the start of the current sub-path. + * It tries to draw a straight line from the current point to the start. + * If the shape has already been closed or has only one point, this function does nothing. + */ closePath(): void; + + /** + * Connects the last point in the sub-path to the x, y coordinates with a straight line (but does not actually draw it). + * + * @param x The x-coordinate for the end of the line. + * @param y The y-coordinate for the end of the line. + */ lineTo(x: number, y: number): void; + + /** + * Move the starting point of a new sub-path to the (x, y) coordinates. + * + * @param x The x-coordinate for the new starting point. + * @param y The y-coordinate for the new starting point. + */ moveTo(x: number, y: number): void; } +/** + * A Geo Path generator + * + * The first generic corresponds to the "this"-context within which the geo path generator will be invoked. This could be e.g. the DOMElement bound to "this" when using selection.attr("d", ...) with the path generator. + * + * The second generic corresponds to the type of the DatumObject which will be passed into the geo path generator for rendering. + */ export interface GeoPath { - (this: This, object: DatumObject, ...args: any[]): string; + /** + * Renders the given object, which may be any GeoJSON feature or geometry object: + * + * + Point - a single position. + * + MultiPoint - an array of positions. + * + LineString - an array of positions forming a continuous line. + * + MultiLineString - an array of arrays of positions forming several lines. + * + Polygon - an array of arrays of positions forming a polygon (possibly with holes). + * + MultiPolygon - a multidimensional array of positions forming multiple polygons. + * + GeometryCollection - an array of geometry objects. + * + Feature - a feature containing one of the above geometry objects. + * + FeatureCollection - an array of feature objects. + * + * The type Sphere is also supported, which is useful for rendering the outline of the globe; a sphere has no coordinates. + * + * + * Any additional arguments are passed along to the pointRadius accessor. + * + * If the rendering context is null, the function returns an SVG Path string, otherwise the function renders to the current context. + * + * Separate path elements are typically slower than a single path element. However, distinct path elements are useful for styling and interation (e.g., click or mouseover). + * Canvas rendering (see path.context) is typically faster than SVG, but requires more effort to implement styling and interaction. + * + * The first generic type of the GeoPath generator used, must correspond to the "this" context bound to the function upon invocation. + * + * @param object An object to be rendered. + */ + (this: This, object: DatumObject, ...args: any[]): string | undefined; + /** + * Returns the projected planar area (typically in square pixels) for the specified GeoJSON object. + * Point, MultiPoint, LineString and MultiLineString features have zero area. For Polygon and MultiPolygon features, + * this method first computes the area of the exterior ring, and then subtracts the area of any interior holes. + * This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent. + * + * @param An object for which the area is to be calculated. + */ area(object: DatumObject): number; + + /** + * Returns the projected planar bounding box (typically in pixels) for the specified GeoJSON object. + * The bounding box is represented by a two-dimensional array: [[x₀, y₀], [x₁, y₁]], where x₀ is the minimum x-coordinate, y₀ is the minimum y-coordinate, + * x₁ is maximum x-coordinate, and y₁ is the maximum y-coordinate. + * + * This is handy for, say, zooming in to a particular feature. (Note that in projected planar coordinates, + * the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.) + * This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent. + * + * @param An object for which the bounds are to be calculated. + */ bounds(object: DatumObject): [[number, number], [number, number]]; + + /** + * Returns the projected planar centroid (typically in pixels) for the specified GeoJSON object. + * This is handy for, say, labeling state or county boundaries, or displaying a symbol map. + * For example, a noncontiguous cartogram might scale each state around its centroid. + * This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent. + * + * @param An object for which the centroid is to be calculated. + */ centroid(object: DatumObject): [number, number]; - context(): C | null; - context(context: GeoContext | null): this; + + /** + * Returns the current render context which defaults to null. + * + * Use the generic to cast the return type of the rendering context, if it is known for a specific application. + */ + context(): C; + + /** + * Set the current rendering context to null and return the path generator. + * The path generator will return an SVG path string; + * + * @param context Null to remove the current rendering context, if any. + */ + context(context: null): this; + + /** + * Set the current rendering context and return the path generator. + * The path generator will render to the specified context. + * + * @param context Rendering context to be used by the path generator. + * The context must at least implement GeoContext, a subset of the CanvasRenderingContext2D API. + */ + context(context: GeoContext): this; /** * Get the current projection. The generic parameter can be used to cast the result to the * correct, known type of the projection, e.g. GeoProjection or GeoConicProjection. Otherwise, * the return type defaults to the minimum type requirement for a projection which * can be passed into a GeoPath. + * + * Use the generic to cast the return type of the projection, if it is known for a specific application. */ - projection

(): P | null; + projection

(): P; /** - * Set the projection to the identity projection + * Set the projection to the identity projection. + * + * @param projection Use null to set the identity projection. */ projection(projection: null): this; /** - * Set the projection to be used with the geo path generator. + * Set the current projection to be used with the geo path generator. + * + * The given projection is typically one of D3’s built-in geographic projections; + * however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. + * See D3’s transforms for more examples of arbitrary geometric transformations. + * + * @param projection A projection. */ projection(projection: GeoProjection): this; /** * Set the projection to be used with the geo path generator to a custom projection. * Custom projections must minimally contain a stream method. + * + * The given projection is typically one of D3’s built-in geographic projections; + * however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. + * See D3’s transforms for more examples of arbitrary geometric transformations. + * + * @param projection A wrapper object exposing, at a minimum a "stream" method to be used for custom projections. */ projection(projection: GeoStreamWrapper): this; - pointRadius(): (this: This, object: DatumObject, ...args: any[]) => number; + /** + * Returns the current radius or radius accessor used to determine the radius for the display of Point and MultiPoint features. + * The default is a constant radius of 4.5. + */ + pointRadius(): ((this: This, object: DatumObject, ...args: any[]) => number) | number; + + /** + * Sets the radius used to display Point and MultiPoint features to the specified number and return the geo path generator. + * + * @param value Fixed radius value. + */ pointRadius(value: number): this; + + /** + * Sets the radius used to display Point and MultiPoint features to use the specified radius accessor function. + * + * While the radius is commonly specified as a number constant, it may also be specified as a function which is computed per feature, + * being passed the any arguments passed to the path generator. For example, if your GeoJSON data has additional properties, + * you might access those properties inside the radius function to vary the point size; + * alternatively, you could d3.symbol and a projection for greater flexibility. + * + * @param value A value accessor function for the radius which is evaluated for each path to be rendered. The value accessor function is invoked within the "this" context in which the path generator is used. + * It is passed the object to be rendered, and any additional arguments which have been passed into the call to the render function of the path generator. + */ pointRadius(value: (this: This, object: DatumObject, ...args: any[]) => number): this; } -export function geoPath(): GeoPath; -export function geoPath(): GeoPath; -export function geoPath(): GeoPath; +/** + * Creates a new geographic path generator. + * + * The default projection is the null projection. The null projection represents the identity transformation, i.e. + * the input geometry is not projected and is instead rendered directly in raw coordinates. + * This can be useful for fast rendering of pre-projected geometry, or for fast rendering of the equirectangular projection. + * + * The default context is null, which implies that the path generator will return an SVG path string. + * + * @param projection An (optional) current projection to be used. Typically this is one of D3’s built-in geographic projections; + * however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. + * See D3’s transforms for more examples of arbitrary geometric transformations. Setting the projection to "null" uses the identity projection. The default value is "null", the identity projection. + * @param context An (optional) rendering context to be used. If a context is provided, it must at least implement the interface described by GeoContext, a subset of the CanvasRenderingContext2D API. + * Setting the context to "null" means that the path generator will return an SVG path string representing the to be rendered object. The default is "null". + */ +export function geoPath(projection?: GeoProjection | GeoStreamWrapper | null, context?: GeoContext | null): GeoPath; +/** + * Creates a new geographic path generator with the default settings. + * + * The default projection is the null projection. The null projection represents the identity transformation: + * the input geometry is not projected and is instead rendered directly in raw coordinates. + * This can be useful for fast rendering of pre-projected geometry, or for fast rendering of the equirectangular projection. + * + * The default context is null, which implies that the path generator will return an SVG path string. + * + * The generic corresponds to the type of the DatumObject which will be passed into the geo path generator for rendering + * + * @param projection An (optional) current projection to be used. Typically this is one of D3’s built-in geographic projections; + * however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. + * See D3’s transforms for more examples of arbitrary geometric transformations. Setting the projection to "null" uses the identity projection. The default value is "null", the identity projection. + * @param context An (optional) rendering context to be used. If a context is provided, it must at least implement the interface described by GeoContext, a subset of the CanvasRenderingContext2D API. + * Setting the context to "null" means that the path generator will return an SVG path string representing the to be rendered object. The default is "null". + */ +export function geoPath(projection?: GeoProjection | GeoStreamWrapper | null, context?: GeoContext | null): GeoPath; +/** + * Creates a new geographic path generator with the default settings. + * + * The default projection is the null projection. The null projection represents the identity transformation: + * the input geometry is not projected and is instead rendered directly in raw coordinates. + * This can be useful for fast rendering of pre-projected geometry, or for fast rendering of the equirectangular projection. + * + * The default context is null, which implies that the path generator will return an SVG path string. + * + * The first generic corresponds to the "this"-context within which the geo path generator will be invoked. This could be e.g. the DOMElement bound to "this" when using selection.attr("d", ...) with the path generator. + * + * The second generic corresponds to the type of the DatumObject which will be passed into the geo path generator for rendering. + * + * @param projection An (optional) current projection to be used. Typically this is one of D3’s built-in geographic projections; + * however, any object that exposes a projection.stream function can be used, enabling the use of custom projections. + * See D3’s transforms for more examples of arbitrary geometric transformations. Setting the projection to "null" uses the identity projection. The default value is "null", the identity projection. + * @param context An (optional) rendering context to be used. If a context is provided, it must at least implement the interface described by GeoContext, a subset of the CanvasRenderingContext2D API. + * Setting the context to "null" means that the path generator will return an SVG path string representing the to be rendered object. The default is "null". + */ +export function geoPath(projection?: GeoProjection | GeoStreamWrapper | null, context?: GeoContext | null): GeoPath; + -// Raw Projections ======================================================== -export function geoAzimuthalEqualAreaRaw(): GeoRawProjection; -export function geoAzimuthalEquidistantRaw(): GeoRawProjection; -export function geoConicConformalRaw(phi0: number, phi1: number): GeoRawProjection; -export function geoConicEqualAreaRaw(phi0: number, phi1: number): GeoRawProjection; -export function geoConicEquidistantRaw(phi0: number, phi1: number): GeoRawProjection; -export function geoEquirectangularRaw(): GeoRawProjection; -export function geoGnomonicRaw(): GeoRawProjection; -export function geoMercatorRaw(): GeoRawProjection; -export function geoOrthographicRaw(): GeoRawProjection; -export function geoStereographicRaw(): GeoRawProjection; -export function geoTransverseMercatorRaw(): GeoRawProjection; // geoProjection ========================================================== +/** + * Constructs a new projection from the specified raw projection, project. + * The project function takes the longitude and latitude of a given point in radians, + * often referred to as lambda (λ) and phi (φ), and returns a two-element array [x, y] representing its unit projection. + * The project function does not need to scale or translate the point, as these are applied automatically by projection.scale, projection.translate, and projection.center. + * Likewise, the project function does not need to perform any spherical rotation, as projection.rotate is applied prior to projection. + * + * If the project function exposes an invert method, the returned projection will also expose projection.invert. + */ export function geoProjection(project: GeoRawProjection): GeoProjection; // geoProjectionMutator ==================================================== +/** + * Constructs a new projection from the specified raw projection factory and returns a mutate function to call whenever the raw projection changes. + * The factory must return a raw projection. The returned mutate function returns the wrapped projection. + * + * When creating a mutable projection, the mutate function is typically not exposed. + */ export function geoProjectionMutator(factory: (...args: any[]) => GeoRawProjection): () => GeoProjection; -// Pre-Defined Projections ================================================= +// Pre-Defined Projections and Raw Projections ============================= -export function geoAlbers(): GeoConicProjection; -export function geoAlbersUsa(): GeoProjection; +// Azimuthal Projections --------------------------------------------------- + +/** + * The azimuthal equal-area projection. + */ export function geoAzimuthalEqualArea(): GeoProjection; + +/** + * The raw azimuthal equal-area projection. + */ +export function geoAzimuthalEqualAreaRaw(): GeoRawProjection; + +/** + * The azimuthal equidistant projection. + */ export function geoAzimuthalEquidistant(): GeoProjection; -export function geoConicConformal(): GeoConicProjection; -export function geoConicEqualArea(): GeoConicProjection; -export function geoConicEquidistant(): GeoConicProjection; -export function geoEquirectangular(): GeoProjection; +/** + * The raw azimuthal equidistant projection. + */ +export function geoAzimuthalEquidistantRaw(): GeoRawProjection; + +/** + * The gnomonic projection. + */ export function geoGnomonic(): GeoProjection; -export function geoMercator(): GeoProjection; + +/** + * The raw gnomonic projection. + */ +export function geoGnomonicRaw(): GeoRawProjection; + +/** + * The orthographic projection. + */ export function geoOrthographic(): GeoProjection; + +/** + * The raw orthographic projection. + */ +export function geoOrthographicRaw(): GeoRawProjection; + +/** + * The stereographic projection. + */ export function geoStereographic(): GeoProjection; +/** + * The raw stereographic projection. + */ +export function geoStereographicRaw(): GeoRawProjection; + +// Composite Projections --------------------------------------------------- + +/** + * A U.S.-centric composite projection of three d3.geoConicEqualArea projections: d3.geoAlbers is used for the lower forty-eight states, + * and separate conic equal-area projections are used for Alaska and Hawaii. Note that the scale for Alaska is diminished: it is projected at 0.35× its true relative area. + * + * Composite consist of several projections that are composed into a single display. The constituent projections have fixed clip, center and rotation, + * and thus composite projections do not support projection.center, projection.rotate, projection.clipAngle, or projection.clipExtent. + */ +export function geoAlbersUsa(): GeoProjection; + +// Conic Projections ------------------------------------------------------- + +/** + * The Albers’ equal area-conic projection. This is a U.S.-centric configuration of d3.geoConicEqualArea. + */ +export function geoAlbers(): GeoConicProjection; + +/** + * The conic conformal projection. The parallels default to [30°, 30°] resulting in flat top. + */ +export function geoConicConformal(): GeoConicProjection; + +/** + * The raw conic conformal projection. + */ +export function geoConicConformalRaw(phi0: number, phi1: number): GeoRawProjection; + +/** + * The Albers’ equal-area conic projection. + */ +export function geoConicEqualArea(): GeoConicProjection; + +/** + * The raw Albers’ equal-area conic projection. + */ +export function geoConicEqualAreaRaw(phi0: number, phi1: number): GeoRawProjection; + +/** + * The conic equidistant projection. + */ +export function geoConicEquidistant(): GeoConicProjection; + +/** + * The raw conic equidistant projection. + */ +export function geoConicEquidistantRaw(phi0: number, phi1: number): GeoRawProjection; + +// Cylindrical Projections ------------------------------------------------ + +/** + * The equirectangular (plate carrée) projection. + */ +export function geoEquirectangular(): GeoProjection; + +/** + * The raw equirectangular (plate carrée) projection. + */ +export function geoEquirectangularRaw(): GeoRawProjection; + +/** + * The spherical Mercator projection. + * Defines a default projection.clipExtent such that the world is projected to a square, clipped to approximately ±85° latitude. + */ +export function geoMercator(): GeoProjection; +/** + * The raw spherical Mercator projection. + */ +export function geoMercatorRaw(): GeoRawProjection; + +/** + * The transverse spherical Mercator projection. + * Defines a default projection.clipExtent such that the world is projected to a square, clipped to approximately ±85° latitude. + */ export function geoTransverseMercator(): GeoProjection; -// geoClipExtent ============================================================= - -export interface GeoExtent { - extent(): [[number, number], [number, number]]; - extent(extent: [[number, number], [number, number]]): this; - stream(stream: GeoStream): GeoStream; -} - - -export function geoClipExtent(): GeoExtent; +/** + * The raw transverse spherical Mercator projection. + */ +export function geoTransverseMercatorRaw(): GeoRawProjection; // ---------------------------------------------------------------------- -// Projection Streams +// Projection Transforms // ---------------------------------------------------------------------- // geoTransform(...) ==================================================== +/** + * A Prototype interface which serves as a template for the implementation of a geometric transform using geoTransform(...) + * It serves as a reference for the custom methods which can be passed into geoTransform as argument to crete a generalized + * transform projection. + */ export interface GeoTransformPrototype { + /** + * Indicates the end of a line or ring. Within a polygon, indicates the end of a ring. + * Unlike GeoJSON, the redundant closing coordinate of a ring is not indicated via point, and instead is implied via lineEnd within a polygon. + */ lineEnd?(this: this & { stream: GeoStream }): void; + /** + * Indicates the start of a line or ring. Within a polygon, indicates the start of a ring. The first ring of a polygon is the exterior ring, and is typically clockwise. + * Any subsequent rings indicate holes in the polygon, and are typically counterclockwise. + */ lineStart?(this: this & { stream: GeoStream }): void; + /** + * Indicates a point with the specified coordinates x and y (and optionally z). The coordinate system is unspecified and implementation-dependent; + * for example, projection streams require spherical coordinates in degrees as input. Outside the context of a polygon or line, + * a point indicates a point geometry object (Point or MultiPoint). Within a line or polygon ring, the point indicates a control point. + * + * @param x x-coordinate of point. + * @param y y-coordinate of point. + * @param z Optional z-coordinate of point. + */ point?(this: this & { stream: GeoStream }, x: number, y: number, z?: number): void; + /** + * Indicates the end of a polygon. + */ polygonEnd?(this: this & { stream: GeoStream }): void; + /** + * Indicates the start of a polygon. The first line of a polygon indicates the exterior ring, and any subsequent lines indicate interior holes. + */ polygonStart?(this: this & { stream: GeoStream }): void; + /** + * Indicates the sphere (the globe; the unit sphere centered at ⟨0,0,0⟩). + */ sphere?(this: this & { stream: GeoStream }): void; } + // TODO: Review whether GeoStreamWrapper should be included into return value union type, i.e. ({ stream: (s: GeoStream) => (T & GeoStream & GeoStreamWrapper)})? // It probably should be omitted for purposes of this API. The stream method added to (T & GeoStream) is more of a private member used internally to // implement the Transform factory -export function geoTransform(prototype: T): { stream: (s: GeoStream) => (T & GeoStream) }; -// geoStream(...) ======================================================= +/** + * Defines an arbitrary transform using the methods defined on the specified methods object. + * Any undefined methods will use pass-through methods that propagate inputs to the output stream. + * + * @param methods An object with custom method implementations, which are used to create a transform projection. + */ +export function geoTransform(methods: T): { stream: (s: GeoStream) => (T & GeoStream) }; -export function geoStream(object: ExtendedFeature, stream: GeoStream): void; -export function geoStream(object: ExtendedFeatureCollection>, stream: GeoStream): void; -export function geoStream(object: GeoGeometryObjects, stream: GeoStream): void; -export function geoStream(object: ExtendedGeometryCollection, stream: GeoStream): void; +// geoIdentity() ================================================================= + +/** + * Geo Identity Transform + */ +export interface GeoIdentityTranform extends GeoStreamWrapper { + + /** + * Returns the current viewport clip extent which defaults to null. + */ + clipExtent(): [[number, number], [number, number]] | null; + /** + * Sets the clip extent to null and returns the projection. + * With a clip extent of null, no viewport clipping is performed. + * + * Viewport clipping is independent of small-circle clipping via projection.clipAngle. + * + * @param extent Set to null to disable viewport clipping. + */ + clipExtent(extent: null): this; + /** + * Sets the projection’s viewport clip extent to the specified bounds in pixels and returns the projection. + * The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom. + * + * Viewport clipping is independent of small-circle clipping via projection.clipAngle. + * + * @param extent The extent bounds are specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left-side of the viewport, y₀ is the top, x₁ is the right and y₁ is the bottom. + */ + clipExtent(extent: [[number, number], [number, number]]): this; + + /** + * Sets the projection’s scale and translate to fit the specified geographic feature in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ + fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). + */ + fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection>): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ + fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ + fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this; + + + /** + * Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic feature supported by d3-geo (An extension of GeoJSON feature). + */ + fitSize(size: [number, number], object: ExtendedFeature): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection). + */ + fitSize(size: [number, number], object: ExtendedFeatureCollection>): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A GeoJson Geometry Object or GeoSphere object supported by d3-geo (An extension of GeoJSON). + */ + fitSize(size: [number, number], object: GeoGeometryObjects): this; + /** + * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of an extent with the given size and top-left corner of [0, 0]. + * Returns the projection. + * + * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150. + * + * @param size The size of the extent, specified as an array [width, height]. + * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection). + */ + fitSize(size: [number, number], object: ExtendedGeometryCollection): this; + + /** + * Returns true if x-reflection is enabled, which defaults to false. + */ + reflectX(): boolean; + /** + * Sets whether or not the x-dimension is reflected (negated) in the output. + * + * @param reflect true = reflect x-dimension, false = do not reflect x-dimension. + */ + reflectX(reflect: boolean): this; + + /** + * Returns true if y-reflection is enabled, which defaults to false. + */ + reflectY(): boolean; + /** + * Sets whether or not the y-dimension is reflected (negated) in the output. + * + * This is especially useful for transforming from standard spatial reference systems, + * which treat positive y as pointing up, to display coordinate systems such as Canvas and SVG, + * which treat positive y as pointing down. + * + * @param reflect true = reflect y-dimension, false = do not reflect y-dimension. + */ + reflectY(reflect: boolean): this; + + /** + * Returns the current scale factor. + * + * The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections. + */ + scale(): number; + /** + * Sets the projection’s scale factor to the specified value and returns the projection. + * The scale factor corresponds linearly to the distance between projected points; however, absolute scale factors are not equivalent across projections. + * + * @param scale Scale factor to be used for the projection. + */ + scale(scale: number): this; + + /** + * Returns the current translation offset. + * The translation offset determines the pixel coordinates of the projection’s center. + */ + translate(): [number, number]; + /** + * Sets the projection’s translation offset to the specified two-element array [tx, ty] and returns the projection. + * The translation offset determines the pixel coordinates of the projection’s center. + * + * @param point A two-element array [tx, ty] specifying the translation offset. + */ + translate(point: [number, number]): this; +} + +/** + * Returns the identity transform which can be used to scale, translate and clip planar geometry. + */ +export function geoIdentity(): GeoIdentityTranform; diff --git a/d3-geo/tsconfig.json b/d3-geo/tsconfig.json index 2ec957f5d4..707a8bda7e 100644 --- a/d3-geo/tsconfig.json +++ b/d3-geo/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "index.d.ts", "d3-geo-tests.ts" ] -} +} \ No newline at end of file diff --git a/d3-hierarchy/tsconfig.json b/d3-hierarchy/tsconfig.json index 6c95cf0415..7dc8a4a49a 100644 --- a/d3-hierarchy/tsconfig.json +++ b/d3-hierarchy/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-hierarchy-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-hierarchy-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-hsv/tsconfig.json b/d3-hsv/tsconfig.json index f6493750fd..60524d6e6f 100644 --- a/d3-hsv/tsconfig.json +++ b/d3-hsv/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-hsv-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-hsv-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-interpolate/tsconfig.json b/d3-interpolate/tsconfig.json index 4271a3052b..80e9a2874a 100644 --- a/d3-interpolate/tsconfig.json +++ b/d3-interpolate/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-interpolate-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-interpolate-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-path/index.d.ts b/d3-path/index.d.ts index b1e7752267..7315ced2cb 100644 --- a/d3-path/index.d.ts +++ b/d3-path/index.d.ts @@ -1,18 +1,106 @@ -// Type definitions for D3JS d3-path module v1.0.1 +// Type definitions for D3JS d3-path module 1.0 // Project: https://github.com/d3/d3-path/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.3 + +/** + * A D3 path serializer implementing CanvasPathMethods + */ export interface Path { + /** + * Move to the specified point ⟨x, y⟩. Equivalent to context.moveTo and SVG’s “moveto” command. + * + * @param x x-Coordinate of point to move to + * @param y y-Coordinate of point to move to + */ moveTo(x: number, y: number): void; + + /** + * Ends the current subpath and causes an automatic straight line to be drawn from the current point to the initial point of the current subpath. + * Equivalent to context.closePath and SVG’s “closepath” command. + */ closePath(): void; + + /** + * Draws a straight line from the current point to the specified point ⟨x, y⟩. + * Equivalent to context.lineTo and SVG’s “lineto” command. + * + * @param x x-Coordinate of point to draw the line to + * @param y y-Coordinate of point to draw the line to + */ lineTo(x: number, y: number): void; + + /** + * Draws a quadratic Bézier segment from the current point to the specified point ⟨x, y⟩, with the specified control point ⟨cpx, cpy⟩. + * Equivalent to context.quadraticCurveTo and SVG’s quadratic Bézier curve commands. + * + * @param cpx x-Coordinate of the control point for the quadratic Bézier curve + * @param cpy y-Coordinate of the control point for the quadratic Bézier curve + * @param x x-Coordinate of point to draw the curve to + * @param y y-Coordinate of point to draw the curve to + */ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + + /** + * Draws a cubic Bézier segment from the current point to the specified point ⟨x, y⟩, with the specified control points ⟨cpx1, cpy1⟩ and ⟨cpx2, cpy2⟩. + * Equivalent to context.bezierCurveTo and SVG’s cubic Bézier curve commands. + * + * @param cpx1 x-Coordinate of the first control point for the Bézier curve + * @param cpy1 y-Coordinate of the first control point for the Bézier curve + * @param cpx2 x-Coordinate of the second control point for the Bézier curve + * @param cpy2 y-Coordinate of the second control point for the Bézier curve + * @param x x-Coordinate of point to draw the curve to + * @param y y-Coordinate of point to draw the curve to + */ bezierCurveTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number): void; + + /** + * Draws a circular arc segment with the specified radius that starts tangent to the line between the current point and the specified point ⟨x1, y1⟩ + * and ends tangent to the line between the specified points ⟨x1, y1⟩ and ⟨x2, y2⟩. If the first tangent point is not equal to the current point, + * a straight line is drawn between the current point and the first tangent point. Equivalent to context.arcTo and uses SVG’s elliptical arc curve commands. + * + * @param x1 x-Coordinate of the first tangent point + * @param y1 y-Coordinate of the first tangent point + * @param x2 x-Coordinate of the second tangent point + * @param y2 y-Coordinate of the second tangent point + * @param r Radius of the arc segment + */ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + + /** + * Draws a circular arc segment with the specified center ⟨x, y⟩, radius, startAngle and endAngle. If anticlockwise is true, + * the arc is drawn in the anticlockwise direction; otherwise, it is drawn in the clockwise direction. + * If the current point is not equal to the starting point of the arc, a straight line is drawn from the current point to the start of the arc. + * Equivalent to context.arc and uses SVG’s elliptical arc curve commands. + * + * @param x x-Coordinate of the center point of the arc segment + * @param y y-Coordinate of the center point of the arc segment + * @param startAngle Start angle of arc segment + * @param endAngle End angle of arc segment + * @param anticlockwise Flag indicating directionality (true = anti-clockwise, false = clockwise) + */ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void; + + /** + * Creates a new subpath containing just the four points ⟨x, y⟩, ⟨x + w, y⟩, ⟨x + w, y + h⟩, ⟨x, y + h⟩, + * with those four points connected by straight lines, and then marks the subpath as closed. Equivalent to context.rect and uses SVG’s “lineto” commands. + * + * @param x x-Coordinate of starting point for drawing the rectangle + * @param y y-Coordinate of starting point for drawing the rectangle + * @param w Width of rectangle + * @param h Height of rectangle + */ rect(x: number, y: number, w: number, h: number): void; + + /** + * Returns the string representation of this path according to SVG’s path data specficiation. + */ toString(): string; } +/** + * Construct a D3 Path serializer + */ export function path(): Path; diff --git a/d3-path/tsconfig.json b/d3-path/tsconfig.json index eea0c6fc90..644bb571d9 100644 --- a/d3-path/tsconfig.json +++ b/d3-path/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-path-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-path-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-polygon/tsconfig.json b/d3-polygon/tsconfig.json index b1c8548022..75b9b7877b 100644 --- a/d3-polygon/tsconfig.json +++ b/d3-polygon/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-polygon-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-polygon-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-quadtree/tsconfig.json b/d3-quadtree/tsconfig.json index cad852ded8..7306e1d3a4 100644 --- a/d3-quadtree/tsconfig.json +++ b/d3-quadtree/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-quadtree-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-quadtree-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-queue/tsconfig.json b/d3-queue/tsconfig.json index fe68a110c5..37b616b4e4 100644 --- a/d3-queue/tsconfig.json +++ b/d3-queue/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-queue-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-queue-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-random/tsconfig.json b/d3-random/tsconfig.json index 2e112e521d..f401f66dc4 100644 --- a/d3-random/tsconfig.json +++ b/d3-random/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-random-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-random-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-request/tsconfig.json b/d3-request/tsconfig.json index d320e3e9de..bbb77ee4e9 100644 --- a/d3-request/tsconfig.json +++ b/d3-request/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-request-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-request-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-scale-chromatic/tsconfig.json b/d3-scale-chromatic/tsconfig.json index bcbb6fd86c..d65c895814 100644 --- a/d3-scale-chromatic/tsconfig.json +++ b/d3-scale-chromatic/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-scale-chromatic-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-scale-chromatic-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-scale/d3-scale-tests.ts b/d3-scale/d3-scale-tests.ts index 7f77472664..269218967e 100644 --- a/d3-scale/d3-scale-tests.ts +++ b/d3-scale/d3-scale-tests.ts @@ -15,23 +15,23 @@ import { timeHour } from 'd3-time'; // ------------------------------------------------------------------------------- class NumCoercible { - public a: number; + a: number; constructor(a: number) { this.a = a; } - public valueOf() { + valueOf() { return this.a; } } class StringCoercible { - public txt: string; + txt: string; constructor(txt: string) { this.txt = txt; } - public toString() { + toString() { return this.txt; } } @@ -45,22 +45,24 @@ let clampFlag: boolean; let outputNumber: number; let outputString: string; -let domainNumbers: Array; -let domainNumeric: Array; -let domainStrings: Array; -let domainDates: Array; +let domainNumbers: number[] = [1, 100]; +let domainNumeric: NumCoercible[] = [new NumCoercible(0), new NumCoercible(100)]; +let domainStrings: string[]; +let domainDates: Date[] = [new Date(2016, 0, 15), new Date(2016, 5, 15)]; -let ticksNumbers: Array; -let ticksDates: Array; +let ticksNumbers: number[]; +let ticksDates: Date[]; let tickFormatNumberFn: ((d: number | { valueOf(): number }) => string); let tickFormatDateFn: ((d: Date) => string); -let rangeNumbers: Array; -let roundRangeNumbers: Array; -let rangeStrings: Array; +let rangeNumbers: number[] = [2, 200]; +let rangeStrings: string[] = ['2px', '200px']; +let numExtent: [number, number]; +let numOrUndefinedExtent: [number | undefined, number | undefined]; +let outputNumberMaybe: number | undefined; // ------------------------------------------------------------------------------- // Linear Scale Factory // ------------------------------------------------------------------------------- @@ -113,7 +115,7 @@ num = linearScaleNumString.invert(new NumCoercible(500)); // has number range, s // rangeRound(...) ----------------------------------------------------------------- -linearScaleNumber = linearScaleNumber.rangeRound(roundRangeNumbers); +linearScaleNumber = linearScaleNumber.rangeRound(rangeNumbers); // clamp(...) ----------------------------------------------------------------- @@ -131,6 +133,14 @@ linearScaleNumString = linearScaleNumString.interpolate(function (a, b) { }; }); +// Changes scale output type (inferred generic) +linearScaleNumString = linearScaleNumber.interpolate(function (a, b) { + // take two numbers + return function (t: number) { + return (a * (1 - t) + b * t) + 'px'; // a and b are numbers based on Range Type, return value of interpolator is string based on Output type + }; +}); + // nice(...) ----------------------------------------------------------------------- @@ -228,7 +238,7 @@ num = powerScaleNumString.invert(new NumCoercible(500)); // has number range, so // rangeRound(...) ----------------------------------------------------------------- -powerScaleNumber = powerScaleNumber.rangeRound(roundRangeNumbers); +powerScaleNumber = powerScaleNumber.rangeRound(rangeNumbers); // clamp(...) ----------------------------------------------------------------- @@ -335,7 +345,7 @@ num = logScaleNumString.invert(new NumCoercible(500)); // has number range, so i // rangeRound(...) ----------------------------------------------------------------- -logScaleNumber = logScaleNumber.rangeRound(roundRangeNumbers); +logScaleNumber = logScaleNumber.rangeRound(rangeNumbers); // clamp(...) ----------------------------------------------------------------- @@ -357,7 +367,7 @@ logScaleNumString = logScaleNumString.interpolate(function (a, b) { // chainable logScaleNumber = logScaleNumber.nice(); -logScaleNumber = logScaleNumber.nice(5); +// logScaleNumber = logScaleNumber.nice(5); // fails, logarithmic scale does not support count parameter. // ticks(...) ----------------------------------------------------------------- @@ -465,9 +475,10 @@ utcScaleNumString = d3Scale.scaleUtc(); // domain(...) ----------------------------------------------------------------- localTimeScaleNumber = localTimeScaleNumber.domain(domainDates); + domainDates = localTimeScaleNumber.domain(); -localTimeScaleString = localTimeScaleString.domain([new Date(2016, 6, 1), new Date(2016, 6, 6)]); +localTimeScaleString = localTimeScaleString.domain([new Date(2016, 6, 1), Date.now()]); domainDates = localTimeScaleString.domain(); localTimeScaleNumString = localTimeScaleNumString.domain(domainDates); @@ -495,7 +506,7 @@ date = localTimeScaleNumString.invert(new NumCoercible(500)); // has number rang // rangeRound(...) ----------------------------------------------------------------- -localTimeScaleNumber = localTimeScaleNumber.rangeRound(roundRangeNumbers); +localTimeScaleNumber = localTimeScaleNumber.rangeRound(rangeNumbers); // clamp(...) ----------------------------------------------------------------- @@ -525,15 +536,23 @@ localTimeScaleNumber = localTimeScaleNumber.nice(timeHour, 5); // ticks(...) ----------------------------------------------------------------- +const timeInterval = timeHour.every(5); + ticksDates = localTimeScaleNumber.ticks(); ticksDates = localTimeScaleNumber.ticks(50); -ticksDates = localTimeScaleNumString.ticks(timeHour.every(5)); + +if (timeInterval !== null) { + ticksDates = localTimeScaleNumString.ticks(timeInterval); +} + // tickFormat(...) ----------------------------------------------------------------- tickFormatDateFn = localTimeScaleNumber.tickFormat(); tickFormatDateFn = localTimeScaleNumber.tickFormat(50, '%I %p'); -tickFormatDateFn = localTimeScaleNumber.tickFormat(timeHour.every(5), '%I %p'); +if (timeInterval !== null) { + tickFormatDateFn = localTimeScaleNumber.tickFormat(timeInterval, '%I %p'); +} // (...) value mapping from domain to output ----------------------------------- @@ -644,7 +663,7 @@ rangeStrings = quantizeScaleString.range(); // invertExtent(...) ----------------------------------------------------------------- -let numExtent: [number, number] = quantizeScaleNumber.invertExtent(500); +numExtent = quantizeScaleNumber.invertExtent(500); numExtent = quantizeScaleString.invertExtent('steelblue'); @@ -715,7 +734,7 @@ numExtent = quantileScaleString.invertExtent('q50'); // quantile() ----------------------------------------------------------------------- -let quantiles: Array = quantileScaleNumber.quantiles(); +let quantiles: number[] = quantileScaleNumber.quantiles(); // (...) value mapping from domain to output ----------------------------------- @@ -759,9 +778,9 @@ rangeStrings = thresholdScaleNumberString.range(); // invertExtent(...) ----------------------------------------------------------------- -numExtent = thresholdScaleNumberNumber.invertExtent(100); +numOrUndefinedExtent = thresholdScaleNumberNumber.invertExtent(100); -numExtent = thresholdScaleNumberString.invertExtent('seagreen'); +numOrUndefinedExtent = thresholdScaleNumberString.invertExtent('seagreen'); // (...) value mapping from domain to output ----------------------------------- @@ -905,9 +924,9 @@ num = bandScaleString.step(); // (...) value mapping from domain to output ----------------------------------- -outputNumber = bandScaleString('neutral'); +outputNumberMaybe = bandScaleString('neutral'); -outputNumber = bandScaleCoercible(new StringCoercible('negative')); +outputNumberMaybe = bandScaleCoercible(new StringCoercible('negative')); // copy(...) ----------------------------------------------------------------- @@ -976,9 +995,9 @@ num = pointScaleString.step(); // (...) value mapping from domain to output ----------------------------------- -outputNumber = pointScaleString('neutral'); +outputNumberMaybe = pointScaleString('neutral'); -outputNumber = pointScaleCoercible(new StringCoercible('negative')); +outputNumberMaybe = pointScaleCoercible(new StringCoercible('negative')); // copy(...) ----------------------------------------------------------------- @@ -988,7 +1007,7 @@ let copiedPointScale: d3Scale.ScalePoint = pointScaleCoercible. // Categorical Color Schemas for Ordinal Scales // ------------------------------------------------------------------------------- -let colorStrings: Array; +let colorStrings: string[]; colorStrings = d3Scale.schemeCategory10; diff --git a/d3-scale/index.d.ts b/d3-scale/index.d.ts index 5ad7cf395f..c1c6e5eb8a 100644 --- a/d3-scale/index.d.ts +++ b/d3-scale/index.d.ts @@ -1,160 +1,689 @@ -// Type definitions for D3JS d3-scale module v1.0.3 +// Type definitions for D3JS d3-scale module 1.0 // Project: https://github.com/d3/d3-scale/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.4 + import { CountableTimeInterval, TimeInterval } from 'd3-time'; // ------------------------------------------------------------------------------- // Shared Types and Interfaces // ------------------------------------------------------------------------------- - +/** + * An Interpolator factory returns an interpolator function. + * + * The first generic correponds to the data type of the interpolation boundaries. + * The second generic corresponds to the data type of the return type of the interpolator. + */ +// This is a base interface to be extended, hence the suppression of the warning +// tslint:disable-next-line:functional-interfaces export interface InterpolatorFactory { + /** + * Construct a new interpolator function, based on the provided interpolation boundaries. + * + * @param a Start boundary of the interpolation interval. + * @param b End boundary of the interpolation interval. + */ (a: T, b: T): ((t: number) => U); } +/** + * A helper interface for a continuous scale defined over a numeric domain. + */ +export interface ScaleContinuousNumeric { + + /** + * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any. + * + * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. + * + * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation. + * + * @param value A numeric value from the domain. + */ + (value: number | { valueOf(): number }): Output; + + /** + * Given a value from the range, returns the corresponding value from the domain. Inversion is useful for interaction, + * say to determine the data value corresponding to the position of the mouse. + * + * If the given value is outside the range, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the domain. + * + * IMPORTANT: This method is only supported if the range is numeric. If the range is not numeric, returns NaN. + * + * For a valid value y in the range, continuous(continuous.invert(y)) approximately equals y; + * similarly, for a valid value x in the domain, continuous.invert(continuous(x)) approximately equals x. + * The scale and its inverse may not be exact due to the limitations of floating point precision. + * + * @param value A numeric value from the range. + */ + invert(value: number | { valueOf(): number }): number; + + /** + * Returns a copy of the scale’s current domain. + */ + domain(): number[]; + /** + * Sets the scale’s domain to the specified array of numbers. The array must contain two or more elements. + * If the elements in the given array are not numbers, they will be coerced to numbers + * + * Although continuous scales typically have two values each in their domain and range, specifying more than two values produces a piecewise scale. + * + * Internally, a piecewise scale performs a binary search for the range interpolator corresponding to the given domain value. + * Thus, the domain must be in ascending or descending order. If the domain and range have different lengths N and M, only the first min(N,M) elements in each are observed. + * + * @param domain Array of numeric domain values. + */ + domain(domain: Array): this; + + /** + * Returns a copy of the scale’s current range. + */ + range(): Range[]; + /** + * Sets the scale’s range to the specified array of values. + * + * The array must contain two or more elements. Unlike the domain, elements in the given array need not be numbers; + * any value that is supported by the underlying interpolator will work, though note that numeric ranges are required for invert. + * + * @param range Array of range values. + */ + range(range: Range[]): this; + + /** + * Sets the scale’s range to the specified array of values while also setting the scale’s interpolator to interpolateRound. + * + * The rounding interpolator is sometimes useful for avoiding antialiasing artifacts, + * though also consider the shape-rendering “crispEdges” styles. Note that this interpolator can only be used with numeric ranges. + * + * The array must contain two or more elements. Unlike the domain, elements in the given array need not be numbers; + * any value that is supported by the underlying interpolator will work, though note that numeric ranges are required for invert. + * + * @param range Array of range values. + */ + rangeRound(range: Array): this; + + /** + * Returns whether or not the scale currently clamps values to within the range. + */ + clamp(): boolean; + /** + * Enables or disables clamping, respectively. If clamping is disabled and the scale is passed a value outside the domain, + * the scale may return a value outside the range through extrapolation. + * + * If clamping is enabled, the return value of the scale is always within the scale’s range. Clamping similarly applies to the "invert" method. + * + * @param clamp A flag to enable (true) or disable (false) clamping. + */ + clamp(clamp: boolean): this; + + /** + * Returns approximately count representative values from the scale’s domain. + * + * If count is not specified, it defaults to 10. + * + * The returned tick values are uniformly spaced, have human-readable values (such as multiples of powers of 10), + * and are guaranteed to be within the extent of the domain. Ticks are often used to display reference lines, or tick marks, in conjunction with the visualized data. + * The specified count is only a hint; the scale may return more or fewer values depending on the domain. See also d3-array’s ticks. + * + * @param count Optional approximate number of ticks to be returned. If count is not specified, it defaults to 10. + */ + ticks(count?: number): number[]; + + /** + * Returns a number format function suitable for displaying a tick value, automatically computing the appropriate precision based on the fixed interval between tick values. + * The specified count should have the same value as the count that is used to generate the tick values. + * + * @param count Approximate number of ticks to be used when calculating precision for the number format function. + * @param specifier An optional valid format specifier string which allows a custom format where the precision of the format is automatically set by the scale as appropriate for the tick interval. + * If specifier uses the format type "s", the scale will return a SI-prefix format based on the largest value in the domain. + * If the specifier already specifies a precision, this method is equivalent to locale.format. + */ + tickFormat(count?: number, specifier?: string): ((d: number | { valueOf(): number }) => string); + + /** + * Extends the domain so that it starts and ends on nice round values. + * This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. + * An optional tick count argument allows greater control over the step size used to extend the bounds, + * guaranteeing that the returned ticks will exactly cover the domain. + * Nicing is useful if the domain is computed from data, say using extent, and may be irregular. + * For example, for a domain of [0.201479…, 0.996679…], a nice domain might be [0.2, 1.0]. + * If the domain has more than two values, nicing the domain only affects the first and last value. + * + * Nicing a scale only modifies the current domain; it does not automatically nice domains that are subsequently set using continuous.domain. + * You must re-nice the scale after setting the new domain, if desired. + * + * @param count An optional number of ticks expexted to be used. + */ + nice(count?: number): this; + + /** + * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. + */ + copy(): this; + +} // ------------------------------------------------------------------------------- // Linear Scale Factory // ------------------------------------------------------------------------------- +/** + * A linear continuous scale defined over a numeric domain. + * + * Continuous scales map a continuous, quantitative input domain to a continuous output range. + * Each range value y can be expressed as a function of the domain value x: y = mx + b. + * + * If the range is also numeric, the mapping may be inverted. + * + * Note that the data types of the range and output of the scale must be compatible with the interpolator applied by the scale. + * + * The first generic corresponds to the data type of the range elements. + * + * The second generic corresponds to the data type of the output elements generated by the scale. + * + * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * convert the interpolated range element to a corresponding output element. + */ +export interface ScaleLinear extends ScaleContinuousNumeric { -export interface ScaleLinear { - (value: number | { valueOf(): number }): Output; /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. Otherwise, returns NaN + * Returns the scale’s current interpolator factory, which defaults to interpolate. */ - invert(value: number | { valueOf(): number }): number; - domain(): Array; - domain(domain: Array): this; - range(): Array; - range(range: Array): this; - /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. - */ - rangeRound(range: Array): this; - clamp(): boolean; - clamp(clamp: boolean): ScaleLinear; interpolate(): InterpolatorFactory; + + /** + * Sets the scale’s range interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; + * these interpolators then map a normalized domain parameter t in [0, 1] to the corresponding value in the range. + * + * Note: the default interpolator may reuse return values. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. + * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); + * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. + * + * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + */ interpolate(interpolate: InterpolatorFactory): this; + /** + * Sets the scale’s range interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; + * these interpolators then map a normalized domain parameter t in [0, 1] to the corresponding value in the range. + * + * Note: the default interpolator may reuse return values. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. + * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); + * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. + * + * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * + * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. + * + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + */ interpolate(interpolate: InterpolatorFactory): ScaleLinear; - ticks(count?: number): Array; - tickFormat(count?: number, specifier?: string): ((d: number | { valueOf(): number }) => string); - nice(count?: number): this; - copy(): ScaleLinear; + } +/** + * Constructs a new continuous linear scale with the unit domain [0, 1], the unit range [0, 1], the default interpolator and clamping disabled. + * + * The scale will have range and output of data type number. + */ export function scaleLinear(): ScaleLinear; +/** + * Constructs a new continuous linear scale with the unit domain [0, 1], the default interpolator and clamping disabled. + * + * The generic correponds to the data type of the range and output elements to be used. + * + * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scaleLinear(): ScaleLinear; +/** + * Constructs a new continuous linear scale with the unit domain [0, 1], the default interpolator and clamping disabled. + * + * The first generic corresponds to the data type of the range elements. + * The second generic corresponds to the data type of the output elements generated by the scale. + * + * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * convert the interpolated range element to a corresponding output element. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scaleLinear(): ScaleLinear; // ------------------------------------------------------------------------------- // Power Scale Factories // ------------------------------------------------------------------------------- +/** + * A continuous power scale defined over a numeric domain. + * + * Continuous scales map a continuous, quantitative input domain to a continuous output range. + * + * Each range value y can be expressed as a function of the domain value x: y = mx^k + b, where k is the exponent value. + * Power scales also support negative domain values, in which case the input value and the resulting output value are multiplied by -1. + * + * If the range is also numeric, the mapping may be inverted. + * + * Note that the data types of the range and output of the scale must be compatible with the interpolator applied by the scale. + * + * The first generic corresponds to the data type of the range elements. + * + * The second generic corresponds to the data type of the output elements generated by the scale. + * + * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * convert the interpolated range element to a corresponding output element. + */ +export interface ScalePower extends ScaleContinuousNumeric { -export interface ScalePower { - (value: number | { valueOf(): number }): Output; /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. Otherwise, returns NaN + * Returns the scale’s current interpolator factory, which defaults to interpolate. */ - invert(value: number | { valueOf(): number }): number; - domain(): Array; - domain(domain: Array): this; - range(): Array; - range(range: Array): this; - /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. - */ - rangeRound(range: Array): this; - clamp(): boolean; - clamp(clamp: boolean): this; interpolate(): InterpolatorFactory; - interpolate(interpolate: InterpolatorFactory): this; - interpolate(interpolate: InterpolatorFactory): ScalePower; - ticks(count?: number): Array; - tickFormat(count?: number, specifier?: string): ((d: number | { valueOf(): number }) => string); - nice(count?: number): this; - copy(): ScalePower; + /** + * Sets the scale’s range interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; + * these interpolators then map a normalized domain parameter t in [0, 1] to the corresponding value in the range. + * + * Note: the default interpolator may reuse return values. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. + * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); + * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. + * + * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + */ + interpolate(interpolate: InterpolatorFactory): this; + /** + * Sets the scale’s range interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; + * these interpolators then map a normalized domain parameter t in [0, 1] to the corresponding value in the range. + * + * Note: the default interpolator may reuse return values. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. + * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); + * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. + * + * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * + * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. + * + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + */ + interpolate(interpolate: InterpolatorFactory): ScalePower; + + /** + * If exponent is not specified, returns the current exponent, which defaults to 1. + * (Note that this is effectively a linear scale until you set a different exponent.) + */ exponent(): number; + /** + * Sets the current exponent to the given numeric value. + * (Note that this is effectively a linear scale until you set a different exponent.) + */ exponent(exponent: number): this; } +/** + * Constructs a new continuous power scale with the unit domain [0, 1], the unit range [0, 1], the exponent 1, the default interpolator and clamping disabled. + * (Note that this is effectively a linear scale until you set a different exponent.) + * + * The scale will have range and output of data type number. + */ export function scalePow(): ScalePower; +/** + * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 1, the default interpolator and clamping disabled. + * (Note that this is effectively a linear scale until you set a different exponent.) + * + * The generic correponds to the data type of the range and output elements to be used. + * + * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scalePow(): ScalePower; +/** + * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 1, the default interpolator and clamping disabled. + * (Note that this is effectively a linear scale until you set a different exponent.) + * + * The first generic corresponds to the data type of the range elements. + * The second generic corresponds to the data type of the output elements generated by the scale. + * + * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * convert the interpolated range element to a corresponding output element. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scalePow(): ScalePower; +/** + * Constructs a new continuous power scale with the unit domain [0, 1], the unit range [0, 1], the exponent 0.5, the default interpolator and clamping disabled. + * This is a convenience method equivalent to d3.scalePow().exponent(0.5). + * + * The scale will have range and output of data type number. + */ export function scaleSqrt(): ScalePower; +/** + * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 0.5, the default interpolator and clamping disabled. + * This is a convenience method equivalent to d3.scalePow().exponent(0.5). + * + * The generic correponds to the data type of the range and output elements to be used. + * + * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scaleSqrt(): ScalePower; +/** + * Constructs a new continuous power scale with the unit domain [0, 1], the exponent 0.5, the default interpolator and clamping disabled. + * This is a convenience method equivalent to d3.scalePow().exponent(0.5). + * + * The first generic corresponds to the data type of the range elements. + * The second generic corresponds to the data type of the output elements generated by the scale. + * + * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * convert the interpolated range element to a corresponding output element. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scaleSqrt(): ScalePower; // ------------------------------------------------------------------------------- // Logarithmic Scale Factory // ------------------------------------------------------------------------------- +/** + * A continuous logarithmic scale defined over a numeric domain. + * + * Continuous scales map a continuous, quantitative input domain to a continuous output range. + * + * The mapping to the range value y can be expressed as a function of the domain value x: y = m log(x) + b. + * + * As log(0) = -∞, a log scale domain must be strictly-positive or strictly-negative; the domain must not include or cross zero. + * A log scale with a positive domain has a well-defined behavior for positive values, and a log scale with a negative domain has a well-defined behavior for negative values. + * (For a negative domain, input and output values are implicitly multiplied by -1.) + * The behavior of the scale is undefined if you pass a negative value to a log scale with a positive domain or vice versa. + * + * If the range is also numeric, the mapping may be inverted. + * + * Note that the data types of the range and output of the scale must be compatible with the interpolator applied by the scale. + * + * The first generic corresponds to the data type of the range elements. + * + * The second generic corresponds to the data type of the output elements generated by the scale. + * + * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * convert the interpolated range element to a corresponding output element. + */ +export interface ScaleLogarithmic extends ScaleContinuousNumeric { -export interface ScaleLogarithmic { - (value: number | { valueOf(): number }): Output; /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. Otherwise, returns NaN + * Returns a copy of the scale’s current domain. + */ + domain(): number[]; + /** + * Sets the scale’s domain to the specified array of numbers. The array must contain two or more elements. + * If the elements in the given array are not numbers, they will be coerced to numbers + * + * As log(0) = -∞, a log scale domain must be strictly-positive or strictly-negative; the domain must not include or cross zero. + * A log scale with a positive domain has a well-defined behavior for positive values, and a log scale with a negative domain has a well-defined behavior for negative values. + * (For a negative domain, input and output values are implicitly multiplied by -1.) + * The behavior of the scale is undefined if you pass a negative value to a log scale with a positive domain or vice versa. + * + * Although continuous scales typically have two values each in their domain and range, specifying more than two values produces a piecewise scale. + * + * Internally, a piecewise scale performs a binary search for the range interpolator corresponding to the given domain value. + * Thus, the domain must be in ascending or descending order. If the domain and range have different lengths N and M, only the first min(N,M) elements in each are observed. + * + * @param domain Array of numeric domain values. */ - invert(value: number | { valueOf(): number }): number; - domain(): Array; domain(domain: Array): this; - range(): Array; - range(range: Array): this; - /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. - */ - rangeRound(range: Array): this; - clamp(): boolean; - clamp(clamp: boolean): this; - interpolate(): InterpolatorFactory; - interpolate(interpolate: InterpolatorFactory): this; - interpolate(interpolate: InterpolatorFactory): ScaleLogarithmic; - ticks(count?: number): Array; - tickFormat(count?: number, specifier?: string): ((d: number | { valueOf(): number }) => string); - nice(count?: number): this; - copy(): ScaleLogarithmic; + /** + * Returns the scale’s current interpolator factory, which defaults to interpolate. + */ + interpolate(): InterpolatorFactory; + + /** + * Sets the scale’s range interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; + * these interpolators then map a normalized domain parameter t in [0, 1] to the corresponding value in the range. + * + * Note: the default interpolator may reuse return values. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. + * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); + * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. + * + * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + */ + interpolate(interpolate: InterpolatorFactory): this; + /** + * Sets the scale’s range interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; + * these interpolators then map a normalized domain parameter t in [0, 1] to the corresponding value in the range. + * + * Note: the default interpolator may reuse return values. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. + * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); + * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. + * + * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * + * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. + * + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + */ + interpolate(interpolate: InterpolatorFactory): ScaleLogarithmic; + + /** + * Returns approximately count representative values from the scale’s domain. + * + * If count is not specified, it defaults to 10. + * + * If the base is an integer, the returned ticks are uniformly spaced within each integer power of base; otherwise, one tick per power of base is returned. + * The returned ticks are guaranteed to be within the extent of the domain. If the orders of magnitude in the domain is greater than count, then at most one tick per power is returned. + * Otherwise, the tick values are unfiltered, but note that you can use log.tickFormat to filter the display of tick labels. + * + * @param count Optional approximate number of ticks to be returned. If count is not specified, it defaults to 10. + */ + ticks(count?: number): number[]; + + /** + * Returns a number format function suitable for displaying a tick value, automatically computing the appropriate precision based on the fixed interval between tick values. + * + * The specified count typically has the same value as the count that is used to generate the tick values. If there are too many ticks, the formatter may return the empty string for some of the tick labels; + * however, note that the ticks are still shown. To disable filtering, specify a count of Infinity. When specifying a count, you may also provide a format specifier or format function. + * For example, to get a tick formatter that will display 20 ticks of a currency, say log.tickFormat(20, "$,f"). + * If the specifier does not have a defined precision, the precision will be set automatically by the scale, returning the appropriate format. + * This provides a convenient way of specifying a format whose precision will be automatically set by the scale. + * + * @param count Approximate number of ticks to be used when calculating precision for the number format function. + * @param specifier An optional valid format specifier string which allows a custom format where the precision of the format is automatically set by the scale as appropriate for the tick interval. + * For example, to get a tick formatter that will display 20 ticks of a currency, say log.tickFormat(20, "$,f"). + * If the specifier does not have a defined precision, the precision will be set automatically by the scale, returning the appropriate format. + * This provides a convenient way of specifying a format whose precision will be automatically set by the scale. + */ + tickFormat(count?: number, specifier?: string): ((d: number | { valueOf(): number }) => string); + + /** + * Extends the domain to integer powers of base. For example, for a domain of [0.201479…, 0.996679…], and base 10, the nice domain is [0.1, 1]. + * If the domain has more than two values, nicing the domain only affects the first and last value. + * + * Nicing a scale only modifies the current domain; it does not automatically nice domains that are subsequently set using continuous.domain. + * You must re-nice the scale after setting the new domain, if desired. + */ + nice(): this; + + /** + * Returns the current base, which defaults to 10. + */ base(): number; + /** + * Sets the base for this logarithmic scale to the specified value. + */ base(base: number): this; } +/** + * Constructs a new continuous logarithmic scale with the domain [1, 10], the unit range [0, 1], the base 10, the default interpolator and clamping disabled. + * + * The scale will have range and output of data type number. + */ export function scaleLog(): ScaleLogarithmic; +/** + * Constructs a new continuous logarithmic scale with the domain [1, 10], the base 10, the default interpolator and clamping disabled. + * + * The generic correponds to the data type of the range and output elements to be used. + * + * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scaleLog(): ScaleLogarithmic; +/** + * Constructs a new continuous logarithmic scale with the domain [1, 10], the base 10, the default interpolator and clamping disabled. + * + * The first generic corresponds to the data type of the range elements. + * The second generic corresponds to the data type of the output elements generated by the scale. + * + * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * convert the interpolated range element to a corresponding output element. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scaleLog(): ScaleLogarithmic; // ------------------------------------------------------------------------------- // Identity Scale Factory // ------------------------------------------------------------------------------- - +/** + * Identity scales are a special case of linear scales where the domain and range are identical; the scale and its invert method are thus the identity function. + * These scales are occasionally useful when working with pixel coordinates, say in conjunction with an axis or brush. + */ export interface ScaleIdentity { - (value: number | { valueOf(): number }): number; + /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. Otherwise, returns NaN + * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any. + * + * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. + * + * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation. + * + * @param value A numeric value from the domain. + */ + (value: number | { valueOf(): number }): number; + + /** + * Given a value from the range, returns the corresponding value from the domain. Inversion is useful for interaction, + * say to determine the data value corresponding to the position of the mouse. + * + * If the given value is outside the range, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the domain. + * + * IMPORTANT: This method is only supported if the range is numeric. If the range is not numeric, returns NaN. + * + * For a valid value y in the range, continuous(continuous.invert(y)) approximately equals y; + * similarly, for a valid value x in the domain, continuous.invert(continuous(x)) approximately equals x. + * The scale and its inverse may not be exact due to the limitations of floating point precision. + * + * @param value A numeric value from the range. */ invert(value: number | { valueOf(): number }): number; - domain(): Array; + + /** + * Returns a copy of the scale’s current domain. + */ + domain(): number[]; + /** + * Sets the scale’s domain to the specified array of numbers. The array must contain two or more elements. + * If the elements in the given array are not numbers, they will be coerced to numbers + * + * Although continuous scales typically have two values each in their domain and range, specifying more than two values produces a piecewise scale. + * + * Internally, a piecewise scale performs a binary search for the range interpolator corresponding to the given domain value. + * Thus, the domain must be in ascending or descending order. If the domain and range have different lengths N and M, only the first min(N,M) elements in each are observed. + * + * @param domain Array of numeric domain values. + */ domain(domain: Array): this; - range(): Array; + + /** + * Returns a copy of the scale’s current range. + */ + range(): number[]; + /** + * Sets the scale’s range to the specified array of values. + * + * The array must contain two or more elements. Unlike the domain, elements in the given array need not be numbers; + * any value that is supported by the underlying interpolator will work, though note that numeric ranges are required for invert. + * + * @param range Array of range values. + */ range(range: Array): this; - ticks(count?: number): Array; + + /** + * Returns approximately count representative values from the scale’s domain. + * + * If count is not specified, it defaults to 10. + * + * The returned tick values are uniformly spaced, have human-readable values (such as multiples of powers of 10), + * and are guaranteed to be within the extent of the domain. Ticks are often used to display reference lines, or tick marks, in conjunction with the visualized data. + * The specified count is only a hint; the scale may return more or fewer values depending on the domain. See also d3-array’s ticks. + * + * @param count Optional approximate number of ticks to be returned. If count is not specified, it defaults to 10. + */ + ticks(count?: number): number[]; + + /** + * Returns a number format function suitable for displaying a tick value, automatically computing the appropriate precision based on the fixed interval between tick values. + * The specified count should have the same value as the count that is used to generate the tick values. + * + * @param count Approximate number of ticks to be used when calculating precision for the number format function. + * @param specifier An optional valid format specifier string which allows a custom format where the precision of the format is automatically set by the scale as appropriate for the tick interval. + * If specifier uses the format type "s", the scale will return a SI-prefix format based on the largest value in the domain. + * If the specifier already specifies a precision, this method is equivalent to locale.format. + */ tickFormat(count?: number, specifier?: string): ((d: number | { valueOf(): number }) => string); + + /** + * Extends the domain so that it starts and ends on nice round values. + * This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. + * An optional tick count argument allows greater control over the step size used to extend the bounds, + * guaranteeing that the returned ticks will exactly cover the domain. + * Nicing is useful if the domain is computed from data, say using extent, and may be irregular. + * For example, for a domain of [0.201479…, 0.996679…], a nice domain might be [0.2, 1.0]. + * If the domain has more than two values, nicing the domain only affects the first and last value. + * + * Nicing a scale only modifies the current domain; it does not automatically nice domains that are subsequently set using continuous.domain. + * You must re-nice the scale after setting the new domain, if desired. + * + * @param count An optional number of ticks expexted to be used. + */ nice(count?: number): this; + + /** + * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. + */ copy(): ScaleIdentity; } +/** + * Constructs a new identity scale with the unit domain [0, 1] and the unit range [0, 1]. + */ export function scaleIdentity(): ScaleIdentity; @@ -162,170 +691,850 @@ export function scaleIdentity(): ScaleIdentity; // Time Scale Factories // ------------------------------------------------------------------------------- +/** + * A linear scale defined over a temporal domain. + * + * Time scales implement ticks based on calendar intervals, taking the pain out of generating axes for temporal domains. + * + * If the range is numeric, the mapping may be inverted to return a date. + * + * Note that the data types of the range and output of the scale must be compatible with the interpolator applied by the scale. + * + * The first generic corresponds to the data type of the range elements. + * + * The second generic corresponds to the data type of the output elements generated by the scale. + * + * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * convert the interpolated range element to a corresponding output element. + */ export interface ScaleTime { - (value: Date): Output; + /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. Otherwise, returns NaN + * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any. + * + * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. + * + * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation. + * + * @param value A temporal value from the domain. If the value is not a Date, it will be coerced to Date. + */ + (value: Date | number | { valueOf(): number }): Output; + + /** + * Given a value from the range, returns the corresponding value from the domain. Inversion is useful for interaction, + * say to determine the data value corresponding to the position of the mouse. + * + * If the given value is outside the range, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the domain. + * + * IMPORTANT: This method is only supported if the range is numeric. If the range is not numeric, returns Invalid Date. + * + * For a valid value y in the range, time(time.invert(y)) equals y; similarly, for a valid value x in the domain, time.invert(time(x)) equals x. + * The invert method is useful for interaction, say to determine the value in the domain that corresponds to the pixel location under the mouse. + * + * @param value A numeric value from the range. */ invert(value: number | { valueOf(): number }): Date; - domain(): Array; - domain(domain: Array): this; - range(): Array; - range(range: Array): this; + /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. + * Returns a copy of the scale’s current domain. + */ + domain(): Date[]; + + /** + * Sets the scale’s domain to the specified array of temporal domain values. The array must contain two or more elements. + * If the elements in the given array are not dates, they will be coerced to dates. + * + * Although continuous scales typically have two values each in their domain and range, specifying more than two values produces a piecewise scale. + * + * Internally, a piecewise scale performs a binary search for the range interpolator corresponding to the given domain value. + * Thus, the domain must be in ascending or descending order. If the domain and range have different lengths N and M, only the first min(N,M) elements in each are observed. + * + * @param domain Array of temporal domain values. Numeric values will be coerced to dates. + */ + domain(domain: Array): this; + + /** + * Returns a copy of the scale’s current range. + */ + range(): Range[]; + /** + * Sets the scale’s range to the specified array of values. + * + * The array must contain two or more elements. Unlike the domain, elements in the given array need not be temporal domain values; + * any value that is supported by the underlying interpolator will work, though note that numeric ranges are required for invert. + * + * @param range Array of range values. + */ + range(range: Range[]): this; + + /** + * Sets the scale’s range to the specified array of values while also setting the scale’s interpolator to interpolateRound. + * + * The rounding interpolator is sometimes useful for avoiding antialiasing artifacts, + * though also consider the shape-rendering “crispEdges” styles. Note that this interpolator can only be used with numeric ranges. + * + * The array must contain two or more elements. Unlike the domain, elements in the given array need not be temporal domain values; + * any value that is supported by the underlying interpolator will work, though note that numeric ranges are required for invert. + * + * @param range Array of range values. */ rangeRound(range: Array): this; + + /** + * Returns whether or not the scale currently clamps values to within the range. + */ clamp(): boolean; + /** + * Enables or disables clamping, respectively. If clamping is disabled and the scale is passed a value outside the domain, + * the scale may return a value outside the range through extrapolation. + * + * If clamping is enabled, the return value of the scale is always within the scale’s range. Clamping similarly applies to the "invert" method. + * + * @param clamp A flag to enable (true) or disable (false) clamping. + */ clamp(clamp: boolean): this; + + /** + * Returns the scale’s current interpolator factory, which defaults to interpolate. + */ interpolate(): InterpolatorFactory; + + /** + * Sets the scale’s range interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; + * these interpolators then map a normalized domain parameter t in [0, 1] to the corresponding value in the range. + * + * Note: the default interpolator may reuse return values. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. + * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); + * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. + * + * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + */ interpolate(interpolate: InterpolatorFactory): this; + /** + * Sets the scale’s range interpolator factory. This interpolator factory is used to create interpolators for each adjacent pair of values from the range; + * these interpolators then map a normalized domain parameter t in [0, 1] to the corresponding value in the range. + * + * Note: the default interpolator may reuse return values. For example, if the range values are objects, then the value interpolator always returns the same object, modifying it in-place. + * If the scale is used to set an attribute or style, this is typically acceptable (and desirable for performance); + * however, if you need to store the scale’s return value, you must specify your own interpolator or make a copy as appropriate. + * + * As part of the interpolation process the interpotaled value from the range may be converted to a corresponding output value. + * + * The generic "NewOutput" can be used to change the scale to have a different output element type corresponding to the new interpolation factory. + * + * @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale. + */ interpolate(interpolate: InterpolatorFactory): ScaleTime; - ticks(): Array; - ticks(count: number): Array; - ticks(interval: TimeInterval): Array; + + /** + * Returns representative dates from the scale’s domain. The returned tick values are uniformly-spaced (mostly), + * have sensible values (such as every day at midnight), and are guaranteed to be within the extent of the domain. + * Ticks are often used to display reference lines, or tick marks, in conjunction with the visualized data. + * + * Without specifying a count or time interval to control the number of ticks returned, a default count of 10 is used. + * The specified count is only a hint; the scale may return more or fewer values depending on the domain. + */ + ticks(): Date[]; + /** + * Returns representative dates from the scale’s domain. The returned tick values are uniformly-spaced (mostly), + * have sensible values (such as every day at midnight), and are guaranteed to be within the extent of the domain. + * Ticks are often used to display reference lines, or tick marks, in conjunction with the visualized data. + * + * The specified count controls the number of ticks to be returned. The specified count is only a hint; + * the scale may return more or fewer values depending on the domain. + * + * @param count Expected number of ticks. + */ + ticks(count: number): Date[]; + /** + * Returns representative dates from the scale’s domain. The returned tick values are uniformly-spaced (mostly), + * have sensible values (such as every day at midnight), and are guaranteed to be within the extent of the domain. + * Ticks are often used to display reference lines, or tick marks, in conjunction with the visualized data. + * + * The specified time interval controls the ticks generated and returned. To prune the generated ticks for a given time interval, + * use interval.every(...) or interval.filter(...). + * + * @param interval A time interval to specify the expected ticks. + */ + ticks(interval: TimeInterval): Date[]; + + /** + * Returns a time format function suitable for displaying tick values. + * + * The default multi-scale time format chooses a human-readable representation based on the specified date as follows: + * + * - %Y - for year boundaries, such as 2011. + * - %B - for month boundaries, such as February. + * - %b %d - for week boundaries, such as Feb 06. + * - %a %d - for day boundaries, such as Mon 07. + * - %I %p - for hour boundaries, such as 01 AM. + * - %I:%M - for minute boundaries, such as 01:23. + * - :%S - for second boundaries, such as :45. + * - .%L - milliseconds for all other times, such as .012. + * + * Although somewhat unusual, this default behavior has the benefit of providing both local and global context: + * for example, formatting a sequence of ticks as [11 PM, Mon 07, 01 AM] reveals information about hours, dates, and day simultaneously, + * rather than just the hours [11 PM, 12 AM, 01 AM]. + */ tickFormat(): ((d: Date) => string); + /** + * Returns a time format function suitable for displaying tick values. + * + * The specified count is currently ignored, but is accepted for consistency with other scales such as continuous.tickFormat. + * + * @param count Expected number of ticks. (Currently ignored) + * @param specifier An optional valid date format specifier string (see d3-time-format). + */ tickFormat(count: number, specifier?: string): ((d: Date) => string); + /** + * Returns a time format function suitable for displaying tick values. + * + * The specified time interval is currently ignored, but is accepted for consistency with other scales such as continuous.tickFormat. + * + * @param interval A time interval to specify the expected ticks. (Currently ignored) + * @param specifier An optional valid date format specifier string (see d3-time-format). + */ tickFormat(interval: TimeInterval, specifier?: string): ((d: Date) => string); + + /** + * Extends the domain so that it starts and ends on nice round values. + * This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. + * + * Nicing is useful if the domain is computed from data, say using extent, and may be irregular. + * For example, for a domain of [2009-07-13T00:02, 2009-07-13T23:48], the nice domain is [2009-07-13, 2009-07-14]. + * If the domain has more than two values, nicing the domain only affects the first and last value. + */ nice(): this; + /** + * Extends the domain so that it starts and ends on nice round values. + * This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. + * + * A tick count argument allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain. + * + * Nicing is useful if the domain is computed from data, say using extent, and may be irregular. + * For example, for a domain of [2009-07-13T00:02, 2009-07-13T23:48], the nice domain is [2009-07-13, 2009-07-14]. + * If the domain has more than two values, nicing the domain only affects the first and last value. + * + * @param count Expected number of ticks. + */ nice(count: number): this; + /** + * Extends the domain so that it starts and ends on nice round values. + * This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. + * + * a time interval may be specified to explicitly set the ticks. If an interval is specified, an optional step may also be specified to skip some ticks. + * For example, time.nice(d3.timeSecond, 10) will extend the domain to an even ten seconds (0, 10, 20, etc.). + * + * Nicing is useful if the domain is computed from data, say using extent, and may be irregular. + * For example, for a domain of [2009-07-13T00:02, 2009-07-13T23:48], the nice domain is [2009-07-13, 2009-07-14]. + * If the domain has more than two values, nicing the domain only affects the first and last value. + * + * @param interval A time interval to specify the expected ticks. + * @param step An optional step number to be applied to the time interval when considering ticks. + */ nice(interval: CountableTimeInterval, step?: number): this; - copy(): ScaleTime; + + /** + * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. + */ + copy(): this; } +/** + * Constructs a new time scale using local time with the domain [2000-01-01, 2000-01-02], the unit range [0, 1], the default interpolator and clamping disabled. + * + * The scale will have range and output of data type number. + */ export function scaleTime(): ScaleTime; +/** + * Constructs a new time scale using local time with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. + * + * The generic correponds to the data type of the range and output elements to be used. + * + * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scaleTime(): ScaleTime; +/** + * Constructs a new time scale using local time with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. + * + * The first generic corresponds to the data type of the range elements. + * The second generic corresponds to the data type of the output elements generated by the scale. + * + * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * convert the interpolated range element to a corresponding output element. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scaleTime(): ScaleTime; +/** + * Constructs a new time scale using Coordinated Universal Time (UTC) with the domain [2000-01-01, 2000-01-02], the unit range [0, 1], the default interpolator and clamping disabled. + * + * The scale will have range and output of data type number. + */ export function scaleUtc(): ScaleTime; +/** + * Constructs a new time scale using Coordinated Universal Time (UTC) with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. + * + * The generic correponds to the data type of the range and output elements to be used. + * + * As range type and output type are the same, the interpolator factory used with the scale must match this behaviour. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scaleUtc(): ScaleTime; +/** + * Constructs a new time scale using Coordinated Universal Time (UTC) with the domain [2000-01-01, 2000-01-02], the default interpolator and clamping disabled. + * + * The first generic corresponds to the data type of the range elements. + * The second generic corresponds to the data type of the output elements generated by the scale. + * + * If range element and output element type differ, the interpolator factory used with the scale must match this behaviour and + * convert the interpolated range element to a corresponding output element. + * + * The range must be set in accordance with the range element type. + * + * The interpolator factory may be set using the interpolate(...) method of the scale. + */ export function scaleUtc(): ScaleTime; // ------------------------------------------------------------------------------- // Sequential Scale Factory // ------------------------------------------------------------------------------- - +/** + * Sequential scales are similar to continuous scales in that they map a continuous, + * numeric input domain to a continuous output range. However, unlike continuous scales, + * the output range of a sequential scale is fixed by its interpolator and not configurable. + * + * The generic corresponds to the data type of the output of the interpolator underlying the scale. + */ export interface ScaleSequential { + + /** + * Given a value from the domain, returns the corresponding value from the output range, subject to interpolation. + * + * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range. + * + * @param value A numeric value from the domain. + */ (value: number | { valueOf(): number }): Output; + + /** + * Returns a copy of the scale’s current domain. + */ domain(): [number, number]; + /** + * Sets the scale’s domain to the specified array of numbers. The array must contain exactly two elements. + * If the elements in the given array are not numbers, they will be coerced to numbers + * + * @param domain A two-element array of numeric domain values. + */ domain(domain: [number | { valueOf(): number }, number | { valueOf(): number }]): this; + + /** + * Returns whether or not the scale currently clamps values to within the range. + */ clamp(): boolean; + /** + * Enables or disables clamping, respectively. If clamping is disabled and the scale is passed a value outside the domain, + * the scale may return a value outside the range through extrapolation. + * + * If clamping is enabled, the return value of the scale is always within the scale’s range. Clamping similarly applies to the "invert" method. + * + * @param clamp A flag to enable (true) or disable (false) clamping. + */ clamp(clamp: boolean): this; + + /** + * Returns the current interpolator underlying the scale. + */ interpolator(): ((t: number) => Output); + /** + * Sets the scale’s interpolator to the specified function. + * + * @param interpolator An interpolator function mapping a value from the [0, 1] interval to an output value. + */ interpolator(interpolator: ((t: number) => Output)): this; + /** + * Sets the scale’s interpolator to the specified function. + * + * The generic corresponds to a the new output type of the scale. The output type of the scale is determined by the output type of the interpolator function. + * + * @param interpolator An interpolator function mapping a value from the [0, 1] interval to an output value. + */ interpolator(interpolator: ((t: number) => NewOutput)): ScaleSequential; + + /** + * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. + */ copy(): ScaleSequential; } +/** + * Constructs a new sequential scale with the given interpolator function. When the scale is applied, the interpolator will be invoked with a value typically in the range [0, 1], + * where 0 represents the start of the domain, and 1 represents the end of the domain. + * + * The generic corresponds to the data type of the output of the interpolator underlying the scale. + * + * @param interpolator The interpolator function to be used with the scale. + */ export function scaleSequential(interpolator: ((t: number) => Output)): ScaleSequential; // ------------------------------------------------------------------------------- // Color Interpolators for Sequential Scale Factory // ------------------------------------------------------------------------------- - +/** + * Given a number t in the range [0,1], returns the corresponding color from the “viridis” perceptually-uniform color scheme designed by van der Walt, Smith and Firing for matplotlib, + * represented as an RGB string. + * + * @param t A number in the interval [0, 1]. + */ export function interpolateViridis(t: number): string; -export function interpolateMagma(t: number): string; - +/** + * Given a number t in the range [0,1], returns the corresponding color from the “inferno” perceptually-uniform color scheme designed by van der Walt and Smith for matplotlib, + * represented as an RGB string. + * + * @param t A number in the interval [0, 1]. + */ export function interpolateInferno(t: number): string; +/** + * Given a number t in the range [0,1], returns the corresponding color from the “magma” perceptually-uniform color scheme designed by van der Walt and Smith for matplotlib, + * represented as an RGB string. + * + * @param t A number in the interval [0, 1]. + */ +export function interpolateMagma(t: number): string; + +/** + * Given a number t in the range [0,1], returns the corresponding color from the “plasma” perceptually-uniform color scheme designed by van der Walt and Smith for matplotlib, + * represented as an RGB string. + * + * @param t A number in the interval [0, 1]. + */ export function interpolatePlasma(t: number): string; -export function interpolateRainbow(t: number): string; - +/** + * Given a number t in the range [0,1], returns the corresponding color from a 180° rotation of Niccoli’s perceptual rainbow, represented as an RGB string. + * + * @param t A number in the interval [0, 1]. + */ export function interpolateWarm(t: number): string; +/** + * Given a number t in the range [0,1], returns the corresponding color from Niccoli’s perceptual rainbow, represented as an RGB string. + * + * @param t A number in the interval [0, 1]. + */ export function interpolateCool(t: number): string; +/** + * Given a number t in the range [0,1], returns the corresponding color from d3.interpolateWarm scale from [0.0, 0.5] followed by the d3.interpolateCool scale from [0.5, 1.0], + * thus implementing the cyclical less-angry rainbow color scheme. + * + * @param t A number in the interval [0, 1]. + */ +export function interpolateRainbow(t: number): string; + +/** + * Given a number t in the range [0,1], returns the corresponding color from Green’s default Cubehelix represented as an RGB string. + * + * @param t A number in the interval [0, 1]. + */ export function interpolateCubehelixDefault(t: number): string; // ------------------------------------------------------------------------------- // Quantize Scale Factory // ------------------------------------------------------------------------------- +/** + * Quantize scales are similar to linear scales, except they use a discrete rather than continuous range. + * The continuous input domain is divided into uniform segments based on the number of values in (i.e., the cardinality of) the output range. + * + * Each range value y can be expressed as a quantized linear function of the domain value x: y = m round(x) + b. + * + * The generic corresponds to the data type of the range elements. + */ export interface ScaleQuantize { + /** + * Given a value in the input domain, returns the corresponding value in the output range. + */ (value: number | { valueOf(): number }): Range; /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. Otherwise, returns NaN + * Returns the extent of values in the domain [x0, x1] for the corresponding value in the range: the inverse of quantize. + * This method is useful for interaction, say to determine the value in the domain that corresponds to the pixel location under the mouse. + * + * If an invalid range value is entered, returns [NaN, NaN]. + * + * @param value A value from the range. */ invertExtent(value: Range): [number, number]; + + /** + * Returns the scale’s current domain. + */ domain(): [number, number]; + + /** + * Sets the scale’s domain to the specified two-element array of numbers. + * If the elements in the given array are not numbers, they will be coerced to numbers. + * + * @param domain A two-element array of numeric values defining the domain. + */ domain(domain: [number | { valueOf(): number }, number | { valueOf(): number }]): this; - range(): Array; - range(range: Array): this; - ticks(count?: number): Array; + + /** + * Returns the scale’s current range. + */ + range(): Range[]; + /** + * Sets the scale’s range to the specified array of values. The array may contain any number of discrete values. + * + * @param range Array of range values. + */ + range(range: Range[]): this; + + /** + * Returns approximately count representative values from the scale’s domain. + * + * If count is not specified, it defaults to 10. + * + * The returned tick values are uniformly spaced, have human-readable values (such as multiples of powers of 10), + * and are guaranteed to be within the extent of the domain. Ticks are often used to display reference lines, or tick marks, in conjunction with the visualized data. + * The specified count is only a hint; the scale may return more or fewer values depending on the domain. See also d3-array’s ticks. + * + * @param count Optional approximate number of ticks to be returned. If count is not specified, it defaults to 10. + */ + ticks(count?: number): number[]; + + /** + * Returns a number format function suitable for displaying a tick value, automatically computing the appropriate precision based on the fixed interval between tick values. + * The specified count should have the same value as the count that is used to generate the tick values. + * + * @param count Approximate number of ticks to be used when calculating precision for the number format function. + * @param specifier An optional valid format specifier string which allows a custom format where the precision of the format is automatically set by the scale as appropriate for the tick interval. + * If specifier uses the format type "s", the scale will return a SI-prefix format based on the largest value in the domain. + * If the specifier already specifies a precision, this method is equivalent to locale.format. + */ tickFormat(count?: number, specifier?: string): ((d: number | { valueOf(): number }) => string); + + /** + * Extends the domain so that it starts and ends on nice round values. + * This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. + * + * Nicing is useful if the domain is computed from data, say using extent, and may be irregular. + * For example, for a domain of [0.201479…, 0.996679…], a nice domain might be [0.2, 1.0]. + * + * Nicing a scale only modifies the current domain; it does not automatically nice domains that are subsequently set using continuous.domain. + * You must re-nice the scale after setting the new domain, if desired. + * + * @param count An optional number of ticks expexted to be used. + */ nice(count?: number): this; - copy(): ScaleQuantize; + + /** + * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. + */ + copy(): this; } +/** + * Constructs a new quantize scale with the unit domain [0, 1] and the unit range [0, 1]. + * Thus, the default quantize scale is equivalent to the Math.round function. + */ export function scaleQuantize(): ScaleQuantize; + +/** + * Constructs a new quantize scale with the unit domain [0, 1]. + * + * The range must be set corresponding to the type of the range elements. + * + * The generic corresponds to the data type of the range elements. + */ export function scaleQuantize(): ScaleQuantize; // ------------------------------------------------------------------------------- // Quantile Scale Factory // ------------------------------------------------------------------------------- +/** + * Quantile scales map a sampled input domain to a discrete range. The domain is considered continuous and thus the scale will accept any reasonable input value; + * however, the domain is specified as a discrete set of sample values. The number of values in (the cardinality of) the output range determines the number of quantiles that will be computed from the domain. + * To compute the quantiles, the domain is sorted, and treated as a population of discrete values; see d3-array’s quantile. + * + * The generic correponds to the data type of range elements. + */ export interface ScaleQuantile { + + /** + * Given a value in the input domain, returns the corresponding value in the output range. + * + * @param value A numeric value in the input domain. + */ (value: number | { valueOf(): number }): Range; + + /** + * Returns the extent of values in the domain [x0, x1] for the corresponding value in the range: the inverse of quantile. + * This method is useful for interaction, say to determine the value in the domain that corresponds to the pixel location under the mouse. + * + * @param value A value from the range. + */ invertExtent(value: Range): [number, number]; - domain(): Array; - domain(domain: Array): this; - range(): Array; - range(range: Array): this; - quantiles(): Array; - copy(): ScaleQuantile; + + /** + * Returns the scale’s current domain. + */ + domain(): number[]; + /** + * Sets the domain of the quantile scale to the specified set of discrete numeric values. + * The array must not be empty, and must contain at least one numeric value; NaN, null and undefined values are ignored and not considered part of the sample population. + * + * If the elements in the given array are not numbers, they will be coerced to numbers. A copy of the input array is sorted and stored internally. + * + * @param domain Array of domain values. + */ + domain(domain: Array): this; + + /** + * Returns the current range. + */ + range(): Range[]; + /** + * Sets the discrete values in the range. The array must not be empty. + * The number of values in (the cardinality, or length, of) the range array determines the number of quantiles that are computed. + * + * For example, to compute quartiles, range must be an array of four elements such as [0, 1, 2, 3]. + * + * @param range Array of range values. + */ + range(range: Range[]): this; + + /** + * Returns the quantile thresholds. If the range contains n discrete values, the returned array will contain n - 1 thresholds. + * Values less than the first threshold are considered in the first quantile; + * values greater than or equal to the first threshold but less than the second threshold are in the second quantile, and so on. + * Internally, the thresholds array is used with bisect to find the output quantile associated with the given input value. + */ + quantiles(): number[]; + + /** + * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. + */ + copy(): this; } +/** + * Constructs a new quantile scale with an empty domain and an empty range. + * The quantile scale is invalid until both a domain and range are specified. + */ export function scaleQuantile(): ScaleQuantile; + +/** + * Constructs a new quantile scale with an empty domain and an empty range. + * The quantile scale is invalid until both a domain and range are specified. + * + * The generic correponds to the data type of range elements. + */ export function scaleQuantile(): ScaleQuantile; // ------------------------------------------------------------------------------- // Threshold Scale Factory // ------------------------------------------------------------------------------- -// TODO: review Domain Type, should be naturally orderable +/** + * Threshold scales are similar to quantize scales, except they allow you to map arbitrary subsets of the domain to discrete values in the range. + * The input domain is still continuous, and divided into slices based on a set of threshold values. + * + * If the number of values in the scale’s range is N+1, the number of values in the scale’s domain must be N. If there are fewer than N elements in the domain, the additional values in the range are ignored. + * If there are more than N elements in the domain, the scale may return undefined for some inputs. + * + * The first generic corresponds to the data type of domain values. + * The second generic corresponds to the data type of range values. + */ export interface ScaleThreshold { - (value: Domain): Range; /** - * Important: While value should come out of range R, this is method is only applicable to - * values that can be coerced to numeric. Otherwise, returns NaN + * Given a value in the input domain, returns the corresponding value in the output range. + * + * @param value A domain value. */ - invertExtent(value: Range): [Domain, Domain] | [undefined, Domain] | [Domain, undefined] | [undefined, undefined]; - domain(): Array; - domain(domain: Array): this; - range(): Array; - range(range: Array): this; - copy(): ScaleThreshold; + (value: Domain): Range; + + /** + * Returns the extent of values in the domain [x0, x1] for the corresponding value in the range, representing the inverse mapping from range to domain. + * This method is useful for interaction, say to determine the value in the domain that corresponds to the pixel location under the mouse. + * + * @param value A range value. + */ + invertExtent(value: Range): [Domain | undefined, Domain | undefined]; + + /** + * Returns the scale’s current domain. + */ + domain(): Domain[]; + /** + * Sets the scale’s domain to the specified array of values. The values must be in sorted ascending order, or the behavior of the scale is undefined. + * The values are typically numbers, but any naturally ordered values (such as strings) will work; a threshold scale can be used to encode any type that is ordered. + * If the number of values in the scale’s range is N+1, the number of values in the scale’s domain must be N. + * If there are fewer than N elements in the domain, the additional values in the range are ignored. + * If there are more than N elements in the domain, the scale may return undefined for some inputs. + * + * @param domain Array of domain values. + */ + domain(domain: Domain[]): this; + + /** + * Returns the scale’s current range. + */ + range(): Range[]; + /** + * Sets the scale’s range to the specified array of values. If the number of values in the scale’s domain is N, the number of values in the scale’s range must be N+1. + * If there are fewer than N+1 elements in the range, the scale may return undefined for some inputs. + * If there are more than N+1 elements in the range, the additional values are ignored. + * + * @param range Array of range values. + */ + range(range: Range[]): this; + + /** + * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. + */ + copy(): this; } +/** + * Constructs a new threshold scale with the default domain [0.5] and the default range [0, 1]. + * Thus, the default threshold scale is equivalent to the Math.round function for numbers; for example threshold(0.49) returns 0, and threshold(0.51) returns 1. + */ export function scaleThreshold(): ScaleThreshold; +/** + * Constructs a new threshold scale. The domain and range must be set corresponding to the type of the corresponding generic. + * + * The first generic corresponds to the data type of domain values. + * The second generic corresponds to the data type of range values. + */ export function scaleThreshold(): ScaleThreshold; // ------------------------------------------------------------------------------- // Ordinal Scale Factory // ------------------------------------------------------------------------------- - +/** + * Unlike continuous scales, ordinal scales have a discrete domain and range. For example, an ordinal scale might map a set of named categories to a set of colors, + * or determine the horizontal positions of columns in a column chart. + * + * The first element in the domain will be mapped to the first element in range, the second domain value to the second range value, and so on. + * If there are fewer elements in the range than in the domain, the scale will reuse values from the start of the range. + * + * The first generic corresponds to the data type of domain values. + * The second generic corresponds to the data type of range values. + */ export interface ScaleOrdinal { + /** + * Given a value in the input domain, returns the corresponding value in the output range. + * If the given value is not in the scale’s domain, returns the unknown; or, if the unknown value is implicit (the default), + * then the value is implicitly added to the domain and the next-available value in the range is assigned to value, + * such that this and subsequent invocations of the scale given the same input value return the same output value. + * + * @param x A value from the domain. + */ (x: Domain): Range; - domain(): Array; - domain(domain: Array): this; - range(): Array; - range(range: Array): this; + + /** + * Returns the scale's current domain. + */ + domain(): Domain[]; + /** + * Sets the domain to the specified array of values. + * + * The first element in domain will be mapped to the first element in the range, + * the second domain value to the second range value, and so on. + * + * Domain values are stored internally in a map from stringified value to index; the resulting index is then used to retrieve a value from the range. + * Thus, an ordinal scale’s values must be coercible to a string, and the stringified version of the domain value uniquely identifies the corresponding range value. + * + * Setting the domain on an ordinal scale is optional if the unknown value is implicit (the default). + * In this case, the domain will be inferred implicitly from usage by assigning each unique value passed to the scale a new value from the range. + * Note that an explicit domain is recommended to ensure deterministic behavior, as inferring the domain from usage will be dependent on ordering. + * + * @param domain Array of domain values. + */ + domain(domain: Domain[]): this; + + /** + * Returns the scale's current range. + */ + range(): Range[]; + /** + * Sets the range of the ordinal scale to the specified array of values. + * + * The first element in the domain will be mapped to the first element in range, the second domain value to the second range value, and so on. + * + * If there are fewer elements in the range than in the domain, the scale will reuse values from the start of the range. + * + * @param range Array of range values. + */ + range(range: Range[]): this; + + /** + * Returns the current unknown value, which defaults to "implicit". + */ unknown(): Range | { name: 'implicit' }; + /** + * Sets the output value of the scale for unknown input values and returns this scale. + * The implicit value enables implicit domain construction. scaleImplicit can be used as a convenience to set the implicit value. + * + * @param value Unknown value to be used or scaleImplicit to set implicit scale generation. + */ unknown(value: Range | { name: 'implicit' }): this; - copy(): ScaleOrdinal; + + /** + * Returns an exact copy of this ordinal scale. Changes to this scale will not affect the returned scale, and vice versa. + */ + copy(): this; } -export function scaleOrdinal(range?: Array): ScaleOrdinal; -export function scaleOrdinal(range?: Array): ScaleOrdinal; +/** + * Constructs a new ordinal scale with an empty domain and the specified range. + * If a range is not specified, it defaults to the empty array; an ordinal scale always returns undefined until a non-empty range is defined. + * + * By default, the domain is configured to generate implicitly, if the scale is invoked with an unknown value. + * See the "unknown(...)" method of the scale to change this behavior. + * + * The generic corresponds to the data type of range elements. + * + * @parm range An optional array of range values to initialize the scale with. + */ +export function scaleOrdinal(range?: Range[]): ScaleOrdinal; +/** + * Constructs a new ordinal scale with an empty domain and the specified range. + * If a range is not specified, it defaults to the empty array; an ordinal scale always returns undefined until a non-empty range is defined. + * + * By default, the domain is configured to generate implicitly, if the scale is invoked with an unknown value. + * See the "unknown(...)" method of the scale to change this behavior. + * + * The first generic corresponds to the data type of domain elements. + * The second generic corresponds to the data type of range elements. + * + * @parm range An optional array of range values to initialize the scale with. + */ +export function scaleOrdinal(range?: Range[]): ScaleOrdinal; +/** + * A special value for ordinal.unknown that enables implicit domain construction: unknown values are implicitly added to the domain. + */ export const scaleImplicit: { name: 'implicit' }; @@ -333,70 +1542,285 @@ export const scaleImplicit: { name: 'implicit' }; // Band Scale Factory // ------------------------------------------------------------------------------- +/** + * Band scales are like ordinal scales except the output range is continuous and numeric. + * Discrete output values are automatically computed by the scale by dividing the continuous range into uniform bands. + * Band scales are typically used for bar charts with an ordinal or categorical dimension. + * The unknown value of a band scale is effectively undefined: they do not allow implicit domain construction. + * + * The generic corresponds to the data type of domain elements. + */ export interface ScaleBand { + /** + * Given a value in the input domain, returns the start of the corresponding band derived from the output range. + * If the given value is not in the scale’s domain, returns undefined. + * + * @param x A value from the domain. + */ (x: Domain): number | undefined; - domain(): Array; - domain(domain: Array): this; + + /** + * Returns to scale's current domain + */ + domain(): Domain[]; + /** + * Sets the domain to the specified array of values. The first element in domain will be mapped to the first band, the second domain value to the second band, and so on. + * Domain values are stored internally in a map from stringified value to index; the resulting index is then used to determine the band. + * Thus, a band scale’s values must be coercible to a string, and the stringified version of the domain value uniquely identifies the corresponding band. + * + * @param domain Array of domain values. + */ + domain(domain: Domain[]): this; + + /** + * Returns the scale’s current range, which defaults to [0, 1]. + */ range(): [number, number]; + /** + * Sets the scale’s range to the specified two-element array of numbers. If the elements in the given array are not numbers, they will be coerced to numbers. + * The default range is [0, 1]. + * + * @param range A two-element array of numeric values. + */ range(range: [number | { valueOf(): number }, number | { valueOf(): number }]): this; + + /** + * Sets the scale’s range to the specified two-element array of numbers while also enabling rounding. + * If the elements in the given array are not numbers, they will be coerced to numbers. + * + * Rounding is sometimes useful for avoiding antialiasing artifacts, though also consider the shape-rendering “crispEdges” styles. + * + * @param range A two-element array of numeric values. + */ rangeRound(range: [number | { valueOf(): number }, number | { valueOf(): number }]): this; + + /** + * Returns the current rounding status for the scale: enabled (= true) or disabled (= false). + */ round(): boolean; + /** + * Enables or disables rounding accordingly. If rounding is enabled, the start and stop of each band will be integers. + * Rounding is sometimes useful for avoiding antialiasing artifacts, though also consider the shape-rendering “crispEdges” styles. + * Note that if the width of the domain is not a multiple of the cardinality of the range, there may be leftover unused space, even without padding! + * Use band.align to specify how the leftover space is distributed. + * + * @param round Enable rounding (= true), disable rounding (= false). + */ round(round: boolean): this; + + /** + * Returns the current inner padding which defaults to 0. + */ paddingInner(): number; + /** + * Sets the inner padding to the specified value which must be in the range [0, 1]. + * The inner padding determines the ratio of the range that is reserved for blank space between bands. + * + * The default setting is 0. + * + * @param padding Value for inner padding in [0, 1] interval. + */ paddingInner(padding: number): this; + + /** + * Returns the current outer padding which defaults to 0. + */ paddingOuter(): number; + /** + * Sets the outer padding to the specified value which must be in the range [0, 1]. + * The outer padding determines the ratio of the range that is reserved for blank space before the first band and after the last band. + * + * The default setting is 0. + * + * @param padding Value for outer padding in [0, 1] interval. + */ paddingOuter(padding: number): this; + /** * Returns the inner padding. */ padding(): number; /** * A convenience method for setting the inner and outer padding to the same padding value. + * + * @param padding Value for inner and outer padding in [0, 1] interval. */ padding(padding: number): this; + + /** + * Returns the current alignment which defaults to 0.5. + */ align(): number; + /** + * Sets the alignment to the specified value which must be in the range [0, 1]. + * + * The default is 0.5. + * + * The alignment determines how any leftover unused space in the range is distributed. + * A value of 0.5 indicates that the leftover space should be equally distributed before the first band and after the last band; + * i.e., the bands should be centered within the range. A value of 0 or 1 may be used to shift the bands to one side, say to position them adjacent to an axis. + * + * @param align Value for alignment setting in [0, 1] interval. + */ align(align: number): this; + + /** + * Returns the width of each band. + */ bandwidth(): number; + + /** + * Returns the distance between the starts of adjacent bands. + */ step(): number; - copy(): ScaleBand; + + /** + * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. + */ + copy(): this; } +/** + * Constructs a new band scale with the empty domain, the unit range [0, 1], no padding, no rounding and center alignment. + */ export function scaleBand(): ScaleBand; +/** + * Constructs a new band scale with the empty domain, the unit range [0, 1], no padding, no rounding and center alignment. + * + * The generic correponds to the data type of domain elements. + */ export function scaleBand(): ScaleBand; // ------------------------------------------------------------------------------- // Point Scale Factory // ------------------------------------------------------------------------------- +/** + * Point scales are a variant of band scales with the bandwidth fixed to zero. + * Point scales are typically used for scatterplots with an ordinal or categorical dimension. + * The unknown value of a point scale is always undefined: they do not allow implicit domain construction. + * + * The generic corresponds to the data type of domain elements. + */ export interface ScalePoint { + /** + * Given a value in the input domain, returns the corresponding point derived from the output range. + * If the given value is not in the scale’s domain, returns undefined. + * + * @param x A value from the domain. + */ (x: Domain): number | undefined; - domain(): Array; - domain(domain: Array): this; + + /** + * Returns the scale's current domain. + */ + domain(): Domain[]; + /** + * Sets the domain to the specified array of values. The first element in domain will be mapped to the first point, the second domain value to the second point, and so on. + * Domain values are stored internally in a map from stringified value to index; the resulting index is then used to determine the point. + * Thus, a point scale’s values must be coercible to a string, and the stringified version of the domain value uniquely identifies the corresponding point. + * + * @param domain Array of domain values. + */ + domain(domain: Domain[]): this; + + /** + * Returns the scale’s current range, which defaults to [0, 1]. + */ range(): [number, number]; + /** + * Sets the scale’s range to the specified two-element array of numbers. + * If the elements in the given array are not numbers, they will be coerced to numbers. + * The default range is [0, 1]. + * + * @param range A two-element array of numeric values. + */ range(range: [number | { valueOf(): number }, number | { valueOf(): number }]): this; + + /** + * Sets the scale’s range to the specified two-element array of numbers while also enabling rounding. + * If the elements in the given array are not numbers, they will be coerced to numbers. + * + * Rounding is sometimes useful for avoiding antialiasing artifacts, though also consider the shape-rendering “crispEdges” styles. + * + * @param range A two-element array of numeric values. + */ rangeRound(range: [number | { valueOf(): number }, number | { valueOf(): number }]): this; + + /** + * Returns the current rounding status for the scale: enabled (= true) or disabled (= false). + */ round(): boolean; + /** + * Enables or disables rounding accordingly. If rounding is enabled, the position of each point will be integers. + * Rounding is sometimes useful for avoiding antialiasing artifacts, though also consider the shape-rendering “crispEdges” styles. + * Note that if the width of the domain is not a multiple of the cardinality of the range, there may be leftover unused space, even without padding! + * Use point.align to specify how the leftover space is distributed. + * + * @param round Enable rounding (= true), disable rounding (= false). + */ round(round: boolean): this; + /** * Returns the current outer padding which defaults to 0. * The outer padding determines the ratio of the range that is reserved for blank space * before the first point and after the last point. + * */ padding(): number; /** * Sets the outer padding to the specified value which must be in the range [0, 1]. * The outer padding determines the ratio of the range that is reserved for blank space * before the first point and after the last point. + * + * The default is 0. + * + * @param padding Value for outer padding in [0, 1] interval. */ padding(padding: number): this; + + /** + * Returns the current alignment which defaults to 0.5. + */ align(): number; + /** + * Sets the alignment to the specified value which must be in the range [0, 1]. + * + * The alignment determines how any leftover unused space in the range is distributed. + * A value of 0.5 indicates that the leftover space should be equally distributed before the first point and after the last point; + * i.e., the points should be centered within the range. A value of 0 or 1 may be used to shift the points to one side, say to position them adjacent to an axis. + * + * The default value is 0.5. + * + * @param align Value for alignment setting in [0, 1] interval. + */ align(align: number): this; + + /** + * Return 0. + */ bandwidth(): number; + + /** + * Returns the distance between the starts of adjacent points. + */ step(): number; - copy(): ScalePoint; + + /** + * Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa. + */ + copy(): this; } +/** + * Constructs a new point scale with the empty domain, the unit range [0, 1], no padding, no rounding and center alignment. + */ export function scalePoint(): ScalePoint; +/** + * Constructs a new point scale with the empty domain, the unit range [0, 1], no padding, no rounding and center alignment. + * + * The generic corresponds to the data type of domain elements. + */ export function scalePoint(): ScalePoint; @@ -404,10 +1828,23 @@ export function scalePoint(): ScalePoint< // Categorical Color Schemas for Ordinal Scales // ------------------------------------------------------------------------------- -export const schemeCategory10: Array; +/** + * An array of ten categorical colors represented as RGB hexadecimal strings. + */ +export const schemeCategory10: string[]; -export const schemeCategory20: Array; +/** + * An array of twenty categorical colors represented as RGB hexadecimal strings. + */ +export const schemeCategory20: string[]; -export const schemeCategory20b: Array; +/** + * An array of twenty categorical colors represented as RGB hexadecimal strings. + */ +export const schemeCategory20b: string[]; -export const schemeCategory20c: Array; +/** + * An array of twenty categorical colors represented as RGB hexadecimal strings. + * This color scale includes color specifications and designs developed by Cynthia Brewer (colorbrewer2.org). + */ +export const schemeCategory20c: string[]; diff --git a/d3-scale/tsconfig.json b/d3-scale/tsconfig.json index 33d6119ad9..597609a643 100644 --- a/d3-scale/tsconfig.json +++ b/d3-scale/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-scale-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-scale-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-scale/tslint.json b/d3-scale/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-scale/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3-selection-multi/d3-selection-multi-tests.ts b/d3-selection-multi/d3-selection-multi-tests.ts index 370b02eb5c..5f8259052d 100644 --- a/d3-selection-multi/d3-selection-multi-tests.ts +++ b/d3-selection-multi/d3-selection-multi-tests.ts @@ -1,4 +1,4 @@ - +// tslint:disable:object-literal-shorthand /** * Typescript definition tests for d3/d3-selection-multi module * @@ -7,12 +7,12 @@ * are not intended as functional tests. */ -import { Selection, ArrayLike } from 'd3-selection'; +import { selectAll, Selection, ArrayLike } from 'd3-selection'; import { Transition } from 'd3-transition'; import * as d3SelectionMulti from 'd3-selection-multi'; -let selection: Selection; +let selection: Selection = selectAll('a'); // Selection.attrs @@ -28,14 +28,17 @@ selection = selection.attrs({ foo: () => 1, bar: (d) => d, baz: (d, i) => i !== 0, - bat: function () { + bat: function() { return this.href; }, }); // Function that returns a map -selection = selection.attrs(function (d) { - return this.id ? null : { id: d }; +selection = selection.attrs(function (d, i, g) { + let that: HTMLAnchorElement = this; + let index: number = i; + let group: HTMLAnchorElement[] | ArrayLike = g; + return this.id ? {} : { id: d }; }); // Selection.styles @@ -86,11 +89,14 @@ selection = selection.properties({ }); // Function that returns an object -selection = selection.properties(function (d) { - return this.href ? null : { href: d }; +selection = selection.properties(function (d, i, g) { + let that: HTMLAnchorElement = this; + let index: number = i; + let group: HTMLAnchorElement[] | ArrayLike = g; + return that.href ? {} : { href: d }; }); -let transition: Transition; +let transition: Transition = selectAll('a').transition(); // Transition.attrs @@ -112,8 +118,11 @@ transition = transition.attrs({ }); // Function that returns a map -transition = transition.attrs(function (d) { - return this.id ? null : { id: d }; +transition = transition.attrs(function (d, i, g) { + let that: HTMLAnchorElement = this; + let index: number = i; + let group: HTMLAnchorElement[] | ArrayLike = g; + return this.id ? {} : { id: d }; }); // Transition.styles @@ -173,14 +182,14 @@ valueMap = { bar2: function (d, i) { let that: SVGCircleElement = this; let datum: SampleDatum = d; - let index: number = i; + let index: number = i; return d.r; }, bar3: function (d, i, g) { let that: SVGCircleElement = this; let datum: SampleDatum = d; let index: number = i; - let group: Array | ArrayLike = g; + let group: SVGCircleElement[] | ArrayLike = g; return d.filled; } }; diff --git a/d3-selection-multi/index.d.ts b/d3-selection-multi/index.d.ts index 6e106d6dc3..30268ad3aa 100644 --- a/d3-selection-multi/index.d.ts +++ b/d3-selection-multi/index.d.ts @@ -1,16 +1,34 @@ -// Type definitions for D3JS d3-selection-multi module v1.0.0 +// Type definitions for D3JS d3-selection-multi module 1.0 // Project: https://github.com/d3/d3-selection-multi/ // Definitions by: Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.0 + import {Selection, BaseType, ArrayLike, ValueFn} from 'd3-selection'; import {Transition} from 'd3-transition'; -// An object mapping attribute (or style or property) names to value accessors -export type ValueMap = { [key: string]: number | string | boolean | null | ValueFn }; +/** + * An object mapping attribute (or style or property) names to value accessors + * + * The first generic corresponds to type of the selected element(s). + * + * The second generic corresponds to the type of the data on the selected element. + */ +// Retained ValueMap as type as it works better with IDE support for its intended purpose. It is not meant to be extended. So type is o.k. +// tslint:disable-next-line:interface-over-type-literal +export type ValueMap = { [key: string]: number | string | boolean | null | ValueFn }; declare module 'd3-selection' { + /** + * A D3 Selection of elements. + * + * The first generic "GElement" refers to the type of the selected element(s). + * The second generic "Datum" refers to the type of the datum of a selected element(s). + * The third generic "PElement" refers to the type of the parent element(s) in the D3 selection. + * The fourth generic "PDatum" refers to the type of the datum of the parent element(s). + */ export interface Selection { /** * Set multiple attributes on the given selection. Attribute values may be constant or derived from each node and its bound data. @@ -59,6 +77,14 @@ declare module 'd3-selection' { } declare module 'd3-transition' { + /** + * A D3 Transition. + * + * The first generic "GElement" refers to the type of the selected element(s) in the Transition. + * The second generic "Datum" refers to the type of the datum of a selected element(s) in the Transition. + * The third generic "PElement" refers to the type of the parent element(s) in the D3 selection in the Transition. + * The fourth generic "PDatum" refers to the type of the datum of the parent element(s) in the Transition. + */ export interface Transition { /** * Set multiple attribute values. The transition will animate from the present value to the new value. Attribute values may be constant or derived from each node and its bound data. diff --git a/d3-selection-multi/tsconfig.json b/d3-selection-multi/tsconfig.json index 0cd4419b55..5d4a3a1114 100644 --- a/d3-selection-multi/tsconfig.json +++ b/d3-selection-multi/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-selection-multi-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-selection-multi-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-selection-multi/tslint.json b/d3-selection-multi/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-selection-multi/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3-selection/d3-selection-tests.ts b/d3-selection/d3-selection-tests.ts index 21043a23af..b1f776c442 100644 --- a/d3-selection/d3-selection-tests.ts +++ b/d3-selection/d3-selection-tests.ts @@ -15,8 +15,8 @@ import * as d3Selection from 'd3-selection'; // --------------------------------------------------------------------------------------- // Generic DOM related variables -let xDoc: Document, - xWindow: Window; +let xDoc: Document = document; +let xWindow: Window = window; interface BodyDatum { foo: string; @@ -79,16 +79,29 @@ let body: d3Selection.Selection = let baseTypeEl2: d3Selection.Selection = d3Selection.select(baseTypeEl.node()); // let body2: d3Selection.Selection = d3Selection.select(baseTypeEl.node()); // fails as baseTypeEl.node() is of type cannot be assigned to HTMLElement -let body3: d3Selection.Selection = d3Selection.select(body.node()); // element types match, but datum is of type 'any' as it cannot be inferred from .node() +let body3: d3Selection.Selection = d3Selection.select(body.node()!); // element types match, but datum is of type 'any' as it cannot be inferred from .node() // Using select() with node argument and type parameters creates selection // with Group element of type HTMLBodyElement and datum of BodyDatum type. The parent element is of type 'null' with datum of type 'undefined' -let body4: d3Selection.Selection = d3Selection.select(body.node()); +let body4: d3Selection.Selection = d3Selection.select(body.node()!); -// d3Selection.select(baseTypeEl.node()); // fails as baseTypeEl.node() is not of type HTMLBodyElement +// Explicitly cast body.node() to HTMLBodyElement to narrow selection definition. +let body5: d3Selection.Selection = d3Selection.select(body.node()!); + +// d3Selection.select(baseTypeEl.node()!); // fails as baseTypeEl.node() is not of type HTMLBodyElement + +// test, when it is not certain, whether an element of the type to be selected exists +let maybeSVG1: d3Selection.Selection = d3Selection.select('svg'); +maybeSVG1 = d3Selection.select('svg'); + +let maybeSVG2: d3Selection.Selection; +maybeSVG2 = d3Selection.select(maybeSVG1.node()); + +// let body7: d3Selection.Selection = d3Selection.select(maybeSVG1.node()); // fails, as node type mismatches selection type +// test "special case DOM objects" d3Selection.select(xDoc); d3Selection.select(xWindow); @@ -99,7 +112,7 @@ d3Selection.select(xWindow); // Using selectAll(), selectAll(null) or selectAll(undefined) creates an empty selection -let emptyRootSelection: d3Selection.Selection = d3Selection.selectAll(); +let emptyRootSelection: d3Selection.Selection = d3Selection.selectAll(); emptyRootSelection = d3Selection.selectAll(null); emptyRootSelection = d3Selection.selectAll(undefined); @@ -133,7 +146,7 @@ let divElements4: d3Selection.Selection argument -let xSVGCircleElementList: NodeListOf; +let xSVGCircleElementList: NodeListOf = document.querySelectorAll('circle'); let circleSelection: d3Selection.Selection = d3Selection.selectAll(xSVGCircleElementList); // selectAll(...) accepts HTMLCollection, HTMLCollectionOf<...> argument @@ -159,30 +172,40 @@ let svgEl: d3Selection.Selection = d3 let firstG: d3Selection.Selection = svgEl.select('g'); // let firstG_2: d3Selection.Selection = svgEl.select('g'); // fails, parent element of selection does not change with .select(...) -// firstG = svgEl.select('g'); // fails, element type defaults to 'any', but SVGGElement expexted on left-hand side +// firstG = svgEl.select('g'); // fails, element type defaults to 'BaseType', but SVGGElement expexted on left-hand side // firstG = svgEl.select('svg'); // fails, element type of SVGSVGElement provided, but SVGGElement expexted on left-hand side (silly test to begin with) +// test, when it is not certain, whether an element of the type to be selected exists +let maybeG: d3Selection.Selection = svgEl.select('g'); +maybeG = svgEl.select('g'); // Using select(...) sub-selection with a selector function argument. -function svgGroupSelector(this: SVGSVGElement, d: SVGDatum, i: number, groups: Array): SVGGElement { - return this.querySelector('g'); // this-type compatible with group element-type to which the selector function will be appplied +function svgGroupSelector(this: SVGSVGElement, d: SVGDatum, i: number, groups: SVGSVGElement[]): SVGGElement { + return this.querySelector('g')!; // this-type compatible with group element-type to which the selector function will be appplied } firstG = svgEl.select(svgGroupSelector); firstG = svgEl.select(function () { + let that: SVGSVGElement = this; + // let that2: HTMLElement = this; // fails, type mismatch console.log('Get Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement - return this.querySelector('g'); // this of type SVGSVGElement by type inference + return this.querySelector('g')!; // this of type SVGSVGElement by type inference }); -firstG = svgEl.select(function (d, i, group) { +firstG = svgEl.select(function (d, i, g) { + let that: SVGSVGElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: SVGDatum = d; + let index: number = i; + let group: SVGSVGElement[] | d3Selection.ArrayLike = g; console.log('Get Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement console.log('Width in datum:', d.width); // d is type of originating selection element Datum: SVGDatum - if (group.length > 1) { - console.log('Get width of 2nd Element in group: ', group[1].width.baseVal.value); // type is SVGSVGElement + if (g.length > 1) { + console.log('Get width of 2nd Element in group: ', g[1].width.baseVal.value); // type is SVGSVGElement } - return this.querySelector('g'); // this of type SVGSVGElement by type inference + return this.querySelector('g')!; // this of type SVGSVGElement by type inference }); @@ -198,7 +221,7 @@ firstG = svgEl.select(function (d, i, group) { // selectAll(), selectAll(null) selectAll(undefined) return empty sub-selection -let emptySubSelection: d3Selection.Selection = svgEl.selectAll(); +let emptySubSelection: d3Selection.Selection = svgEl.selectAll(); emptySubSelection = svgEl.selectAll(null); emptySubSelection = svgEl.selectAll(undefined); @@ -211,22 +234,35 @@ let gElementsOldData: d3Selection.Selection): NodeListOf { +function svgGroupSelectorAll(this: SVGSVGElement, d: SVGDatum, i: number, groups: SVGSVGElement[]): NodeListOf { return this.querySelectorAll('g'); // this-type compatible with group element-type to which the selector function will be appplied } + gElementsOldData = svgEl.selectAll(svgGroupSelectorAll); +function wrongSvgGroupSelectorAll(this: HTMLElement, d: SVGDatum, i: number, groups: HTMLElement[]): NodeListOf { + return this.querySelectorAll('g'); +} +// gElementsOldData = svgEl.selectAll(wrongSvgGroupSelectorAll); // fails, wrong this context + gElementsOldData = svgEl.selectAll(function () { + let that: SVGSVGElement = this; + // let that2: HTMLElement = this; // fails, type mismatch console.log('Get Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement return this.querySelectorAll('g'); // this of type SVGSVGElement by type inference }); -gElementsOldData = svgEl.selectAll(function (d, i, group) { +gElementsOldData = svgEl.selectAll(function (d, i, g) { + let that: SVGSVGElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: SVGDatum = d; + let index: number = i; + let group: SVGSVGElement[] | d3Selection.ArrayLike = g; console.log('Get Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement console.log('Width in datum:', d.width); // type of d is SVGDatum - if (group.length > 1) { - console.log('Get width of 2nd Element in group: ', group[1].width.baseVal.value); // type of group is SVGSVGElement[] + if (g.length > 1) { + console.log('Get width of 2nd Element in group: ', g[1].width.baseVal.value); // type of group is SVGSVGElement[] } return this.querySelectorAll('g'); }); @@ -242,6 +278,8 @@ gElementsOldData = svgEl.selectAll(function (d, i, gro elementsUnknownData = svgEl.selectAll(svgGroupSelectorAll); elementsUnknownData = svgEl.selectAll(function () { + let that: SVGSVGElement = this; + // let that2: HTMLElement = this; // fails, type mismatch console.log('Get Element width using "this": ', this.width.baseVal.value); // 'this' type is SVGSVGElement return this.querySelectorAll('g'); // this of type SVGSVGElement by type inference }); @@ -250,6 +288,15 @@ elementsUnknownData = svgEl.selectAll(function () { // return this.querySelectorAll('a'); // }); +maybeG.selectAll(function (d, i, g) { + let that: SVGGElement | null = this; + // let that2: SVGGElement = this; // fails with strictNullChecks + // let that3: HTMLElement | null = this; // fails, type mismatch + let datum: SVGDatum = d; + let index: number = i; + let group: Array | d3Selection.ArrayLike = g; + return that ? that.querySelectorAll('circle') : []; +}); // Selection Helper methods ------------------------------------------------------------- @@ -266,18 +313,43 @@ gElementsOldData = svgEl.selectAll(d3Selection.selecto // filter() ------------------------------------------------------------------------------ +// Scenario 1: Filter retaining the element type of the select group (i.e. no type narrowing during filtering) + let filterdGElements: d3Selection.Selection; filterdGElements = gElementsOldData.filter('.top-level'); -filterdGElements = gElementsOldData.filter(function (d, i, group) { +filterdGElements = gElementsOldData.filter(function (d, i, g) { + let that: SVGGElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGGElement[] | d3Selection.ArrayLike = g; console.log('Element Id of DOM element: ', this.id); // this context SVGGElement - if (group.length > 0) { - console.log('Element Id of first DOM element in group: ', group[0].id); // group: Array + if (g.length > 0) { + console.log('Element Id of first DOM element in group: ', g[0].id); // group: Array } return d.r > 10; // uses CircleDatum }); +// Scenario 2: Filtering narrows the type of selected elements in a known way + +// assume the class ".any-svg-type" can only be assigned to SVGElements in the DOM +let filterdGElements2: d3Selection.Selection; + +filterdGElements2 = d3Selection.selectAll('.any-svg-type').filter('g'); +// filterdGElements2 = d3Selection.selectAll('.any-type').filter('g'); // fails without using narrowing generic on filter method + +filterdGElements2 = d3Selection.selectAll('.any-svg-type').filter(function(){ + let that: SVGElement = this; + return that.tagName === 'g' || that.tagName === 'G'; +}); +// filterdGElements2 = d3Selection.selectAll('.any-svg-type').filter(function(){ +// let that: SVGElement = this; +// return that.tagName === 'g'|| that.tagName === 'G'; +// }); // fails without using narrowing generic on filter method + + // matcher() ----------------------------------------------------------------------------- filterdGElements = gElementsOldData.filter(d3Selection.matcher('.top-level')); @@ -289,9 +361,9 @@ filterdGElements = gElementsOldData.filter(d3Selection.matcher('.top-level')); // Getter return values tests ------------------------------------------------------------- -let flag: boolean, - str: string, - dummy: any; +let flag: boolean; +let str: string; +let dummy: any; flag = body.classed('any-class'); str = body.attr('class'); @@ -313,10 +385,15 @@ circles = d3Selection.selectAll('circl .attr('stroke', 'blue'); // string circles = circles // re-assignment test chaining return-type - .attr('cx', function (d, i, group) { + .attr('cx', function (d, i, g) { + let that: SVGGElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGGElement[] | d3Selection.ArrayLike = g; console.log('Pre-change center x-coordinate: ', this.cx.baseVal.value); // this context SVGCircleElement - if (group.length > 0) { - console.log('Owner SVG Element of first group element:', group[0].ownerSVGElement); // group : Array + if (g.length > 0) { + console.log('Owner SVG Element of first group element:', g[0].ownerSVGElement); // group : Array } return d.cx; // numeric return value }) @@ -336,10 +413,15 @@ divs = divs .classed('success', true); divs = divs - .classed('zero-px-padding', function (d, i, group) { + .classed('zero-px-padding', function (d, i, g) { + let that: HTMLDivElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: DivDatum = d; + let index: number = i; + let group: HTMLDivElement[] | d3Selection.ArrayLike = g; console.log('Client Rectangle Top: ', this.getBoundingClientRect().top); // this context HTMLDivElement - if (group.length > 0) { - console.log('Alignment of first group element:', group[0].align); // group : Array + if (g.length > 0) { + console.log('Alignment of first group element:', g[0].align); // group : Array } return d.padding === '0px'; // boolean return value }); @@ -354,10 +436,15 @@ divs = divs .style('color', 'green', 'important'); divs = divs - .style('padding', function (d, i, group) { + .style('padding', function (d, i, g) { + let that: HTMLDivElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: DivDatum = d; + let index: number = i; + let group: HTMLDivElement[] | d3Selection.ArrayLike = g; console.log('Client Rectangle Top: ', this.getBoundingClientRect().top); // this context HTMLDivElement - if (group.length > 0) { - console.log('Alignment of first group element:', group[0].align); // group : Array + if (g.length > 0) { + console.log('Alignment of first group element:', g[0].align); // group : Array } return d.padding; // string return value }) @@ -377,10 +464,15 @@ circles = circles }); // any circles = circles - .property('__hitchhikersguide__', function (d, i, group) { + .property('__hitchhikersguide__', function (d, i, g) { + let that: SVGCircleElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatumAlternative = d; + let index: number = i; + let group: SVGCircleElement[] | d3Selection.ArrayLike = g; console.log('Pre-change center x-coordinate: ', this.cx.baseVal.value); // this context SVGCircleElement - if (group.length > 0) { - console.log('Owner SVG Element of first group element:', group[0].ownerSVGElement); // group : Array + if (g.length > 0) { + console.log('Owner SVG Element of first group element:', g[0].ownerSVGElement); // group : Array } return { value: 42, @@ -396,7 +488,12 @@ body = body .text(true); // boolean will be converted to string by D3 body = body - .text(function (d) { + .text(function (d, i, g) { + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | d3Selection.ArrayLike = g; console.log('Body background color: ', this.bgColor); // this context HTMLBodyElement return d.foo; // BodyDatum }) @@ -411,7 +508,12 @@ body = body .html('

42
'); body = body - .html(function (d) { + .html(function (d, i, g) { + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | d3Selection.ArrayLike = g; return '
Body Background Color: ' + this.bgColor + ', Foo Datum: ' + d.foo + '
'; // this context HTMLBodyElement, datum BodyDatum }); @@ -420,13 +522,13 @@ body = body // --------------------------------------------------------------------------------------- -let data: Array = [ +let data: CircleDatum[] = [ { nodeId: 'c1', cx: 10, cy: 10, r: 5, name: 'foo', label: 'Foo' }, { nodeId: 'c2', cx: 20, cy: 20, r: 5, name: 'bar', label: 'Bar' }, { nodeId: 'c3', cx: 30, cy: 30, r: 5, name: 'fooBar', label: 'Foo Bar' } ]; -let data2: Array = [ +let data2: CircleDatumAlternative[] = [ { nodeId: 'c1', cx: 10, cy: 10, r: 5, name: 'foo', label: 'Foo', color: 'seagreen' }, { nodeId: 'c2', cx: 20, cy: 20, r: 5, name: 'bar', label: 'Bar', color: 'midnightblue' }, { nodeId: 'c4', cx: 10, cy: 15, r: 10, name: 'newbie', label: 'Newbie', color: 'red' } @@ -453,7 +555,12 @@ newBodyDatum = body.datum({ newFoo: 'new foo' }).datum(); // inferred type // function-based -newBodyDatum = body.datum(function (d) { +newBodyDatum = body.datum(function (d, i, g) { + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | d3Selection.ArrayLike = g; console.log('HTML5 Custom Data Attributes of body: ', this.dataset); // this typings HTMLBodyElement console.log('Old foo:', d.foo); // current data of type BodyDatum return { newFoo: 'new foo' }; @@ -482,12 +589,17 @@ d3Selection.select('#svg-1') d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in last step of chain .select('g.circles-group') .datum(data2) // new data type inferred - .classed('has-transform-property', function (d) { + .classed('has-transform-property', function (d, i, g) { + let that: SVGGElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatumAlternative[] = d; + let index: number = i; + let group: SVGGElement[] | d3Selection.ArrayLike = g; console.log('Color of first data element array', d.length > 0 ? d[0].color : 'Data array empty'); // CircleDatumAlternative type return this.transform !== undefined; }); -// below fails, as 'this' in .classed(...) will default to BaseType, which does not have 'transform' property +// below fails, as 'this' in .classed(...) will default to BaseType, which may be null and does not have 'transform' property // d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in last step of chain // .select('g.circles-group') // missing typing of selected DOM element for use in .classed(...) @@ -502,7 +614,12 @@ d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in la d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in last step of chain .select('g.circles-group') // irrelevant typing to get contextual typing in last step of chain .datum(data2) // new data type inferred - .classed('has-green-first-data-element', function (d) { + .classed('has-green-first-data-element', function (d, i, g) { + let that: d3Selection.BaseType = this; + // let that2: Element = this; // fails, type mismatch + let datum: CircleDatumAlternative[] = d; + let index: number = i; + let group: d3Selection.BaseType[] | d3Selection.ArrayLike = g; return d.length > 0 && d[0].color === 'green'; }); @@ -515,8 +632,46 @@ let dimensions: SVGDatum = { height: 300 }; -let startCircleData: Array, - endCircleData: Array; +let startCircleData: CircleDatumAlternative[] = [ + { + nodeId: 'n1', + name: 'node_1', + label: 'Test Node 1', + cx: 10, + cy: 10, + r: 5, + color: 'slateblue' + }, + { + nodeId: 'n2', + name: 'node_2', + label: 'Test Node 2', + cx: 30, + cy: 30, + r: 10, + color: 'slateblue' + } +]; +let endCircleData: CircleDatumAlternative[] = [ + { + nodeId: 'n1', + name: 'node_1', + label: 'Test Node 1', + cx: 15, + cy: 15, + r: 5, + color: 'slateblue' + }, + { + nodeId: 'n3', + name: 'node_3', + label: 'Test Node 3', + cx: 40, + cy: 40, + r: 20, + color: 'red' + } +]; let circles2: d3Selection.Selection; @@ -566,7 +721,12 @@ let enterCircles = enterElements let exitCircles = circles2.exit(); // Note: need to re-type datum type, as the exit selection elements have the 'old data' exitCircles - .style('opacity', function (d) { + .style('opacity', function (d, i, g) { + let that: SVGCircleElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatumAlternative = d; + let index: number = i; + let group: SVGCircleElement[] | d3Selection.ArrayLike = g; console.log('Circle Radius exit node: ', this.r.baseVal.value); // this type is SVGCircleElement return d.color === 'green' ? 1 : 0; // data type as per .exit<...>() parameterization }) @@ -575,8 +735,8 @@ exitCircles // Note: the alternative using only .exit() without typing, will fail, if access to datum properties is attemped. // If access to d is not required, the short-hand is acceptable e.g. circles2.exit().remove(); -// let exitCircles = circles2.exit(); // Note: Without explicit re-typing to the old data type, the data type default to '{}' -// exitCircles +// let exitCircles2 = circles2.exit(); // Note: Without explicit re-typing to the old data type, the data type default to '{}' +// exitCircles2 // .style('opacity', function (d) { // console.log('Circle Radius exit node: ', this.r.baseVal.value); // return d.color === 'green' ? 1 : 0; // fails, as data type is defaulted to {}. If datum access is required, this should trigger the thought to type .exit<...> @@ -599,8 +759,8 @@ const matrix = [ // SCENARIO 1 - Fully type parameterized, when there is a need for `this` typings in callbacks // and enforcement of type of data used in data join as input to data(...) -let nMatrix: Array, - nRow: Array; +let nMatrix: number[][]; +let nRow: number[]; let tr: d3Selection.Selection; tr = d3Selection.select('body') @@ -617,7 +777,12 @@ let td: d3Selection.Selection inferred (Array[4] of number per parent ) .enter().append('td') - .text(function (d) { + .text(function (d, i, g) { + let that: HTMLTableDataCellElement = this; + // let that2: Element = this; // fails, type mismatch + let datum: number = d; + let index: number = i; + let group: HTMLTableDataCellElement[] | d3Selection.ArrayLike = g; console.log('Abbreviated text for object', this.abbr); // this-type HTMLTableDataCellElement (demonstration only) return d; }); // d:number inferred @@ -658,7 +823,12 @@ newDiv2 = body.append('div'); newDiv2 = body.append(d3Selection.creator('div')); // newDiv2 = body.append(d3Selection.creator('div')); // fails, as creator returns BaseType element, but HTMLDivElement is expected. -newDiv2 = body.append(function (d) { +newDiv2 = body.append(function (d, i, g) { + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | d3Selection.ArrayLike = g; console.log('Body element foo property: ', d.foo); // data of type BodyDatum return this.ownerDocument.createElement('div'); // this-type HTMLBodyElement }); @@ -681,7 +851,12 @@ let newParagraph2: d3Selection.Selection('p', 'p.second-paragraph'); newParagraph2 = body.insert(d3Selection.creator('p'), 'p.second-paragraph'); -newParagraph2 = body.insert(function (d) { +newParagraph2 = body.insert(function (d, i, g) { + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | d3Selection.ArrayLike = g; console.log('Body element foo property: ', d.foo); // data of type BodyDatum return this.ownerDocument.createElement('p'); // this-type HTMLParagraphElement }, 'p.second-paragraph'); @@ -694,19 +869,34 @@ newParagraph2 = body.insert(function (d) { // return this.ownerDocument.createElement('a'); // fails, HTMLParagraphElement expected by type inference, HTMLAnchorElement returned // }, 'p.second-paragraph'); -newParagraph2 = body.insert(d3Selection.creator('p'), function (d, i, group) { +newParagraph2 = body.insert(d3Selection.creator('p'), function (d, i, g) { + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | d3Selection.ArrayLike = g; console.log('Body element foo property: ', d.foo); // data of type BodyDatum return this.children[0]; // this type HTMLBodyElement }); newParagraph2 = body.insert( // type - function (d) { + function (d, i, g) { + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | d3Selection.ArrayLike = g; console.log('Body element foo property: ', d.foo); // data of type BodyDatum return this.ownerDocument.createElement('p'); // this-type HTMLParagraphElement }, // before - function (d, i, group) { + function (d, i, g) { + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | d3Selection.ArrayLike = g; console.log('Body element foo property: ', d.foo); // data of type BodyDatum return this.children[0]; // this type HTMLBodyElement }); @@ -742,9 +932,9 @@ let emptyFlag = gElementsOldData.empty(); // node() and nodes() -------------------------------------------------------------------- -let bodyNode: HTMLBodyElement = body.node(); +let bodyNode: HTMLBodyElement | null= body.node(); -let gElementsNodes: Array = gElementsOldData.nodes(); +let gElementsNodes: SVGGElement[] = gElementsOldData.nodes(); // size() -------------------------------------------------------------------------------- @@ -753,11 +943,16 @@ let size: number = gElementsOldData.size(); // each() ------------------------------------------------------------------------------- // returns 'this' selection -circles = circles.each(function (d, i, group) { // check chaining return type by re-assigning +circles = circles.each(function (d, i, g) { // check chaining return type by re-assigning + let that: SVGCircleElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGCircleElement[] | d3Selection.ArrayLike = g; if (this.r.baseVal.value < d.r) { // this of type SVGCircleElement, datum of type CircleDatumAlternative d3Selection.select(this).attr('r', d.r); } - console.log(group[i].cx.baseVal.value); // group : Array + console.log(g[i].cx.baseVal.value); // group : Array }); // call() ------------------------------------------------------------------------------- @@ -788,12 +983,15 @@ circles = circles.call(enforceMinRadius, 40); // check chaining return type by r // on(...) ------------------------------------------------------------------------------- -let listener: (this: HTMLBodyElement, datum: BodyDatum, index: number, group: Array | ArrayLike) => void; +let listener: undefined | ((this: HTMLBodyElement, datum: BodyDatum, index: number, group: HTMLBodyElement[] | ArrayLike) => void); -// returns 'this' selection -body = body.on('click', listener); // check chaining return type by re-assigning -body = body.on('click', function (d) { +body = body.on('click', function (d, i, g) { + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | ArrayLike = g; console.log('onclick print body background color: ', this.bgColor); // HTMLBodyElement console.log('onclick print "foo" datum property: ', d.foo); // BodyDatum type }); @@ -801,6 +999,11 @@ body = body.on('click', function (d) { // get current listener listener = body.on('click'); +if (listener) { + // returns 'this' selection + body = body.on('click', listener); // check chaining return type by re-assigning +} + // remove listener body = body.on('click', null); // check chaining return type by re-assigning @@ -816,7 +1019,12 @@ let fooEventParam: d3Selection.CustomEventParameters = { // returns 'this' selection body = body.dispatch('fooEvent', fooEventParam); // re-assign for chaining test; -body = body.dispatch('fooEvent', function (d, i, group) { // re-assign for chaining test; +body = body.dispatch('fooEvent', function (d, i, g) { // re-assign for chaining test; + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | d3Selection.ArrayLike = g; let eParam: d3Selection.CustomEventParameters; console.log('fooEvent dispatch body background color', this.bgColor); eParam = { @@ -844,14 +1052,14 @@ let successEvent = { type: 'wonEuro2016', team: 'Island' }; let customListener: (this: HTMLBodyElement, finalOpponent: string) => string; customListener = function (finalOpponent) { - let e = d3Selection.event; + let e = d3Selection.event; return e.team + ' defeated ' + finalOpponent + ' in the EURO 2016 Cup. Who would have thought!!!'; }; let resultText: string = d3Selection.customEvent(successEvent, customListener, body.node(), 'Wales'); -// result = d3Selection.customEvent(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in call +// let result = d3Selection.customEvent(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in call // let resultValue: number = d3Selection.customEvent(successEvent, customListener, body.node(), 'Wales'); // fails, incompatible return types // d3Selection.customEvent(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in type parameter and call // d3Selection.customEvent(successEvent, customListener, circles.nodes()[0], 'Wales'); // fails, incompatible 'this' context in type parameter and call @@ -859,11 +1067,11 @@ let resultText: string = d3Selection.customEvent(successEvent, customListener, b // mouse() --------------------------------------------------------------------------------- -let position: [number, number], - svg: SVGSVGElement, - g: SVGGElement, - h: HTMLElement, - changedTouches: TouchList; +let position: [number, number] | null; +let svg: SVGSVGElement = d3Selection.select('svg').node()!; +let g: SVGGElement = d3Selection.select('g').node()!; +let h: HTMLElement = d3Selection.select('div').node()!; +let changedTouches: TouchList = new TouchList(); // dummy position = d3Selection.mouse(svg); position = d3Selection.mouse(g); @@ -893,19 +1101,19 @@ positions = d3Selection.touches(h, changedTouches); // Tests of Local // --------------------------------------------------------------------------------------- -let xElement: Element; +let xElement: Element = d3Selection.select('foo').node()!; let foo: d3Selection.Local = d3Selection.local(); let propName: string = foo.toString(); // direct set & get on Local object xElement = foo.set(xElement, [1, 2, 3]); -let array: number[] = foo.get(xElement); +let array: number[] | undefined = foo.get(xElement); // test read & write of .property() access to locals array = d3Selection.select(xElement) - .property(foo, [3, 2, 1]) - .property(foo, () => [999]) - .property(foo); + .property(foo, [3, 2, 1]) + .property(foo, () => [999]) + .property(foo); foo.remove(xElement); diff --git a/d3-selection/index.d.ts b/d3-selection/index.d.ts index 5919e9ce39..44bf64c0e0 100644 --- a/d3-selection/index.d.ts +++ b/d3-selection/index.d.ts @@ -1,8 +1,10 @@ -// Type definitions for D3JS d3-selection module v1.0.2 +// Type definitions for D3JS d3-selection module 1.0 // Project: https://github.com/d3/d3-selection/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.2 + // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces // -------------------------------------------------------------------------- @@ -12,7 +14,7 @@ * without 'd3-selection' trying to use properties internally which would otherwise not * be supported. */ -export type BaseType = Element | EnterElement | Window; +export type BaseType = Element | EnterElement | Document | Window | null; /** * A helper interface which covers arguments like NodeListOf or HTMLCollectionOf @@ -44,10 +46,10 @@ export type ContainerElement = HTMLElement | SVGSVGElement | SVGGElement; /** - * Type for optional parameters map, when dispatching custom events + * Interface for optional parameters map, when dispatching custom events * on a selection */ -export type CustomEventParameters = { +export interface CustomEventParameters { /** * If true, the event is dispatched to ancestors in reverse tree order */ @@ -65,7 +67,7 @@ export type CustomEventParameters = { /** * Callback type for selections and transitions */ -export type ValueFn = (this: Element, datum: Datum, index: number, groups: Array | ArrayLike) => Result; +export type ValueFn = (this: T, datum: Datum, index: number, groups: T[] | ArrayLike) => Result; /** @@ -117,9 +119,13 @@ export function select(node: GElement): Sel */ export function selectAll(): Selection; /** - * Create an empy selection. + * Create an empty selection. */ export function selectAll(selector: null): Selection; +/** + * Create an empty selection. + */ +export function selectAll(selector: undefined): Selection; /** * Select all elements that match the specified selector string. The elements will be selected in document order (top-to-bottom). * If no elements in the document match the selector, returns an empty selection. @@ -209,6 +215,11 @@ interface Selection; + /** + * Create an empty sub-selection. Selection.selectAll does affect grouping: The elements in the returned + * selection are grouped by their corresponding parent node in this selection, the group at the current index will be empty. + */ + selectAll(selector: undefined): Selection; /** * For each selected element, selects the descendant elements that match the specified selector string. The elements in the returned * selection are grouped by their corresponding parent node in this selection. If no element matches the specified selector @@ -239,7 +250,7 @@ interface Selection(selector: ValueFn | ArrayLike>): Selection; + selectAll(selector: ValueFn>): Selection; // Modifying ------------------------------- @@ -584,7 +595,20 @@ interface Selection; + /** + * Filters the selection, returning a new selection that contains only the elements for + * which the specified filter is true. + * + * The returned filtered selection preserves the parents of this selection, but like array.filter, + * it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed. + * + * The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types + * contained in a pre-filter selection are narrowed to a subset as part of the filtering. + * + * @param selector A CSS selector string to match when filtering. + */ + filter(selector: string): Selection; /** * Filter the selection, returning a new selection that contains only the elements for * which the specified filter is true. @@ -596,8 +620,19 @@ interface Selection): this; - + filter(selector: ValueFn): Selection; + /** + * Filter the selection, returning a new selection that contains only the elements for + * which the specified filter is true. + * + * The returned filtered selection preserves the parents of this selection, but like array.filter, + * it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed. + * + * @param selector A value function which is evaluated for each selected element, in order, being passed the current datum (d), + * the current index (i), and the current group (nodes), with this as the current DOM element. This function should return true + * for an element to be included, and false otherwise. + */ + filter(selector: ValueFn): Selection; /** * Return a new selection that contains a copy of each group in this selection sorted according @@ -699,7 +734,7 @@ interface Selection(data: Array, key?: ValueFn): Selection; + data(data: NewDatum[], key?: ValueFn): Selection; /** * Joins the data returned by the specified value function with the selected elements, returning a new selection that it represents * the update selection: the elements successfully bound to data. Also defines the enter and exit selections on @@ -731,7 +766,7 @@ interface Selection(data: ValueFn>, key?: ValueFn): Selection; + data(data: ValueFn, key?: ValueFn): Selection; /** * Return the enter selection: placeholder nodes for each datum that had no corresponding DOM element @@ -763,7 +798,7 @@ interface Selection; + on(typenames: string): ValueFn | undefined; /** * Remove a listener for the specified event type names. To remove all listeners for a given name, * pass null as the listener and ".foo" as the typename, where foo is the name; to remove all listeners with no name, specify "." as the typename. @@ -850,7 +885,7 @@ interface Selection; + nodes(): GElement[]; /** * Returns the total number of elements in this selection. @@ -864,9 +899,7 @@ interface Selection; -} +type SelectionFn = () => Selection; /** * Selects the root element, document.documentElement. This function can also be used to test for selections @@ -1031,17 +1064,17 @@ export function local(): Local; // --------------------------------------------------------------------------- /** - * Type for object literal containing local name with related fully qualified namespace + * Interface for object literal containing local name with related fully qualified namespace */ -export type NamespaceLocalObject = { +export interface NamespaceLocalObject { /** * Fully qualified namespace */ - space: string, + space: string; /** * Name of the local to be namespaced. */ - local: string + local: string; } /** @@ -1061,9 +1094,9 @@ export function namespace(prefixedLocal: string): NamespaceLocalObject | string; // --------------------------------------------------------------------------- /** - * Type for maps of namespace prefixes to corresponding fully qualified namespace strings + * Interface for maps of namespace prefixes to corresponding fully qualified namespace strings */ -export type NamespaceMap = { [prefix: string]: string }; +export interface NamespaceMap { [prefix: string]: string; } /** * Map of namespace prefixes to corresponding fully qualified namespace strings @@ -1120,7 +1153,7 @@ export function matcher(selector: string): (this: BaseType) => boolean; * * @param selector A CSS selector string. */ -export function selector(selector: string): (this: BaseType) => DescElement +export function selector(selector: string): (this: BaseType) => DescElement; /** * Given the specified selector, returns a function which returns all descendants of "this" element that match the specified selector. diff --git a/d3-selection/tsconfig.json b/d3-selection/tsconfig.json index 4dc36b99e3..a217cfd905 100644 --- a/d3-selection/tsconfig.json +++ b/d3-selection/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-selection-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-selection-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-selection/tslint.json b/d3-selection/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-selection/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3-shape/d3-shape-tests.ts b/d3-shape/d3-shape-tests.ts index 874782f1ca..beec6c84c8 100644 --- a/d3-shape/d3-shape-tests.ts +++ b/d3-shape/d3-shape-tests.ts @@ -7,15 +7,17 @@ */ import * as d3Shape from 'd3-shape'; -import { Selection } from 'd3-selection'; +import { select, Selection } from 'd3-selection'; +import { path } from 'd3-path'; // ----------------------------------------------------------------------------------- // Preparatory Steps (General) // ----------------------------------------------------------------------------------- -let context: CanvasRenderingContext2D; +let context: CanvasRenderingContext2D | null = document.querySelector('canvas')!.getContext('2d'); let num: number; let pathString: string; +let pathStringMaybe: string | null; // ----------------------------------------------------------------------------------- // Test Arc Generator @@ -46,10 +48,17 @@ let arcDatum: ArcDatum = { }; let accessorArcDatumNumber: (this: any, d: ArcDatum, ...args: any[]) => number; +let accessorArcDatumNumberOrNull: ((this: any, d: ArcDatum, ...args: any[]) => number) | null; // DefaultArcObject interface ======================================================== -let defaultArcObject: d3Shape.DefaultArcObject; +let defaultArcObject: d3Shape.DefaultArcObject = { + innerRadius: 0, + outerRadius: 100, + startAngle: 0, + endAngle: Math.PI / 2, + padAngle: 0 +}; num = defaultArcObject.innerRadius; num = defaultArcObject.outerRadius; @@ -66,7 +75,9 @@ let svgArc: d3Shape.Arc = d3Shape.arc; -let wrongArc1: Selection; -let wrongArc2: Selection; +let pArc: Selection = select('.arc-paths'); // mock +let wrongArc1: Selection = select('.arc-paths'); // mock +let wrongArc2: Selection = select('.arc-paths'); // mock pArc.attr('d', svgArc); // wrongArc1.attr('d', svgArc); // fails, incompatible this contexts // wrongArc2.attr('d', svgArc); // fails, incompatible datum types -// pathString = svgArc(arcDatum); // fails, wrong this type for invocation +// pathStringMaybe = svgArc(arcDatum); // fails, wrong this type for invocation // Use with custom object @@ -188,15 +212,15 @@ class Arcer { private arc: d3Shape.Arc; - public getPathString(d?: ArcerDatum) { + getPathString(d?: ArcerDatum) { return d ? this.arc(d) : this.arc({ innerRadius: this.innerRadius, outerRadius: this.outerRadius }); } } let arcer = new Arcer(100, 120); -pathString = arcer.getPathString(); -pathString = arcer.getPathString({ innerRadius: 10, outerRadius: 20 }); +pathStringMaybe = arcer.getPathString(); +pathStringMaybe = arcer.getPathString({ innerRadius: 10, outerRadius: 20 }); // ----------------------------------------------------------------------------------- // Test Pie Generator @@ -208,12 +232,22 @@ interface PieDatum { } -let accessorPieDatumNumber: (this: any, data: Array, ...args: any[]) => number; +let accessorPieDatumNumber: (this: any, data: PieDatum[], ...args: any[]) => number; // PieArcDatum interface ============================================================= -let pieArcObject: d3Shape.PieArcDatum; +let pieArcObject: d3Shape.PieArcDatum = { + data: { + val: 10, + name: "Segment 1" + }, + value: 10, + index: 0, + startAngle: 0, + endAngle: Math.PI / 2, + padAngle: 0 +}; let pieDatum: PieDatum = pieArcObject.data; num = pieArcObject.value; @@ -238,7 +272,7 @@ defaultPie = defaultPie.value(10); defaultPieValueAccessor = defaultPie.value(); -let pieValueAccessor: (d: PieDatum, i?: number, data?: Array) => number; +let pieValueAccessor: (d: PieDatum, i?: number, data?: PieDatum[]) => number; pie = pie.value(function (d, i, data) { console.log(data.length > 0 ? data[0].val : 'no data'); // data type is Array @@ -309,7 +343,7 @@ let defaultPieChart: Array>; defaultPieChart = defaultPie([20, 10, 30, 40]); -let pieData: Array = [ +let pieData: PieDatum[] = [ { name: 'John', val: 20 }, { name: 'Jill', val: 10 }, { name: 'Rodrigo', val: 30 } @@ -329,8 +363,8 @@ interface LineDatum { missing: boolean; } -let lineXYAccessorFn: (d: LineDatum, index?: number, data?: Array) => number; -let lineDefAccessorFn: (d: LineDatum, index?: number, data?: Array) => boolean; +let lineXYAccessorFn: (d: LineDatum, index?: number, data?: LineDatum[]) => number; +let lineDefAccessorFn: (d: LineDatum, index?: number, data?: LineDatum[]) => boolean; interface RadialLineDatum { angle: number; @@ -338,8 +372,8 @@ interface RadialLineDatum { missing: boolean; } -let radialLineAngRAccessorFn: (d: RadialLineDatum, index?: number, data?: Array) => number; -let radialLineDefAccessorFn: (d: RadialLineDatum, index?: number, data?: Array) => boolean; +let radialLineAngRAccessorFn: (d: RadialLineDatum, index?: number, data?: RadialLineDatum[]) => number; +let radialLineDefAccessorFn: (d: RadialLineDatum, index?: number, data?: RadialLineDatum[]) => boolean; // line(...) create Line generator ===================================================== @@ -350,7 +384,10 @@ let line: d3Shape.Line = d3Shape.line(); // context(...) ---------------------------------------------------------------------- -defaultLine = defaultLine.context(context); // draw to canvas +if (context !== null) { + defaultLine = defaultLine.context(context); // draw to canvas +} + context = defaultLine.context(); line = line.context(null); // use as path string generator for SVG @@ -403,13 +440,13 @@ let currentCurveFactory: d3Shape.CurveFactory | d3Shape.CurveFactoryLineOnly = l defaultLine([[10, 10], [20, 10], [20, 20]]); -let lineData: Array = [ +let lineData: LineDatum[] = [ { x: 10, y: 10, missing: false }, { x: 20, y: 10, missing: false }, { x: 20, y: 20, missing: false } ]; -let linePathString: string = line(lineData); +let linePathStringMaybe: string | null = line(lineData); // radialLine(...) create Line generator ===================================================== @@ -420,7 +457,9 @@ let radialLine: d3Shape.RadialLine = d3Shape.radialLine = [ +let radialLineData: RadialLineDatum[] = [ { angle: 0, radius: 10, missing: false }, { angle: Math.PI / 2, radius: 20, missing: false }, { angle: 2 * Math.PI, radius: 10, missing: false } ]; -let radialLinePathString: string = radialLine(radialLineData); +let radialLinePathStringMaybe: string | null = radialLine(radialLineData); // ----------------------------------------------------------------------------------- @@ -494,8 +533,9 @@ interface AreaDatum { missing: boolean; } -let areaXYAccessorFn: (d: AreaDatum, index?: number, data?: Array) => number; -let areaDefAccessorFn: (d: AreaDatum, index?: number, data?: Array) => boolean; +let areaXYAccessorFn: (d: AreaDatum, index?: number, data?: AreaDatum[]) => number; +let areaXYAccessorFnMaybe: null | ((d: AreaDatum, index?: number, data?: AreaDatum[]) => number); +let areaDefAccessorFn: (d: AreaDatum, index?: number, data?: AreaDatum[]) => boolean; interface RadialAreaDatum { startAngle: number; @@ -505,8 +545,9 @@ interface RadialAreaDatum { missing: boolean; } -let radialAreaAngRAccessorFn: (d: RadialAreaDatum, index?: number, data?: Array) => number; -let radialAreaDefAccessorFn: (d: RadialAreaDatum, index?: number, data?: Array) => boolean; +let radialAreaAngRAccessorFn: (d: RadialAreaDatum, index?: number, data?: RadialAreaDatum[]) => number; +let radialAreaAngRAccessorFnMaybe: null | ((d: RadialAreaDatum, index?: number, data?: RadialAreaDatum[]) => number); +let radialAreaDefAccessorFn: (d: RadialAreaDatum, index?: number, data?: RadialAreaDatum[]) => boolean; // area(...) create Area generator ===================================================== @@ -517,7 +558,9 @@ let area: d3Shape.Area = d3Shape.area(); // context(...) ---------------------------------------------------------------------- -defaultArea = defaultArea.context(context); // draw to canvas +if (context !== null) { + defaultArea = defaultArea.context(context); // draw to canvas +} context = defaultArea.context(); area = area.context(null); // use as path string generator for SVG @@ -556,7 +599,7 @@ area = area.x1(function (d, t, data) { return d.x1; // d type is AreaDatum }); -areaXYAccessorFn = area.x1(); +areaXYAccessorFnMaybe = area.x1(); // y(...) ---------------------------------------------------------------------------- @@ -592,7 +635,7 @@ area = area.y1(function (d, t, data) { return d.y1; // d type is AreaDatum }); -areaXYAccessorFn = area.y1(); +areaXYAccessorFnMaybe = area.y1(); // defined(...) ---------------------------------------------------------------------- @@ -619,13 +662,13 @@ currentCurveFactory = area.curve(); defaultArea([[10, 10], [20, 10], [20, 20]]); -let areaData: Array = [ +let areaData: AreaDatum[] = [ { x0: 10, y0: 10, x1: 10, y1: 30, missing: false }, { x0: 20, y0: 20, x1: 20, y1: 40, missing: false }, { x0: 30, y0: 30, x1: 30, y1: 30, missing: false } ]; -let areaPathString: string = area(areaData); +let areaPathStringMaybe: string | null = area(areaData); // Get Line Generators from Area generator ======================================================== @@ -645,7 +688,9 @@ let radialArea: d3Shape.RadialArea = d3Shape.radialArea = [ +let radialAreaData: RadialAreaDatum[] = [ { startAngle: 0, innerRadius: 10, endAngle: 0, outerRadius: 30, missing: false }, { startAngle: Math.PI / 2, innerRadius: 20, endAngle: Math.PI / 2, outerRadius: 40, missing: false }, { startAngle: Math.PI, innerRadius: 30, endAngle: Math.PI, outerRadius: 30, missing: false } ]; -let radialAreaPathString: string = radialArea(radialAreaData); +let radialAreaPathStringMaybe: string | null = radialArea(radialAreaData); // Get RadialLine Generators from RadialArea generator ======================================================== @@ -773,10 +818,10 @@ areaRadialLineGenerator = radialArea.lineOuterRadius(); let lineOnlyGenerator: d3Shape.CurveGeneratorLineOnly; -let lineOnlyFactory: d3Shape.CurveFactoryLineOnly; +let lineOnlyFactory: d3Shape.CurveFactoryLineOnly = d3Shape.curveBundle; -lineOnlyGenerator = lineOnlyFactory(null); -lineOnlyGenerator = lineOnlyFactory(context); +lineOnlyGenerator = lineOnlyFactory(path()); +lineOnlyGenerator = lineOnlyFactory(context!); // force context to be non-null with post-fix for mock lineOnlyGenerator.lineStart(); lineOnlyGenerator.lineEnd(); @@ -784,10 +829,10 @@ lineOnlyGenerator.point(10, 20); let curveGenerator: d3Shape.CurveGenerator; -let curveFactory: d3Shape.CurveFactory; +let curveFactory: d3Shape.CurveFactory = d3Shape.curveBasis; -curveGenerator = curveFactory(null); -curveGenerator = curveFactory(context); +curveGenerator = curveFactory(path()); +curveGenerator = curveFactory(context!); // force context to be non-null with post-fix for mock curveGenerator.lineStart(); curveGenerator.lineEnd(); @@ -806,7 +851,8 @@ let curveBundleFactory: d3Shape.CurveBundleFactory; curveBundleFactory = d3Shape.curveBundle; curveBundleFactory = d3Shape.curveBundle.beta(0.5); -lineOnlyGenerator = d3Shape.curveBundle.beta(0.5)(context); +lineOnlyGenerator = d3Shape.curveBundle.beta(0.5)(context!); // force context to be non-null with post-fix for mock +lineOnlyGenerator = d3Shape.curveBundle.beta(0.5)(path()); // curveGenerator = d3Shape.curveBundle.beta(0.5)(context); // fails, no area related methods let curveCardinalFactory: d3Shape.CurveCardinalFactory; @@ -814,34 +860,40 @@ let curveCardinalFactory: d3Shape.CurveCardinalFactory; curveCardinalFactory = d3Shape.curveCardinal; curveCardinalFactory = d3Shape.curveCardinal.tension(0.5); -curveGenerator = d3Shape.curveCardinal.tension(0.5)(context); +curveGenerator = d3Shape.curveCardinal.tension(0.5)(context!); // force context to be non-null with post-fix for mock +curveGenerator = d3Shape.curveCardinal.tension(0.5)(path()); curveCardinalFactory = d3Shape.curveCardinalOpen; curveCardinalFactory = d3Shape.curveCardinalOpen.tension(0.5); -curveGenerator = d3Shape.curveCardinalOpen.tension(0.5)(context); +curveGenerator = d3Shape.curveCardinalOpen.tension(0.5)(context!); // force context to be non-null with post-fix for mock +curveGenerator = d3Shape.curveCardinalOpen.tension(0.5)(path()); curveCardinalFactory = d3Shape.curveCardinalClosed; curveCardinalFactory = d3Shape.curveCardinalClosed.tension(0.5); -curveGenerator = d3Shape.curveCardinalClosed.tension(0.5)(context); +curveGenerator = d3Shape.curveCardinalClosed.tension(0.5)(context!); // force context to be non-null with post-fix for mock +curveGenerator = d3Shape.curveCardinalClosed.tension(0.5)(path()); let curveCatmullRomFactory: d3Shape.CurveCatmullRomFactory; curveCatmullRomFactory = d3Shape.curveCatmullRom; curveCatmullRomFactory = d3Shape.curveCatmullRom.alpha(0.5); -curveGenerator = d3Shape.curveCatmullRom.alpha(0.5)(context); +curveGenerator = d3Shape.curveCatmullRom.alpha(0.5)(context!); // force context to be non-null with post-fix for mock +curveGenerator = d3Shape.curveCatmullRom.alpha(0.5)(path()); curveCatmullRomFactory = d3Shape.curveCatmullRomOpen; curveCatmullRomFactory = d3Shape.curveCatmullRomOpen.alpha(0.5); -curveGenerator = d3Shape.curveCatmullRomOpen.alpha(0.5)(context); +curveGenerator = d3Shape.curveCatmullRomOpen.alpha(0.5)(context!); // force context to be non-null with post-fix for mock +curveGenerator = d3Shape.curveCatmullRomOpen.alpha(0.5)(path()); curveCatmullRomFactory = d3Shape.curveCatmullRomClosed; curveCatmullRomFactory = d3Shape.curveCatmullRomClosed.alpha(0.5); -curveGenerator = d3Shape.curveCatmullRomClosed.alpha(0.5)(context); +curveGenerator = d3Shape.curveCatmullRomClosed.alpha(0.5)(context!); // force context to be non-null with post-fix for mock +curveGenerator = d3Shape.curveCatmullRomClosed.alpha(0.5)(path()); curveFactory = d3Shape.curveLinear; @@ -892,7 +944,9 @@ svgSymbol = d3Shape.symbol(); // context() -------------------------------------------------------------------------- -canvasSymbol = canvasSymbol.context(context); // draw to canvas +if (context !== null) { + canvasSymbol = canvasSymbol.context(context); // draw to canvas +} context = canvasSymbol.context(); svgSymbol = svgSymbol.context(null); // use as path string generator for SVG @@ -941,16 +995,16 @@ let symbolDatum: SymbolDatum = { type: 'circle' }; -let pSymbol: Selection; -let wrongSymbol1: Selection; -let wrongSymbol2: Selection; +let pSymbol: Selection = select('.symbol-path'); // mock +let wrongSymbol1: Selection = select('.symbol-path'); // mock +let wrongSymbol2: Selection = select('.symbol-path'); // mock pSymbol.attr('d', svgSymbol); // wrongSymbol1.attr('d', svgSymbol); // fails, incompatible this contexts // wrongSymbol2.attr('d', svgSymbol); // fails, incompatible datum types -// pathString = svgSymbol(symbolDatum); // fails, wrong this type for invocation +// pathStringMaybe = svgSymbol(symbolDatum); // fails, wrong this type for invocation // Use with custom object @@ -982,6 +1036,8 @@ class Symbolizer { case 'square': type = d3Shape.symbolSquare; break; + default: + type = d3Shape.symbolSquare; } } return type; @@ -991,20 +1047,20 @@ class Symbolizer { private type: d3Shape.SymbolType; private symbol: d3Shape.Symbol; - public getPathString(d?: SymbolDatum) { + getPathString(d?: SymbolDatum) { return d ? this.symbol(d) : this.symbol(); } } let sym = new Symbolizer(100, 'square'); -pathString = sym.getPathString(); -pathString = sym.getPathString({ size: 10, type: 'circle' }); +pathStringMaybe = sym.getPathString(); +pathStringMaybe = sym.getPathString({ size: 10, type: 'circle' }); // Test pre-fab symbols =============================================================== -let symbolArray: Array = d3Shape.symbols; +let symbolArray: d3Shape.SymbolType[] = d3Shape.symbols; customSymbol = d3Shape.symbolCircle; customSymbol = d3Shape.symbolCross; @@ -1031,33 +1087,19 @@ interface StackKey { let key: StackKey; -let keys: Array = [ +let keys: StackKey[] = [ { name: 'bananas', label: 'Bananas' }, { name: 'apples', label: 'Apples' }, { name: 'oranges', label: 'Oranges' } ]; -let stackData: Array = [ +let stackData: StackDatum[] = [ { values: { bananas: 10, apples: 20, oranges: 10 } }, { values: { bananas: 10, apples: 25, oranges: 0 } }, { values: { bananas: 20, apples: 20, oranges: 30 } }, { values: { bananas: 12, apples: 10, oranges: 50 } } ]; -// Test SeriesPoint and Series interfaces ============================================ - -let seriesPoint: d3Shape.SeriesPoint; - -num = seriesPoint[0]; -num = seriesPoint[1]; -num = seriesPoint.index; -seriesDatum = seriesPoint.data; - -let series: d3Shape.Series; - -seriesPoint = series[0]; -key = series.key; - // Create stack generator ========================================================== @@ -1076,11 +1118,11 @@ overlyComplicatedStack = d3Shape.stack(); defaultStack = defaultStack.keys(['bananas', 'apples', 'oranges']); -overlyComplicatedStack = overlyComplicatedStack.keys(function (data: Array, keys: Array) { +overlyComplicatedStack = overlyComplicatedStack.keys(function (data: StackDatum[], keys: StackKey[]) { return keys; }); -let keysAccessor: (this: any, data: Array, keys: Array) => Array; +let keysAccessor: (this: any, data: StackDatum[], keys: StackKey[]) => StackKey[]; keysAccessor = overlyComplicatedStack.keys(); // values(...) ---------------------------------------------------------------------- @@ -1091,7 +1133,7 @@ overlyComplicatedStack = overlyComplicatedStack.value(function (d, key, j, data) return d.values[key.name]; }); -let valueAccessorFn: (this: any, d: StackDatum, key: StackKey, j?: number, data?: Array) => number; +let valueAccessorFn: (this: any, d: StackDatum, key: StackKey, j?: number, data?: StackDatum[]) => number; valueAccessorFn = overlyComplicatedStack.value(); // order(...) ---------------------------------------------------------------------- @@ -1101,7 +1143,7 @@ defaultStack = defaultStack.order(null); overlyComplicatedStack = overlyComplicatedStack.order(d3Shape.stackOrderAscending); -let orderStackDatumSeries: (series: d3Shape.Series) => Array; +let orderStackDatumSeries: (series: d3Shape.Series) => number[]; orderStackDatumSeries = overlyComplicatedStack.order(); // TODO: other signatures @@ -1112,27 +1154,40 @@ defaultStack = defaultStack.offset(null); overlyComplicatedStack = overlyComplicatedStack.offset(d3Shape.stackOffsetWiggle); -let offsetStackDatumSeries: (series: d3Shape.Series, order: Array) => void; +let offsetStackDatumSeries: (series: d3Shape.Series, order: number[]) => void; offsetStackDatumSeries = overlyComplicatedStack.offset(); // Use stack generator ============================================================ let defaultSeriesArray: Array>; defaultSeriesArray = defaultStack([ - {bananas: 10, apples: 20, oranges: 10}, - {bananas: 30, apples: 10, oranges: 30}, - {bananas: 80, apples: 20, oranges: 40} + { bananas: 10, apples: 20, oranges: 10 }, + { bananas: 30, apples: 10, oranges: 30 }, + { bananas: 80, apples: 20, oranges: 40 } ]); let seriesArray: Array>; seriesArray = overlyComplicatedStack(stackData, keys); +// Test SeriesPoint and Series interfaces ============================================ + +let series: d3Shape.Series = seriesArray[0]; +let seriesPoint: d3Shape.SeriesPoint; +seriesPoint = series[0]; +key = series.key; +num = series.index; + +num = seriesPoint[0]; +num = seriesPoint[1]; +seriesDatum = seriesPoint.data; + + // Test stack orders =============================================================== -let order: Array; -let seriesAnyAny: d3Shape.Series; +let order: number[]; +let seriesAnyAny: d3Shape.Series = seriesArray[0]; order = d3Shape.stackOrderAscending(seriesAnyAny); order = d3Shape.stackOrderDescending(seriesAnyAny); diff --git a/d3-shape/index.d.ts b/d3-shape/index.d.ts index cf3f0a5c21..9245bca54c 100644 --- a/d3-shape/index.d.ts +++ b/d3-shape/index.d.ts @@ -1,283 +1,1864 @@ -// Type definitions for D3JS d3-shape module v1.0.3 +// Type definitions for D3JS d3-shape module 1.0 // Project: https://github.com/d3/d3-shape/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.4 + +import { Path } from 'd3-path'; + // ----------------------------------------------------------------------------------- // Arc Generator // ----------------------------------------------------------------------------------- +/** + * Interface corresponding to the minimum data type assumed by the accessor functions of the Arc generator + */ export interface DefaultArcObject { + /** + * Inner radius of arc. + */ innerRadius: number; + /** + * Outer radius of arc. + */ outerRadius: number; + /** + * Start angle of arc. The angle is specified in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + */ startAngle: number; + /** + * End angle of arc. The angle is specified in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + */ endAngle: number; + /** + * Pad angle of arcin radians. + */ padAngle: number; } +/** + * The arc generator produces a circular or annular sector, as in a pie or donut chart. + * + * If the difference between the start and end angles (the angular span) is greater than τ, the arc generator will produce a complete circle or annulus. + * If it is less than τ, arcs may have rounded corners and angular padding. Arcs are always centered at ⟨0,0⟩; use a transform (see: SVG, Canvas) to move the arc to a different position. + * + * See also the pie generator, which computes the necessary angles to represent an array of data as a pie or donut chart; these angles can then be passed to an arc generator. + * + * The first generic corresponds to the type of the "this" context within which the arc generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type for which the arc is to be generated. + */ export interface Arc { - (this: This, d: Datum, ...args: any[]): string | undefined; + /** + * Generates an arc for the given arguments. + * + * IMPORTANT: If the rendering context of the arc generator is null, + * then the arc is returned as a path data string. + * + * The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. + * All arguments passed into this function, will be passed to the accessor functions of the generator. + * + * @param d The datum for which the arc is to be generated. + */ + (this: This, d: Datum, ...args: any[]): string | null; + /** + * Generates an arc for the given arguments. + * + * IMPORTANT: If the arc generator has been configured with a rendering context, + * then the arc is rendered to this context as a sequence of path method calls and this function returns void. + * + * The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. + * All arguments passed into this function, will be passed to the accessor functions of the generator. + * + * @param d The datum for which the arc is to be generated. + */ + (this: This, d: Datum, ...args: any[]): void; + + /** + * Computes the midpoint [x, y] of the center line of the arc that would be generated by the given arguments. + * + * To be consistent with the generated arc, the accessors must be deterministic, i.e., return the same value given the same arguments. + * The midpoint is defined as (startAngle + endAngle) / 2 and (innerRadius + outerRadius) / 2. + * + * Note that this is not the geometric center of the arc, which may be outside the arc; + * this method is merely a convenience for positioning labels. + * + * The method is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that are passed into the arc generator. + * + * @param d The datum for which the arc is to be generated. + */ centroid(d: Datum, ...args: any[]): [number, number]; + + /** + * Returns the current inner radius accessor, which defaults to a function returning the innerRadius property + * of the first argument passed into it. + */ innerRadius(): (this: This, d: Datum, ...args: any[]) => number; + /** + * Sets the inner radius to the specified number and returns this arc generator. + * + * Specifying the inner radius as a function is useful for constructing a stacked polar bar chart, often in conjunction with a sqrt scale. + * More commonly, a constant inner radius is used for a donut or pie chart. If the outer radius is smaller than the inner radius, the inner and outer radii are swapped. + * A negative value is treated as zero. + * + * @param radius Constant radius. + */ innerRadius(radius: number): this; + /** + * Sets the inner radius to the specified function and returns this arc generator. + * + * Specifying the inner radius as a function is useful for constructing a stacked polar bar chart, often in conjunction with a sqrt scale. + * More commonly, a constant inner radius is used for a donut or pie chart. If the outer radius is smaller than the inner radius, the inner and outer radii are swapped. + * A negative value is treated as zero. + * + * @param radius An accessor function returning a number to be used as a radius. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the arc generator. + */ innerRadius(radius: (this: This, d: Datum, ...args: any[]) => number): this; + + /** + * Returns the current outer radius accessor, which defaults to a function returning the outerRadius property + * of the first argument passed into it. + */ outerRadius(): (this: This, d: Datum, ...args: any[]) => number; + /** + * Sets the outer radius to the specified number and returns this arc generator. + * + * Specifying the outer radius as a function is useful for constructing a coxcomb or polar bar chart, + * often in conjunction with a sqrt scale. More commonly, a constant outer radius is used for a pie or donut chart. + * If the outer radius is smaller than the inner radius, the inner and outer radii are swapped. + * A negative value is treated as zero. + * + * @param radius Constant radius. + */ outerRadius(radius: number): this; + /** + * Sets the outer radius to the specified function and returns this arc generator. + * + * Specifying the outer radius as a function is useful for constructing a coxcomb or polar bar chart, + * often in conjunction with a sqrt scale. More commonly, a constant outer radius is used for a pie or donut chart. + * If the outer radius is smaller than the inner radius, the inner and outer radii are swapped. + * A negative value is treated as zero. + * + * @param radius An accessor function returning a number to be used as a radius. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the arc generator. + */ outerRadius(radius: (this: This, d: Datum, ...args: any[]) => number): this; + + /** + * Returns the current corner radius accessor, which defaults to a function returning a constant value of zero. + */ cornerRadius(): (this: This, d: Datum, ...args: any[]) => number; + /** + * Sets the corner radius to the specified number and returns this arc generator. + * + * If the corner radius is greater than zero, the corners of the arc are rounded using circles of the given radius. + * For a circular sector, the two outer corners are rounded; for an annular sector, all four corners are rounded. + * + * The corner radius may not be larger than (outerRadius - innerRadius) / 2. + * In addition, for arcs whose angular span is less than π, the corner radius may be reduced as two adjacent rounded corners intersect. + * This is occurs more often with the inner corners. + * + * @param radius Constant radius. + */ cornerRadius(radius: number): this; + /** + * Sets the corner radius to the specified function and returns this arc generator. + * + * The corner radius may not be larger than (outerRadius - innerRadius) / 2. + * In addition, for arcs whose angular span is less than π, the corner radius may be reduced as two adjacent rounded corners intersect. + * This is occurs more often with the inner corners. + * + * @param radius An accessor function returning a number to be used as a radius. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the arc generator. + */ cornerRadius(radius: (this: This, d: Datum, ...args: any[]) => number): this; + + /** + * Returns the current start angle accessor, which defaults to a function returning the startAngle property + * of the first argument passed into it. + */ startAngle(): (this: This, d: Datum, ...args: any[]) => number; + /** + * Sets the start angle to the specified number and returns this arc generator. + * + * The angle is specified in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * If |endAngle - startAngle| ≥ τ, a complete circle or annulus is generated rather than a sector. + * + * @param angle Constant angle in radians. + */ startAngle(angle: number): this; + /** + * Sets the start angle to the specified function and returns this arc generator. + * + * The angle is specified in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * If |endAngle - startAngle| ≥ τ, a complete circle or annulus is generated rather than a sector. + * + * @param angle An accessor function returning a number in radians to be used as an angle. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the arc generator. + */ startAngle(angle: (this: This, d: Datum, ...args: any[]) => number): this; + + /** + * Returns the current end angle accessor, which defaults to a function returning the endAngle property + * of the first argument passed into it. + */ endAngle(): (this: This, d: Datum, ...args: any[]) => number; + /** + * Sets the end angle to the specified number and returns this arc generator. + * + * The angle is specified in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * If |endAngle - startAngle| ≥ τ, a complete circle or annulus is generated rather than a sector. + * + * @param angle Constant angle in radians. + */ endAngle(angle: number): this; + /** + * Sets the end angle to the specified function and returns this arc generator. + * + * The angle is specified in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * If |endAngle - startAngle| ≥ τ, a complete circle or annulus is generated rather than a sector. + * + * @param angle An accessor function returning a number in radians to be used as an angle. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the arc generator. + */ endAngle(angle: (this: This, d: Datum, ...args: any[]) => number): this; + + /** + * Returns the current pad angle accessor, which defaults to a function returning the padAngle property + * of the first argument passed into it, or false if no data are passed in or the property is not defined. + */ padAngle(): (this: This, d: Datum, ...args: any[]) => number; + /** + * Sets the pad angle to the specified number and returns this arc generator. + * + * The pad angle is converted to a fixed linear distance separating adjacent arcs, defined as padRadius * padAngle. This distance is subtracted equally from the start and end of the arc. + * If the arc forms a complete circle or annulus, as when |endAngle - startAngle| ≥ τ, the pad angle is ignored. If the inner radius or angular span is small relative to the pad angle, + * it may not be possible to maintain parallel edges between adjacent arcs. In this case, the inner edge of the arc may collapse to a point, similar to a circular sector. + * For this reason, padding is typically only applied to annular sectors (i.e., when innerRadius is positive). + * + * The recommended minimum inner radius when using padding is outerRadius * padAngle / sin(θ), where θ is the angular span of the smallest arc before padding. + * For example, if the outer radius is 200 pixels and the pad angle is 0.02 radians, a reasonable θ is 0.04 radians, and a reasonable inner radius is 100 pixels. + * + * Often, the pad angle is not set directly on the arc generator, but is instead computed by the pie generator so as to ensure that the area of padded arcs is proportional to their value; + * see pie.padAngle. See the pie padding animation for illustration. + * If you apply a constant pad angle to the arc generator directly, it tends to subtract disproportionately from smaller arcs, introducing distortion. + * + * @param angle Constant angle in radians. + */ padAngle(angle: number): this; + /** + * Sets the pad angle to the specified function and returns this arc generator. + * + * The pad angle is converted to a fixed linear distance separating adjacent arcs, defined as padRadius * padAngle. This distance is subtracted equally from the start and end of the arc. + * If the arc forms a complete circle or annulus, as when |endAngle - startAngle| ≥ τ, the pad angle is ignored. If the inner radius or angular span is small relative to the pad angle, + * it may not be possible to maintain parallel edges between adjacent arcs. In this case, the inner edge of the arc may collapse to a point, similar to a circular sector. + * For this reason, padding is typically only applied to annular sectors (i.e., when innerRadius is positive). + * + * The recommended minimum inner radius when using padding is outerRadius * padAngle / sin(θ), where θ is the angular span of the smallest arc before padding. + * For example, if the outer radius is 200 pixels and the pad angle is 0.02 radians, a reasonable θ is 0.04 radians, and a reasonable inner radius is 100 pixels. + * + * Often, the pad angle is not set directly on the arc generator, but is instead computed by the pie generator so as to ensure that the area of padded arcs is proportional to their value; + * see pie.padAngle. See the pie padding animation for illustration. + * If you apply a constant pad angle to the arc generator directly, it tends to subtract disproportionately from smaller arcs, introducing distortion. + * + * @param angle An accessor function returning a number in radians to be used as an angle. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the arc generator. + */ padAngle(angle: (this: This, d: Datum, ...args: any[]) => number): this; + + /** + * Returns the current pad radius accessor, which defaults to null, indicating that the pad radius should be automatically computed as sqrt(innerRadius * innerRadius + outerRadius * outerRadius). + */ + padRadius(): ((this: This, d: Datum, ...args: any[]) => number) | null; + /** + * Sets the pad radius to null indicating that the pad radius should be automatically computed as sqrt(innerRadius * innerRadius + outerRadius * outerRadius), and returns this arc generator. + * + * The pad radius determines the fixed linear distance separating adjacent arcs, defined as padRadius * padAngle. + * + * @param radius null to set automatic pad radius calculation. + */ + padRadius(radius: null): this; + /** + * Sets the pad radius to the specified number, and returns this arc generator. + * + * The pad radius determines the fixed linear distance separating adjacent arcs, defined as padRadius * padAngle. + * + * @param radius A constant radius. + */ + padRadius(radius: number): this; + + /* + * Sets the pad radius to the specified function, and returns this arc generator. + * + * @param radius An accessor function returning a number to be used as a radius. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the arc generator. + */ + padRadius(radius: (this: This, d: Datum, ...args: any[]) => number): this; + + /** + * Returns the current rendering context, which defaults to null. + */ context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this arc generator. + * + * If the context is not null, then the generated arc is rendered to this context as a sequence of path method calls. + * + * @param context The rendering context. + */ context(context: CanvasRenderingContext2D): this; + /** + * Sets the rendering context to null and returns this arc generator. + * + * A path data string representing the generated arc will be returned when the generator is invoked with data. + * + * @param context null, to remove rendering context. + */ context(context: null): this; } +/** + * Constructs a new arc generator with the default settings. + * + * Ensure that the accessors used with the arc generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + */ export function arc(): Arc; +/** + * Constructs a new arc generator with the default settings. + * + * Ensure that the accessors used with the arc generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + * + * The generic corresponds to the datum type representing a arc. + */ export function arc(): Arc; +/** + * Constructs a new arc generator with the default settings. + * + * Ensure that the accessors used with the arc generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + * + * The first generic corresponds to the type of the "this" context within which the arc generator and its accessor functions will be invoked. + * + * The second generic corresponds to the datum type representing a arc. + */ export function arc(): Arc; // ----------------------------------------------------------------------------------- // Pie Generator // ----------------------------------------------------------------------------------- - +/** + * Element of the Arc Datums Array created by invoking the Pie generator. + * + * The generic refers to the data type of an element in the input array passed into the Pie generator. + */ export interface PieArcDatum { + /** + * The input datum; the corresponding element in the input data array of the Pie generator + */ data: T; + /** + * The numeric value of the arc. + */ value: number; + /** + * The zero-based sorted index of the arc. + */ index: number; + /** + * The start angle of the arc. If the pie generator was configured to be used for the arc generator, than the units are in radians with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + */ startAngle: number; + /** + * The end angle of the arc. If the pie generator was configured to be used for the arc generator, than the units are in radians with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + */ endAngle: number; + /** + * The pad angle of the arc. If the pie generator was configured to be used for the arc generator, than the units are in radians. + */ padAngle: number; } - +/** + * The pie generator does not produce a shape directly, but instead computes the necessary angles to represent a tabular dataset as a pie or donut chart; + * these angles can then be passed to an arc generator. + * + * The first generic corresponds to the type of the "this" context within which the pie generator and its accessor functions will be invoked. + * + * The second generic refers to the data type of an element in the input array passed into the Pie generator. + */ export interface Pie { - (this: This, data: Array, ...args: any[]): Array>; - value(): (d: Datum, i: number, data: Array) => number; + /** + * Generates a pie for the given array of data, returning an array of objects representing each datum’s arc angles. + * Any additional arguments are arbitrary; they are simply propagated to the pie generator’s accessor functions along with the this object. + * The length of the returned array is the same as data, and each element i in the returned array corresponds to the element i in the input data. + * + * This representation is designed to work with the arc generator’s default startAngle, endAngle and padAngle accessors. + * The angular units are arbitrary, but if you plan to use the pie generator in conjunction with an arc generator, + * you should specify angles in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * + * @param data Array of data elements. + */ + (this: This, data: Datum[], ...args: any[]): Array>; + + /** + * Returns the current value accessor, which defaults to a function returning the first argument passed into it. + * The default value accessor assumes that the input data are numbers, or that they are coercible to numbers using valueOf. + * + */ + value(): (d: Datum, i: number, data: Datum[]) => number; + /** + * Sets the value accessor to use the specified constant number and returns this pie generator. + * + * @param value Constant value to be used. + */ value(value: number): this; - value(value: (d: Datum, i: number, data: Array) => number): this; + /** + * Sets the value accessor to use the specified function and returns this pie generator. + * + * When a pie is generated, the value accessor will be invoked for each element in the input data array. + * The default value accessor assumes that the input data are numbers, or that they are coercible to numbers using valueOf. + * If your data are not simply numbers, then you should specify an accessor that returns the corresponding numeric value for a given datum. + * + * + * @param value A value accessor function, which is invoked for each element in the input data array, being passed the element d, the index i, and the array data as three arguments. + * It returns a numeric value. + */ + value(value: (d: Datum, i: number, data: Datum[]) => number): this; + + /** + * Returns the current data comparator, which defaults to null. + */ sort(): ((a: Datum, b: Datum) => number) | null; + /** + * Sets the data comparator to the specified function and returns this pie generator. + * + * If both the data comparator and the value comparator are null, then arcs are positioned in the original input order. + * Otherwise, the data is sorted according to the data comparator, and the resulting order is used. Setting the data comparator implicitly sets the value comparator to null. + * + * Sorting does not affect the order of the generated arc array which is always in the same order as the input data array; it merely affects the computed angles of each arc. + * The first arc starts at the start angle and the last arc ends at the end angle. + * + * @param comparator A compare function takes two arguments a and b, each elements from the input data array. + * If the arc for a should be before the arc for b, then the comparator must return a number less than zero; + * if the arc for a should be after the arc for b, then the comparator must return a number greater than zero; + * returning zero means that the relative order of a and b is unspecified. + */ sort(comparator: (a: Datum, b: Datum) => number): this; + /** + * Sets the data comparator to null and returns this pie generator. + * + * If both the data comparator and the value comparator are null, then arcs are positioned in the original input order. + * + * @param comparator null, to set the pie generator to use the original input order or use the sortValues comparator, if any. + */ sort(comparator: null): this; + + /** + * Returns the current value comparator, which defaults to descending value. + */ sortValues(): ((a: number, b: number) => number) | null; + /** + * Sets the value comparator to the specified function and returns this pie generator. + * + * If both the data comparator and the value comparator are null, then arcs are positioned in the original input order. + * Otherwise, the data is sorted according to the data comparator, and the resulting order is used. + * Setting the value comparator implicitly sets the data comparator to null. + * + * Sorting does not affect the order of the generated arc array which is always in the same order as the input data array; + * it merely affects the computed angles of each arc. The first arc starts at the start angle and the last arc ends at the end angle. + * + * @param comparator The value comparator takes two arguments a and b which are values derived from the input data array using the value accessor, not the data elements. + * If the arc for a should be before the arc for b, then the comparator must return a number less than zero; + * if the arc for a should be after the arc for b, then the comparator must return a number greater than zero; returning zero means that the relative order of a and b is unspecified. + * + */ sortValues(comparator: (a: number, b: number) => number): this; + /** + * Sets the value comparator to null and returns this pie generator. + * + * If both the data comparator and the value comparator are null, then arcs are positioned in the original input order. + * + * @param comparator null, to set the pie generator to use the original input order or use the data comparator, if any. + */ sortValues(comparator: null): this; - startAngle(): (this: This, data: Array, ...args: any[]) => number; + + /** + * Returns the current start angle accessor, which defaults to a function returning a constant zero. + */ + startAngle(): (this: This, data: Datum[], ...args: any[]) => number; + /** + * Sets the overall start angle of the pie to the specified number and returns this pie generator. + * + * The default start angle is zero. + * + * The start angle here means the overall start angle of the pie, i.e., the start angle of the first arc. + * The start angle accessor is invoked once, being passed the same arguments and this context as the pie generator. + * The units of angle are arbitrary, but if you plan to use the pie generator in conjunction with an arc generator, + * you should specify an angle in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * + * @param angle A constant angle. + */ startAngle(angle: number): this; - startAngle(angle: (this: This, data: Array, ...args: any[]) => number): this; - endAngle(): (this: This, data: Array, ...args: any[]) => number; + /** + * Sets the overall start angle of the pie to the specified function and returns this pie generator. + * + * The default start angle is zero. + * + * The start angle here means the overall start angle of the pie, i.e., the start angle of the first arc. + * The start angle accessor is invoked once, being passed the same arguments and this context as the pie generator. + * The units of angle are arbitrary, but if you plan to use the pie generator in conjunction with an arc generator, + * you should specify an angle in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * + * @param angle An angle accessor function, which is invoked once, being passed the same arguments and this context as the pie generator. + */ + startAngle(angle: (this: This, data: Datum[], ...args: any[]) => number): this; + + /** + * Returns the current end angle accessor, which defaults to a function returning a constant 2*pi. + */ + endAngle(): (this: This, data: Datum[], ...args: any[]) => number; + /** + * Sets the overall end angle of the pie to the specified number and returns this pie generator. + * + * The default end angle is 2*pi. + * + * The end angle here means the overall end angle of the pie, i.e., the end angle of the last arc. + * The units of angle are arbitrary, but if you plan to use the pie generator in conjunction with an arc generator, + * you should specify an angle in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * + * The value of the end angle is constrained to startAngle ± τ, such that |endAngle - startAngle| ≤ τ. + * + * @param angle A constant angle. + */ endAngle(angle: number): this; - endAngle(angle: (this: This, data: Array, ...args: any[]) => number): this; - padAngle(): (this: This, data: Array, ...args: any[]) => number; + /** + * Sets the overall end angle of the pie to the specified function and returns this pie generator. + * + * The default end angle is 2*pi. + * + * The end angle here means the overall end angle of the pie, i.e., the end angle of the last arc. + * The end angle accessor is invoked once, being passed the same arguments and this context as the pie generator. + * The units of angle are arbitrary, but if you plan to use the pie generator in conjunction with an arc generator, + * you should specify an angle in radians, with 0 at -y (12 o’clock) and positive angles proceeding clockwise. + * + * The value of the end angle is constrained to startAngle ± τ, such that |endAngle - startAngle| ≤ τ. + * + * @param angle An angle accessor function, which is invoked once, being passed the same arguments and this context as the pie generator. + */ + endAngle(angle: (this: This, data: Datum[], ...args: any[]) => number): this; + + /** + * Returns the current pad angle accessor, which defaults to a function returning a constant zero. + */ + padAngle(): (this: This, data: Datum[], ...args: any[]) => number; + /** + * Sets the pad angle to the specified number and returns this pie generator. + * + * The pad angle here means the angular separation between each adjacent arc. + * The total amount of padding reserved is the specified angle times the number of elements in the input data array, and at most |endAngle - startAngle|; + * the remaining space is then divided proportionally by value such that the relative area of each arc is preserved. + * The units of angle are arbitrary, but if you plan to use the pie generator in conjunction with an arc generator, you should specify an angle in radians. + * + * @param angle A constant angle. + */ padAngle(angle: number): this; - padAngle(angle: (this: This, data: Array, ...args: any[]) => number): this; + /** + * Sets the pad angle to the specified function and returns this pie generator. + * + * The pad angle here means the angular separation between each adjacent arc. + * The total amount of padding reserved is the specified angle times the number of elements in the input data array, and at most |endAngle - startAngle|; + * the remaining space is then divided proportionally by value such that the relative area of each arc is preserved. + * The pad angle accessor is invoked once, being passed the same arguments and this context as the pie generator. + * The units of angle are arbitrary, but if you plan to use the pie generator in conjunction with an arc generator, you should specify an angle in radians. + * + * @param angle An angle accessor function, which is invoked once, being passed the same arguments and this context as the pie generator. + */ + padAngle(angle: (this: This, data: Datum[], ...args: any[]) => number): this; } +/** + * Constructs a new pie generator with the default settings. + * + * Ensure that the accessors used with the pie generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + */ export function pie(): Pie; +/** + * Constructs a new pie generator with the default settings. + * + * Ensure that the accessors used with the pie generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + * + * The generic refers to the data type of an element in the input array passed into the Pie generator. + */ export function pie(): Pie; +/** + * Constructs a new pie generator with the default settings. + * + * Ensure that the accessors used with the pie generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + * + * The first generic corresponds to the type of the "this" context within which the pie generator and its accessor functions will be invoked. + * + * The second generic refers to the data type of an element in the input array passed into the Pie generator. + */ export function pie(): Pie; // ----------------------------------------------------------------------------------- // Line Generators // ----------------------------------------------------------------------------------- - +/** + * The line generator produces a spline or polyline, as in a line chart. + * Lines also appear in many other visualization types, such as the links in hierarchical edge bundling. + * + * The generic refers to the data type of an element in the input array passed into the line generator. + */ export interface Line { - (data: Array): string | undefined; - x(): (d: Datum, index: number, data: Array) => number; + /** + * Generates a line for the given array of data. Depending on this line generator’s associated curve, + * the given input data may need to be sorted by x-value before being passed to the line generator. + * + * IMPORTANT: If the rendering context of the line generator is null, + * then the line is returned as a path data string. + * + * @param data Array of data elements. + */ + (data: Datum[]): string | null; + /** + * Generates a line for the given array of data. Depending on this line generator’s associated curve, + * the given input data may need to be sorted by x-value before being passed to the line generator. + * + * IMPORTANT: If the line generator has been configured with a rendering context, + * then the line is rendered to this context as a sequence of path method calls and this function returns void. + * + * @param data Array of data elements. + */ + (data: Datum[]): void; + + /** + * Returns the current x-coordinate accessor function, which defaults to a function returning first element of a two-element array of numbers. + */ + x(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets the x accessor to the specified number and returns this line generator. + * + * @param x A constant x-coordinate value. + */ x(x: number): this; - x(x: (d: Datum, index: number, data: Array) => number): this; - y(): (d: Datum, index: number, data: Array) => number; + /** + * Sets the x accessor to the specified function and returns this line generator. + * + * When a line is generated, the x accessor will be invoked for each defined element in the input data array. + * + * The default x accessor assumes that the input data are two-element arrays of numbers. If your data are in a different format, or if you wish to transform the data before rendering, + * then you should specify a custom accessor. + * + * @param x A coordinate accessor function which returns the x-coordinate value. The x accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + x(x: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current y-coordinate accessor function, which defaults to a function returning second element of a two-element array of numbers. + */ + y(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets the y accessor to the specified number and returns this line generator. + * + * @param y A constant y-coordinate value. + */ y(y: number): this; - y(y: (d: Datum, index: number, data: Array) => number): this; - defined(): (d: Datum, index: number, data: Array) => boolean; + /** + * Sets the y accessor to the specified function and returns this line generator. + * + * When a line is generated, the y accessor will be invoked for each defined element in the input data array. + * + * The default y accessor assumes that the input data are two-element arrays of numbers. If your data are in a different format, or if you wish to transform the data before rendering, + * then you should specify a custom accessor. + * + * @param y A coordinate accessor function which returns the y-coordinate value. The y accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + y(y: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current defined accessor, which defaults to a function returning a constant boolean value of true. + */ + defined(): (d: Datum, index: number, data: Datum[]) => boolean; + /** + * Sets the defined accessor to the specified boolean and returns this line generator. + * + * The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. + * + * When a line is generated, the defined accessor will be invoked for each element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + * If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), + * the x and y accessors will subsequently be evaluated and the point will be added to the current line segment. + * Otherwise, the element will be skipped, the current line segment will be ended, and a new line segment will be generated for the next defined point. + * As a result, the generated line may have several discrete segments. + * + * Note that if a line segment consists of only a single point, it may appear invisible unless rendered with rounded or square line caps. + * In addition, some curves such as curveCardinalOpen only render a visible segment if it contains multiple points. + * + * @param defined A boolean constant + */ defined(defined: boolean): this; - defined(defined: (d: Datum, index: number, data: Array) => boolean): this; + /** + * Sets the defined accessor to the specified function and returns this line generator. + * + * The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. + * + * When a line is generated, the defined accessor will be invoked for each element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + * If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), + * the x and y accessors will subsequently be evaluated and the point will be added to the current line segment. + * Otherwise, the element will be skipped, the current line segment will be ended, and a new line segment will be generated for the next defined point. + * As a result, the generated line may have several discrete segments. + * + * Note that if a line segment consists of only a single point, it may appear invisible unless rendered with rounded or square line caps. + * In addition, some curves such as curveCardinalOpen only render a visible segment if it contains multiple points. + * + * @param defined An accessor function which returns a boolean value. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + defined(defined: (d: Datum, index: number, data: Datum[]) => boolean): this; + + /** + * Returns the current curve factory, which defaults to curveLinear. + */ curve(): CurveFactory | CurveFactoryLineOnly; + /** + * Returns the current curve factory, which defaults to curveLinear. + * + * The generic allows to cast the curve factory to a specifc type, if known. + */ + curve(): C; + /** + * Sets the curve factory and returns this line generator. + * + * @param curve A valid curve factory. + */ curve(curve: CurveFactory | CurveFactoryLineOnly): this; + + /** + * Returns the current rendering context, which defaults to null. + */ context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this line generator. + * + * If the context is not null, then the generated line is rendered to this context as a sequence of path method calls. + * + * @param context The rendering context. + */ context(context: CanvasRenderingContext2D): this; + /** + * Sets the rendering context to null and returns this line generator. + * + * A path data string representing the generated line will be returned when the generator is invoked with data. + * + * @param context null, to remove rendering context. + */ context(context: null): this; } + +/** + * Constructs a new line generator with the default settings. + * + * Ensure that the accessors used with the line generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + */ export function line(): Line<[number, number]>; +/** + * Constructs a new line generator with the default settings. + * + * Ensure that the accessors used with the line generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + * + * The generic refers to the data type of an element in the input array passed into the line generator. + */ export function line(): Line; -export function line(): Line; + +/** + * The radial line generator produces a spline or polyline, as in a line chart. + * + * A radial line generator is equivalent to the standard Cartesian line generator, + * except the x and y accessors are replaced with angle and radius accessors. + * Radial lines are always positioned relative to ⟨0,0⟩; use a transform (see: SVG, Canvas) to change the origin. + * + * The generic refers to the data type of an element in the input array passed into the line generator. + */ export interface RadialLine { - (data: Array): string | undefined; - angle(): (d: Datum, index: number, data: Array) => number; + /** + * Generates a radial line for the given array of data. Depending on this radial line generator’s associated curve, + * the given input data may need to be sorted by x-value before being passed to the line generator. + * + * IMPORTANT: If the rendering context of the radial line generator is null, + * then the radial line is returned as a path data string. + * + * @param data Array of data elements. + */ + (data: Datum[]): string | null; + /** + * Generates a radial line for the given array of data. Depending on this radial line generator’s associated curve, + * the given input data may need to be sorted by x-value before being passed to the radial line generator. + * + * IMPORTANT: If the radial line generator has been configured with a rendering context, + * then the radial line is rendered to this context as a sequence of path method calls and this function returns void. + * + * @param data Array of data elements. + */ + (data: Datum[]): void; + + /** + * Returns the current angle accessor function, which defaults to a function returning first element of a two-element array of numbers. + */ + angle(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets the angle accessor to the specified number and returns this radial line generator. + * + * @param angle A constant angle value in radians, with 0 at -y (12 o’clock). + */ angle(angle: number): this; - angle(angle: (d: Datum, index: number, data: Array) => number): this; - radius(): (d: Datum, index: number, data: Array) => number; + /** + * Sets the angle accessor to the specified function and returns this radial line generator. + * + * When a radial line is generated, the angle accessor will be invoked for each defined element in the input data array. + * + * The default angle accessor assumes that the input data are two-element arrays of numbers. If your data are in a different format, or if you wish to transform the data before rendering, + * then you should specify a custom accessor. + * + * @param angle An angle accessor function which returns the angle value in radians, with 0 at -y (12 o’clock). The angle accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + angle(angle: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current radius accessor function, which defaults to a function returning second element of a two-element array of numbers. + */ + radius(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets the radius accessor to the specified number and returns this radial line generator. + * + * @param radius A constant radius value. + */ radius(radius: number): this; - radius(radius: (d: Datum, index: number, data: Array) => number): this; - defined(): (d: Datum, index: number, data: Array) => boolean; + /** + * Sets the radius accessor to the specified function and returns this radial line generator. + * + * When a radial line is generated, the radius accessor will be invoked for each defined element in the input data array. + * + * The default radius accessor assumes that the input data are two-element arrays of numbers. If your data are in a different format, or if you wish to transform the data before rendering, + * then you should specify a custom accessor. + * + * @param radius A radius accessor function which returns the radius value. The radius accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + radius(radius: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current defined accessor, which defaults to a function returning a constant boolean value of true. + */ + defined(): (d: Datum, index: number, data: Datum[]) => boolean; + /** + * Sets the defined accessor to the specified boolean and returns this radial line generator. + * + * The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. + * + * When a radial line is generated, the defined accessor will be invoked for each element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + * If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), + * the angle and radius accessors will subsequently be evaluated and the point will be added to the current radial line segment. + * Otherwise, the element will be skipped, the current radial line segment will be ended, and a new radial line segment will be generated for the next defined point. + * As a result, the generated radial line may have several discrete segments. + * + * Note that if a radial line segment consists of only a single point, it may appear invisible unless rendered with rounded or square line caps. + * In addition, some curves such as curveCardinalOpen only render a visible segment if it contains multiple points. + * + * @param defined A boolean constant + */ defined(defined: boolean): this; - defined(defined: (d: Datum, index: number, data: Array) => boolean): this; + /** + * Sets the defined accessor to the specified function and returns this radial line generator. + * + * The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. + * + * When a radial line is generated, the defined accessor will be invoked for each element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + * If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), + * the angle and radius accessors will subsequently be evaluated and the point will be added to the current radial line segment. + * Otherwise, the element will be skipped, the current radial line segment will be ended, and a new radial line segment will be generated for the next defined point. + * As a result, the generated radial line may have several discrete segments. + * + * Note that if a radial line segment consists of only a single point, it may appear invisible unless rendered with rounded or square line caps. + * In addition, some curves such as curveCardinalOpen only render a visible segment if it contains multiple points. + * + * @param defined An accessor function which returns a boolean value. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + defined(defined: (d: Datum, index: number, data: Datum[]) => boolean): this; + + /** + * Returns the current curve factory, which defaults to curveLinear. + */ curve(): CurveFactory | CurveFactoryLineOnly; + /** + * Returns the current curve factory, which defaults to curveLinear. + * + * The generic allows to cast the curve factory to a specifc type, if known. + */ + curve(): C; + /** + * Sets the curve factory and returns this radial line generator. + * + * Note that curveMonotoneX or curveMonotoneY are not recommended for radial lines because they assume that the data is monotonic in x or y, + * which is typically untrue of radial lines. + * + * @param curve A valid curve factory. + */ curve(curve: CurveFactory | CurveFactoryLineOnly): this; + + /** + * Returns the current rendering context, which defaults to null. + */ context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this radial line generator. + * + * If the context is not null, then the generated radial line is rendered to this context as a sequence of path method calls. + * + * @param context The rendering context. + */ context(context: CanvasRenderingContext2D): this; + /** + * Sets the rendering context to null and returns this radial line generator. + * + * A path data string representing the generated radial line will be returned when the generator is invoked with data. + * + * @param context null, to remove rendering context. + */ context(context: null): this; } +/** + * Constructs a new radial line generator with the default settings. + * + * Ensure that the accessors used with the radial line generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + */ export function radialLine(): RadialLine<[number, number]>; +/** + * Constructs a new radial line generator with the default settings. + * + * Ensure that the accessors used with the radial line generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + * + * The generic refers to the data type of an element in the input array passed into the radial line generator. + */ export function radialLine(): RadialLine; // ----------------------------------------------------------------------------------- // Area Generators // ----------------------------------------------------------------------------------- - +/** + * The area generator produces an area, as in an area chart. An area is defined by two bounding lines, either splines or polylines. + * Typically, the two lines share the same x-values (x0 = x1), differing only in y-value (y0 and y1); most commonly, y0 is defined as a constant representing zero. + * The first line (the topline) is defined by x1 and y1 and is rendered first; the second line (the baseline) is defined by x0 and y0 and is rendered second, with the points in reverse order. + * With a curveLinear curve, this produces a clockwise polygon. + * + * The generic refers to the data type of an element in the input array passed into the area generator. + */ export interface Area { - (data: Array): string | undefined; - x(): (d: Datum, index: number, data: Array) => number; + /** + * Generates an area for the given array of data. Depending on this area generator’s associated curve, + * the given input data may need to be sorted by x-value before being passed to the area generator. + * + * IMPORTANT: If the rendering context of the area generator is null, + * then the area is returned as a path data string. + * + * @param data Array of data elements. + */ + (data: Datum[]): string | null; + /** + * Generates an area for the given array of data. Depending on this area generator’s associated curve, + * the given input data may need to be sorted by x-value before being passed to the area generator. + * + * IMPORTANT: If the area generator has been configured with a rendering context, + * then the area is rendered to this context as a sequence of path method calls and this function returns void. + * + * @param data Array of data elements. + */ + (data: Datum[]): void; + + /** + * Returns the current x0 accessor. The default x0 accessor is a function returning the first element of a + * two-element array of numbers. + */ + x(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets x0 to a constant number x and x1 to null and returns this area generator. + * + * Setting x1 to null indicates that the previously-computed x0 value should be reused for the x1 value. + * + * @param x A constant value to be used for x0. + */ x(x: number): this; - x(x: (d: Datum, index: number, data: Array) => number): this; - x0(): (d: Datum, index: number, data: Array) => number; - x0(x0: number): this; - x0(x0: (d: Datum, index: number, data: Array) => number): this; - x1(): ((d: Datum, index: number, data: Array) => number) | null; + /** + * Sets x0 to the specified function x and x1 to null and returns this area generator. + * + * The default x0 accessor assumes that the input data are two-element arrays of numbers and returns the first element. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param x An accessor function returning a value to be used for x0. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + x(x: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current x0 accessor. The default x0 accessor is a function returning the first element of a + * two-element array of numbers. + */ + x0(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets x0 to a constant number and returns this area generator. + * + * @param x A constant value. + */ + x0(x: number): this; + /** + * Sets x0 to the specified function and returns this area generator. + * + * The default x0 accessor assumes that the input data are two-element arrays of numbers and returns the first element. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param x An accessor function returning a value to be used for x0. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + x0(x: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current x1 accessor, which defaults to null, indicating that the previously-computed x0 value should be reused for the x1 value. + */ + x1(): ((d: Datum, index: number, data: Datum[]) => number) | null; + /** + * Sets x1 to null and returns this area generator. + * + * Setting x1 to null indicates that the previously-computed x0 value should be reused for the x1 value. + * + * @param x null. + */ + x1(x: null): this; + /** + * Sets x1 to a constant number and returns this area generator. + * + * @param x A constant value. + */ x1(x: number): this; - x1(x: (d: Datum, index: number, data: Array) => number): this; - y(): (d: Datum, index: number, data: Array) => number; + /** + * Sets x1 to the specified function and returns this area generator. + * + * The default x1 accessor is null, indicating that the previously-computed x0 value should be reused for the x1 value. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param x An accessor function returning a value to be used for x1. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + x1(x: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current y0 accessor. The default y0 accessor is a function returning a constant value of zero. + */ + y(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets y0 to a constant number y and y1 to null and returns this area generator. + * + * Setting y1 to null indicates that the previously-computed y0 value should be reused for the y1 value. + * + * @param y A constant value to be used for y0. + */ y(y: number): this; - y(y: (d: Datum, index: number, data: Array) => number): this; - y0(): (d: Datum, index: number, data: Array) => number; + /** + * Sets y0 to the accessor function y and y1 to null and returns this area generator. + * + * The default y0 accessor returns a constant value of zero. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param y An accessor function returning a value to be used for y0. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + y(y: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current y0 accessor. The default y0 accessor is a function a constant value of zero. + */ + y0(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets y0 to a constant number and returns this area generator. + * + * @param y A constant value. + */ y0(y: number): this; - y0(y: (d: Datum, index: number, data: Array) => number): this; - y1(): (d: Datum, index: number, data: Array) => number; + /** + * Sets y0 to the specified function and returns this area generator. + * + * The default y0 accessor is a function which returns a constant value of zero. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param y An accessor function returning a value to be used for y0. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + y0(y: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current y1 accessor or null. The default y1 accessor is a function returning the second element of a + * two-element array of numbers. + * + * If the y1 accessor is null, the previously-computed y0 value is reused for the y1 value. + * + */ + y1(): ((d: Datum, index: number, data: Datum[]) => number) | null; + /** + * Sets y1 to null and returns this area generator. + * + * Setting y1 to null indicates that the previously-computed y0 value should be reused for the y1 value. + * + * @param y null. + */ + y1(y: null): this; + /** + * Sets y1 to a constant number and returns this area generator. + * + * @param y A constant value. + */ y1(y: number): this; - y1(y: (d: Datum, index: number, data: Array) => number): this; - defined(): (d: Datum, index: number, data: Array) => boolean; + /** + * Sets y1 to the specified function and returns this area generator. + * + * The default y1 accessor assumes that the input data are two-element arrays of numbers and returns the second element. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param y An accessor function returning a value to be used for y1. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + y1(y: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current defined accessor, which defaults to a function returning a constant boolean value of true. + */ + defined(): (d: Datum, index: number, data: Datum[]) => boolean; + /** + * Sets the defined accessor to the specified boolean and returns this area generator. + * + * The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. + * When an area is generated, the defined accessor will be invoked for each element in the input data array, being passed the element d, the index i, and the array data as three arguments. + * If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), the x0, x1, y0 and y1 accessors will subsequently be evaluated and the point will be added to the current area segment. + * Otherwise, the element will be skipped, the current area segment will be ended, and a new area segment will be generated for the next defined point. + * As a result, the generated area may have several discrete segments. + * + * Note that if an area segment consists of only a single point, it may appear invisible unless rendered with rounded or square line caps. + * In addition, some curves such as curveCardinalOpen only render a visible segment if it contains multiple points + * + * @param defined A boolean constant + */ defined(defined: boolean): this; - defined(defined: (d: Datum, index: number, data: Array) => boolean): this; + /** + * Sets the defined accessor to the specified function and returns this area generator. + * + * The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. + * + * The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. + * When an area is generated, the defined accessor will be invoked for each element in the input data array, being passed the element d, the index i, and the array data as three arguments. + * If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), the x0, x1, y0 and y1 accessors will subsequently be evaluated and the point will be added to the current area segment. + * Otherwise, the element will be skipped, the current area segment will be ended, and a new area segment will be generated for the next defined point. + * As a result, the generated area may have several discrete segments. + * + * Note that if an area segment consists of only a single point, it may appear invisible unless rendered with rounded or square line caps. + * In addition, some curves such as curveCardinalOpen only render a visible segment if it contains multiple points + * + * @param defined An accessor function which returns a boolean value. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + defined(defined: (d: Datum, index: number, data: Datum[]) => boolean): this; + + /** + * Returns the current curve factory, which defaults to curveLinear. + */ curve(): CurveFactory; + /** + * Returns the current curve factory, which defaults to curveLinear. + * + * The generic allows to cast the curve factory to a specifc type, if known. + */ + curve(): C; + /** + * Sets the curve factory and returns this area generator. + * + * + * @param curve A valid curve factory. + */ curve(curve: CurveFactory): this; + + /** + * Returns the current rendering context, which defaults to null. + */ context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this area generator. + * + * If the context is not null, then the generated area is rendered to this context as a sequence of path method calls. + * + * @param context The rendering context. + */ context(context: CanvasRenderingContext2D): this; + /** + * Sets the rendering context to null and returns this area generator. + * + * A path data string representing the generated area will be returned when the generator is invoked with data. + * + * @param context null, to remove rendering context. + */ context(context: null): this; + + /** + * Returns a new line generator that has this area generator’s current defined accessor, curve and context. + * The line’s x-accessor is this area’s x0-accessor, and the line’s y-accessor is this area’s y0-accessor. + */ lineX0(): Line; + /** + * Returns a new line generator that has this area generator’s current defined accessor, curve and context. + * The line’s x-accessor is this area’s x0-accessor, and the line’s y-accessor is this area’s y0-accessor. + */ lineY0(): Line; + + /** + * Returns a new line generator that has this area generator’s current defined accessor, curve and context. + * The line’s x-accessor is this area’s x1-accessor, and the line’s y-accessor is this area’s y0-accessor. + */ lineX1(): Line; + /** + * Returns a new line generator that has this area generator’s current defined accessor, curve and context. + * The line’s x-accessor is this area’s x0-accessor, and the line’s y-accessor is this area’s y1-accessor. + */ lineY1(): Line; } +/** + * Constructs a new area generator with the default settings. + * + * Ensure that the accessors used with the area generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + */ export function area(): Area<[number, number]>; +/** + * Constructs a new area generator with the default settings. + * + * Ensure that the accessors used with the area generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + * + * The generic refers to the data type of an element in the input array passed into the area generator. + */ export function area(): Area; - +/** + * A radial area generator. + * + * A radial area generator is equivalent to the standard Cartesian area generator, + * except the x and y accessors are replaced with angle and radius accessors. + * Radial areas are always positioned relative to ⟨0,0⟩; use a transform (see: SVG, Canvas) to change the origin. + * + * The generic refers to the data type of an element in the input array passed into the area generator. + */ export interface RadialArea { - (data: Array): string | undefined; - angle(): (d: Datum, index: number, data: Array) => number; + + /** + * Generates a radial area for the given array of data. + * + * IMPORTANT: If the rendering context of the radial area generator is null, + * then the radial area is returned as a path data string. + * + * @param data Array of data elements. + */ + (data: Datum[]): string | null; + /** + * Generates a radial area for the given array of data. + * + * IMPORTANT: If the radial area generator has been configured with a rendering context, + * then the radial area is rendered to this context as a sequence of path method calls and this function returns void. + * + * @param data Array of data elements. + */ + (data: Datum[]): void; + + /** + * Returns the current startAngle accessor. The default startAngle accessor is a function returning the first element of a + * two-element array of numbers. + */ + angle(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets startAngle to a constant number angle and endAngle to null and returns this radial area generator. + * + * Setting endAngle to null indicates that the previously-computed startAngle value should be reused for the endAngle value. + * + * @param angle A constant value in radians with 0 at -y (12 o’clock). + */ angle(angle: number): this; - angle(angle: (d: Datum, index: number, data: Array) => number): this; - startAngle(): (d: Datum, index: number, data: Array) => number; + /** + * Sets startAngle to the specified function angle and endAngle to null and returns this radial area generator. + * + * The default startAngle accessor assumes that the input data are two-element arrays of numbers and returns the first element. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param angle An accessor function returning a value to be used for startAngle in radians with 0 at -y (12 o’clock). + * The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + angle(angle: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current startAngle accessor. The default startAngle accessor is a function returning the first element of a + * two-element array of numbers. + */ + startAngle(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets startAngle to a constant number and returns this radial area generator. + * + * @param angle A constant value in radians with 0 at -y (12 o’clock). + */ startAngle(angle: number): this; - startAngle(angle: (d: Datum, index: number, data: Array) => number): this; - endAngle(): ((d: Datum, index: number, data: Array) => number) | null; + /** + * Sets startAngle to the specified function and returns this radial area generator. + * + * The default startAngle accessor assumes that the input data are two-element arrays of numbers and returns the first element. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param angle An accessor function returning a value to be used for startAngle in radians with 0 at -y (12 o’clock). + * The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + startAngle(angle: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current endAngle accessor, which defaults to null, indicating that the previously-computed startAngle value should be reused for the endAngle value. + */ + endAngle(): ((d: Datum, index: number, data: Datum[]) => number) | null; + /** + * Sets endAngle to null and returns this radial area generator. + * + * Setting endAngle to null indicates that the previously-computed startAngle value should be reused for the endAngle value. + * + * @param angle null. + */ + endAngle(angle: null): this; + /** + * Sets endAngle to a constant number and returns this radial area generator. + * + * @param angle A constant value in radians with 0 at -y (12 o’clock). + */ endAngle(angle: number): this; - endAngle(angle: (d: Datum, index: number, data: Array) => number): this; - radius(): (d: Datum, index: number, data: Array) => number; + /** + * Sets endAngle to the specified function and returns this radial area generator. + * + * The default endAngle accessor is null, indicating that the previously-computed startAngle value should be reused for the endAngle value. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param angle An accessor function returning a value to be used for endAngle in radians with 0 at -y (12 o’clock). + * The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + endAngle(angle: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current innerRadius accessor. The default innerRadius accessor is a function returning a constant value of zero. + */ + radius(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets innerRadius to a constant number radius and outerRadius to null and returns this radial area generator. + * + * Setting outerRadius to null indicates that the previously-computed innerRadius value should be reused for the outerRadius value. + * + * @param radius A constant value to be used for innerRadius. + */ radius(radius: number): this; - radius(radius: (d: Datum, index: number, data: Array) => number): this; - innerRadius(): (d: Datum, index: number, data: Array) => number; + /** + * Sets innerRadius to the accessor function radius and outerRadius to null and returns this radial area generator. + * + * The default innerRadius accessor returns a constant value of zero. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param radius An accessor function returning a value to be used for innerRadius. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + radius(radius: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current innerRadius accessor. The default innerRadius accessor is a function a constant value of zero. + */ + innerRadius(): (d: Datum, index: number, data: Datum[]) => number; + /** + * Sets innerRadius to a constant number and returns this radial area generator. + * + * @param radius A constant value. + */ innerRadius(radius: number): this; - innerRadius(radius: (d: Datum, index: number, data: Array) => number): this; - outerRadius(): (d: Datum, index: number, data: Array) => number; + /** + * Sets innerRadius to the specified function and returns this radial area generator. + * + * The default innerRadius accessor is a function which returns a constant value of zero. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param radius An accessor function returning a value to be used for innerRadius. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + innerRadius(radius: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current outerRadius accessor or null. The default outerRadius accessor is a function returning the second element of a + * two-element array of numbers. + * + * If the outerRadius accessor is null, the previously-computed innerRadius value is reused for the outerRadius value. + * + */ + outerRadius(): ((d: Datum, index: number, data: Datum[]) => number) | null; + /** + * Sets outerRadius to null and returns this radial area generator. + * + * Setting outerRadius to null indicates that the previously-computed innerRadius value should be reused for the outerRadius value. + * + * @param radius null. + */ + outerRadius(radius: null): this; + /** + * Sets outerRadius to a constant number and returns this radial area generator. + * + * @param radius A constant value. + */ outerRadius(radius: number): this; - outerRadius(radius: (d: Datum, index: number, data: Array) => number): this; - defined(): (d: Datum, index: number, data: Array) => boolean; + /** + * Sets outerRadius to the specified function and returns this radial area generator. + * + * The default outerRadius accessor assumes that the input data are two-element arrays of numbers and returns the second element. + * If your data are in a different format, or if you wish to transform the data before rendering, then you should specify a custom accessor. + * + * @param radius An accessor function returning a value to be used for outerRadius. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + outerRadius(radius: (d: Datum, index: number, data: Datum[]) => number): this; + + /** + * Returns the current defined accessor, which defaults to a function returning a constant boolean value of true. + */ + defined(): (d: Datum, index: number, data: Datum[]) => boolean; + /** + * Sets the defined accessor to the specified boolean and returns this radial area generator. + * + * The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. + * + * When a radial area is generated, the defined accessor will be invoked for each element in the input data array, being passed the element d, the index i, and the array data as three arguments. + * If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), + * the startAngle, endAngle, innerRadius and outerRadius accessors will subsequently be evaluated and the point will be added to the current area segment. + * + * Otherwise, the element will be skipped, the current area segment will be ended, and a new area segment will be generated for the next defined point. + * As a result, the generated area may have several discrete segments. + * + * Note that if an area segment consists of only a single point, it may appear invisible unless rendered with rounded or square line caps. + * In addition, some curves such as curveCardinalOpen only render a visible segment if it contains multiple points + * + * @param defined A boolean constant + */ defined(defined: boolean): this; - defined(defined: (d: Datum, index: number, data: Array) => boolean): this; + /** + * Sets the defined accessor to the specified function and returns this radial area generator. + * + * The default accessor for defined returns a constant boolean value of true, thus assumes that the input data is always defined. + * + * When a radial area is generated, the defined accessor will be invoked for each element in the input data array, being passed the element d, the index i, and the array data as three arguments. + * If the given element is defined (i.e., if the defined accessor returns a truthy value for this element), + * the startAngle, endAngle, innerRadius and outerRadius accessors will subsequently be evaluated and the point will be added to the current area segment. + * + * Otherwise, the element will be skipped, the current area segment will be ended, and a new area segment will be generated for the next defined point. + * As a result, the generated area may have several discrete segments. + * + * Note that if an area segment consists of only a single point, it may appear invisible unless rendered with rounded or square line caps. + * In addition, some curves such as curveCardinalOpen only render a visible segment if it contains multiple points + * + * @param defined An accessor function which returns a boolean value. The accessor will be invoked for each defined element in the input data array, + * being passed the element d, the index i, and the array data as three arguments. + */ + defined(defined: (d: Datum, index: number, data: Datum[]) => boolean): this; + + /** + * Returns the current curve factory, which defaults to curveLinear. + */ curve(): CurveFactory; + /** + * Returns the current curve factory, which defaults to curveLinear. + * + * The generic allows to cast the curve factory to a specifc type, if known. + */ + curve(): C; + /** + * Sets the curve factory and returns this radial area generator. + * + * Note that curveMonotoneX or curveMonotoneY are not recommended for radial areas because they assume that the data is monotonic in x or y, which is typically untrue of radial areas. + * + * @param curve A valid curve factory. + */ curve(curve: CurveFactory): this; + + /** + * Returns the current rendering context, which defaults to null. + */ context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this radial area generator. + * + * If the context is not null, then the generated radial area is rendered to this context as a sequence of path method calls. + * + * @param context The rendering context. + */ context(context: CanvasRenderingContext2D): this; + /** + * Sets the rendering context to null and returns this radial area generator. + * + * A path data string representing the generated radial area will be returned when the generator is invoked with data. + * + * @param context null, to remove rendering context. + */ context(context: null): this; + + /** + * Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. + * The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s inner radius accessor. + */ lineStartAngle(): RadialLine; + + /** + * Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. + * The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s inner radius accessor. + */ lineInnerRadius(): RadialLine; + + /** + * Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. + * The line’s angle accessor is this area’s end angle accessor, and the line’s radius accessor is this area’s inner radius accessor. + */ lineEndAngle(): RadialLine; + + /** + * Returns a new radial line generator that has this radial area generator’s current defined accessor, curve and context. + * The line’s angle accessor is this area’s start angle accessor, and the line’s radius accessor is this area’s outer radius accessor. + */ lineOuterRadius(): RadialLine; } +/** + * Constructs a new radial area generator with the default settings. + * + * Ensure that the accessors used with the area generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + */ export function radialArea(): RadialArea<[number, number]>; +/** + * Constructs a new radial area generator with the default settings. + * + * Ensure that the accessors used with the area generator correspond to the arguments passed into them, + * or set them to constants as appropriate. + * + * The generic refers to the data type of an element in the input array passed into the radial area generator. + */ export function radialArea(): RadialArea; // ----------------------------------------------------------------------------------- // Curve Factories // ----------------------------------------------------------------------------------- +/** + * A minimal interface for a curve generator which supports only the rendering of lines. + * Methods for related to the rendering of areas are not implemented in this minimal interface. + * + * While lines are defined as a sequence of two-dimensional [x, y] points, + * there remains the task of transforming this discrete representation into a continuous shape: i.e., how to interpolate between the points. + * A curve generator serves this purpose. + * + * Curves are typically not constructed or used directly, instead being passed to line.curve. + */ export interface CurveGeneratorLineOnly { + /** + * Indicates the start of a new line segment. Zero or more points will follow. + */ lineStart(): void; + /** + * Indicates the end of the current line segment. + */ lineEnd(): void; + /** + * Indicates a new point in the current line segment with the given x- and y-values. + */ point(x: number, y: number): void; } +/** + * A factory for curve generators addressing only lines, but not areas. + */ +// This is a base interface to be extended, hence the suppression of the warning +// tslint:disable-next-line:functional-interfaces export interface CurveFactoryLineOnly { - (context: CanvasRenderingContext2D | null): CurveGeneratorLineOnly; + /** + * Returns a "lines only" curve generator which renders to the specified context. + * + * @param context A rendering context + */ + (context: CanvasRenderingContext2D | Path): CurveGeneratorLineOnly; } +/** + * A minimal interface for a curve generator which supports the rendering of lines and areas. + * + * While lines are defined as a sequence of two-dimensional [x, y] points, + * and areas are similarly defined by a topline and a baseline, + * there remains the task of transforming this discrete representation into a continuous shape: i.e., how to interpolate between the points. + * A curve generator serves this purpose. + * + * Curves are typically not constructed or used directly, instead being passed to line.curve and area.curve. + */ export interface CurveGenerator extends CurveGeneratorLineOnly { + /** + * Indicates the start of a new area segment. + * Each area segment consists of exactly two line segments: the topline, followed by the baseline, with the baseline points in reverse order. + */ areaStart(): void; + /** + * Indicates the end of the current area segment. + */ areaEnd(): void; } +/** + * A factory for curve generators addressing both lines and areas. + */ +// This is a base interface to be extended, hence the suppression of the warning +// tslint:disable-next-line:functional-interfaces export interface CurveFactory { - (context: CanvasRenderingContext2D | null): CurveGenerator; + /** + * Returns a curve generator which renders to the specified context. + * + * @param context A rendering context + */ + (context: CanvasRenderingContext2D | Path): CurveGenerator; } +/** + * A curve factory for cubic basis spline generators. + * + * The curve generators produce a cubic basis spline using the specified control points. + * The first and last points are triplicated such that the spline starts at the first point and ends at the last point, + * and is tangent to the line between the first and second points, and to the line between the penultimate and last points. + */ export var curveBasis: CurveFactory; -export var curveBasisOpen: CurveFactory; - +/** + * A curve factory for closed cubic basis spline generators. + * + * The curve generators produce a closed cubic basis spline using the specified control points. + * When a line segment ends, the first three control points are repeated, producing a closed loop with C2 continuity. + */ export var curveBasisClosed: CurveFactory; +/** + * A curve factory for open cubic basis spline generators. + * + * The curve generators produce a cubic basis spline using the specified control points. + * Unlike basis, the first and last points are not repeated, and thus the curve typically does not intersect these points. + */ +export var curveBasisOpen: CurveFactory; + +/** + * A curve factory for straightened cubic basis spline generators. + * + * The curve generators produce a straightened cubic basis spline using the specified control points, + * with the spline straightened according to the curve’s beta, which defaults to 0.85. + * This curve is typically used in hierarchical edge bundling to disambiguate connections, + * as proposed by Danny Holten in Hierarchical Edge Bundles: Visualization of Adjacency Relations in Hierarchical Data. + * + * This curve does not implement curve.areaStart and curve.areaEnd; it is intended to work with d3.line, not d3.area. + */ export interface CurveBundleFactory extends CurveFactoryLineOnly { + /** + * Returns a bundle curve factory with the specified beta in the range [0, 1], representing the bundle strength. + * If beta equals zero, a straight line between the first and last point is produced; if beta equals one, + * a standard basis spline is produced. + * + * @param beta A constant value in the [0, 1] interval. + */ beta(beta: number): this; } +/** + * A curve factory for straightened cubic basis spline generators. + * + * The curve generators produce a straightened cubic basis spline using the specified control points, + * with the spline straightened according to the curve’s beta, which defaults to 0.85. + * This curve is typically used in hierarchical edge bundling to disambiguate connections, + * as proposed by Danny Holten in Hierarchical Edge Bundles: Visualization of Adjacency Relations in Hierarchical Data. + * + * This curve does not implement curve.areaStart and curve.areaEnd; it is intended to work with d3.line, not d3.area. + */ export var curveBundle: CurveBundleFactory; + +/** + * A curve factory for cubic cardinal spline generators. + */ export interface CurveCardinalFactory extends CurveFactory { + /** + * Returns a cardinal curve factory with the specified tension in the range [0, 1]. + * The tension determines the length of the tangents: a tension of one yields all zero tangents, equivalent to curveLinear; a tension of zero produces a uniform Catmull–Rom spline. + * + * @param tension A constant in the [0, 1] interval. + */ tension(tension: number): this; } +/** + * A curve factory for cubic cardinal spline generators. + * + * The curve generators produce a cubic cardinal spline using the specified control points, with one-sided differences used for the first and last piece. + * The default tension is 0. + */ export var curveCardinal: CurveCardinalFactory; -export var curveCardinalOpen: CurveCardinalFactory; + +/** + * A curve factory for closed cubic cardinal spline generators. + * + * The curve generators produce closed cubic cardinal spline using the specified control points. + * When a line segment ends, the first three control points are repeated, producing a closed loop. + * The default tension is 0. + */ export var curveCardinalClosed: CurveCardinalFactory; +/** + * A curve factory for open cubic cardinal spline generators. + * + * The curve generators produce a cubic cardinal spline using the specified control points. + * Unlike curveCardinal, one-sided differences are not used for the first and last piece, + * and thus the curve starts at the second point and ends at the penultimate point. + * The default tension is 0. + */ +export var curveCardinalOpen: CurveCardinalFactory; + +/** + * A curve factory for cubic Catmull–Rom spline generators. + */ export interface CurveCatmullRomFactory extends CurveFactory { + /** + * Returns a cubic Catmull–Rom curve factory with the specified alpha in the range [0, 1]. + * If alpha is zero, produces a uniform spline, equivalent to curveCardinal with a tension of zero; + * if alpha is one, produces a chordal spline; if alpha is 0.5, produces a centripetal spline. + * Centripetal splines are recommended to avoid self-intersections and overshoot. + * + * @param alpha A constant in the [0, 1] interval. + */ alpha(alpha: number): this; } +/** + * A curve factory for cubic Catmull–Rom spline generators. + * + * The curve generators produce a cubic Catmull–Rom spline using the specified control points and the parameter alpha, + * which defaults to 0.5, as proposed by Yuksel et al. in On the Parameterization of Catmull–Rom Curves, + * with one-sided differences used for the first and last piece. + */ export var curveCatmullRom: CurveCatmullRomFactory; -export var curveCatmullRomOpen: CurveCatmullRomFactory; + +/** + * A curve factory for cubic Catmull–Rom spline generators. + * + * The curve generators produce a closed cubic Catmull–Rom spline using the specified control points and the parameter alpha, + * which defaults to 0.5, as proposed by Yuksel et al. When a line segment ends, + * the first three control points are repeated, producing a closed loop. + */ export var curveCatmullRomClosed: CurveCatmullRomFactory; +/** + * A curve factory for cubic Catmull–Rom spline generators. + * + * The curve generators produce a cubic Catmull–Rom spline using the specified control points and the parameter alpha, + * which defaults to 0.5, as proposed by Yuksel et al. Unlike curveCatmullRom, one-sided differences are not used for the first and last piece, + * and thus the curve starts at the second point and ends at the penultimate point. + */ +export var curveCatmullRomOpen: CurveCatmullRomFactory; + + +/** + * A curve factory for polyline generators. + * + * The curve generators produce a polyline through the specified points. + */ export var curveLinear: CurveFactory; +/** + * A curve factory for closed polyline generators. + * + * The curve generators produce a closed polyline through the specified points by repeating the first point when the line segment ends. + */ export var curveLinearClosed: CurveFactory; +/** + * A curve factory for cubic spline generators preserving monotonicity in y. + * + * The curve generators produce a cubic spline that preserves monotonicity in y, assuming monotonicity in x, as proposed by Steffen in A simple method for monotonic interpolation in one dimension: + * “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations. + * Local extrema can occur only at grid points where they are given by the data, but not in between two adjacent grid points.” + */ export var curveMonotoneX: CurveFactory; +/** + * A curve factory for cubic spline generators preserving monotonicity in x. + * + * The curve generators produce a cubic spline that preserves monotonicity in x, assuming monotonicity in y, as proposed by Steffen in A simple method for monotonic interpolation in one dimension: + * “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations. + * Local extrema can occur only at grid points where they are given by the data, but not in between two adjacent grid points.” + */ export var curveMonotoneY: CurveFactory; +/** + * A curve factory for natural cubic spline generators. + * + * The curve generators produce a natural cubic spline with the second derivative of the spline set to zero at the endpoints. + */ export var curveNatural: CurveFactory; +/** + * A curve factory for step function (midpoint) generators. + * + * The curve generators produce a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. + * The y-value changes at the midpoint of each pair of adjacent x-values. + */ export var curveStep: CurveFactory; +/** + * A curve factory for step function (after) generators. + * + * The curve generators produce a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. + * The y-value changes after the x-value. + */ export var curveStepAfter: CurveFactory; +/** + * A curve factory for step function (before) generators. + * + * The curve generators produce a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. + * The y-value changes before the x-value. + */ export var curveStepBefore: CurveFactory; @@ -285,39 +1866,185 @@ export var curveStepBefore: CurveFactory; // SYMBOLS // ----------------------------------------------------------------------------------- +/** + * A Symbol Type. + * + * Symbol types are typically not used directly, instead being passed to symbol.type. + * However, you can define your own sumbol type implementation should none of the built-in types satisfy your needs using the following interface. + * You can also use this low-level interface with a built-in symbol type as an alternative to the symbol generator + */ export interface SymbolType { + /** + * Renders this symbol type to the specified context with the specified size in square pixels. The context implements the CanvasPathMethods interface. + * (Note that this is a subset of the CanvasRenderingContext2D interface!) + * + * @param context A rendering context implementing CanvasPathMethods. + * @param size Size of the symbol to draw. + */ draw(context: CanvasPathMethods, size: number): void; } - +/** + * A symbol generator. + * + * Symbols provide a categorical shape encoding as is commonly used in scatterplots. Symbols are always centered at ⟨0,0⟩; + * use a transform (see: SVG, Canvas) to move the arc to a different position. + * + * The first generic corresponds to the "this" context within which the symbol generator is invoked. + * The second generic corrsponds to the data type of the datum underlying the symbol. + */ export interface Symbol { - (this: This, d?: Datum, ...args: any[]): undefined | string; + /** + * Generates a symbol for the given arguments. + * + * IMPORTANT: If the rendering context of the symbol generator is null, + * then the symbol is returned as a path data string. + * + * The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. + * All arguments passed into this function, will be passed to the accessor functions of the generator. + * + * For example, with the default settings, no arguments are needed to produce a circle with area 64 square pixels. + * + * @param d The datum for which the symbol is to be generated. + */ + (this: This, d?: Datum, ...args: any[]): string | null; + /** + * Generates an symbol for the given arguments. + * + * IMPORTANT: If the symbol generator has been configured with a rendering context, + * then the symbol is rendered to this context as a sequence of path method calls and this function returns void. + * + * The "this" context within which this function is invoked, will be the context within which the accessor methods of the generator are invoked. + * All arguments passed into this function, will be passed to the accessor functions of the generator. + * + * For example, with the default settings, no arguments are needed to produce a circle with area 64 square pixels. + * + * @param d The datum for which the symbol is to be generated. + */ + (this: This, d?: Datum, ...args: any[]): void; + /** + * Returns the current size accessor, which defaults to a function returning a constant value of 64. + */ size(): (this: This, d: Datum, ...args: any[]) => number; + /** + * Sets the size to the specified number and returns this symbol generator. + * + * @param size A fixed size (area in square pixels). + */ size(size: number): this; + /** + * Sets the size to the specified function and returns this symbol generator. + * + * Specifying the size as a function is useful for constructing a scatterplot with a size encoding. + * If you wish to scale the symbol to fit a given bounding box, rather than by area, try SVG’s getBBox. + * + * @param size An accessor function returning a number to be used as a symbol size. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the symbol generator. + */ size(size: (this: This, d: Datum, ...args: any[]) => number): this; + + /** + * Returns the current symbol type accessor, which defaults to a function returning the circle symbol type. + */ type(): (this: This, d: Datum, ...args: any[]) => SymbolType; + /** + * Sets the symbol type to the specified symbol type and returns this symbol generator. + * + * + * @param type A constant symbol type. + */ type(type: SymbolType): this; + /** + * Sets the symbol type to the specified function and returns this symbol generator. + * + * @param type An accessor function returning a symbol type. The accessor function is invoked in the same "this" context as the generator was invoked in and + * receives the same arguments that were passed into the symbol generator. See symbols for the set of built-in symbol types. + * To implement a custom symbol type, return an object that implements symbolType.draw. + */ type(type: (this: This, d: Datum, ...args: any[]) => SymbolType): this; + + /** + * Returns the current rendering context, which defaults to null. + */ context(): CanvasRenderingContext2D | null; + /** + * Sets the rendering context and returns this symbol generator. + * + * If the context is not null, then the generated symbol is rendered to this context as a sequence of path method calls. + * + * @param context The rendering context. + */ context(context: CanvasRenderingContext2D): this; + /** + * Sets the rendering context to null and returns this symbol generator. + * + * A path data string representing the generated symbol will be returned when the generator is invoked with data. + * + * @param context null, to remove rendering context. + */ context(context: null): this; } +/** + * Constructs a new symbol generator with the default settings. + */ export function symbol(): Symbol; + +/** + * Constructs a new symbol generator with the default settings. + * + * The generic corrsponds to the data type of the datum underlying the symbol. + */ export function symbol(): Symbol; + +/** + * Constructs a new symbol generator with the default settings. + * + * The first generic corresponds to the "this" context within which the symbol generator is invoked. + * The second generic corrsponds to the data type of the datum underlying the symbol. + */ export function symbol(): Symbol; -export var symbols: Array; - +/** + * An array containing the set of all built-in symbol types: circle, cross, diamond, square, star, triangle, and wye. + * Useful for constructing the range of an ordinal scale should you wish to use a shape encoding for categorical data. + */ +export var symbols: SymbolType[]; +/** + * The circle symbol type. + */ export var symbolCircle: SymbolType; +/** + * The Greek cross symbol type, with arms of equal length. + */ export var symbolCross: SymbolType; + +/** + * The rhombus symbol type. + */ export var symbolDiamond: SymbolType; + +/** + * The square symbol type. + */ export var symbolSquare: SymbolType; + +/** + * The pentagonal star (pentagram) symbol type. + */ export var symbolStar: SymbolType; + +/** + * he up-pointing triangle symbol type. + */ export var symbolTriangle: SymbolType; + +/** + * The Y-shape symbol type. + */ export var symbolWye: SymbolType; @@ -325,56 +2052,270 @@ export var symbolWye: SymbolType; // STACKS // ----------------------------------------------------------------------------------- - -// SeriesPoint is a [number, number] two-element Array with added -// data and index properties related to the data element which formed the basis for the -// SeriesPoint +/** + * Each series point j in a stack chart corresponds to the jth element in the input data. + * Each point is represented as an array [y0, y1] where y0 is the lower value (baseline) and y1 is the upper value (topline); + * the difference between y0 and y1 corresponds to the computed value for this point. + * + * SeriesPoint is a [number, number] two-element Array with added data and index properties + * related to the data element which formed the basis for theSeriesPoint + */ export interface SeriesPoint extends Array { + /** + * Correponds to y0, the lower value (baseline). + */ 0: number; + /** + * Correponds to y1, the upper value (topline). + */ 1: number; - index: number; + /** + * The data element underlying the series point. + */ data: Datum; } +/** + * The series are determined by the keys accessor; each series i in the returned array corresponds to the ith key. + * Each series is an array of points, where each point j corresponds to the jth element in the input data. + * + * The key for each series is available as series.key, and the index as series.index. + */ export interface Series extends Array> { + /** + * Key of the series + */ key: Key; + /** + * Index of the series in the series array returned by stack generator + */ + index: number; } +/** + * A stack generator. + * + * Some shape types can be stacked, placing one shape adjacent to another. For example, a bar chart of monthly sales might be broken down into a multi-series bar chart by product category, stacking bars vertically. + * This is equivalent to subdividing a bar chart by an ordinal dimension (such as product category) and applying a color encoding. + * + * Stacked charts can show overall value and per-category value simultaneously; however, it is typically harder to compare across categories, as only the bottom layer of the stack is aligned. + * So, chose the stack order carefully, and consider a streamgraph. (See also grouped charts.) + * + * Like the pie generator, the stack generator does not produce a shape directly. Instead it computes positions which you can then pass to an area generator or use directly, say to position bars. + * + * The first generic corresponds to the "this" context in which the stack generator and its accessor functions are invoked. + * + * The second generic corresponds to the data type of an element in the data array passed into the stack generator. + * + * The third generic corresponds to the data type of key used to identify a series. + */ export interface Stack { - (data: Array, ...args: any[]): Array>; + /** + * Generates a stack for the given array of data, returning an array representing each series. + * The resulting array has one element per series. Each series in then typically passed to an area generator to render an area chart, + * or used to construct rectangles for a bar chart. + * + * Any additional arguments are arbitrary; they are simply propagated to the generator’s accessor functions along with the this object. + * + * @param data Array of data elements. + */ + (data: Datum[], ...args: any[]): Array>; - keys(): (this: This, data: Array, ...args: any[]) => Array; - keys(keys: Array): this; - keys(keys: (this: This, data: Array, ...args: any[]) => Array): this; + /** + * Returns the current keys accessor, which defaults to the empty array. + */ + keys(): (this: This, data: Datum[], ...args: any[]) => Key[]; + /** + * Sets the keys accessor to the specified function or array and returns this stack generator. + * + * A series (layer) is generated for each key. Keys are typically strings, but they may be arbitrary values. + * The series’ key is passed to the value accessor, along with each data point, to compute the point’s value. + * + * @param keys An array of keys. + */ + keys(keys: Key[]): this; + /** + * Sets the keys accessor to the specified function or array and returns this stack generator. + * + * A series (layer) is generated for each key. Keys are typically strings, but they may be arbitrary values. + * The series’ key is passed to the value accessor, along with each data point, to compute the point’s value. + * + * @param keys An accessor function returning the array of keys. The accessor function is invoked with the "this" context of the Stack generator and passed the same arguments passed into the generator. + */ + keys(keys: (this: This, data: Datum[], ...args: any[]) => Key[]): this; - value(): (d: Datum, key: Key, j: number, data: Array) => number; + /** + * Returns the current value accessor, which defaults to a function return the property corresponding to the relevant key from the data element. + * + * Thus, by default the stack generator assumes that the input data is an array of objects, with each object exposing named properties with numeric values; see stack for an example. + */ + value(): (d: Datum, key: Key, j: number, data: Datum[]) => number; + /** + * Sets the value accessor to the specified number and returns this stack generator. + * + * @param value A constant value. + */ value(value: number): this; - value(value: (d: Datum, key: Key, j: number, data: Array) => number): this; + /** + * Sets the value accessor to the specified function and returns this stack generator. + * + * @param value A value accessor function which returns the numeric value for a given data element and key combination. The accessor function is invoked for each data element and key being passed + * the datum, the key, index of the data element in the input data array, and the complete data array. + */ + value(value: (d: Datum, key: Key, j: number, data: Datum[]) => number): this; - order(): (series: Series) => Array; + /** + * Returns the current order acccesor, which defaults to stackOrderNone; this uses the order given by the key accessor. + */ + order(): (series: Series) => number[]; + /** + * Reset the order to use stackOrderNone; this uses the order given by the key accessor. + * + * @param order null to set to the default stackOrderNone. + */ order(order: null): this; - order(order: Array): this; - order(order: (series: Series) => Array): this; + /** + * Sets the order accessor to the specified array and returns this stack generator. + * + * The stack order is computed prior to the offset; thus, the lower value for all points is zero at the time the order is computed. + * The index attribute for each series is also not set until after the order is computed. + * + * @param order An array of numeric indexes representing the stack order. + */ + order(order: number[]): this; + /** + * Sets the order accessor to the specified function and returns this stack generator. + * + * The stack order is computed prior to the offset; thus, the lower value for all points is zero at the time the order is computed. + * The index attribute for each series is also not set until after the order is computed. + * + * See stack orders for the built-in orders. + * + * @param order A function returning a sort order array. It is passed the generated series array and must return an array of numeric indexes representing the stack order. + */ + order(order: (series: Series) => number[]): this; - offset(): (series: Series, order: Array) => void; + /** + * Returns the current offset acccesor, which defaults to stackOffsetNone; this uses a zero baseline. + */ + offset(): (series: Series, order: number[]) => void; + /** + * Reset the offset to use stackOffsetNone; this uses a zero baseline. + * + * @param offset null to set to the default stackOffsetNone. + */ offset(offset: null): this; - offset(offset: (series: Series, order: Array) => void): this; + /** + * Sets the offset accessor to the specified function and returns this stack generator. + * + * @param offset A function which is passed the generated series array and the order index array. The offset function is then responsible for updating the lower and upper values in the series array to layout the stack. + */ + offset(offset: (series: Series, order: number[]) => void): this; } +/** + * Constructs a new stack generator with the default settings. + * + * Ensure that the accessors used with the stack generator correspond to the arguments passed into them. + */ export function stack(): Stack; +/** + * Constructs a new stack generator with the default settings. + * + * Ensure that the accessors used with the stack generator correspond to the arguments passed into them. + * + * The generic corresponds to the data type of an element in the data array passed into the stack generator. + */ export function stack(): Stack; +/** + * Constructs a new stack generator with the default settings. + * + * Ensure that the accessors used with the stack generator correspond to the arguments passed into them. + * + * The first generic corresponds to the data type of an element in the data array passed into the stack generator. + * + * The second generic corresponds to the data type of key used to identify a series. + */ export function stack(): Stack; +/** + * Constructs a new stack generator with the default settings. + * + * Ensure that the accessors used with the stack generator correspond to the arguments passed into them. + * + * The first generic corresponds to the "this" context in which the stack generator and its accessor functions are invoked. + * + * The second generic corresponds to the data type of an element in the data array passed into the stack generator. + * + * The third generic corresponds to the data type of key used to identify a series. + */ export function stack(): Stack; +/** + * Returns a series order such that the smallest series (according to the sum of values) is at the bottom. + * + * @param series A series generated by a stack generator + */ +export function stackOrderAscending(series: Series): number[]; -export function stackOrderAscending(series: Series): Array; -export function stackOrderDescending(series: Series): Array -export function stackOrderInsideOut(series: Series): Array -export function stackOrderNone(series: Series): Array -export function stackOrderReverse(series: Series): Array +/** + * Returns a series order such that the largest series (according to the sum of values) is at the bottom. + * + * @param series A series generated by a stack generator + */ +export function stackOrderDescending(series: Series): number[]; -export function stackOffsetExpand(series: Series, order: Array): void; -export function stackOffsetNone(series: Series, order: Array): void; -export function stackOffsetSilhouette(series: Series, order: Array): void; -export function stackOffsetWiggle(series: Series, order: Array): void; +/** + * Returns a series order such that the larger series (according to the sum of values) are on the inside and the smaller series are on the outside. + * This order is recommended for streamgraphs in conjunction with the wiggle offset. See Stacked Graphs—Geometry & Aesthetics by Bryon & Wattenberg for more information. + * + * @param series A series generated by a stack generator + */ +export function stackOrderInsideOut(series: Series): number[]; + +/** + * Returns the given series order [0, 1, … n - 1] where n is the number of elements in series. Thus, the stack order is given by the key accessor. + * + * @param series A series generated by a stack generator + */ +export function stackOrderNone(series: Series): number[]; + +/** + * Returns the reverse of the given series order [n - 1, n - 2, … 0] where n is the number of elements in series. Thus, the stack order is given by the reverse of the key accessor. + * + * @param series A series generated by a stack generator + */ +export function stackOrderReverse(series: Series): number[]; + +/** + * Applies a zero baseline and normalizes the values for each point such that the topline is always one. + * + * @param series A series generated by a stack generator + * @param order An array of numeric indexes representing the stack order. + */ +export function stackOffsetExpand(series: Series, order: number[]): void; + +/** + * Applies a zero baseline. + * + * @param series A series generated by a stack generator + * @param order An array of numeric indexes representing the stack order. + */ +export function stackOffsetNone(series: Series, order: number[]): void; + +/** + * Shifts the baseline down such that the center of the streamgraph is always at zero. + * + * @param series A series generated by a stack generator + * @param order An array of numeric indexes representing the stack order. + */ +export function stackOffsetSilhouette(series: Series, order: number[]): void; + +/** + * Shifts the baseline so as to minimize the weighted wiggle of layers. This offset is recommended for streamgraphs in conjunction with the inside-out order. + * See Stacked Graphs—Geometry & Aesthetics by Bryon & Wattenberg for more information. + * + * @param series A series generated by a stack generator + * @param order An array of numeric indexes representing the stack order. + */ +export function stackOffsetWiggle(series: Series, order: number[]): void; diff --git a/d3-shape/tsconfig.json b/d3-shape/tsconfig.json index be2622a32c..311aea0647 100644 --- a/d3-shape/tsconfig.json +++ b/d3-shape/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-shape-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-shape-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-shape/tslint.json b/d3-shape/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-shape/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3-time-format/tsconfig.json b/d3-time-format/tsconfig.json index a51247265c..0047045e92 100644 --- a/d3-time-format/tsconfig.json +++ b/d3-time-format/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-time-format-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-time-format-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-time/d3-time-tests.ts b/d3-time/d3-time-tests.ts index da765f75f4..b16c3e40ea 100644 --- a/d3-time/d3-time-tests.ts +++ b/d3-time/d3-time-tests.ts @@ -70,13 +70,13 @@ resultDate = countableI.offset(inBetween, 3); dateArray = countableI.range(new Date(), new Date()); // TODO: specify dates dateArray = countableI.range(new Date(), new Date(), 2); // TODO: specify dates -// countI = countI.filter((d: Date)=>{ return d.getMonth() === 2;}); // Test fails, since .filter(...) return Interval and not CountableInterval +// countableI = countableI.filter((d: Date)=>{ return d.getMonth() === 2;}); // Test fails, since .filter(...) return Interval and not CountableInterval simpleI = countableI.filter((d: Date) => { return d.getMonth() === 2; }); count = countableI.count(start, end); -// countI = countI.every(10); // Test fails, since .every(...) return Interval and not CountableInterval -simpleI = countableI.every(10); +// let countableIOrNull: d3Time.CountableTimeInterval | null = countableI.every(10); // Test fails, since .every(...) return Interval and not CountableInterval +let simpleIOrNull: d3Time.TimeInterval | null = countableI.every(10); resultDate = simpleI.floor(inBetween); resultDate = simpleI.round(inBetween); diff --git a/d3-time/index.d.ts b/d3-time/index.d.ts index 526d0fb43e..912d999ce4 100644 --- a/d3-time/index.d.ts +++ b/d3-time/index.d.ts @@ -1,24 +1,143 @@ -// Type definitions for D3JS d3-time module v1.0.2 +// Type definitions for D3JS d3-time module 1.0 // Project: https://github.com/d3/d3-time/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.4 + // --------------------------------------------------------------- // Interfaces // --------------------------------------------------------------- +/** + * A D3 Time Interval + */ export interface TimeInterval { + /** + * Returns a new date representing the latest interval boundary date before or equal to date. + * This function is an alias for "TimeInterval.floor(date)". For example, timeYear(date) and timeYear.floor(date) are equivalent. + * + * For example, timeDay(date) typically returns 12:00 AM local time on the given date. + * + * This function is idempotent: if the specified date is already floored to the current interval, a new date with an identical time is returned. + * Furthermore, the returned date is the minimum expressible value of the associated interval, such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date. + * + * Note that the == and === operators do not compare by value with Date objects, and thus you cannot use them to tell whether the specified date has already been floored. Instead, coerce to a number and then compare. + * + * This is more reliable than testing whether the time is 12:00 AM, as in some time zones midnight may not exist due to daylight saving. + * + * @param date A date object. + */ (date: Date): Date; + + /** + * Returns a new date representing the latest interval boundary date before or equal to date. + * + * For example, timeDay.floor(date) typically returns 12:00 AM local time on the given date. + * + * This method is idempotent: if the specified date is already floored to the current interval, a new date with an identical time is returned. + * Furthermore, the returned date is the minimum expressible value of the associated interval, such that interval.floor(interval.floor(date) - 1) returns the preceeding interval boundary date. + * + * Note that the == and === operators do not compare by value with Date objects, and thus you cannot use them to tell whether the specified date has already been floored. Instead, coerce to a number and then compare. + * + * This is more reliable than testing whether the time is 12:00 AM, as in some time zones midnight may not exist due to daylight saving. + * + * @param date A date object. + */ floor(date: Date): Date; + + /** + * Returns a new date representing the closest interval boundary date to date. + * + * For example, timeDay.round(date) typically returns 12:00 AM local time on the given date if it is on or before noon, + * and 12:00 AM of the following day if it is after noon. + * + * This method is idempotent: if the specified date is already rounded to the current interval, a new date with an identical time is returned. + * + * @param date A date object. + */ round(date: Date): Date; + + /** + * Returns a new date representing the earliest interval boundary date after or equal to date. + * + * For example, timeDay.ceil(date) typically returns 12:00 AM local time on the date following the given date. + * + * This method is idempotent: if the specified date is already ceilinged to the current interval, a new date with an identical time is returned. Furthermore, + * the returned date is the maximum expressible value of the associated interval, such that interval.ceil(interval.ceil(date) + 1) returns the following interval boundary date. + * + * @param date A date object. + */ ceil(date: Date): Date; + + /** + * Returns a new date equal to date plus step intervals. + * + * If step is not specified it defaults to 1. + * + * This method does not round the specified date to the interval. For example, if date is today at 5:34 PM, + * then timeDay.offset(date, 1) returns 5:34 PM tomorrow (even if daylight saving changes!). + * + * @param date A date object. + * @param step An optional number of steps to apply when calculating the offset date. If step is negative, then the returned date will be before the specified date; + * if step is zero, then a copy of the specified date is returned; if step is not an integer, it is floored. + */ offset(date: Date, step?: number): Date; + + /** + * Returns an array of dates representing every interval boundary after or equal to start (inclusive) and before stop (exclusive). + * + * If step is specified, then every step-th boundary will be returned; for example, for the timeDay interval a step of 2 will return every other day. + * If step is not an integer, it is floored. + * + * The first date in the returned array is the earliest boundary after or equal to start; subsequent dates are offset by step intervals and floored. + * Thus, two overlapping ranges may be inconsistent. + * + * To make ranges consistent when a step is specified, use CountableInterval.every instead. + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ range(start: Date, stop: Date, step?: number): Date[]; - filter(test: (date: Date) => boolean): this; + + /** + * Returns a new interval that is a filtered subset of this interval using the specified test function. + * + * @param test A test function which is passed a date and should return true if and only if the specified date should be considered part of the interval. + */ + filter(test: (date: Date) => boolean): TimeInterval; } +/** + * A D3 Countable Time Interval + */ export interface CountableTimeInterval extends TimeInterval { + /** + * Returns the number of interval boundaries after start (exclusive) and before or equal to end (inclusive). + * + * Note that this behavior is slightly different than interval.range, + * because its purpose is to return the zero-based number of the specified end date relative to the specified start date. + * + * @param start A start date object. + * @param start An end date object. + */ count(start: Date, end: Date): number; + /** + * Returns a filtered view of this interval representing every stepth date. + * + * The meaning of step is dependent on this interval’s parent interval as defined by the field function. + * + * For example, timeMinute.every(15) returns an interval representing every fifteen minutes, + * starting on the hour: :00, :15, :30, :45, etc. Note that for some intervals, the resulting dates may not be uniformly-spaced; + * timeDay’s parent interval is timeMonth, and thus the interval number resets at the start of each month. + * + * If step is not valid, returns null. If step is one, returns this interval. + * + * This method can be used in conjunction with interval.range to ensure that two overlapping ranges are consistent. + * + * @param step Number of steps. + */ every(step: number): TimeInterval | null; } @@ -26,11 +145,34 @@ export interface CountableTimeInterval extends TimeInterval { // Custom (Countable)Interval Factories // --------------------------------------------------------------- +/** + * Constructs a new custom interval given the specified floor and offset functions. + * + * The returned custom interval is not countable, i.e. does not exposee the methods "count(..)" and "every(...)". + * + * @param floor A floor function which takes a single date as an argument and rounds it down to the nearest interval boundary. + * @param offset An offset function which takes a date and an integer step as arguments and advances the specified date by the specified number of boundaries; the step may be positive, negative or zero. + */ export function timeInterval( floor: (date: Date) => void, offset: (date: Date, step: number) => void, ): TimeInterval; - +/** + * Constructs a new custom interval given the specified floor, offset and count functions. + * + * The returned custom interval is countable and exposes the methods "count(..)" and "every(...)". + * + * Note: due to an internal optimization, the specified count function must not invoke interval.count on other time intervals. + * + * @param floor A floor function which takes a single date as an argument and rounds it down to the nearest interval boundary. + * @param offset An offset function which takes a date and an integer step as arguments and advances the specified date by the specified number of boundaries; the step may be positive, negative or zero. + * @param count A count function which takes a start date and an end date, already floored to the current interval, and returns the number of boundaries between the start (exclusive) and end (inclusive). + * Note: due to an internal optimization, the specified count function must not invoke interval.count on other time intervals. + * @param field An optional field function which takes a date, already floored to the current interval, and returns the field value of the specified date, + * corresponding to the number of boundaries between this date (exclusive) and the latest previous parent boundary. + * For example, for the timeDay interval, this returns the number of days since the start of the month. If a field function is not specified, + * it defaults to counting the number of interval boundaries since the UNIX epoch of January 1, 1970 UTC. The field function defines the behavior of interval.every. + */ export function timeInterval( floor: (date: Date) => void, offset: (date: Date, step: number) => void, @@ -45,83 +187,460 @@ export function timeInterval( // local time ---------------------------------------------------------- +/** + * Milliseconds Interval in Local Time; the shortest available time unit. + */ export var timeMillisecond: CountableTimeInterval; + +/** + * This is a convenience alias for timeMillisecond.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeMilliseconds(start: Date, stop: Date, step?: number): Date[]; +/** + * Seconds Interval in Local Time; seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. + */ export var timeSecond: CountableTimeInterval; + +/** + * This is a convenience alias for timeSecond.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeSeconds(start: Date, stop: Date, step?: number): Date[]; +/** + * Minutes Interval in Local Time; minutes (e.g., 01:02:00 AM); 60 seconds. Note that ECMAScript ignores leap seconds. + */ export var timeMinute: CountableTimeInterval; + +/** + * This is a convenience alias for timeMinute.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeMinutes(start: Date, stop: Date, step?: number): Date[]; +/** + * Hours Interval in Local Time; Hours (e.g., 01:00 AM); 60 minutes. + * + * Note that advancing time by one hour in local time can return the same hour or skip an hour due to daylight saving. + */ export var timeHour: CountableTimeInterval; + +/** + * This is a convenience alias for timeHour.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeHours(start: Date, stop: Date, step?: number): Date[]; +/** + * Days Interval in Local Time; days (e.g., February 7, 2012 at 12:00 AM); typically 24 hours. + * Days in local time may range from 23 to 25 hours due to daylight saving. + */ export var timeDay: CountableTimeInterval; + +/** + * This is a convenience alias for timeDay.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeDays(start: Date, stop: Date, step?: number): Date[]; +/** + * Week Interval in Local Time. Alias for sunday; 7 days and typically 168 hours. + * + * Weeks in local time may range from 167 to 169 hours due on daylight saving. + */ export var timeWeek: CountableTimeInterval; + +/** + * This is a convenience alias for timeWeek.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeWeeks(start: Date, stop: Date, step?: number): Date[]; +/** + * Week Interval for Sunday-based weeks in Local Time (e.g., February 5, 2012 at 12:00 AM). + * 7 days and typically 168 hours. + * + * Weeks in local time may range from 167 to 169 hours due on daylight saving. + */ export var timeSunday: CountableTimeInterval; + +/** + * This is a convenience alias for timeSunday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeSundays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Monday-based weeks in Local Time (e.g., February 6, 2012 at 12:00 AM). + * 7 days and typically 168 hours. + * + * Weeks in local time may range from 167 to 169 hours due on daylight saving. + */ export var timeMonday: CountableTimeInterval; + +/** + * This is a convenience alias for timeMonday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeMondays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Tuesday-based weeks in Local Time (e.g., February 7, 2012 at 12:00 AM). + * 7 days and typically 168 hours. + * + * Weeks in local time may range from 167 to 169 hours due on daylight saving. + */ export var timeTuesday: CountableTimeInterval; + +/** + * This is a convenience alias for timeTuesday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeTuesdays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Wednesday-based weeks in Local Time (e.g., February 8, 2012 at 12:00 AM). + * 7 days and typically 168 hours. + * + * Weeks in local time may range from 167 to 169 hours due on daylight saving. + */ export var timeWednesday: CountableTimeInterval; + +/** + * This is a convenience alias for timeWednesday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeWednesdays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Thursday-based weeks in Local Time (e.g., February 9, 2012 at 12:00 AM). + * 7 days and typically 168 hours. + * + * Weeks in local time may range from 167 to 169 hours due on daylight saving. + */ export var timeThursday: CountableTimeInterval; + +/** + * This is a convenience alias for timeThursday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeThursdays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Friday-based weeks in Local Time (e.g., February 10, 2012 at 12:00 AM). + * 7 days and typically 168 hours. + * + * Weeks in local time may range from 167 to 169 hours due on daylight saving. + */ export var timeFriday: CountableTimeInterval; + + +/** + * This is a convenience alias for timeFriday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeFridays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Saturday-based weeks in Local Time (e.g., February 11, 2012 at 12:00 AM). + * 7 days and typically 168 hours. + * + * Weeks in local time may range from 167 to 169 hours due on daylight saving. + */ export var timeSaturday: CountableTimeInterval; + +/** + * This is a convenience alias for timeSaturday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeSaturdays(start: Date, stop: Date, step?: number): Date[]; +/** + * Month Interval in Local Time; months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. + */ export var timeMonth: CountableTimeInterval; + +/** + * This is a convenience alias for timeMonth.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeMonths(start: Date, stop: Date, step?: number): Date[]; +/** + * Year Interval in Local Time; years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. + */ export var timeYear: CountableTimeInterval; + +/** + * This is a convenience alias for timeYear.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function timeYears(start: Date, stop: Date, step?: number): Date[]; // utc Universal Coordinated Time ---------------------------------------------------------- +/** + * Milliseconds Interval in Univarsal Coordinated Time (UTC); the shortest available time unit. + */ export var utcMillisecond: CountableTimeInterval; + +/** + * This is a convenience alias for utcMilliesecond.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcMilliseconds(start: Date, stop: Date, step?: number): Date[]; +/** + * Seconds Interval in Univarsal Coordinated Time (UTC); seconds (e.g., 01:23:45.0000 AM); 1,000 milliseconds. + */ export var utcSecond: CountableTimeInterval; + +/** + * This is a convenience alias for utcSecond.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcSeconds(start: Date, stop: Date, step?: number): Date[]; +/** + * Minutes Interval in Univarsal Coordinated Time (UTC); minutes (e.g., 01:02:00 AM); 60 seconds. Note that ECMAScript ignores leap seconds. + */ export var utcMinute: CountableTimeInterval; + +/** + * This is a convenience alias for utcMinute.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcMinutes(start: Date, stop: Date, step?: number): Date[]; +/** + * Hours Interval in Univarsal Coordinated Time (UTC); Hours (e.g., 01:00 AM); 60 minutes. + */ export var utcHour: CountableTimeInterval; + +/** + * This is a convenience alias for utcHour.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcHours(start: Date, stop: Date, step?: number): Date[]; +/** + * Days Interval in Univarsal Coordinated Time (UTC); days (e.g., February 7, 2012 at 12:00 AM); 24 hours. + */ export var utcDay: CountableTimeInterval; + +/** + * This is a convenience alias for utcDay.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcDays(start: Date, stop: Date, step?: number): Date[]; +/** + * Week Interval in Local Time. Alias for sunday; 7 days and 168 hours. + * + */ export var utcWeek: CountableTimeInterval; + +/** + * This is a convenience alias for utcWeek.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcWeeks(start: Date, stop: Date, step?: number): Date[]; +/** + * Week Interval for Sunday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 5, 2012 at 12:00 AM). + * 7 days and 168 hours. + */ export var utcSunday: CountableTimeInterval; + +/** + * This is a convenience alias for utcSunday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcSundays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Monday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 6, 2012 at 12:00 AM). + * 7 days and 168 hours. + */ export var utcMonday: CountableTimeInterval; + +/** + * This is a convenience alias for utcMonday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcMondays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Tuesday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 7, 2012 at 12:00 AM). + * 7 days and 168 hours. + */ export var utcTuesday: CountableTimeInterval; + +/** + * This is a convenience alias for utcTuesday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcTuesdays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Wednesday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 8, 2012 at 12:00 AM). + * 7 days and 168 hours. + */ export var utcWednesday: CountableTimeInterval; + +/** + * This is a convenience alias for utcWednesday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcWednesdays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Thursday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 9, 2012 at 12:00 AM). + * 7 days and 168 hours. + */ export var utcThursday: CountableTimeInterval; + +/** + * This is a convenience alias for utcThursday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcThursdays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Friday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 10, 2012 at 12:00 AM). + * 7 days and 168 hours. + */ export var utcFriday: CountableTimeInterval; + +/** + * This is a convenience alias for utcFriday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcFridays(start: Date, stop: Date, step?: number): Date[]; + +/** + * Week Interval for Saturday-based weeks in Univarsal Coordinated Time (UTC) (e.g., February 11, 2012 at 12:00 AM). + * 7 days and 168 hours. + */ export var utcSaturday: CountableTimeInterval; + +/** + * This is a convenience alias for utcSaturday.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcSaturdays(start: Date, stop: Date, step?: number): Date[]; +/** + * Month Interval in Univarsal Coordinated Time (UTC); months (e.g., February 1, 2012 at 12:00 AM); ranges from 28 to 31 days. + */ export var utcMonth: CountableTimeInterval; + +/** + * This is a convenience alias for utcMonth.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcMonths(start: Date, stop: Date, step?: number): Date[]; +/** + * Year Interval in Univarsal Coordinated Time (UTC); years (e.g., January 1, 2012 at 12:00 AM); ranges from 365 to 366 days. + */ export var utcYear: CountableTimeInterval; + +/** + * This is a convenience alias for utcYear.range(...). + * + * @param start A start date object for the range. + * @param stop A stop date object for the range. + * @param step An optional number of steps to apply when calculating the dates in the range. + */ export function utcYears(start: Date, stop: Date, step?: number): Date[]; diff --git a/d3-time/tsconfig.json b/d3-time/tsconfig.json index 58b3b582e2..127622abc9 100644 --- a/d3-time/tsconfig.json +++ b/d3-time/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-time-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-time-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-timer/tsconfig.json b/d3-timer/tsconfig.json index c9381563f4..5dabc7477e 100644 --- a/d3-timer/tsconfig.json +++ b/d3-timer/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-timer-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-timer-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-tip/tsconfig.json b/d3-tip/tsconfig.json index a490e65f55..8e1fb64ba1 100644 --- a/d3-tip/tsconfig.json +++ b/d3-tip/tsconfig.json @@ -1,14 +1,15 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-tip-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-tip-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-transition/d3-transition-tests.ts b/d3-transition/d3-transition-tests.ts index b1c4fff35c..1feeabf042 100644 --- a/d3-transition/d3-transition-tests.ts +++ b/d3-transition/d3-transition-tests.ts @@ -44,8 +44,47 @@ let dimensions: SVGDatum = { height: 300 }; -let startCircleData: Array, - endCircleData: Array; +let startCircleData: CircleDatum[] = [ + { + nodeId: 'n1', + name: 'node_1', + label: 'Test Node 1', + cx: 10, + cy: 10, + r: 5, + color: 'slateblue' + }, + { + nodeId: 'n2', + name: 'node_2', + label: 'Test Node 2', + cx: 30, + cy: 30, + r: 10, + color: 'slateblue' + } +]; + +let endCircleData: CircleDatum[] = [ + { + nodeId: 'n1', + name: 'node_1', + label: 'Test Node 1', + cx: 15, + cy: 15, + r: 5, + color: 'slateblue' + }, + { + nodeId: 'n3', + name: 'node_3', + label: 'Test Node 3', + cx: 40, + cy: 40, + r: 20, + color: 'red' + } +]; // -------------------------------------------------------------------------- // Tests of plain selections @@ -90,9 +129,9 @@ let exitCircles = circles.exit(); // Note: need to re-type datum ty // Create Transition from Selection // -------------------------------------------------------------------------- -let updateTransition: d3Transition.Transition, - enterTransition: d3Transition.Transition, - exitTransition: d3Transition.Transition; +let updateTransition: d3Transition.Transition; +let enterTransition: d3Transition.Transition; +let exitTransition: d3Transition.Transition; updateTransition = circles.transition('update'); enterTransition = enterCircles.transition('enter'); @@ -108,7 +147,9 @@ let differentDatumTypeTransition: d3Transition.Transition('body').selectAll('svg').transition(); newEnterTransition = enterCircles.transition(differentElementTypeTransition); +differentDatumTypeTransition = select('svg').selectAll('circle').transition(); newEnterTransition = enterCircles.transition(differentDatumTypeTransition); // -------------------------------------------------------------------------- @@ -157,9 +198,15 @@ let bodyTransition: d3Transition.Transition = bodyTransition.select('div'); -firstDivTransition = bodyTransition.select(function (d, i) { +firstDivTransition = bodyTransition.select(function (d, i, g) { + let that: HTMLBodyElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLBodyElement[] | ArrayLike = g; + console.log('Body Datum foo', d.foo); // d is of type BodyDatum - return this.querySelector('div'); // 'this' type is HTMLElement, return type is HTMLDivElement + return this.querySelector('div')!; // 'this' type is HTMLElement, return type is HTMLDivElement }); @@ -170,20 +217,53 @@ firstDivTransition = bodyTransition.select(function (d, i) { let paragraphsTransition: d3Transition.Transition = firstDivTransition.selectAll('p'); -paragraphsTransition = firstDivTransition.selectAll(function (d, i) { +paragraphsTransition = firstDivTransition.selectAll(function (d, i, g) { + let that: HTMLDivElement = this; + // let that2: SVGElement = this; // fails, type mismatch + let datum: BodyDatum = d; + let index: number = i; + let group: HTMLDivElement[] | ArrayLike = g; console.log('Body Datum foo', d.foo); // d is of type BodyDatum return this.querySelectorAll('p'); // 'this' type is HTMLElement, return type is HTMLParagraphElement }); // filter () ----------------------------------------------------------------- +// Scenario 1: Filter retaining the element type of the select group (i.e. no type narrowing during filtering) + enterTransition = enterTransition.filter('.big'); -exitTransition = exitTransition.filter(function (d, i) { +exitTransition = exitTransition.filter(function (d, i, g) { + let that: SVGCircleElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGCircleElement[] | ArrayLike = g; // console.log(this.x) // fails, x property not defined on SVGCircleElement return this.r.baseVal.value < i * d.r; // this-type SVGCircleElement, datum tpye CircleDatum }); +// Scenario 2: Filtering narrows the type of selected elements in a known way + +// assume the class ".any-svg-type" can only be assigned to SVGElements in the DOM +let filterdGElements2: d3Transition.Transition; + +filterdGElements2 = selectAll('.any-svg-type').transition().filter('g'); +// filterdGElements2 = selectAll('.any-type').transition().filter('g'); // fails without using narrowing generic on filter method + +filterdGElements2 = selectAll('.any-svg-type').transition().filter(function (d, i, g) { + let that: SVGElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGElement[] | ArrayLike = g; + return that.tagName === 'g' || that.tagName === 'G'; +}); +// filterdGElements2 = selectAll('.any-svg-type').transition().filter(function(){ +// let that: SVGElement = this; +// return that.tagName === 'g'|| that.tagName === 'G'; +// }); // fails without using narrowing generic on filter method + // -------------------------------------------------------------------------- // Obtain Selection underlying a transition // -------------------------------------------------------------------------- @@ -201,10 +281,15 @@ enterTransition = enterTransition // re-assignment test chaining return-type .attr('stroke', 'blue'); // string enterTransition = enterTransition // re-assignment test chaining return-type - .attr('cx', function (d, i, group) { + .attr('cx', function (d, i, g) { + let that: SVGCircleElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGCircleElement[] | ArrayLike = g; console.log('Pre-change center x-coordinate: ', this.cx.baseVal.value); // this context SVGCircleElement if (group.length > 0) { - console.log('Owner SVG Element of first group element:', group[0].ownerSVGElement); // group : Array + console.log('Owner SVG Element of first group element:', g[0].ownerSVGElement); // group : Array } return d.cx; // numeric return value }) @@ -219,10 +304,15 @@ enterTransition = enterTransition .style('stroke', 'green', 'important'); enterTransition = enterTransition - .style('fill', function (d, i, group) { + .style('fill', function (d, i, g) { + let that: SVGCircleElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGCircleElement[] | ArrayLike = g; console.log('Client Rectangle Top: ', this.getBoundingClientRect().top); // this context SVGCircleElement - if (group.length > 0) { - console.log('Radius of first group element:', group[0].r.baseVal.value); // group : Array + if (g.length > 0) { + console.log('Radius of first group element:', g[0].r.baseVal.value); // group : Array } return d.color; // string return value }) @@ -239,9 +329,37 @@ select('body') .transition().duration(100) .text(function (d) { return d.test; }); // selection datum type + +// test, when it is not certain, whether an element of the type to be selected exists + +let maybeG1: d3Transition.Transition; +maybeG1 = selectAll('svg') + .selectAll('circle') + .transition() + .duration(500) + .attr('fill', function (d, i, g) { + let that: SVGCircleElement | null = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: Array | ArrayLike = g; + + if (that) { + return that.r.baseVal.value < 5 ? 'slateblue' : 'seagreen'; + } else { + return null; + } + + }); + // Tweening Function Use ===================================================== -enterTransition = enterTransition.attrTween('r', function (d, i, group) { +enterTransition = enterTransition.attrTween('r', function (d, i, g) { + let that: SVGCircleElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGCircleElement[] | ArrayLike = g; console.log(this.r.baseVal.value); // this type is SVGCircleElement return interpolateString(0, d.r); // datum type is CircleDatum }); @@ -252,19 +370,24 @@ exitTransition = exitTransition.styleTween('fill', function (d, i, group) { return interpolateRgb(c, d.color); // datum type is CircleDatum }); -let tweenFnAccessor: (this: SVGCircleElement, datum?: CircleDatum, i?: number, group?: SVGCircleElement[] | ArrayLike) => ((t: number) => void); +let tweenFnAccessor: undefined | ((this: SVGCircleElement, datum?: CircleDatum, i?: number, group?: SVGCircleElement[] | ArrayLike) => ((t: number) => void)); // chainable updateTransition = updateTransition.tween('fillColor', null); // remove named tween // chainable -updateTransition = updateTransition.tween('fillColor', function (d, i, group) { - let circle = this; - let interpolator = interpolateRgb(circle.getAttribute('fill'), d.color); // datum type CircleDatum +updateTransition = updateTransition.tween('fillColor', function (d, i, g) { + let that: SVGCircleElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGCircleElement[] | ArrayLike = g; + let c: string | null = that.getAttribute('fill'); + let interpolator = interpolateRgb(c ? c : 'blue', d.color); // datum type CircleDatum console.log('Radius ', this.r.baseVal.value); // this type SVGCircleElement return function (t) { - circle.setAttribute('fill', interpolator(t)); + that.setAttribute('fill', interpolator(t)); }; }); @@ -288,12 +411,15 @@ exitTransition.remove(); // Test Event Handling // -------------------------------------------------------------------------- -let listener: (this: SVGCircleElement, datum: CircleDatum, index: number, group: Array | ArrayLike) => void; +let listener: undefined | ((this: SVGCircleElement, datum: CircleDatum, index: number, group: SVGCircleElement[] | ArrayLike) => void); -// returns 'this' transition -enterTransition = enterTransition.on('end', listener); // check chaining return type by re-assigning -enterTransition = enterTransition.on('end', function (d) { +enterTransition = enterTransition.on('end', function (d, i, g) { + let that: SVGCircleElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGCircleElement[] | ArrayLike = g; console.log('transition end radius: ', this.r.baseVal.value); // SVGCircleElement console.log('end event datum color property: ', d.color); // CircleDatum type }); @@ -301,6 +427,11 @@ enterTransition = enterTransition.on('end', function (d) { // get current listener listener = enterTransition.on('end'); +if (listener) { + // returns 'this' transition + enterTransition = enterTransition.on('end', listener); // check chaining return type by re-assigning +} + // remove listener enterTransition = enterTransition.on('end', null); // check chaining return type by re-assigning @@ -314,11 +445,16 @@ enterTransition = enterTransition.on('end', null); // check chaining return type // each(valueFn: (this: GElement, datum?: Datum, index?: number, group?: Array | ArrayLike) => void): Transition; // returns 'this' transition -enterTransition = enterTransition.each(function (d, i, group) { // check chaining return type by re-assigning +enterTransition = enterTransition.each(function (d, i, g) { // check chaining return type by re-assigning + let that: SVGCircleElement = this; + // let that2: HTMLElement = this; // fails, type mismatch + let datum: CircleDatum = d; + let index: number = i; + let group: SVGCircleElement[] | ArrayLike = g; if (this.r.baseVal.value < d.r) { // this of type SVGCircleElement, datum of type CircleDatum console.log('Color of circles with current radius smaller than data radius: ', d.color); } - console.log(group[i].cx.baseVal.value); // group : Array + console.log(g[i].cx.baseVal.value); // group : Array }); // call() ------------------------------------------------------------------------------- @@ -346,8 +482,8 @@ let empty: boolean = enterTransition.empty(); // node() and nodes() -------------------------------------------------------------------- -let firstCircleNode: SVGCircleElement = enterTransition.node(); -let circleNodes: Array = enterTransition.nodes(); +let firstCircleNode: SVGCircleElement = enterTransition.node()!; +let circleNodes: SVGCircleElement[] = enterTransition.nodes(); // size() -------------------------------------------------------------------------------- @@ -386,7 +522,7 @@ topTransition2 = d3Transition.transition(enterTransition); // active(...) ---------------------------------------------------------- -let updateTransitionActive: d3Transition.Transition; +let updateTransitionActive: d3Transition.Transition | null; updateTransitionActive = d3Transition.active(circles.nodes()[0], 'update'); @@ -394,3 +530,7 @@ updateTransitionActive = d3Transition.active, Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.0.3 + import { ArrayLike, BaseType, Selection, ValueFn } from 'd3-selection'; /** * Extend interface 'Selection' by declaration merging with 'd3-selection' */ declare module 'd3-selection' { + /** + * A D3 Selection of elements. + * + * The first generic "GElement" refers to the type of the selected element(s). + * The second generic "Datum" refers to the type of the datum of a selected element(s). + * The third generic "PElement" refers to the type of the parent element(s) in the D3 selection. + * The fourth generic "PDatum" refers to the type of the datum of the parent element(s). + */ export interface Selection { /** * Interrupts the active transition of the specified name on the selected elements, and cancels any pending transitions with the specified name, if any. @@ -37,6 +47,9 @@ declare module 'd3-selection' { * Thus, this method can be used to synchronize a transition across multiple selections, * or to re-select a transition for specific elements and modify its configuration. * + * If the specified transition is not found on a selected node or its ancestors (such as if the transition already ended), + * the default timing parameters are used; however, in a future release, this will likely be changed to throw an error. + * * @param transition A transition instance. */ transition(transition: Transition): Transition; @@ -126,7 +139,7 @@ export interface Transition(selector: ValueFn | ArrayLike>): Transition; + selectAll(selector: ValueFn>): Transition; /** * Return the selection corresponding to this transition. @@ -365,7 +378,19 @@ export interface Transition; + /** + * For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection. + * + * The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, + * the existing transition is returned for that element. + * + * The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types + * contained in a pre-filter selection are narrowed to a subset as part of the filtering. + * + * @param filter A CSS selector string. + */ + filter(filter: string): Transition; /** * For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection. * @@ -376,7 +401,21 @@ export interface Transition): this; + filter(filter: ValueFn): Transition; + /** + * For each selected element, selects only the elements that match the specified filter, and returns a transition on the resulting selection. + * + * The new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, + * the existing transition is returned for that element. + * + * The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types + * contained in a pre-filter selection are narrowed to a subset as part of the filtering. + * + * @param filter A filter function which is evaluated for each selected element, in order, being passed the current datum (d), + * the current index (i), and the current group (nodes), with this as the current DOM element. The filter function returns a boolean indicating, + * whether the selected element matches. + */ + filter(filter: ValueFn): Transition; // Event Handling ------------------- @@ -389,7 +428,7 @@ export interface Transition; + on(type: string): ValueFn | undefined; /** * Remove all listeners for a given name. * @@ -448,7 +487,7 @@ export interface Transition; + nodes(): GElement[]; /** * Returns the total number of elements in this transition. diff --git a/d3-transition/tsconfig.json b/d3-transition/tsconfig.json index 7c77f746da..84e0d271d7 100644 --- a/d3-transition/tsconfig.json +++ b/d3-transition/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-transition-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-transition-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-transition/tslint.json b/d3-transition/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-transition/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3-voronoi/d3-voronoi-tests.ts b/d3-voronoi/d3-voronoi-tests.ts index 2255d75b74..966ab622ec 100644 --- a/d3-voronoi/d3-voronoi-tests.ts +++ b/d3-voronoi/d3-voronoi-tests.ts @@ -234,3 +234,18 @@ link = links[0]; testDatum = link.source; testDatum = link.target; + + +// find() =============================================================== + +let nearestSite: d3Voronoi.VoronoiSite | null; +let wrongSiteDataType: d3Voronoi.VoronoiSite<[number, number]> | null; + +// Without search radius +nearestSite = voronoiDiagram.find(10, 50); + +// With search radius +nearestSite = voronoiDiagram.find(10, 50, 20); + +// wrong data type +// wrongSiteDataType = voronoiDiagram.find(10, 50); // fails, due to data type mismatch diff --git a/d3-voronoi/index.d.ts b/d3-voronoi/index.d.ts index 0265019451..9bd270d11d 100644 --- a/d3-voronoi/index.d.ts +++ b/d3-voronoi/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3-voronoi module v1.0.2 +// Type definitions for D3JS d3-voronoi module v1.1.0 // Project: https://github.com/d3/d3-voronoi/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -28,60 +28,273 @@ export interface VoronoiPointPair extends Array<[number, number]> { 1: [number, number]; } +/** + * A Voronoi Polygon is represented as an array of points [x, y] where x and y are the point coordinates, and a data field that refers to the corresponding element in data. + * Polygons are open: they do not contain a closing point that duplicates the first point; a triangle, for example, is an array of three points. + * Polygons are also counterclockwise, assuming the origin ⟨0,0⟩ is in the top-left corner. + * + * The generic refers to the type of the data for the corresponding element. + */ export interface VoronoiPolygon extends Array<[number, number]> { + /** + * The input data corresponding to this Voronoi polygon. + */ data: T; } +/** + * Voronoi Triangle is a three-element array of elements from data. + * + * The generic refers to the type of the data for the corresponding element. + */ export type VoronoiTriangle = [T, T, T]; +/** + * A Voronoi Site in the diagram is an array [x, y] with two additional properties: + * index and data. + * + * The generic refers to the type of the data for the corresponding element. + */ export interface VoronoiSite extends VoronoiPoint { + /** + * The Voronoi Site’s index, corresponding to the associated input point. + */ index: number; + /** + * The input data corresponding to this site. + */ data: T; } +/** + * A Voronoi Cell in the diagram is an object with the following properties: + * site and halfEdges + * + * The generic refers to the type of the data for the corresponding element. + */ export interface VoronoiCell { + /** + * The Voronoi Site of the cell’s associated input point. + */ site: VoronoiSite; + /** + * An array of indexes into diagram.edges representing the cell’s polygon. + */ halfEdges: Array; } - +/** + * Voronoi Edge in the diagram is an array [[x0, y0], [x1, y1]] with two additional properties: + * left and right. + * + * The generic refers to the type of the data for the corresponding element. + */ export interface VoronoiEdge extends VoronoiPointPair { + /** + * The Voronoi site on the left side of the edge. + */ left: VoronoiSite; + /** + * The Voronoi site on the right side of the edge. null for a clipped border edge. + */ right: VoronoiSite | null; } +/** + * Voronoi Link for an edge in the mesh created by the Delaunay triangulation of the specified data array. + * Each link has the following attributes: source and target. + * + * The generic refers to the type of the data for the corresponding element. + */ export interface VoronoiLink { + /** + * The source node, an element in data. + */ source: T; + /** + * The target node, an element in data. + */ target: T; } +/** + * A Voronoi Layout. + * + * The generic refers to the type of the data for the corresponding element. + */ export interface VoronoiLayout { + /** + * Computes the Voronoi diagram for the specified data points. + * @param data Array of data elements + */ (data: Array): VoronoiDiagram; + + /** + * Return the current x-coordinate accessor, + * which defaults to accessing the first element of an array (i.e. at index 0). + */ x(): (d: T) => number; + /** + * Set the x-coordinate accessor and return the layout. + * @param x An accessor function which takes a data element as input and return a + * numeric value for the x-coordinate. + */ x(x: (d: T) => number): this; + + /** + * Return the current y-coordinate accessor, + * which defaults to accessing the second element of an array (i.e. at index 1). + */ y(): (d: T) => number; + /** + * Set the y-coordinate accessor and return the layout. + * @param y An accessor function which takes a data element as input and return a + * numeric value for the y-coordinate. + */ y(y: (d: T) => number): this; + + /** + * Returns the current clip extent which defaults to null. + * + * The extent bounds are specified as an array [[x0, y0], [x1, y1]], + * where x0 is the left side of the extent, y0 is the top, + * x1 is the right and y1 is the bottom. + * + * A clip extent is required when using voronoi.polygons. + * + */ extent(): [[number, number], [number, number]] | null; + /** + * Set the clip extent of the Voronoi layout to the specified bounds and return the layout. + * + * A clip extent is required when using voronoi.polygons. + * + * @param extent The extent bounds are specified as an array [[x0, y0], [x1, y1]], + * where x0 is the left side of the extent, y0 is the top, x1 is the right and y1 is the bottom. + */ extent(extent: [[number, number], [number, number]]): this; + + /** + * Get the clip size of the Voronoi layout. Size is an alias for voronoi.extent + * where the minimum x and y of the extent are ⟨0,0⟩. + */ size(): [number, number] | null; + /** + * Set the clip size and return the layout. + * + * Size is an alias for voronoi.extent where the minimum x and y of the extent are ⟨0,0⟩. + * + * @param size An array representing the x- and y-size of the clip extent, + * where the minimum x and y of the extent are ⟨0,0⟩. + */ size(size: [number, number]): this; + + /** + * Return an array of polygons clipped to the extent, one for each input point in the specified data points, + * corresponding to the cells in the computed Voronoi diagram. + * + * Each polygon is represented as an array of points [x, y] where x and y are the point coordinates, + * and a data field that refers to the corresponding element in data. + * Polygons are open: they do not contain a closing point that duplicates the first point; + * a triangle, for example, is an array of three points. Polygons are also counterclockwise, + * assuming the origin ⟨0,0⟩ is in the top-left corner. + * + * If the cell’s site is coincident with an earlier site, the associated polygon is null. + * + * Important: Using polygon requires the extent to be set for the layout. + * + * @param data Array of data points. + */ polygons(data: Array): Array>; + /** + * Return the Delaunay triangulation of the specified data array as an array of triangles. + * Each triangle is a three-element array of elements from data. + * + * @param data Array of data points. + */ triangles(data: Array): Array>; + /** + * Return the Delaunay triangulation of the specified data array as an array of links. + * Each link has source and target attributes referring to elements in data. + * + * @param data Array of data points. + */ links(data: Array): Array>; } + +/** + * Computed Voronoi diagram + * + * The generic refers to the type of the data for the corresponding element. + */ export interface VoronoiDiagram { + /** + * Array of Voronoi Edges + */ edges: Array>; + /** + * Array of Voronoi Cells, one per input point; a cell may be null for a coincident point. + */ cells: Array | null>; + /** + * Return an array of polygons clipped to the extent, one for each cell in the diagram. + * Each polygon is represented as an array of points [x, y] where x and y are the point coordinates, + * and a data field that refers to the corresponding element in data. + * Polygons are open: they do not contain a closing point that duplicates the first point; + * a triangle, for example, is an array of three points. Polygons are also counterclockwise, + * assuming the origin ⟨0,0⟩ is in the top-left corner. + * + * If the cell’s site is coincident with an earlier site, the associated polygon is null. + */ polygons(): Array>; + + /** + * Returns the Delaunay triangulation of the specified data array as an array of triangles. + * Each triangle is a three-element array of elements from data. + * Since the triangulation is computed as the dual of the Voronoi diagram, and the Voronoi diagram is clipped by the extent, + * a subset of the Delaunay triangulation is returned. + */ triangles(): Array>; + + /** + * Returns the Delaunay triangulation of the specified data array as an array of links, one for each edge in the mesh. + * Each link has the following attributes: + * - source (the source node, an element in data) + * - target (the target node, an element in data) + * + * Since the triangulation is computed as the dual of the Voronoi diagram, and the Voronoi diagram is clipped by the extent, a subset of the Delaunay links is returned. + */ links(): Array>; + + /** + * Return the nearest Voronoi Site to point [x, y]. If radius is specified, only sites within radius distance are considered. + * If no Voronoi Site can be found (within the specified radius), null is returned. + * + * @param x x-coordinate + * @param y y-coordinate + * @param radius Optional parameter for search radius around [x, y] + */ + find(x: number, y:number, radius?:number): VoronoiSite | null; } // -------------------------------------------------------------------------- // voronoi Export // -------------------------------------------------------------------------- +/** + * Creates a new Voronoi layout with default x- and y- accessors and a null extent. + * + * Without specifying a generic the layout is assumed to be based on data represented + * by a two-dimensional coordinate [number, number] for x- and y-coordinate, respectively. + */ export function voronoi(): VoronoiLayout<[number, number]>; +/** + * Creates a new Voronoi layout with default x- and y- accessors and a null extent. + * x- and y-accessors may have to be set to correspond to the data type provided by the + * generic. + * + * The generic refers to the type of the data for the corresponding element. + */ export function voronoi(): VoronoiLayout; diff --git a/d3-voronoi/tsconfig.json b/d3-voronoi/tsconfig.json index 100510809d..1be6d656e5 100644 --- a/d3-voronoi/tsconfig.json +++ b/d3-voronoi/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-voronoi-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-voronoi-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-zoom/d3-zoom-tests.ts b/d3-zoom/d3-zoom-tests.ts index 0a5d32d4fe..4806479476 100644 --- a/d3-zoom/d3-zoom-tests.ts +++ b/d3-zoom/d3-zoom-tests.ts @@ -9,7 +9,8 @@ import * as d3Zoom from 'd3-zoom'; import { ArrayLike, select, Selection, event } from 'd3-selection'; import { Transition } from 'd3-transition'; -import { ScaleLinear } from 'd3-scale'; +import { scaleLinear, ScaleLinear } from 'd3-scale'; +import { interpolateZoom, interpolate, interpolateArray, ZoomInterpolator, ZoomView } from 'd3-interpolate'; // -------------------------------------------------------------------------- // Preparatory Steps @@ -32,19 +33,23 @@ let canvas = select('canvas') .attr('width', function (d) { return d.width; }) .attr('height', function (d) { return d.height; }); -let context = canvas.node().getContext('2d'); +let context = canvas.node()!.getContext('2d'); function drawPointsOnCanvas(radius: number) { - context.beginPath(); - points.forEach(drawPointOnCanvas(radius)); - context.fill(); + if (context) { + context.beginPath(); + points.forEach(drawPointOnCanvas(radius)); + context.fill(); + } } function drawPointOnCanvas(radius: number) { return function (point: [number, number]) { - context.moveTo(point[0] + radius, point[1]); - context.arc(point[0], point[1], radius, 0, 2 * Math.PI); + if (context) { + context.moveTo(point[0] + radius, point[1]); + context.arc(point[0], point[1], radius, 0, 2 * Math.PI); + } }; } @@ -81,8 +86,8 @@ interface GroupDatum { toK: number; } -let groupsSelection: Selection, - groupsTransition: Transition; +let groupsSelection: Selection; +let groupsTransition: Transition; // -------------------------------------------------------------------------- @@ -94,14 +99,15 @@ let groupsSelection: Selection, function zoomedCanvas(this: HTMLCanvasElement, d: CanvasDatum) { // Cast d3 event to D3ZoomEvent to be used in zoom event handler - let e = >event; - - context.save(); - context.clearRect(0, 0, this.width, this.height); // this element - context.translate(e.transform.x, e.transform.y); - context.scale(e.transform.k, e.transform.k); - drawPointsOnCanvas(d.radius); - context.restore(); + let e = > event; + if (context) { + context.save(); + context.clearRect(0, 0, this.width, this.height); // this element + context.translate(e.transform.x, e.transform.y); + context.scale(e.transform.k, e.transform.k); + drawPointsOnCanvas(d.radius); + context.restore(); + } } let canvasZoom: d3Zoom.ZoomBehavior; @@ -115,7 +121,7 @@ canvasZoom = d3Zoom.zoom() function zoomedSVGOverlay(this: SVGRectElement) { // Cast d3 event to D3ZoomEvent to be used in zoom event handler - let e = >event; + let e = > event; g.attr('transform', e.transform.toString()); } @@ -131,19 +137,19 @@ svgZoom = d3Zoom.zoom(); svgZoom = svgZoom.filter(function (d, i, group) { // Cast d3 event to D3ZoomEvent to be used in filter logic - let e = >event; + let e = > event; console.log('Overlay Rectangle width: ', this.width.baseVal.value); // this typing is SVGRectElement return e.sourceEvent.type !== 'brush' || !d.filterBrushEvent; // datum type is SVGDatum (as propagated to SVGRectElement with zoom event attached) }); -let filterFn: (this: SVGRectElement, d?: SVGDatum, index?: number, group?: Array) => boolean; +let filterFn: (this: SVGRectElement, d: SVGDatum, index: number, group: SVGRectElement[]) => boolean; filterFn = svgZoom.filter(); // extent() --------------------------------------------------------------- -let extentAccessor: (this: SVGRectElement, d: SVGDatum, index: number, group: Array) => [[number, number], [number, number]]; +let extentAccessor: (this: SVGRectElement, d: SVGDatum, index: number, group: SVGRectElement[]) => [[number, number], [number, number]]; extentAccessor = svgZoom.extent(); // chainable with array @@ -179,21 +185,42 @@ svgZoom = svgZoom.duration(500); let duration: number = svgZoom.duration(); +// interpolate() -------------------------------------------------------------- + +// chainable setter accepts interpoateZoom, interpolate and interpolateArray +svgZoom = svgZoom.interpolate(interpolateZoom); +svgZoom = svgZoom.interpolate(interpolate); +svgZoom = svgZoom.interpolate(interpolateArray); + + +// getter + +let basicInterpolatorFactory: (a: ZoomView, b: ZoomView) => ((t: number) => ZoomView); +let zoomInterpolatorFactory: (a: ZoomView, b: ZoomView) => ZoomInterpolator; + +// Basic case without casting +basicInterpolatorFactory = svgZoom.interpolate(); + +// Assuming it is know that a specialized interpolation factory was used. E.g. ZoomInterpolator also has a duration +// argument +zoomInterpolatorFactory = svgZoom.interpolate<(a: ZoomView, b: ZoomView) => ZoomInterpolator>(); + // on() -------------------------------------------------------------------- // chainable svgZoom = svgZoom.on('zoom', zoomedSVGOverlay); // svgZoom = svgZoom.on('zoom', zoomedCanvas); // fails, zoom event handler has wrong this and datum type -let zoomHandler: (this: SVGRectElement, datum: SVGDatum, index: number, group: Array | ArrayLike) => void; +let zoomHandler: ((this: SVGRectElement, datum: SVGDatum, index: number, group: SVGRectElement[] | ArrayLike) => void) | undefined; zoomHandler = svgZoom.on('zoom'); // chainable remove handler svgZoom = svgZoom.on('zoom', null); // re-apply -svgZoom.on('zoom', zoomHandler); - +if (zoomHandler) { + svgZoom.on('zoom', zoomHandler); +} // -------------------------------------------------------------------------- // Test Attach ZoomBehaviour // -------------------------------------------------------------------------- @@ -230,7 +257,7 @@ svgZoom.transform(svgOverlay, function (datum, index, groups) { let that: SVGRectElement = this; let d: SVGDatum = datum; let i: number = index; - let g: Array | ArrayLike = groups; + let g: SVGRectElement[] | ArrayLike = groups; console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum return d3Zoom.zoomIdentity; @@ -244,7 +271,7 @@ svgZoom.transform(svgOverlayTransition, function (datum, index, groups) { let that: SVGRectElement = this; let d: SVGDatum = datum; let i: number = index; - let g: Array | ArrayLike = groups; + let g: SVGRectElement[] | ArrayLike = groups; console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum return d3Zoom.zoomIdentity; @@ -263,7 +290,7 @@ svgZoom.translateBy( let that: SVGRectElement = this; let d: SVGDatum = datum; let i: number = index; - let g: Array | ArrayLike = groups; + let g: SVGRectElement[] | ArrayLike = groups; console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum return 30; @@ -274,7 +301,7 @@ svgZoom.translateBy( let that: SVGRectElement = this; let d: SVGDatum = datum; let i: number = index; - let g: Array | ArrayLike = groups; + let g: SVGRectElement[] | ArrayLike = groups; console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum return 30; @@ -286,7 +313,7 @@ svgZoom.translateBy( let that: SVGRectElement = this; let d: SVGDatum = datum; let i: number = index; - let g: Array | ArrayLike = groups; + let g: SVGRectElement[] | ArrayLike = groups; console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum return 30; @@ -295,7 +322,7 @@ svgZoom.translateBy( let that: SVGRectElement = this; let d: SVGDatum = datum; let i: number = index; - let g: Array | ArrayLike = groups; + let g: SVGRectElement[] | ArrayLike = groups; console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum return 30; @@ -312,7 +339,7 @@ svgZoom.translateBy( let that: SVGRectElement = this; let d: SVGDatum = datum; let i: number = index; - let g: Array | ArrayLike = groups; + let g: SVGRectElement[] | ArrayLike = groups; console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum return 30; @@ -323,7 +350,7 @@ svgZoom.translateBy( let that: SVGRectElement = this; let d: SVGDatum = datum; let i: number = index; - let g: Array | ArrayLike = groups; + let g: SVGRectElement[] | ArrayLike = groups; console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum return 30; @@ -335,7 +362,7 @@ svgZoom.translateBy( let that: SVGRectElement = this; let d: SVGDatum = datum; let i: number = index; - let g: Array | ArrayLike = groups; + let g: SVGRectElement[] | ArrayLike = groups; console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum return 30; @@ -344,7 +371,7 @@ svgZoom.translateBy( let that: SVGRectElement = this; let d: SVGDatum = datum; let i: number = index; - let g: Array | ArrayLike = groups; + let g: SVGRectElement[] | ArrayLike = groups; console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum return 30; @@ -357,26 +384,26 @@ svgZoom.scaleBy(svgOverlay, 3); // svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismachtes DOM Element type and datum type svgZoom.scaleBy(svgOverlay, function (datum, index, groups) { - let that: SVGRectElement = this; - let d: SVGDatum = datum; - let i: number = index; - let g: Array | ArrayLike = groups; - console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement - console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum - return 3; + let that: SVGRectElement = this; + let d: SVGDatum = datum; + let i: number = index; + let g: SVGRectElement[] | ArrayLike = groups; + console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement + console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum + return 3; }); // use on transition svgZoom.scaleBy(svgOverlayTransition, 3); // svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismachtes DOM Element type and datum type svgZoom.scaleBy(svgOverlayTransition, function (datum, index, groups) { - let that: SVGRectElement = this; - let d: SVGDatum = datum; - let i: number = index; - let g: Array | ArrayLike = groups; - console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement - console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum - return 3; + let that: SVGRectElement = this; + let d: SVGDatum = datum; + let i: number = index; + let g: SVGRectElement[] | ArrayLike = groups; + console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement + console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum + return 3; }); // scaleTo() ------------------------------------------------------------------------------------- @@ -386,33 +413,33 @@ svgZoom.scaleTo(svgOverlay, 3); // svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismachtes DOM Element type and datum type svgZoom.scaleTo(svgOverlay, function (datum, index, groups) { - let that: SVGRectElement = this; - let d: SVGDatum = datum; - let i: number = index; - let g: Array | ArrayLike = groups; - console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement - console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum - return 3; + let that: SVGRectElement = this; + let d: SVGDatum = datum; + let i: number = index; + let g: SVGRectElement[] | ArrayLike = groups; + console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement + console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum + return 3; }); // use on transition svgZoom.scaleTo(svgOverlayTransition, 3); // svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismachtes DOM Element type and datum type svgZoom.scaleTo(svgOverlayTransition, function (datum, index, groups) { - let that: SVGRectElement = this; - let d: SVGDatum = datum; - let i: number = index; - let g: Array | ArrayLike = groups; - console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement - console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum - return 30; + let that: SVGRectElement = this; + let d: SVGDatum = datum; + let i: number = index; + let g: SVGRectElement[] | ArrayLike = groups; + console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement + console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum + return 30; }); // -------------------------------------------------------------------------- // Test Zoom Event Interface // -------------------------------------------------------------------------- -let e: d3Zoom.D3ZoomEvent; +let e: d3Zoom.D3ZoomEvent = event; // mock assignment let target: d3Zoom.ZoomBehavior = e.target; let type: 'start' | 'zoom' | 'end' | string = e.type; @@ -427,7 +454,7 @@ let sourceEvent: any = e.sourceEvent; let zTransform: d3Zoom.ZoomTransform; -zTransform = d3Zoom.zoomTransform(canvas.node()); +zTransform = d3Zoom.zoomTransform(canvas.node()!); // Test ZoomTransform ------------------------------------------------------- @@ -445,7 +472,7 @@ let invertedY: number = zTransform.invertY(240); // TODO: reScaleX, reScaleY -let linearScale: ScaleLinear; +let linearScale: ScaleLinear = scaleLinear(); linearScale = zTransform.rescaleX(linearScale); linearScale = zTransform.rescaleY(linearScale); diff --git a/d3-zoom/index.d.ts b/d3-zoom/index.d.ts index 9814d2f7bd..9e0d2b72ec 100644 --- a/d3-zoom/index.d.ts +++ b/d3-zoom/index.d.ts @@ -1,9 +1,12 @@ -// Type definitions for d3JS d3-zoom module v1.0.3 +// Type definitions for d3JS d3-zoom module 1.1 // Project: https://github.com/d3/d3-zoom/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Last module patch version validated against: 1.1.1 + import { ArrayLike, Selection, TransitionLike, ValueFn } from 'd3-selection'; +import { ZoomView, ZoomInterpolator } from 'd3-interpolate'; // -------------------------------------------------------------------------- @@ -23,10 +26,10 @@ type ZoomedElementBaseType = Element; * that can be passed into zoomTransform methods rescaleX and rescaleY */ export interface ZoomScale { - domain(): Array; - domain(domain: Array): this; - range(): Array; - range(range: Array): this; + domain(): number[]; + domain(domain: number[]): this; + range(): number[]; + range(range: number[]): this; copy(): ZoomScale; invert(value: number): number; } @@ -472,6 +475,23 @@ export interface ZoomBehavior ((t: number) => ZoomView)>(): InterpolationFactory; + + /** + * Sets the interpolation factory for zoom transitions to the specified function. + * Use the default d3.interpolateZoom to implement smooth zooming. + * To apply direct interpolation between two views, try d3.interpolate instead. + * + * Each view is defined as an array of three numbers: cx, cy and width. The first two coordinates cx, cy represent the center of the viewport; + * the last coordinate width represents the size of the viewport. + * + * @param interpolatorFactory An interpolator factory to be used to generate interpolators beetween zooms for transitions. + */ + interpolate(interpolatorFactory: (a: ZoomView, b: ZoomView) => ((t: number) => ZoomView)): this; + /** * Return the first currently-assigned listener matching the specified typenames, if any. * @@ -481,7 +501,7 @@ export interface ZoomBehavior; + on(typenames: string): ValueFn | undefined; /** * Remove the current event listeners for the specified typenames, if any, return the drag behavior. * @@ -685,8 +705,11 @@ export interface ZoomTransform { } /** - * Return the current transform for the specified node. Internally, an element’s transform is stored as element.__zoom; - * however, you should use this method rather than accessing it directly. If the given node has no defined transform, returns the identity transformation. + * Returns the current transform for the specified node. Note that node should typically be a DOM element, and not a selection. + * (A selection may consist of multiple nodes, in different states, and this function only returns a single transform.) If you have a selection, call selection.node first. + * In the context of an event listener, the node is typically the element that received the input event (which should be equal to event.transform), "this". + * Internally, an element’s transform is stored as element.__zoom; however, you should use this method rather than accessing it directly. If the given node has no defined transform, returns the identity transformation. + * The returned transform represents a two-dimensional transformation matrix * * For details see {@link https://github.com/d3/d3-zoom#zoom-transforms} * diff --git a/d3-zoom/tsconfig.json b/d3-zoom/tsconfig.json index f2e715aabf..cb308465f0 100644 --- a/d3-zoom/tsconfig.json +++ b/d3-zoom/tsconfig.json @@ -1,19 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "d3-zoom-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3-zoom-tests.ts" + ] +} \ No newline at end of file diff --git a/d3-zoom/tslint.json b/d3-zoom/tslint.json new file mode 100644 index 0000000000..68d10d72a6 --- /dev/null +++ b/d3-zoom/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "unified-signatures": false + } +} diff --git a/d3.cloud.layout/index.d.ts b/d3.cloud.layout/index.d.ts index 474af57828..70e2140bd5 100644 --- a/d3.cloud.layout/index.d.ts +++ b/d3.cloud.layout/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for d3JS cloud layout plugin by Jason Davies v1.2.2 +// Type definitions for d3JS cloud layout plugin by Jason Davies v1.2.2 // Project: https://github.com/jasondavies/d3-cloud // Definitions by: hans windhoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/d3.cloud.layout/tsconfig.json b/d3.cloud.layout/tsconfig.json index 45d7cc6006..8ea8609e35 100644 --- a/d3.cloud.layout/tsconfig.json +++ b/d3.cloud.layout/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "noEmit": true, "forceConsistentCasingInFileNames": true @@ -11,4 +12,4 @@ "index.d.ts", "d3.cloud.layout-tests.ts" ] -} +} \ No newline at end of file diff --git a/d3.slider/d3.slider-tests.ts b/d3.slider/d3.slider-tests.ts index e0e0473059..30f5900d41 100644 --- a/d3.slider/d3.slider-tests.ts +++ b/d3.slider/d3.slider-tests.ts @@ -1,6 +1,3 @@ -/// -/// - d3.select('#slider1').call(d3.slider()); d3.select('#slider2').call(d3.slider().value( [ 10, 25 ] )); d3.select('#slider3').call(d3.slider().axis(true).value( [ 10, 25 ] ) diff --git a/d3.slider/d3.slider.d.ts b/d3.slider/index.d.ts similarity index 94% rename from d3.slider/d3.slider.d.ts rename to d3.slider/index.d.ts index d459f4f04c..7b0dfcc5c2 100644 --- a/d3.slider/d3.slider.d.ts +++ b/d3.slider/index.d.ts @@ -3,9 +3,9 @@ // Definitions by: Linkun Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as d3 from "d3"; -declare namespace d3 { +declare module "d3" { export function slider(): Slider; interface Slider { diff --git a/d3.slider/package.json b/d3.slider/package.json new file mode 100644 index 0000000000..ca67ffd471 --- /dev/null +++ b/d3.slider/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@types/d3": "^3.5.36" + } +} \ No newline at end of file diff --git a/d3.slider/tsconfig.json b/d3.slider/tsconfig.json new file mode 100644 index 0000000000..5101924cfe --- /dev/null +++ b/d3.slider/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3.slider-tests.ts" + ] +} \ No newline at end of file diff --git a/d3/d3-v3.5-tests.ts b/d3/d3-v3.5-tests.ts index 380b15db96..959b85bda5 100644 --- a/d3/d3-v3.5-tests.ts +++ b/d3/d3-v3.5-tests.ts @@ -2708,15 +2708,15 @@ function testMultiUtcFormat() { } function testEnterSizeEmpty() { - + var selectionSize: number, emptyStatus: boolean; - + var newNodes = d3.selectAll('.test') .data(['1', '2', '3']) .enter(); - + emptyStatus = newNodes.empty(); selectionSize = newNodes.size(); -} \ No newline at end of file +} diff --git a/d3/d3-v3.5.d.ts b/d3/d3-v3.5.d.ts index d8469d68a3..90afdd3938 100644 --- a/d3/d3-v3.5.d.ts +++ b/d3/d3-v3.5.d.ts @@ -1,8 +1,12 @@ -// Type definitions for d3JS v3.5.17 +// Type definitions for d3JS 3.5 // Project: http://d3js.org/ // Definitions by: Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/* tslint:disable */ + +// Latest patch version of module validated against: 3.5.17 + export = d3; export as namespace d3; diff --git a/d3/index.d.ts b/d3/index.d.ts index a9d29d1646..61953fe148 100644 --- a/d3/index.d.ts +++ b/d3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for D3JS d3 standard bundle v4.2.2 +// Type definitions for D3JS d3 standard bundle 4.4 // Project: https://github.com/d3/d3 // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/d3/legacy/plugins/index.d.ts b/d3/legacy/plugins/index.d.ts index 2f0b6de7f2..1e4727d3c7 100644 --- a/d3/legacy/plugins/index.d.ts +++ b/d3/legacy/plugins/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/* tslint:disable */ + import * as d3 from 'd3'; declare module 'd3' { diff --git a/d3/package.json b/d3/package.json new file mode 100644 index 0000000000..6101422996 --- /dev/null +++ b/d3/package.json @@ -0,0 +1,34 @@ +{ + "dependencies": { + "@types/d3-array": "1.0", + "@types/d3-axis": "1.0", + "@types/d3-brush": "1.0", + "@types/d3-chord": "1.0", + "@types/d3-collection": "1.0", + "@types/d3-color": "1.0", + "@types/d3-dispatch": "1.0", + "@types/d3-drag": "1.0", + "@types/d3-dsv": "1.0", + "@types/d3-ease": "1.0", + "@types/d3-force": "1.0", + "@types/d3-format": "1.0", + "@types/d3-geo": "1.4", + "@types/d3-hierarchy": "1.0", + "@types/d3-interpolate": "1.1", + "@types/d3-path": "1.0", + "@types/d3-polygon": "1.0", + "@types/d3-quadtree": "1.0", + "@types/d3-queue": "3.0", + "@types/d3-random": "1.0", + "@types/d3-request": "1.0", + "@types/d3-scale": "1.0", + "@types/d3-selection": "1.0", + "@types/d3-shape": "1.0", + "@types/d3-time": "1.0", + "@types/d3-time-format": "2.0", + "@types/d3-timer": "1.0", + "@types/d3-transition": "1.0", + "@types/d3-voronoi": "1.1", + "@types/d3-zoom": "1.1" + } +} diff --git a/d3/tsconfig.json b/d3/tsconfig.json index 0d664ce882..f206050216 100644 --- a/d3/tsconfig.json +++ b/d3/tsconfig.json @@ -3,9 +3,11 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ + "node_modules/@types", "../" ], "types": [], diff --git a/d3kit/d3kit-tests.ts b/d3kit/d3kit-tests.ts index 5eab2a4e79..8e524a1f69 100644 --- a/d3kit/d3kit-tests.ts +++ b/d3kit/d3kit-tests.ts @@ -1,1112 +1,196 @@ -/// /// -/// -/// - -/* jshint expr: true */ - -var expect = chai.expect; -describe('Skeleton', function(){ - var element: Element, $element: d3.Selection, $svg: d3.Selection, skeleton: d3kit.Skeleton; - - beforeEach(function(done){ - element = document.body.appendChild(document.createElement('div')) as Element; - skeleton = new d3kit.Skeleton(element, null, ['custom1', 'custom2']); - $element = d3.select(element); - $svg = $element.select('svg'); - done(); - }); - - describe('new Skeleton()', function(){ - it('should create inside the element', function(){ - expect($element.select('svg').size()).to.be.equal(1); - }); - it('should create inside inside the element', function(){ - expect($element.select('svg').select('g').size()).to.be.equal(1); - }); - }); - - describe('#getCustomEventNames()', function(){ - it('should return custom event names', function(){ - expect(skeleton.getCustomEventNames()).to.deep.equal(['custom1', 'custom2']); - }); - }); - - describe('#getDispatcher()', function(){ - it('should return event dispatcher', function(){ - expect(skeleton.getDispatcher()).to.be.an('Object'); - expect(skeleton.getDispatcher().data).to.be.a('Function'); - }); - }); - - describe('#getInnerWidth()', function(){ - it('should return width of the skeleton excluding margin', function(){ - skeleton.options({ - margin: {left: 10, right: 10} - }); - skeleton.width(100); - expect(skeleton.getInnerWidth()).to.equal(80); - }); - }); - - describe('#getInnerHeight()', function(){ - it('should return height of the skeleton excluding margin', function(){ - skeleton.options({ - margin: {top: 10, bottom: 20} - }); - skeleton.height(100); - expect(skeleton.getInnerHeight()).to.equal(70); - }); - }); - - describe('#getLayerOrganizer()', function(){ - it('should return the LayerOrganizer', function(){ - expect(skeleton.getLayerOrganizer()).to.be.an('Object'); - }); - }); - - describe('#getRootG()', function(){ - it('should return d3 selection of the root ', function(){ - var g = skeleton.getRootG(); - expect(g.size()).to.equal(1); - expect((g[0][0] as Element).tagName).to.equal('g'); - }); - }); - - describe('#getSvg()', function(){ - it('should return d3 selection of the ', function(){ - var svg = skeleton.getSvg(); - expect(svg.size()).to.equal(1); - expect((svg[0][0] as Element).tagName).to.equal('svg'); - }); - }); - - describe('#data(data, doNotDispatch)', function(){ - it('should return data when called without argument', function(){ - skeleton.data({a: 1}); - expect(skeleton.data()).to.deep.equal({a: 1}); - }); - it('should set data when called with at least one argument', function(){ - skeleton.data('test'); - expect(skeleton.data()).to.equal('test'); - }); - it('after setting, should dispatch "data" event', function(done){ - skeleton.on('data.test', function(){ - // This block should be reached to pass the test. - expect(true).to.be.true; - done(); - }); - skeleton.data({a: 1}); - }); - it('after setting, should not dispatch "data" event if doNotDispatch is true', function(done){ - skeleton.on('data.test', function(){ - // This block should not be reached. - expect(true).to.be.false; - done(); - }); - skeleton.data({a: 1}, true); - setTimeout(done, 100); - }); - }); - - describe('#options(options, doNotDispatch)', function(){ - it('should return options when called without argument', function(){ - skeleton.options({a: 2}); - expect(skeleton.options()).to.include.keys(['a']); - expect(skeleton.options().a).to.equal(2); - }); - it('should set options when called with at least one argument', function(){ - skeleton.options({a: 1}); - expect(skeleton.options()).to.include.keys(['a']); - expect(skeleton.options().a).to.equal(1); - }); - it('should not overwrite but extend existing options when setting', function(){ - skeleton.options({a: 1}); - skeleton.options({b: 2}); - expect(skeleton.options()).to.include.keys(['a', 'b']); - expect(skeleton.options().a).to.equal(1); - expect(skeleton.options().b).to.equal(2); - }); - it('after setting, should dispatch "options" event', function(done){ - skeleton.on('options.test', function(){ - // This block should be reached to pass the test. - expect(true).to.be.true; - done(); - }); - skeleton.options({a: 1}); - }); - it('after setting, should not dispatch "options" event if doNotDispatch is true', function(done){ - skeleton.on('options.test', function(){ - // This block should not be reached. - expect(true).to.be.false; - done(); - }); - skeleton.options({a: 1}, true); - setTimeout(done, 100); - }); - }); - - describe('#margin(margin, doNotDispatch)', function(){ - it('should return margin when called without argument', function(){ - var margin = {left: 10, right: 10, top: 10, bottom: 10}; - skeleton.margin(margin); - expect(skeleton.margin()).to.deep.equal(margin); - }); - it('should set margin when called with at least one argument', function(){ - var margin = {left: 10, right: 10, top: 10, bottom: 10}; - skeleton.margin(margin); - - skeleton.margin({left: 20}); - expect(skeleton.margin().left).to.equal(20); - expect(skeleton.margin().right).to.equal(10); - skeleton.margin({right: 20}); - expect(skeleton.margin().right).to.equal(20); - skeleton.margin({top: 20}); - expect(skeleton.margin().top).to.equal(20); - skeleton.margin({bottom: 20}); - expect(skeleton.margin().bottom).to.equal(20); - }); - it('should update innerWidth after setting margin', function(){ - skeleton.width(100); - skeleton.margin({left: 10, right:10}); - expect(skeleton.getInnerWidth()).to.equal(80); - skeleton.margin({left: 15, right:15}); - expect(skeleton.getInnerWidth()).to.equal(70); - }); - it('should update innerHeight after setting margin', function(){ - skeleton.height(100); - skeleton.margin({top: 10, bottom:10}); - expect(skeleton.getInnerHeight()).to.equal(80); - skeleton.margin({top: 15, bottom:15}); - expect(skeleton.getInnerHeight()).to.equal(70); - }); - it('should update the root transform/translate', function(){ - skeleton.margin({left: 30, top: 30}); - skeleton.offset([0.5, 0.5]); - skeleton.margin({left: 10, top: 10}); - var translate = skeleton.getRootG().attr('transform'); - expect(translate).to.equal('translate(10.5,10.5)'); - }); - it('after setting, should dispatch "resize" event', function(done){ - skeleton.on('resize.test', function(){ - // This block should be reached to pass the test. - expect(true).to.be.true; - done(); - }); - skeleton.margin({left: 33}); - }); - it('after setting, should not dispatch "resize" event if doNotDispatch is true', function(done){ - skeleton.on('resize.test', function(){ - // This block should not be reached. - expect(true).to.be.false; - done(); - }); - skeleton.margin({left: 33}, true); - setTimeout(done, 100); - }); - }); - - describe('#offset(offset)', function(){ - it('should return offset when called without argument', function(){ - var offset = [1,1]; - skeleton.offset(offset); - expect(skeleton.offset()).to.deep.equal(offset); - }); - it('should set offset when called with at least one argument', function(){ - var offset = [1,1]; - skeleton.offset(offset); - skeleton.offset([2,3]); - expect(skeleton.offset()).to.deep.equal([2,3]); - }); - it('should update the root transform/translate', function(){ - skeleton.offset([0.5, 0.5]); - skeleton.margin({left: 10, top: 10}); - skeleton.offset([2,3]); - var translate = skeleton.getRootG().attr('transform'); - expect(translate).to.equal('translate(12,13)'); - }); - }); - - describe('#width(width, doNotDispatch)', function(){ - it('should return width when called without argument', function(){ - var w = $svg.attr('width'); - expect(skeleton.width()).to.equal(+w); - }); - it('should set width when called with Number as the first argument', function(){ - skeleton.width(300); - expect(+$svg.attr('width')).to.equal(300); - }); - it('should set width when called with a Number and "px" such as "100px" as the first argument', function(){ - skeleton.width('299px'); - expect(+$svg.attr('width')).to.equal(299); - }); - it('should set width to container\'s width when called with "auto" as the first argument', function(){ - var w = element.clientWidth; - skeleton.width('auto'); - expect(+$svg.attr('width')).to.equal(w); - }); - it('after setting, should dispatch "resize" event', function(done){ - skeleton.on('resize.test', function(){ - // This block should be reached to pass the test. - expect(true).to.be.true; - done(); - }); - skeleton.width(200); - }); - it('after setting, should not dispatch "resize" event if doNotDispatch is true', function(done){ - skeleton.on('resize.test', function(){ - // This block should not be reached. - expect(true).to.be.false; - done(); - }); - skeleton.width(200, true); - setTimeout(done, 100); - }); - }); - - describe('#height(height, doNotDispatch)', function(){ - it('should return height when called without argument', function(){ - var w = $svg.attr('height'); - expect(skeleton.height()).to.equal(+w); - }); - it('should set height when called with Number as the first argument', function(){ - skeleton.height(300); - expect(+$svg.attr('height')).to.equal(300); - }); - it('should set height when called with a Number and "px" such as "100px" as the first argument', function(){ - skeleton.height('299px'); - expect(+$svg.attr('height')).to.equal(299); - }); - it('should set height to container\'s height when called with "auto" as the first argument', function(){ - var w = element.clientHeight; - skeleton.height('auto'); - expect(+$svg.attr('height')).to.equal(w); - }); - it('after setting, should dispatch "resize" event', function(done){ - skeleton.on('resize.test', function(){ - // This block should be reached to pass the test. - expect(true).to.be.true; - done(); - }); - skeleton.height(200); - }); - it('after setting, should not dispatch "resize" event if doNotDispatch is true', function(done){ - skeleton.on('resize.test', function(){ - // This block should not be reached. - expect(true).to.be.false; - done(); - }); - skeleton.height(200, true); - setTimeout(done, 100); - }); - }); - - describe('#dimension(dimension, doNotDispatch)', function(){ - it('should return an array [width, height] when called without argument', function(){ - var dim = [+$svg.attr('width'), +$svg.attr('height')]; - expect(skeleton.dimension()).to.deep.equal(dim); - }); - it('should set width and height of the when called with an array [width, height] as the first argument', function(){ - skeleton.dimension([118, 118]); - expect([+$svg.attr('width'), +$svg.attr('height')]).to.deep.equal([118, 118]); - }); - it('after setting, should dispatch "resize" event', function(done){ - skeleton.on('resize.test', function(){ - // This block should be reached to pass the test. - expect(true).to.be.true; - done(); - }); - skeleton.dimension([150, 150]); - }); - it('after setting, should not dispatch "resize" event if doNotDispatch is true', function(done){ - skeleton.on('resize.test', function(){ - // This block should not be reached. - expect(true).to.be.false; - done(); - }); - skeleton.dimension([150, 150], true); - setTimeout(done, 100); - }); - }); - - describe('#hasData()', function(){ - it('should return true when data are not null nor undefined', function(){ - skeleton.data({}); - expect(skeleton.hasData()).to.be.true; - skeleton.data({test: 1}); - expect(skeleton.hasData()).to.be.true; - skeleton.data([]); - expect(skeleton.hasData()).to.be.true; - skeleton.data(['test']); - expect(skeleton.hasData()).to.be.true; - }); - it('should return false when data are null or undefined', function(){ - skeleton.data(null); - expect(skeleton.hasData()).to.be.false; - skeleton.data(undefined); - expect(skeleton.hasData()).to.be.false; - }); - }); - - describe('#hasNonZeroArea()', function(){ - it('should return true if \'s width & height excluding margin is more than zero', function(){ - skeleton.options({ - margin: {left: 10, right: 10} - }); - skeleton.width(80); - skeleton.options({ - margin: {top: 10, bottom: 20} - }); - skeleton.height(50); - expect(skeleton.hasNonZeroArea()).to.be.true; - }); - it('should return false otherwise', function(){ - skeleton.options({ - margin: {left: 10, right: 10} - }); - skeleton.width(20); - skeleton.options({ - margin: {top: 10, bottom: 20} - }); - skeleton.height(30); - expect(skeleton.hasNonZeroArea()).to.be.false; - }); - }); - - describe('#mixin({})', function(){ - it('should extend this skeleton with new fields/functions', function(){ - skeleton.mixin({ - a: 1, - b: 2 - }); - expect(skeleton).to.include.keys(['a', 'b']); - expect((skeleton).a).to.equal(1); - expect((skeleton).b).to.equal(2); - }); - it('should overwrite existing fields', function(){ - skeleton.mixin({ - b: 2 - }); - skeleton.mixin({ - b: 3 - }); - expect(skeleton).to.include.keys(['b']); - expect((skeleton).b).to.equal(3); - }); - it('should keep original fields if not overwritten', function(){ - skeleton.mixin({ - a: 1, - b: 2 - }); - skeleton.mixin({ - c: 20, - b: 3 - }); - expect(skeleton).to.include.keys(['a', 'b', 'c']); - expect((skeleton).a).to.equal(1); - expect((skeleton).b).to.equal(3); - expect((skeleton).c).to.equal(20); - }); - }); - - describe('#resizeToFitContainer(mode)', function(){ - it('when mode is "all" should resize to fit both width and height', function(){ - skeleton.dimension([element.clientWidth/2, element.clientHeight/2]); - var w = element.clientWidth; - var h = element.clientHeight; - skeleton.resizeToFitContainer('all'); - expect(skeleton.dimension()).to.deep.equal([w, h]); - }); - it('when mode is "both" should resize to fit both width and height', function(){ - skeleton.dimension([element.clientWidth/2, element.clientHeight/2]); - var w = element.clientWidth; - var h = element.clientHeight; - skeleton.resizeToFitContainer('both'); - expect(skeleton.dimension()).to.deep.equal([w, h]); - }); - it('when mode is "full" should resize to fit both width and height', function(){ - skeleton.dimension([element.clientWidth/2, element.clientHeight/2]); - var w = element.clientWidth; - var h = element.clientHeight; - skeleton.resizeToFitContainer('full'); - expect(skeleton.dimension()).to.deep.equal([w, h]); - }); - it('when mode is "width" should resize width to fit container but keep original height', function(){ - var w1 = element.clientWidth/2; - var h1 = element.clientHeight/2; - - skeleton.dimension([w1, h1]); - - var w2 = element.clientWidth; - var h2 = element.clientHeight; - - skeleton.resizeToFitContainer('width'); - - expect(skeleton.width()).to.equal(Math.floor(w2)); - expect(skeleton.height()).to.equal(Math.floor(h1)); - expect(skeleton.width()).to.not.equal(w1); - expect(skeleton.height()).to.not.equal(h2); - }); - it('when mode is "height" should resize height to fit container but keep original width', function(){ - var w1 = element.clientWidth/2; - var h1 = element.clientHeight*2; - - skeleton.dimension([w1, h1]); - - var w2 = element.clientWidth; - var h2 = element.clientHeight; - - skeleton.resizeToFitContainer('height'); - - expect(skeleton.width()).to.equal(Math.floor(w1)); - expect(skeleton.height()).to.equal(Math.floor(h2)); - expect(skeleton.width()).to.not.equal(w2); - expect(skeleton.height()).to.not.equal(h1); - }); - }); - - describe('#resizeToAspectRatio(ratio)', function(){ - // todo - }); - - describe('#autoResize(mode)', function(){ - it('should return current mode when called without argument', function(){ - skeleton.autoResize(false); - expect(skeleton.autoResize()).to.be.false; - skeleton.autoResize('width'); - expect(skeleton.autoResize()).to.equal('width'); - }); - it('should enable auto resize when set mode to "width/height/both/etc.", similar to parameters of resizeToFitContainer()', function(done){ - // set initial size - skeleton.width(50); - skeleton.autoResize('width'); - setTimeout(function(){ - expect(skeleton.width()).to.equal(element.clientWidth); - done(); - }, 500); - }); - it('should disable auto resize when set mode to false', function(done){ - // set initial size - skeleton.width(50); - skeleton.autoResize('width'); - setTimeout(function(){ - expect(skeleton.width()).to.equal(element.clientWidth); - // disable resize and - skeleton.autoResize(false); - skeleton.width(50); - setTimeout(function(){ - expect(skeleton.width()).to.not.equal(element.clientWidth); - done(); - }, 500); - }, 500); - }); - }); - - describe('#autoResizeDetection(detection)', function(){ - // todo - }); - - describe('#autoResizeToAspectRatio(ratio)', function(){ - // todo - }); - - -}); - -describe.only('LayerOrganizer', function(){ - - describe('new LayerOrganizer(container) will create layers as by default', function(){ - var container: d3.Selection, layers: d3kit.LayerOrganizer; - before(function(done){ - container = d3.select('body').append('svg').append('g'); - layers = new d3kit.LayerOrganizer(container); - done(); - }); - - describe('#create(names)', function(){ - it('should create single layer given a String', function(){ - layers.create('single'); - expect(container.select('g.single-layer').size()).to.be.equal(1); - }); - - it('should create multiple layers given an array', function(){ - layers.create(['a', 'b', 'c']); - expect(container.select('g.a-layer').size()).to.be.equal(1); - expect(container.select('g.b-layer').size()).to.be.equal(1); - expect(container.select('g.c-layer').size()).to.be.equal(1); - }); - - it('should create nested layers given a plain Object with a String inside', function(){ - layers.create({d: 'e'}); - expect(container.select('g.d-layer').size()).to.be.equal(1); - expect(container.select('g.d-layer g.e-layer').size()).to.be.equal(1); - }); - - it('should create nested layers given a plain Object with an Array inside', function(){ - layers.create({f: ['g', 'h']}); - expect(container.select('g.f-layer').size()).to.be.equal(1); - expect(container.select('g.f-layer g.g-layer').size()).to.be.equal(1); - expect(container.select('g.f-layer g.h-layer').size()).to.be.equal(1); - }); - - it('should create multiple nested layers given an array of objects', function(){ - layers.create([{'i': ['x']}, {'j': 'x'}, {'k': ['x','y']}]); - expect(container.select('g.i-layer').size()).to.be.equal(1); - expect(container.select('g.j-layer').size()).to.be.equal(1); - expect(container.select('g.k-layer').size()).to.be.equal(1); - expect(container.select('g.i-layer g.x-layer').size()).to.be.equal(1); - expect(container.select('g.i-layer g.x-layer').size()).to.be.equal(1); - expect(container.select('g.k-layer g.x-layer').size()).to.be.equal(1); - expect(container.select('g.k-layer g.y-layer').size()).to.be.equal(1); - }); - - it('should create multi-level nested layers given a nested plain Object', function(){ - layers.create({ - l: [ - 'm', - {'n': [ - {'o': ['p']}, 'q' - ]} - ] - }); - expect(container.select('g.l-layer').size()).to.be.equal(1); - expect(container.select('g.l-layer g.m-layer').size()).to.be.equal(1); - expect(container.select('g.l-layer g.n-layer').size()).to.be.equal(1); - expect(container.select('g.l-layer g.n-layer g.o-layer').size()).to.be.equal(1); - expect(container.select('g.l-layer g.n-layer g.o-layer g.p-layer').size()).to.be.equal(1); - expect(container.select('g.l-layer g.n-layer g.q-layer').size()).to.be.equal(1); - }); - - }); - - describe('#has(name)', function(){ - it('should be able to check first-level layer', function(){ - expect(layers.has('single')).to.be.true; - expect(layers.has('test')).to.be.false; - }); - it('should be able to check second-level layer', function(){ - expect(layers.has('l.m')).to.be.true; - expect(layers.has('l.x')).to.be.false; - }); - it('should be able to check third-level layer', function(){ - expect(layers.has('l.n.q')).to.be.true; - expect(layers.has('l.n.x')).to.be.false; - }); - }); - - describe('#get(name)', function(){ - it('should be able to get first-level layer', function(){ - expect(layers.get('single')).to.exist; - expect(layers.get('test')).to.be.not.exist; - }); - it('should be able to get second-level layer', function(){ - expect(layers.get('l.m')).to.exist; - expect(layers.get('l.x')).to.not.exist; - }); - it('should be able to get third-level layer', function(){ - expect(layers.get('l.n.o')).to.exist; - expect(layers.get('l.n.x')).to.not.exist; - }); - }); - }); - - describe('new LayerOrganizer(container, tag) will create layers with the given tag instead of ', function(){ - var container: d3.Selection, layers: d3kit.LayerOrganizer; - before(function(done){ - container = d3.select('body').append('div'); - layers = new d3kit.LayerOrganizer(container, 'div'); - done(); - }); - - describe('#create(names)', function(){ - it('should create single layer given a String', function(){ - layers.create('single'); - expect(container.select('div.single-layer').size()).to.be.equal(1); - }); - - it('should create multiple layers given an array', function(){ - layers.create(['a', 'b', 'c']); - expect(container.select('div.a-layer').size()).to.be.equal(1); - expect(container.select('div.b-layer').size()).to.be.equal(1); - expect(container.select('div.c-layer').size()).to.be.equal(1); - }); - - it('should create nested layers given a plain Object with a String inside', function(){ - layers.create({d: 'e'}); - expect(container.select('div.d-layer').size()).to.be.equal(1); - expect(container.select('div.d-layer div.e-layer').size()).to.be.equal(1); - }); - - it('should create nested layers given a plain Object with an Array inside', function(){ - layers.create({f: ['g', 'h']}); - expect(container.select('div.f-layer').size()).to.be.equal(1); - expect(container.select('div.f-layer div.g-layer').size()).to.be.equal(1); - expect(container.select('div.f-layer div.h-layer').size()).to.be.equal(1); - }); - - it('should create multiple nested layers given an array of objects', function(){ - layers.create([{'i': ['x']}, {'j': 'x'}, {'k': ['x','y']}]); - expect(container.select('div.i-layer').size()).to.be.equal(1); - expect(container.select('div.j-layer').size()).to.be.equal(1); - expect(container.select('div.k-layer').size()).to.be.equal(1); - expect(container.select('div.i-layer div.x-layer').size()).to.be.equal(1); - expect(container.select('div.i-layer div.x-layer').size()).to.be.equal(1); - expect(container.select('div.k-layer div.x-layer').size()).to.be.equal(1); - expect(container.select('div.k-layer div.y-layer').size()).to.be.equal(1); - }); - - it('should create multi-level nested layers given a nested plain Object', function(){ - layers.create({ - l: [ - 'm', - {'n': [ - {'o': ['p']}, 'q' - ]} - ] - }); - expect(container.select('div.l-layer').size()).to.be.equal(1); - expect(container.select('div.l-layer div.m-layer').size()).to.be.equal(1); - expect(container.select('div.l-layer div.n-layer').size()).to.be.equal(1); - expect(container.select('div.l-layer div.n-layer div.o-layer').size()).to.be.equal(1); - expect(container.select('div.l-layer div.n-layer div.o-layer div.p-layer').size()).to.be.equal(1); - expect(container.select('div.l-layer div.n-layer div.q-layer').size()).to.be.equal(1); - }); - - }); - - describe('#has(name)', function(){ - it('should be able to check first-level layer', function(){ - expect(layers.has('single')).to.be.true; - expect(layers.has('test')).to.be.false; - }); - it('should be able to check second-level layer', function(){ - expect(layers.has('l.m')).to.be.true; - expect(layers.has('l.x')).to.be.false; - }); - it('should be able to check third-level layer', function(){ - expect(layers.has('l.n.q')).to.be.true; - expect(layers.has('l.n.x')).to.be.false; - }); - }); - - describe('#get(name)', function(){ - it('should be able to get first-level layer', function(){ - expect(layers.get('single')).to.exist; - expect(layers.get('test')).to.be.not.exist; - }); - it('should be able to get second-level layer', function(){ - expect(layers.get('l.m')).to.exist; - expect(layers.get('l.x')).to.not.exist; - }); - it('should be able to get third-level layer', function(){ - expect(layers.get('l.n.o')).to.exist; - expect(layers.get('l.n.x')).to.not.exist; - }); - }); - }); - -}); - -describe('Chartlet', function(){ - interface ConfigureFunction { - (parent: d3kit.Chartlet, child: d3kit.Chartlet): void; - } - var enter: d3kit.ChartletEventFunction, update: d3kit.ChartletEventFunction, exit: d3kit.ChartletEventFunction, chartlet: d3kit.Chartlet; - var customEvents: Array = ['fooEvent']; - var ChildChartlet: () => d3kit.Chartlet; - var ParentChartlet: (configureFunction: ConfigureFunction) => d3kit.Chartlet; - - var callback = function(selection?: d3.Selection, done?: any) { return (sel: d3.Selection) => {done();};}; - beforeEach(function(done){ - ChildChartlet = function() { - var chartlet = new d3kit.Chartlet(callback, callback, callback); - (chartlet).runTest = function (testFunction: any) { - testFunction(chartlet); - }; - return chartlet; - }; - - ParentChartlet = function(configureFunction: ConfigureFunction) { - var chartlet = new d3kit.Chartlet(callback, callback, callback); - var child = ChildChartlet(); - configureFunction(chartlet, child); - (chartlet).runTest = (child).runTest; - return chartlet; - }; - - enter = callback; - update = callback; - exit = callback; - chartlet = new d3kit.Chartlet(enter, update, exit, customEvents); - done(); - }); - - describe('new Chartlet(enter, update, exit, customEvents)', function(){ - it('should create a chartlet', function(){ - expect(chartlet).to.be.an('Object'); - expect(chartlet).to.include.keys(['property', 'on']); - expect(chartlet.enter).to.be.a('Function'); - expect(chartlet.update).to.be.a('Function'); - expect(chartlet.exit).to.be.a('Function'); - expect(function(){ chartlet.enter(); }).to.not.throw(Error); - expect(function(){ chartlet.update(); }).to.not.throw(Error); - expect(function(){ chartlet.exit(); }).to.not.throw(Error); - expect(chartlet.getCustomEventNames()).to.deep.equal(customEvents); - }); - it('arguments "update", "exit" and "customEvents" are optional', function(){ - var comp = new d3kit.Chartlet(enter); - expect(comp).to.be.an('Object'); - expect(comp).to.include.keys(['property', 'on']); - expect(comp.enter).to.be.a('Function'); - expect(comp.update).to.be.a('Function'); - expect(comp.exit).to.be.a('Function'); - expect(function(){ comp.enter(); }).to.not.throw(Error); - expect(function(){ comp.update(); }).to.not.throw(Error); - expect(function(){ comp.exit(); }).to.not.throw(Error); - }); - }); - - describe('#getDispatcher()', function(){ - it('should return a dispatcher', function(){ - var dispatcher = chartlet.getDispatcher(); - expect(dispatcher).to.exist; - }); - it('returned dispatcher should handle enter/update/exit events', function(){ - var dispatcher = chartlet.getDispatcher(); - expect(dispatcher).to.include.keys(['enterDone', 'updateDone', 'exitDone'].concat(customEvents)); - }); - }); - - describe('#getPropertyValue(name, d, i)', function(){ - it('should return computed value for specified property name, d and i', function(){ - var d = {a: 99}; - var i = 2; - - chartlet.property('foo', 1); - chartlet.property('bar', 'two'); - chartlet.property('baz', function(d:{a:number}, i: number) {return 3;}); - chartlet.property('qux', function(d:{a:number}, i: number) {return 'four';}); - chartlet.property('nux', function(d:{a:number}, i: number) {return d.a * i;}); - - expect(chartlet.getPropertyValue('foo', d, i)).to.equal(1); - expect(chartlet.getPropertyValue('bar', d, i)).to.equal('two'); - expect(chartlet.getPropertyValue('baz', d, i)).to.equal(3); - expect(chartlet.getPropertyValue('qux', d, i)).to.equal('four'); - expect(chartlet.getPropertyValue('nux', d, i)).to.equal(198); - }); - }); - - describe('#property(name, valueOrFn)', function(){ - describe('should act as a getter when called with one argument', function(){ - it('should always return a function', function(){ - chartlet.property('foo', 1); - expect(chartlet.property('foo')).to.be.a('Function'); - chartlet.property('bar', function(){ return 100; }); - expect(chartlet.property('bar')).to.be.a('Function'); - }); - it('should return a function that return undefined for unknown property name', function(){ - expect(chartlet.property('unknown name')).to.be.a('Function'); - expect(chartlet.property('unknown name')()).to.equal(undefined); - }); - }); - - describe('should act as a setter when called with two arguments', function(){ - it('should set specified property to a functor of given value', function(){ - chartlet.property('foo', 1); - expect(chartlet.property('foo')).to.be.a('Function'); - expect(chartlet.property('foo')()).to.equal(1); - chartlet.property('bar', function(){ return 100; }); - expect(chartlet.property('bar')).to.be.a('Function'); - expect(chartlet.property('bar')()).to.equal(100); - }); - it('should overwrite previous value when set property with the same name', function(){ - chartlet.property('foo', 1); - expect(chartlet.property('foo')()).to.equal(1); - chartlet.property('foo', 100); - expect(chartlet.property('foo')()).to.equal(100); - }); - }); - }); - - describe('#on(eventName, listener)', function(){ - it('event "enterDone" should be triggered after chartlet.enter() is completed.', function(done){ - chartlet.on('enterDone', function(){ return (sel: d3.Selection) => {done();} }); - chartlet.enter(); - }); - it('event "updateDone" should be triggered after chartlet.update() is completed.', function(done){ - chartlet.on('updateDone', function(){ return (sel: d3.Selection) => {done();} }); - chartlet.update(); - }); - it('event "exitDone" should be triggered after chartlet.exit() is completed.', function(done){ - chartlet.on('exitDone', function(){ return (sel: d3.Selection) => {done();} }); - chartlet.exit(); - }); - }); - - describe('#inheritPropertyFrom(parentChartlet, parentPropertyName, childPropertyName)', function(){ - it('it should cause a child to inherit a parent property', function() { - var parent = ParentChartlet(function(parent: d3kit.Chartlet, child: d3kit.Chartlet) { - child.inheritPropertyFrom(parent, 'foo', 'bar'); - }) - .property('foo', function(d:number) {return 2 * d;}); - - (parent).runTest(function(child: d3kit.Chartlet) { - expect(child.getPropertyValue('bar', 4, 0)).to.be.equal(8); - }); - }); - - it('it should default to the parent property name', function() { - var parent = ParentChartlet( - function(parent: d3kit.Chartlet, child: d3kit.Chartlet) { - child.inheritPropertyFrom(parent, 'foo'); - }) - .property('foo', function(d:number) {return 2 * d;}); - - (parent).runTest(function(child: d3kit.Chartlet) { - expect(child.getPropertyValue('foo', 4, 0)).to.be.equal(8); - }); - }); - }); - - describe('#inheritProperties(parentChartlet, parentPropertyNames, childPropertyNames)', function(){ - it('it should cause a child to inherit many parent properties', function() { - var parent = ParentChartlet( - function(parent: d3kit.Chartlet, child: d3kit.Chartlet) { - child.inheritPropertiesFrom(parent, ['foo', 'bar', 'baz'], ['foo-x', 'bar-x', 'baz-x']); - }) - .property('foo', function(d:number) {return 2 * d;}) - .property('bar', function(d:number) {return 3 * d;}) - .property('baz', function(d:number) {return 4 * d;}); - - (parent).runTest(function(child: d3kit.Chartlet) { - expect(child.getPropertyValue('foo-x', 1, 0)).to.be.equal(2); - expect(child.getPropertyValue('bar-x', 1, 0)).to.be.equal(3); - expect(child.getPropertyValue('baz-x', 1, 0)).to.be.equal(4); - }); - }); - - it('it should default to the parent property names', function() { - var parent = ParentChartlet( - function(parent: d3kit.Chartlet, child: d3kit.Chartlet) { - child.inheritPropertiesFrom(parent, ['foo', 'bar', 'baz']); - }) - .property('foo', function(d:number) {return 2 * d;}) - .property('bar', function(d:number) {return 3 * d;}) - .property('baz', function(d:number) {return 4 * d;}); - - (parent).runTest(function(child: d3kit.Chartlet) { - expect(child.getPropertyValue('foo', 1, 0)).to.be.equal(2); - expect(child.getPropertyValue('bar', 1, 0)).to.be.equal(3); - expect(child.getPropertyValue('baz', 1, 0)).to.be.equal(4); - }); - }); - }); - - describe('#publishEventsTo(foreignDispatcher)', function(){ - it('should map events to a foreignDispatcher', function(done) { - - var parent = new d3kit.Chartlet(callback, callback, callback, ['foo']); - parent.getDispatcher().on('foo', function(value:number) { - expect(value).to.be.equal(99); - done(); - }); - - var child = new d3kit.Chartlet(callback, callback, callback, ['foo']) - .publishEventsTo(parent.getDispatcher()); - - (child.getDispatcher()).foo(99); - }); - }); -}); - -describe('#createChart', function(){ - var Chart = d3kit.factory.createChart({}, ['test'], function(skeleton: d3kit.Skeleton){ - return skeleton; - }); - - it('should return a function to create a chart', function(){ - expect(Chart).to.be.a('Function'); - }); - - // // Don't think it's possible to define these in a d.ts file; skipping - // it('results should have function getCustomEvents()', function(){ - // expect(Chart.getCustomEvents).to.exist; - // expect(Chart.getCustomEvents()).to.deep.equal(['test']); - // }); -}); - -describe('d3kit.helper', function(){ - - describe('#dasherize(str)', function(){ - it('should convert input to dash-case', function(){ - expect(d3kit.helper.dasherize('camelCase')).to.equal('camel-case'); - }); - }); - - describe('#deepExtend(target, src1, src2, ...)', function(){ - it('should copy fields from sources into target', function(){ - expect(d3kit.helper.deepExtend({}, { - a: 1, - b: 2 - },{ - b: 3, - c: 4 - })).to.deep.equal({ - a: 1, - b: 3, - c: 4 - }); - - expect(d3kit.helper.deepExtend({}, { - a: 1, - b: 2 - },{ - b: 3, - c: 4 - }, null)).to.deep.equal({ - a: 1, - b: 3, - c: 4 - }); - }); - - it('should copy arrays and functions correctly from sources into target', function(){ - var fn1 = function(d:number){return d + 1;}; - var fn2 = function(d:number){return d + 2;}; - expect(d3kit.helper.deepExtend({}, { - a: fn1, - b: [1,2] - },{ - b: [3,4], - c: fn2 - })).to.deep.equal({ - a: fn1, - b: [3,4], - c: fn2 - }); - }); - - it('should perform "deep" copy', function(){ - var fn1 = function(d:number){return d + 1;}; - var fn2 = function(d:number){return d + 2;}; - expect(d3kit.helper.deepExtend({}, { - a: { d: fn1 }, - b: [1,2], - c: { f: 3 }, - h: { i: [1,2,3], j: [3,4,5] } - },{ - a: { e: 2 }, - b: [3,4], - c: { f: 4, g: fn2 }, - h: { i: [2,3,4], k: [3,4,5], l: {m: 2} } - })).to.deep.equal({ - a: { d: fn1, e: 2 }, - b: [3,4], - c: { f: 4, g: fn2 }, - h: { i: [2,3,4], j: [3,4,5], k: [3,4,5], l: {m: 2} } - }); - }); - }); - - describe('#extend(target, src1, src2, ...)', function(){ - it('should copy fields from sources into target', function(){ - expect(d3kit.helper.extend({}, { - a: 1, - b: 2 - },{ - b: 3, - c: 4 - })).to.deep.equal({ - a: 1, - b: 3, - c: 4 - }); - - expect(d3kit.helper.extend({}, { - a: 1, - b: 2 - },{ - b: 3, - c: 4 - }, null)).to.deep.equal({ - a: 1, - b: 3, - c: 4 - }); - }); - - it('should copy arrays and functions correctly from sources into target', function(){ - var fn1 = function(d:number){return d + 1;}; - var fn2 = function(d:number){return d + 2;}; - expect(d3kit.helper.extend({}, { - a: fn1, - b: [1,2] - },{ - b: [3,4], - c: fn2 - })).to.deep.equal({ - a: fn1, - b: [3,4], - c: fn2 - }); - }); - - it('should NOT perform "deep" copy', function(){ - var fn1 = function(d:number){return d + 1;}; - var fn2 = function(d:number){return d + 2;}; - expect(d3kit.helper.extend({}, { - a: { d: fn1 }, - b: [1,2], - c: { f: 3 }, - h: { i: [1,2,3], j: [3,4,5] } - },{ - a: { e: 2 }, - b: [3,4], - c: { f: 4, g: fn2 }, - h: { i: [2,3,4], k: [3,4,5], l: {m: 2} } - })).to.deep.equal({ - a: { e: 2 }, - b: [3,4], - c: { f: 4, g: fn2 }, - h: { i: [2,3,4], k: [3,4,5], l: {m: 2} } - }); - }); - }); - - describe('#isFunction(function)', function(){ - it('should return true if the value is a function', function(){ - var fn1 = function(d:number){return d + 1;}; - function fn2(d:number){return d + 2;} - - expect(d3kit.helper.isFunction(fn1)).to.be.true; - expect(d3kit.helper.isFunction(fn2)).to.be.true; - }); - it('should return false if the value is not a function', function(){ - expect(d3kit.helper.isFunction(0)).to.be.false; - expect(d3kit.helper.isFunction(1)).to.be.false; - expect(d3kit.helper.isFunction(true)).to.be.false; - expect(d3kit.helper.isFunction('what')).to.be.false; - expect(d3kit.helper.isFunction(null)).to.be.false; - expect(d3kit.helper.isFunction(undefined)).to.be.false; - }); - }); - - describe('#isNumber(value)', function(){ - it('should return true for number', function(){ - expect(d3kit.helper.isNumber(1)).to.be.true; - expect(d3kit.helper.isNumber(0)).to.be.true; - expect(d3kit.helper.isNumber(-1)).to.be.true; - }); - it('should return false for string even if it is a number', function(){ - expect(d3kit.helper.isNumber('')).to.be.false; - expect(d3kit.helper.isNumber('1')).to.be.false; - expect(d3kit.helper.isNumber('0')).to.be.false; - expect(d3kit.helper.isNumber('what')).to.be.false; - }); - it('should return false for null and undefined', function(){ - expect(d3kit.helper.isNumber(null)).to.be.false; - expect(d3kit.helper.isNumber(undefined)).to.be.false; - }); - }); -}); +function test_abstract_chart() { + let el: Element, + chart: d3kit.AbstractChart, + options: d3kit.ChartOptions, + margins: d3kit.ChartMargin, + offsets: d3kit.ChartOffset, + defopts: d3kit.ChartOptions, + fitopts: d3kit.FitOptions, + watchop: d3kit.WatchOptions, + events: string[], + w: number, h:number, d: [number, number], a: any, b: boolean; + + // create a div, append to body, return Node as type Element + el = document.body.appendChild(document.createElement('div')) as Element; + + // create examples of margins, offsets, options, fit options, watch options + margins = { top: 20, right: 20, bottom: 20, left: 20}; + offsets = { x: 0.5, y: 0.5 }; + options = { initialWidth: 400, initialHeight: 300, margin: margins, offset: offsets }; + fitopts = { mode: 'basic', width: '90%', ratio: 4/3 }; + watchop = { mode: 'window', target: null, interval: 500 }; + + /** + * Test constructor + */ + chart = new d3kit.AbstractChart(el); // with element + chart = new d3kit.AbstractChart('div#chart'); // with selector + chart = new d3kit.AbstractChart(el, options); // with element+options + chart = new d3kit.AbstractChart('div#chart', options); // with selector+options + + /** + * Test static functions + */ + defopts = d3kit.AbstractChart.getDefaultOptions(); + events = d3kit.AbstractChart.getCustomEventNames(); + + /** + * Test getters + */ + w = chart.getInnerWidth(); + h = chart.getInnerHeight(); + w = chart.width(); + h = chart.height(); + d = chart.dimension(); + a = chart.data(); + margins = chart.margin(); + offsets = chart.offset(); + options = chart.options(); + events = chart.getCustomEventNames(); + + /** + * Test setters + */ + chart.width(w); + chart.height(h); + chart.dimension(d); + chart.data([1, 2, 3, 4, 5, 6]); + chart.margin(margins); + chart.offset(offsets); + chart.options(options); + + /** + * Test booleans + */ + b = chart.hasData(); + b = chart.hasNonZeroArea(); + + /** + * Test events + */ + chart.dimension(d).updateDimensionNow(); + chart.setupDispatcher(['click', 'mouseover']); + chart.fit(fitopts); // without watch options + chart.fit(fitopts, watchop); // with watch options + chart.stopFitWatcher(); + chart.on('mouseover', () => { chart.stopFitWatcher(); }); + chart.off('mouseover'); + chart.destroy(); +} + +function test_svgchart() { + let el: Element, + chart: d3kit.SvgChart, + options: d3kit.ChartOptions, + margins: d3kit.ChartMargin, + offsets: d3kit.ChartOffset, + svg: d3.Selection, + rootg: d3.Selection, + layers: d3kit.LayerOrganizer; + + // create a div, append to body, return Node as type Element + el = document.body.appendChild(document.createElement('div')) as Element; + + // create examples of margins, offsets, options, fit options, watch options + margins = { top: 20, right: 20, bottom: 20, left: 20}; + offsets = { x: 0.5, y: 0.5 }; + options = { initialWidth: 400, initialHeight: 300, margin: margins, offset: offsets }; + + /** + * Test constructor + */ + chart = new d3kit.SvgChart(el); // with element + chart = new d3kit.SvgChart('div#chart'); // with selector + chart = new d3kit.SvgChart(el, options); // with element+options + chart = new d3kit.SvgChart('div#chart', options); // with selector+options + + /** + * Test properties + */ + svg = chart.svg; + rootg = chart.rootG; + layers = chart.layers; +} + +function test_canvaschart() { + let el: Element, + chart: d3kit.CanvasChart, + options: d3kit.ChartOptions, + margins: d3kit.ChartMargin, + offsets: d3kit.ChartOffset, + context: CanvasRenderingContext2D; + + // create a div, append to body, return Node as type Element + el = document.body.appendChild(document.createElement('div')) as Element; + + // create examples of margins, offsets, options, fit options, watch options + margins = { top: 20, right: 20, bottom: 20, left: 20}; + offsets = { x: 0.5, y: 0.5 }; + options = { initialWidth: 400, initialHeight: 300, margin: margins, offset: offsets, pixelRatio: 1 }; + + /** + * Test constructor + */ + chart = new d3kit.CanvasChart(el); // with element + chart = new d3kit.CanvasChart('div#chart'); // with selector + chart = new d3kit.CanvasChart(el, options); // with element+options + chart = new d3kit.CanvasChart('div#chart', options); // with selector+options + + /** + * Test canvas chart functions + */ + context = chart.getContext2d(); + options = d3kit.CanvasChart.getDefaultOptions(); + chart.clear(); +} + +function test_layer_organizer() { + let selection: d3.Selection, + layer: d3.Selection, + layers: d3kit.LayerOrganizer, + hasXAxis: boolean; + + selection = d3.select('svg'); + + /** + * Test constructor + */ + layers = new d3kit.LayerOrganizer(selection); // without specifying tag + layers = new d3kit.LayerOrganizer(selection, 'div'); // specifying tag + + /** + * Test layer creation + */ + layers.create('graph'); + layers.create(['graph', 'highlight']); + layers.create({'graph': [{'axes':['x-axis', 'y-axis']}, {'labels':['x-label', 'y-label', 'title']}]}); + layers.create([{'axes':['x-axis', 'y-axis']}, {'labels':['x-label', 'y-label', 'title']}]); + + /** + * Test other layer organizer functions + */ + layer = layers.get('x-axis'); + hasXAxis = layers.has('x-axis'); +} + +function test_helper() { + let simple1: Object = { "one": 1 }, + simple2: Object = { "two": 2 }, + complex: Object = { "fruit": ["apple", "pear", "grape"], "prez": { "fn": "Barack", "ln": "Obama" } }, + merged1: Object, merged2: Object, + anObject: Object = {"this": "isanobject"}, isObj: boolean, + aFuncxn = () => "this is a function", isFunc: boolean, + kebabed: string, dbouncd: any, throtld: any; + + dbouncd = d3kit.helper.debounce(aFuncxn, 300); + merged1 = d3kit.helper.extend(simple1, simple2); + merged2 = d3kit.helper.deepExtend(simple1, complex); + aFuncxn = d3kit.helper.functor(aFuncxn); // with a function argument + aFuncxn = d3kit.helper.functor(simple1); // with a value argument + isObj = d3kit.helper.isObject(anObject); + isFunc = d3kit.helper.isFunction(aFuncxn); + kebabed = d3kit.helper.kebabCase("a string to convert to kebab case"); + throtld = d3kit.helper.throttle(aFuncxn, 300); +} diff --git a/d3kit/d3kit-v1.1.0-tests.ts b/d3kit/d3kit-v1.1.0-tests.ts new file mode 100644 index 0000000000..5eab2a4e79 --- /dev/null +++ b/d3kit/d3kit-v1.1.0-tests.ts @@ -0,0 +1,1112 @@ +/// +/// +/// +/// + +/* jshint expr: true */ + +var expect = chai.expect; +describe('Skeleton', function(){ + var element: Element, $element: d3.Selection, $svg: d3.Selection, skeleton: d3kit.Skeleton; + + beforeEach(function(done){ + element = document.body.appendChild(document.createElement('div')) as Element; + skeleton = new d3kit.Skeleton(element, null, ['custom1', 'custom2']); + $element = d3.select(element); + $svg = $element.select('svg'); + done(); + }); + + describe('new Skeleton()', function(){ + it('should create inside the element', function(){ + expect($element.select('svg').size()).to.be.equal(1); + }); + it('should create inside inside the element', function(){ + expect($element.select('svg').select('g').size()).to.be.equal(1); + }); + }); + + describe('#getCustomEventNames()', function(){ + it('should return custom event names', function(){ + expect(skeleton.getCustomEventNames()).to.deep.equal(['custom1', 'custom2']); + }); + }); + + describe('#getDispatcher()', function(){ + it('should return event dispatcher', function(){ + expect(skeleton.getDispatcher()).to.be.an('Object'); + expect(skeleton.getDispatcher().data).to.be.a('Function'); + }); + }); + + describe('#getInnerWidth()', function(){ + it('should return width of the skeleton excluding margin', function(){ + skeleton.options({ + margin: {left: 10, right: 10} + }); + skeleton.width(100); + expect(skeleton.getInnerWidth()).to.equal(80); + }); + }); + + describe('#getInnerHeight()', function(){ + it('should return height of the skeleton excluding margin', function(){ + skeleton.options({ + margin: {top: 10, bottom: 20} + }); + skeleton.height(100); + expect(skeleton.getInnerHeight()).to.equal(70); + }); + }); + + describe('#getLayerOrganizer()', function(){ + it('should return the LayerOrganizer', function(){ + expect(skeleton.getLayerOrganizer()).to.be.an('Object'); + }); + }); + + describe('#getRootG()', function(){ + it('should return d3 selection of the root ', function(){ + var g = skeleton.getRootG(); + expect(g.size()).to.equal(1); + expect((g[0][0] as Element).tagName).to.equal('g'); + }); + }); + + describe('#getSvg()', function(){ + it('should return d3 selection of the ', function(){ + var svg = skeleton.getSvg(); + expect(svg.size()).to.equal(1); + expect((svg[0][0] as Element).tagName).to.equal('svg'); + }); + }); + + describe('#data(data, doNotDispatch)', function(){ + it('should return data when called without argument', function(){ + skeleton.data({a: 1}); + expect(skeleton.data()).to.deep.equal({a: 1}); + }); + it('should set data when called with at least one argument', function(){ + skeleton.data('test'); + expect(skeleton.data()).to.equal('test'); + }); + it('after setting, should dispatch "data" event', function(done){ + skeleton.on('data.test', function(){ + // This block should be reached to pass the test. + expect(true).to.be.true; + done(); + }); + skeleton.data({a: 1}); + }); + it('after setting, should not dispatch "data" event if doNotDispatch is true', function(done){ + skeleton.on('data.test', function(){ + // This block should not be reached. + expect(true).to.be.false; + done(); + }); + skeleton.data({a: 1}, true); + setTimeout(done, 100); + }); + }); + + describe('#options(options, doNotDispatch)', function(){ + it('should return options when called without argument', function(){ + skeleton.options({a: 2}); + expect(skeleton.options()).to.include.keys(['a']); + expect(skeleton.options().a).to.equal(2); + }); + it('should set options when called with at least one argument', function(){ + skeleton.options({a: 1}); + expect(skeleton.options()).to.include.keys(['a']); + expect(skeleton.options().a).to.equal(1); + }); + it('should not overwrite but extend existing options when setting', function(){ + skeleton.options({a: 1}); + skeleton.options({b: 2}); + expect(skeleton.options()).to.include.keys(['a', 'b']); + expect(skeleton.options().a).to.equal(1); + expect(skeleton.options().b).to.equal(2); + }); + it('after setting, should dispatch "options" event', function(done){ + skeleton.on('options.test', function(){ + // This block should be reached to pass the test. + expect(true).to.be.true; + done(); + }); + skeleton.options({a: 1}); + }); + it('after setting, should not dispatch "options" event if doNotDispatch is true', function(done){ + skeleton.on('options.test', function(){ + // This block should not be reached. + expect(true).to.be.false; + done(); + }); + skeleton.options({a: 1}, true); + setTimeout(done, 100); + }); + }); + + describe('#margin(margin, doNotDispatch)', function(){ + it('should return margin when called without argument', function(){ + var margin = {left: 10, right: 10, top: 10, bottom: 10}; + skeleton.margin(margin); + expect(skeleton.margin()).to.deep.equal(margin); + }); + it('should set margin when called with at least one argument', function(){ + var margin = {left: 10, right: 10, top: 10, bottom: 10}; + skeleton.margin(margin); + + skeleton.margin({left: 20}); + expect(skeleton.margin().left).to.equal(20); + expect(skeleton.margin().right).to.equal(10); + skeleton.margin({right: 20}); + expect(skeleton.margin().right).to.equal(20); + skeleton.margin({top: 20}); + expect(skeleton.margin().top).to.equal(20); + skeleton.margin({bottom: 20}); + expect(skeleton.margin().bottom).to.equal(20); + }); + it('should update innerWidth after setting margin', function(){ + skeleton.width(100); + skeleton.margin({left: 10, right:10}); + expect(skeleton.getInnerWidth()).to.equal(80); + skeleton.margin({left: 15, right:15}); + expect(skeleton.getInnerWidth()).to.equal(70); + }); + it('should update innerHeight after setting margin', function(){ + skeleton.height(100); + skeleton.margin({top: 10, bottom:10}); + expect(skeleton.getInnerHeight()).to.equal(80); + skeleton.margin({top: 15, bottom:15}); + expect(skeleton.getInnerHeight()).to.equal(70); + }); + it('should update the root transform/translate', function(){ + skeleton.margin({left: 30, top: 30}); + skeleton.offset([0.5, 0.5]); + skeleton.margin({left: 10, top: 10}); + var translate = skeleton.getRootG().attr('transform'); + expect(translate).to.equal('translate(10.5,10.5)'); + }); + it('after setting, should dispatch "resize" event', function(done){ + skeleton.on('resize.test', function(){ + // This block should be reached to pass the test. + expect(true).to.be.true; + done(); + }); + skeleton.margin({left: 33}); + }); + it('after setting, should not dispatch "resize" event if doNotDispatch is true', function(done){ + skeleton.on('resize.test', function(){ + // This block should not be reached. + expect(true).to.be.false; + done(); + }); + skeleton.margin({left: 33}, true); + setTimeout(done, 100); + }); + }); + + describe('#offset(offset)', function(){ + it('should return offset when called without argument', function(){ + var offset = [1,1]; + skeleton.offset(offset); + expect(skeleton.offset()).to.deep.equal(offset); + }); + it('should set offset when called with at least one argument', function(){ + var offset = [1,1]; + skeleton.offset(offset); + skeleton.offset([2,3]); + expect(skeleton.offset()).to.deep.equal([2,3]); + }); + it('should update the root transform/translate', function(){ + skeleton.offset([0.5, 0.5]); + skeleton.margin({left: 10, top: 10}); + skeleton.offset([2,3]); + var translate = skeleton.getRootG().attr('transform'); + expect(translate).to.equal('translate(12,13)'); + }); + }); + + describe('#width(width, doNotDispatch)', function(){ + it('should return width when called without argument', function(){ + var w = $svg.attr('width'); + expect(skeleton.width()).to.equal(+w); + }); + it('should set width when called with Number as the first argument', function(){ + skeleton.width(300); + expect(+$svg.attr('width')).to.equal(300); + }); + it('should set width when called with a Number and "px" such as "100px" as the first argument', function(){ + skeleton.width('299px'); + expect(+$svg.attr('width')).to.equal(299); + }); + it('should set width to container\'s width when called with "auto" as the first argument', function(){ + var w = element.clientWidth; + skeleton.width('auto'); + expect(+$svg.attr('width')).to.equal(w); + }); + it('after setting, should dispatch "resize" event', function(done){ + skeleton.on('resize.test', function(){ + // This block should be reached to pass the test. + expect(true).to.be.true; + done(); + }); + skeleton.width(200); + }); + it('after setting, should not dispatch "resize" event if doNotDispatch is true', function(done){ + skeleton.on('resize.test', function(){ + // This block should not be reached. + expect(true).to.be.false; + done(); + }); + skeleton.width(200, true); + setTimeout(done, 100); + }); + }); + + describe('#height(height, doNotDispatch)', function(){ + it('should return height when called without argument', function(){ + var w = $svg.attr('height'); + expect(skeleton.height()).to.equal(+w); + }); + it('should set height when called with Number as the first argument', function(){ + skeleton.height(300); + expect(+$svg.attr('height')).to.equal(300); + }); + it('should set height when called with a Number and "px" such as "100px" as the first argument', function(){ + skeleton.height('299px'); + expect(+$svg.attr('height')).to.equal(299); + }); + it('should set height to container\'s height when called with "auto" as the first argument', function(){ + var w = element.clientHeight; + skeleton.height('auto'); + expect(+$svg.attr('height')).to.equal(w); + }); + it('after setting, should dispatch "resize" event', function(done){ + skeleton.on('resize.test', function(){ + // This block should be reached to pass the test. + expect(true).to.be.true; + done(); + }); + skeleton.height(200); + }); + it('after setting, should not dispatch "resize" event if doNotDispatch is true', function(done){ + skeleton.on('resize.test', function(){ + // This block should not be reached. + expect(true).to.be.false; + done(); + }); + skeleton.height(200, true); + setTimeout(done, 100); + }); + }); + + describe('#dimension(dimension, doNotDispatch)', function(){ + it('should return an array [width, height] when called without argument', function(){ + var dim = [+$svg.attr('width'), +$svg.attr('height')]; + expect(skeleton.dimension()).to.deep.equal(dim); + }); + it('should set width and height of the when called with an array [width, height] as the first argument', function(){ + skeleton.dimension([118, 118]); + expect([+$svg.attr('width'), +$svg.attr('height')]).to.deep.equal([118, 118]); + }); + it('after setting, should dispatch "resize" event', function(done){ + skeleton.on('resize.test', function(){ + // This block should be reached to pass the test. + expect(true).to.be.true; + done(); + }); + skeleton.dimension([150, 150]); + }); + it('after setting, should not dispatch "resize" event if doNotDispatch is true', function(done){ + skeleton.on('resize.test', function(){ + // This block should not be reached. + expect(true).to.be.false; + done(); + }); + skeleton.dimension([150, 150], true); + setTimeout(done, 100); + }); + }); + + describe('#hasData()', function(){ + it('should return true when data are not null nor undefined', function(){ + skeleton.data({}); + expect(skeleton.hasData()).to.be.true; + skeleton.data({test: 1}); + expect(skeleton.hasData()).to.be.true; + skeleton.data([]); + expect(skeleton.hasData()).to.be.true; + skeleton.data(['test']); + expect(skeleton.hasData()).to.be.true; + }); + it('should return false when data are null or undefined', function(){ + skeleton.data(null); + expect(skeleton.hasData()).to.be.false; + skeleton.data(undefined); + expect(skeleton.hasData()).to.be.false; + }); + }); + + describe('#hasNonZeroArea()', function(){ + it('should return true if \'s width & height excluding margin is more than zero', function(){ + skeleton.options({ + margin: {left: 10, right: 10} + }); + skeleton.width(80); + skeleton.options({ + margin: {top: 10, bottom: 20} + }); + skeleton.height(50); + expect(skeleton.hasNonZeroArea()).to.be.true; + }); + it('should return false otherwise', function(){ + skeleton.options({ + margin: {left: 10, right: 10} + }); + skeleton.width(20); + skeleton.options({ + margin: {top: 10, bottom: 20} + }); + skeleton.height(30); + expect(skeleton.hasNonZeroArea()).to.be.false; + }); + }); + + describe('#mixin({})', function(){ + it('should extend this skeleton with new fields/functions', function(){ + skeleton.mixin({ + a: 1, + b: 2 + }); + expect(skeleton).to.include.keys(['a', 'b']); + expect((skeleton).a).to.equal(1); + expect((skeleton).b).to.equal(2); + }); + it('should overwrite existing fields', function(){ + skeleton.mixin({ + b: 2 + }); + skeleton.mixin({ + b: 3 + }); + expect(skeleton).to.include.keys(['b']); + expect((skeleton).b).to.equal(3); + }); + it('should keep original fields if not overwritten', function(){ + skeleton.mixin({ + a: 1, + b: 2 + }); + skeleton.mixin({ + c: 20, + b: 3 + }); + expect(skeleton).to.include.keys(['a', 'b', 'c']); + expect((skeleton).a).to.equal(1); + expect((skeleton).b).to.equal(3); + expect((skeleton).c).to.equal(20); + }); + }); + + describe('#resizeToFitContainer(mode)', function(){ + it('when mode is "all" should resize to fit both width and height', function(){ + skeleton.dimension([element.clientWidth/2, element.clientHeight/2]); + var w = element.clientWidth; + var h = element.clientHeight; + skeleton.resizeToFitContainer('all'); + expect(skeleton.dimension()).to.deep.equal([w, h]); + }); + it('when mode is "both" should resize to fit both width and height', function(){ + skeleton.dimension([element.clientWidth/2, element.clientHeight/2]); + var w = element.clientWidth; + var h = element.clientHeight; + skeleton.resizeToFitContainer('both'); + expect(skeleton.dimension()).to.deep.equal([w, h]); + }); + it('when mode is "full" should resize to fit both width and height', function(){ + skeleton.dimension([element.clientWidth/2, element.clientHeight/2]); + var w = element.clientWidth; + var h = element.clientHeight; + skeleton.resizeToFitContainer('full'); + expect(skeleton.dimension()).to.deep.equal([w, h]); + }); + it('when mode is "width" should resize width to fit container but keep original height', function(){ + var w1 = element.clientWidth/2; + var h1 = element.clientHeight/2; + + skeleton.dimension([w1, h1]); + + var w2 = element.clientWidth; + var h2 = element.clientHeight; + + skeleton.resizeToFitContainer('width'); + + expect(skeleton.width()).to.equal(Math.floor(w2)); + expect(skeleton.height()).to.equal(Math.floor(h1)); + expect(skeleton.width()).to.not.equal(w1); + expect(skeleton.height()).to.not.equal(h2); + }); + it('when mode is "height" should resize height to fit container but keep original width', function(){ + var w1 = element.clientWidth/2; + var h1 = element.clientHeight*2; + + skeleton.dimension([w1, h1]); + + var w2 = element.clientWidth; + var h2 = element.clientHeight; + + skeleton.resizeToFitContainer('height'); + + expect(skeleton.width()).to.equal(Math.floor(w1)); + expect(skeleton.height()).to.equal(Math.floor(h2)); + expect(skeleton.width()).to.not.equal(w2); + expect(skeleton.height()).to.not.equal(h1); + }); + }); + + describe('#resizeToAspectRatio(ratio)', function(){ + // todo + }); + + describe('#autoResize(mode)', function(){ + it('should return current mode when called without argument', function(){ + skeleton.autoResize(false); + expect(skeleton.autoResize()).to.be.false; + skeleton.autoResize('width'); + expect(skeleton.autoResize()).to.equal('width'); + }); + it('should enable auto resize when set mode to "width/height/both/etc.", similar to parameters of resizeToFitContainer()', function(done){ + // set initial size + skeleton.width(50); + skeleton.autoResize('width'); + setTimeout(function(){ + expect(skeleton.width()).to.equal(element.clientWidth); + done(); + }, 500); + }); + it('should disable auto resize when set mode to false', function(done){ + // set initial size + skeleton.width(50); + skeleton.autoResize('width'); + setTimeout(function(){ + expect(skeleton.width()).to.equal(element.clientWidth); + // disable resize and + skeleton.autoResize(false); + skeleton.width(50); + setTimeout(function(){ + expect(skeleton.width()).to.not.equal(element.clientWidth); + done(); + }, 500); + }, 500); + }); + }); + + describe('#autoResizeDetection(detection)', function(){ + // todo + }); + + describe('#autoResizeToAspectRatio(ratio)', function(){ + // todo + }); + + +}); + +describe.only('LayerOrganizer', function(){ + + describe('new LayerOrganizer(container) will create layers as by default', function(){ + var container: d3.Selection, layers: d3kit.LayerOrganizer; + before(function(done){ + container = d3.select('body').append('svg').append('g'); + layers = new d3kit.LayerOrganizer(container); + done(); + }); + + describe('#create(names)', function(){ + it('should create single layer given a String', function(){ + layers.create('single'); + expect(container.select('g.single-layer').size()).to.be.equal(1); + }); + + it('should create multiple layers given an array', function(){ + layers.create(['a', 'b', 'c']); + expect(container.select('g.a-layer').size()).to.be.equal(1); + expect(container.select('g.b-layer').size()).to.be.equal(1); + expect(container.select('g.c-layer').size()).to.be.equal(1); + }); + + it('should create nested layers given a plain Object with a String inside', function(){ + layers.create({d: 'e'}); + expect(container.select('g.d-layer').size()).to.be.equal(1); + expect(container.select('g.d-layer g.e-layer').size()).to.be.equal(1); + }); + + it('should create nested layers given a plain Object with an Array inside', function(){ + layers.create({f: ['g', 'h']}); + expect(container.select('g.f-layer').size()).to.be.equal(1); + expect(container.select('g.f-layer g.g-layer').size()).to.be.equal(1); + expect(container.select('g.f-layer g.h-layer').size()).to.be.equal(1); + }); + + it('should create multiple nested layers given an array of objects', function(){ + layers.create([{'i': ['x']}, {'j': 'x'}, {'k': ['x','y']}]); + expect(container.select('g.i-layer').size()).to.be.equal(1); + expect(container.select('g.j-layer').size()).to.be.equal(1); + expect(container.select('g.k-layer').size()).to.be.equal(1); + expect(container.select('g.i-layer g.x-layer').size()).to.be.equal(1); + expect(container.select('g.i-layer g.x-layer').size()).to.be.equal(1); + expect(container.select('g.k-layer g.x-layer').size()).to.be.equal(1); + expect(container.select('g.k-layer g.y-layer').size()).to.be.equal(1); + }); + + it('should create multi-level nested layers given a nested plain Object', function(){ + layers.create({ + l: [ + 'm', + {'n': [ + {'o': ['p']}, 'q' + ]} + ] + }); + expect(container.select('g.l-layer').size()).to.be.equal(1); + expect(container.select('g.l-layer g.m-layer').size()).to.be.equal(1); + expect(container.select('g.l-layer g.n-layer').size()).to.be.equal(1); + expect(container.select('g.l-layer g.n-layer g.o-layer').size()).to.be.equal(1); + expect(container.select('g.l-layer g.n-layer g.o-layer g.p-layer').size()).to.be.equal(1); + expect(container.select('g.l-layer g.n-layer g.q-layer').size()).to.be.equal(1); + }); + + }); + + describe('#has(name)', function(){ + it('should be able to check first-level layer', function(){ + expect(layers.has('single')).to.be.true; + expect(layers.has('test')).to.be.false; + }); + it('should be able to check second-level layer', function(){ + expect(layers.has('l.m')).to.be.true; + expect(layers.has('l.x')).to.be.false; + }); + it('should be able to check third-level layer', function(){ + expect(layers.has('l.n.q')).to.be.true; + expect(layers.has('l.n.x')).to.be.false; + }); + }); + + describe('#get(name)', function(){ + it('should be able to get first-level layer', function(){ + expect(layers.get('single')).to.exist; + expect(layers.get('test')).to.be.not.exist; + }); + it('should be able to get second-level layer', function(){ + expect(layers.get('l.m')).to.exist; + expect(layers.get('l.x')).to.not.exist; + }); + it('should be able to get third-level layer', function(){ + expect(layers.get('l.n.o')).to.exist; + expect(layers.get('l.n.x')).to.not.exist; + }); + }); + }); + + describe('new LayerOrganizer(container, tag) will create layers with the given tag instead of ', function(){ + var container: d3.Selection, layers: d3kit.LayerOrganizer; + before(function(done){ + container = d3.select('body').append('div'); + layers = new d3kit.LayerOrganizer(container, 'div'); + done(); + }); + + describe('#create(names)', function(){ + it('should create single layer given a String', function(){ + layers.create('single'); + expect(container.select('div.single-layer').size()).to.be.equal(1); + }); + + it('should create multiple layers given an array', function(){ + layers.create(['a', 'b', 'c']); + expect(container.select('div.a-layer').size()).to.be.equal(1); + expect(container.select('div.b-layer').size()).to.be.equal(1); + expect(container.select('div.c-layer').size()).to.be.equal(1); + }); + + it('should create nested layers given a plain Object with a String inside', function(){ + layers.create({d: 'e'}); + expect(container.select('div.d-layer').size()).to.be.equal(1); + expect(container.select('div.d-layer div.e-layer').size()).to.be.equal(1); + }); + + it('should create nested layers given a plain Object with an Array inside', function(){ + layers.create({f: ['g', 'h']}); + expect(container.select('div.f-layer').size()).to.be.equal(1); + expect(container.select('div.f-layer div.g-layer').size()).to.be.equal(1); + expect(container.select('div.f-layer div.h-layer').size()).to.be.equal(1); + }); + + it('should create multiple nested layers given an array of objects', function(){ + layers.create([{'i': ['x']}, {'j': 'x'}, {'k': ['x','y']}]); + expect(container.select('div.i-layer').size()).to.be.equal(1); + expect(container.select('div.j-layer').size()).to.be.equal(1); + expect(container.select('div.k-layer').size()).to.be.equal(1); + expect(container.select('div.i-layer div.x-layer').size()).to.be.equal(1); + expect(container.select('div.i-layer div.x-layer').size()).to.be.equal(1); + expect(container.select('div.k-layer div.x-layer').size()).to.be.equal(1); + expect(container.select('div.k-layer div.y-layer').size()).to.be.equal(1); + }); + + it('should create multi-level nested layers given a nested plain Object', function(){ + layers.create({ + l: [ + 'm', + {'n': [ + {'o': ['p']}, 'q' + ]} + ] + }); + expect(container.select('div.l-layer').size()).to.be.equal(1); + expect(container.select('div.l-layer div.m-layer').size()).to.be.equal(1); + expect(container.select('div.l-layer div.n-layer').size()).to.be.equal(1); + expect(container.select('div.l-layer div.n-layer div.o-layer').size()).to.be.equal(1); + expect(container.select('div.l-layer div.n-layer div.o-layer div.p-layer').size()).to.be.equal(1); + expect(container.select('div.l-layer div.n-layer div.q-layer').size()).to.be.equal(1); + }); + + }); + + describe('#has(name)', function(){ + it('should be able to check first-level layer', function(){ + expect(layers.has('single')).to.be.true; + expect(layers.has('test')).to.be.false; + }); + it('should be able to check second-level layer', function(){ + expect(layers.has('l.m')).to.be.true; + expect(layers.has('l.x')).to.be.false; + }); + it('should be able to check third-level layer', function(){ + expect(layers.has('l.n.q')).to.be.true; + expect(layers.has('l.n.x')).to.be.false; + }); + }); + + describe('#get(name)', function(){ + it('should be able to get first-level layer', function(){ + expect(layers.get('single')).to.exist; + expect(layers.get('test')).to.be.not.exist; + }); + it('should be able to get second-level layer', function(){ + expect(layers.get('l.m')).to.exist; + expect(layers.get('l.x')).to.not.exist; + }); + it('should be able to get third-level layer', function(){ + expect(layers.get('l.n.o')).to.exist; + expect(layers.get('l.n.x')).to.not.exist; + }); + }); + }); + +}); + +describe('Chartlet', function(){ + interface ConfigureFunction { + (parent: d3kit.Chartlet, child: d3kit.Chartlet): void; + } + var enter: d3kit.ChartletEventFunction, update: d3kit.ChartletEventFunction, exit: d3kit.ChartletEventFunction, chartlet: d3kit.Chartlet; + var customEvents: Array = ['fooEvent']; + var ChildChartlet: () => d3kit.Chartlet; + var ParentChartlet: (configureFunction: ConfigureFunction) => d3kit.Chartlet; + + var callback = function(selection?: d3.Selection, done?: any) { return (sel: d3.Selection) => {done();};}; + beforeEach(function(done){ + ChildChartlet = function() { + var chartlet = new d3kit.Chartlet(callback, callback, callback); + (chartlet).runTest = function (testFunction: any) { + testFunction(chartlet); + }; + return chartlet; + }; + + ParentChartlet = function(configureFunction: ConfigureFunction) { + var chartlet = new d3kit.Chartlet(callback, callback, callback); + var child = ChildChartlet(); + configureFunction(chartlet, child); + (chartlet).runTest = (child).runTest; + return chartlet; + }; + + enter = callback; + update = callback; + exit = callback; + chartlet = new d3kit.Chartlet(enter, update, exit, customEvents); + done(); + }); + + describe('new Chartlet(enter, update, exit, customEvents)', function(){ + it('should create a chartlet', function(){ + expect(chartlet).to.be.an('Object'); + expect(chartlet).to.include.keys(['property', 'on']); + expect(chartlet.enter).to.be.a('Function'); + expect(chartlet.update).to.be.a('Function'); + expect(chartlet.exit).to.be.a('Function'); + expect(function(){ chartlet.enter(); }).to.not.throw(Error); + expect(function(){ chartlet.update(); }).to.not.throw(Error); + expect(function(){ chartlet.exit(); }).to.not.throw(Error); + expect(chartlet.getCustomEventNames()).to.deep.equal(customEvents); + }); + it('arguments "update", "exit" and "customEvents" are optional', function(){ + var comp = new d3kit.Chartlet(enter); + expect(comp).to.be.an('Object'); + expect(comp).to.include.keys(['property', 'on']); + expect(comp.enter).to.be.a('Function'); + expect(comp.update).to.be.a('Function'); + expect(comp.exit).to.be.a('Function'); + expect(function(){ comp.enter(); }).to.not.throw(Error); + expect(function(){ comp.update(); }).to.not.throw(Error); + expect(function(){ comp.exit(); }).to.not.throw(Error); + }); + }); + + describe('#getDispatcher()', function(){ + it('should return a dispatcher', function(){ + var dispatcher = chartlet.getDispatcher(); + expect(dispatcher).to.exist; + }); + it('returned dispatcher should handle enter/update/exit events', function(){ + var dispatcher = chartlet.getDispatcher(); + expect(dispatcher).to.include.keys(['enterDone', 'updateDone', 'exitDone'].concat(customEvents)); + }); + }); + + describe('#getPropertyValue(name, d, i)', function(){ + it('should return computed value for specified property name, d and i', function(){ + var d = {a: 99}; + var i = 2; + + chartlet.property('foo', 1); + chartlet.property('bar', 'two'); + chartlet.property('baz', function(d:{a:number}, i: number) {return 3;}); + chartlet.property('qux', function(d:{a:number}, i: number) {return 'four';}); + chartlet.property('nux', function(d:{a:number}, i: number) {return d.a * i;}); + + expect(chartlet.getPropertyValue('foo', d, i)).to.equal(1); + expect(chartlet.getPropertyValue('bar', d, i)).to.equal('two'); + expect(chartlet.getPropertyValue('baz', d, i)).to.equal(3); + expect(chartlet.getPropertyValue('qux', d, i)).to.equal('four'); + expect(chartlet.getPropertyValue('nux', d, i)).to.equal(198); + }); + }); + + describe('#property(name, valueOrFn)', function(){ + describe('should act as a getter when called with one argument', function(){ + it('should always return a function', function(){ + chartlet.property('foo', 1); + expect(chartlet.property('foo')).to.be.a('Function'); + chartlet.property('bar', function(){ return 100; }); + expect(chartlet.property('bar')).to.be.a('Function'); + }); + it('should return a function that return undefined for unknown property name', function(){ + expect(chartlet.property('unknown name')).to.be.a('Function'); + expect(chartlet.property('unknown name')()).to.equal(undefined); + }); + }); + + describe('should act as a setter when called with two arguments', function(){ + it('should set specified property to a functor of given value', function(){ + chartlet.property('foo', 1); + expect(chartlet.property('foo')).to.be.a('Function'); + expect(chartlet.property('foo')()).to.equal(1); + chartlet.property('bar', function(){ return 100; }); + expect(chartlet.property('bar')).to.be.a('Function'); + expect(chartlet.property('bar')()).to.equal(100); + }); + it('should overwrite previous value when set property with the same name', function(){ + chartlet.property('foo', 1); + expect(chartlet.property('foo')()).to.equal(1); + chartlet.property('foo', 100); + expect(chartlet.property('foo')()).to.equal(100); + }); + }); + }); + + describe('#on(eventName, listener)', function(){ + it('event "enterDone" should be triggered after chartlet.enter() is completed.', function(done){ + chartlet.on('enterDone', function(){ return (sel: d3.Selection) => {done();} }); + chartlet.enter(); + }); + it('event "updateDone" should be triggered after chartlet.update() is completed.', function(done){ + chartlet.on('updateDone', function(){ return (sel: d3.Selection) => {done();} }); + chartlet.update(); + }); + it('event "exitDone" should be triggered after chartlet.exit() is completed.', function(done){ + chartlet.on('exitDone', function(){ return (sel: d3.Selection) => {done();} }); + chartlet.exit(); + }); + }); + + describe('#inheritPropertyFrom(parentChartlet, parentPropertyName, childPropertyName)', function(){ + it('it should cause a child to inherit a parent property', function() { + var parent = ParentChartlet(function(parent: d3kit.Chartlet, child: d3kit.Chartlet) { + child.inheritPropertyFrom(parent, 'foo', 'bar'); + }) + .property('foo', function(d:number) {return 2 * d;}); + + (parent).runTest(function(child: d3kit.Chartlet) { + expect(child.getPropertyValue('bar', 4, 0)).to.be.equal(8); + }); + }); + + it('it should default to the parent property name', function() { + var parent = ParentChartlet( + function(parent: d3kit.Chartlet, child: d3kit.Chartlet) { + child.inheritPropertyFrom(parent, 'foo'); + }) + .property('foo', function(d:number) {return 2 * d;}); + + (parent).runTest(function(child: d3kit.Chartlet) { + expect(child.getPropertyValue('foo', 4, 0)).to.be.equal(8); + }); + }); + }); + + describe('#inheritProperties(parentChartlet, parentPropertyNames, childPropertyNames)', function(){ + it('it should cause a child to inherit many parent properties', function() { + var parent = ParentChartlet( + function(parent: d3kit.Chartlet, child: d3kit.Chartlet) { + child.inheritPropertiesFrom(parent, ['foo', 'bar', 'baz'], ['foo-x', 'bar-x', 'baz-x']); + }) + .property('foo', function(d:number) {return 2 * d;}) + .property('bar', function(d:number) {return 3 * d;}) + .property('baz', function(d:number) {return 4 * d;}); + + (parent).runTest(function(child: d3kit.Chartlet) { + expect(child.getPropertyValue('foo-x', 1, 0)).to.be.equal(2); + expect(child.getPropertyValue('bar-x', 1, 0)).to.be.equal(3); + expect(child.getPropertyValue('baz-x', 1, 0)).to.be.equal(4); + }); + }); + + it('it should default to the parent property names', function() { + var parent = ParentChartlet( + function(parent: d3kit.Chartlet, child: d3kit.Chartlet) { + child.inheritPropertiesFrom(parent, ['foo', 'bar', 'baz']); + }) + .property('foo', function(d:number) {return 2 * d;}) + .property('bar', function(d:number) {return 3 * d;}) + .property('baz', function(d:number) {return 4 * d;}); + + (parent).runTest(function(child: d3kit.Chartlet) { + expect(child.getPropertyValue('foo', 1, 0)).to.be.equal(2); + expect(child.getPropertyValue('bar', 1, 0)).to.be.equal(3); + expect(child.getPropertyValue('baz', 1, 0)).to.be.equal(4); + }); + }); + }); + + describe('#publishEventsTo(foreignDispatcher)', function(){ + it('should map events to a foreignDispatcher', function(done) { + + var parent = new d3kit.Chartlet(callback, callback, callback, ['foo']); + parent.getDispatcher().on('foo', function(value:number) { + expect(value).to.be.equal(99); + done(); + }); + + var child = new d3kit.Chartlet(callback, callback, callback, ['foo']) + .publishEventsTo(parent.getDispatcher()); + + (child.getDispatcher()).foo(99); + }); + }); +}); + +describe('#createChart', function(){ + var Chart = d3kit.factory.createChart({}, ['test'], function(skeleton: d3kit.Skeleton){ + return skeleton; + }); + + it('should return a function to create a chart', function(){ + expect(Chart).to.be.a('Function'); + }); + + // // Don't think it's possible to define these in a d.ts file; skipping + // it('results should have function getCustomEvents()', function(){ + // expect(Chart.getCustomEvents).to.exist; + // expect(Chart.getCustomEvents()).to.deep.equal(['test']); + // }); +}); + +describe('d3kit.helper', function(){ + + describe('#dasherize(str)', function(){ + it('should convert input to dash-case', function(){ + expect(d3kit.helper.dasherize('camelCase')).to.equal('camel-case'); + }); + }); + + describe('#deepExtend(target, src1, src2, ...)', function(){ + it('should copy fields from sources into target', function(){ + expect(d3kit.helper.deepExtend({}, { + a: 1, + b: 2 + },{ + b: 3, + c: 4 + })).to.deep.equal({ + a: 1, + b: 3, + c: 4 + }); + + expect(d3kit.helper.deepExtend({}, { + a: 1, + b: 2 + },{ + b: 3, + c: 4 + }, null)).to.deep.equal({ + a: 1, + b: 3, + c: 4 + }); + }); + + it('should copy arrays and functions correctly from sources into target', function(){ + var fn1 = function(d:number){return d + 1;}; + var fn2 = function(d:number){return d + 2;}; + expect(d3kit.helper.deepExtend({}, { + a: fn1, + b: [1,2] + },{ + b: [3,4], + c: fn2 + })).to.deep.equal({ + a: fn1, + b: [3,4], + c: fn2 + }); + }); + + it('should perform "deep" copy', function(){ + var fn1 = function(d:number){return d + 1;}; + var fn2 = function(d:number){return d + 2;}; + expect(d3kit.helper.deepExtend({}, { + a: { d: fn1 }, + b: [1,2], + c: { f: 3 }, + h: { i: [1,2,3], j: [3,4,5] } + },{ + a: { e: 2 }, + b: [3,4], + c: { f: 4, g: fn2 }, + h: { i: [2,3,4], k: [3,4,5], l: {m: 2} } + })).to.deep.equal({ + a: { d: fn1, e: 2 }, + b: [3,4], + c: { f: 4, g: fn2 }, + h: { i: [2,3,4], j: [3,4,5], k: [3,4,5], l: {m: 2} } + }); + }); + }); + + describe('#extend(target, src1, src2, ...)', function(){ + it('should copy fields from sources into target', function(){ + expect(d3kit.helper.extend({}, { + a: 1, + b: 2 + },{ + b: 3, + c: 4 + })).to.deep.equal({ + a: 1, + b: 3, + c: 4 + }); + + expect(d3kit.helper.extend({}, { + a: 1, + b: 2 + },{ + b: 3, + c: 4 + }, null)).to.deep.equal({ + a: 1, + b: 3, + c: 4 + }); + }); + + it('should copy arrays and functions correctly from sources into target', function(){ + var fn1 = function(d:number){return d + 1;}; + var fn2 = function(d:number){return d + 2;}; + expect(d3kit.helper.extend({}, { + a: fn1, + b: [1,2] + },{ + b: [3,4], + c: fn2 + })).to.deep.equal({ + a: fn1, + b: [3,4], + c: fn2 + }); + }); + + it('should NOT perform "deep" copy', function(){ + var fn1 = function(d:number){return d + 1;}; + var fn2 = function(d:number){return d + 2;}; + expect(d3kit.helper.extend({}, { + a: { d: fn1 }, + b: [1,2], + c: { f: 3 }, + h: { i: [1,2,3], j: [3,4,5] } + },{ + a: { e: 2 }, + b: [3,4], + c: { f: 4, g: fn2 }, + h: { i: [2,3,4], k: [3,4,5], l: {m: 2} } + })).to.deep.equal({ + a: { e: 2 }, + b: [3,4], + c: { f: 4, g: fn2 }, + h: { i: [2,3,4], k: [3,4,5], l: {m: 2} } + }); + }); + }); + + describe('#isFunction(function)', function(){ + it('should return true if the value is a function', function(){ + var fn1 = function(d:number){return d + 1;}; + function fn2(d:number){return d + 2;} + + expect(d3kit.helper.isFunction(fn1)).to.be.true; + expect(d3kit.helper.isFunction(fn2)).to.be.true; + }); + it('should return false if the value is not a function', function(){ + expect(d3kit.helper.isFunction(0)).to.be.false; + expect(d3kit.helper.isFunction(1)).to.be.false; + expect(d3kit.helper.isFunction(true)).to.be.false; + expect(d3kit.helper.isFunction('what')).to.be.false; + expect(d3kit.helper.isFunction(null)).to.be.false; + expect(d3kit.helper.isFunction(undefined)).to.be.false; + }); + }); + + describe('#isNumber(value)', function(){ + it('should return true for number', function(){ + expect(d3kit.helper.isNumber(1)).to.be.true; + expect(d3kit.helper.isNumber(0)).to.be.true; + expect(d3kit.helper.isNumber(-1)).to.be.true; + }); + it('should return false for string even if it is a number', function(){ + expect(d3kit.helper.isNumber('')).to.be.false; + expect(d3kit.helper.isNumber('1')).to.be.false; + expect(d3kit.helper.isNumber('0')).to.be.false; + expect(d3kit.helper.isNumber('what')).to.be.false; + }); + it('should return false for null and undefined', function(){ + expect(d3kit.helper.isNumber(null)).to.be.false; + expect(d3kit.helper.isNumber(undefined)).to.be.false; + }); + }); +}); + diff --git a/d3kit/d3kit.d.ts b/d3kit/d3kit-v1.1.0.d.ts similarity index 100% rename from d3kit/d3kit.d.ts rename to d3kit/d3kit-v1.1.0.d.ts diff --git a/d3kit/index.d.ts b/d3kit/index.d.ts new file mode 100644 index 0000000000..18adf3c6c0 --- /dev/null +++ b/d3kit/index.d.ts @@ -0,0 +1,115 @@ +// Type definitions for d3Kit v3.1.2 +// Project: https://github.com/twitter/d3kit +// Definitions by: Morgan Benton +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export as namespace d3kit; + +export class AbstractChart { + container: Element; + constructor(selector: string|Element, options?: ChartOptions); + static getDefaultOptions(): ChartOptions; + static getCustomEventNames(): string[]; + setupDispatcher(customEventNames?: string[]): void; + getCustomEventNames(): string[]; + getInnerWidth(): number; + getInnerHeight(): number; + width(value: number): this; + width(): number; + height(value: number): this; + height(): number; + dimension(dimensions: [number, number]): this; + dimension(): [number, number]; + data(data: any): this; + data(): any; + margin(margins: ChartMargin): this; + margin(): ChartMargin; + offset(offset: ChartOffset): this; + offset(): ChartOffset; + options(options: ChartOptions): this; + options(): ChartOptions; + updateDimensionNow(): this; + hasData(): boolean; + hasNonZeroArea(): boolean; + fit(fitOptions: FitOptions, watchOptions?: WatchOptions): this; + stopFitWatcher(): this; + on(name: string, listener: () => void): this; + off(name: string): this; + destroy(): void; +} + +export interface ChartMargin { + top?: number; + right?: number; + bottom?: number; + left?: number; +} + +export interface ChartOffset { + x: number; + y: number; +} + +export interface ChartOptions { + initialWidth?: number; + initialHeight?: number; + margin?: ChartMargin; + offset?: ChartOffset; + pixelRatio?: number; +} + +// from https://github.com/kristw/slimfit +export interface FitOptions { + mode?: string; + width?: string|number; + height?: string|number; + ratio?: number; + maxWidth?: string|number; + maxHeight?: string|number; +} + +// from https://github.com/kristw/slimfit +export interface WatchOptions { + mode?: string; + target?: any; // lazy + interval?: number; +} + +export class SvgChart extends AbstractChart { + svg: d3.Selection; + rootG: d3.Selection; + layers: LayerOrganizer; + constructor(selector: string|Element, options?: ChartOptions); +} + +export class CanvasChart extends AbstractChart { + constructor(selector: string|Element, options?: ChartOptions); + static getDefaultOptions(): ChartOptions; + getContext2d(): CanvasRenderingContext2D; + clear(): this; +} + +export class LayerOrganizer { + constructor(container: d3.Selection, defaultTag?: string); + create(layerNames: string|Array|LayerConfig|Array): d3.Selection|Array>; + get(name: string): d3.Selection; + has(name: string): boolean; +} + +export interface LayerConfig { + [layerName: string]: string|string[]|LayerConfig|Array; +} + +export namespace helper { + function debounce(fn: (...args: Array) => void, delay: number): (...args: Array) => void; + function deepExtend(dest: Object, ...args: Object[]): Object; + function extend(dest: Object, ...args: Object[]): Object; + function functor(value: any): (...args: Array) => any; + function rebind(target: Object, source: Object): Object; + function isFunction(value: any): boolean; + function isObject(value: any): boolean; + function kebabCase(str: string): string; + function throttle(fn: (...args: Array) => void, delay: number): (...args: Array) => void; +} diff --git a/d3kit/package.json b/d3kit/package.json index 5e771f4dcd..8eabdc01d2 100644 --- a/d3kit/package.json +++ b/d3kit/package.json @@ -1,5 +1,5 @@ { "dependencies": { - "@types/d3": "^3.5.36" + "@types/d3": "^4.2.38" } } diff --git a/d3kit/tsconfig.json b/d3kit/tsconfig.json index 1937b920e2..2c945e5729 100644 --- a/d3kit/tsconfig.json +++ b/d3kit/tsconfig.json @@ -1,20 +1,20 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "node_modules/@types", - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "d3kit.d.ts", - "d3kit-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "d3kit-tests.ts" + ] +} \ No newline at end of file diff --git a/d3pie/tsconfig.json b/d3pie/tsconfig.json index 6a44a0dc5c..2743ccf885 100644 --- a/d3pie/tsconfig.json +++ b/d3pie/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dagre-d3/tsconfig.json b/dagre-d3/tsconfig.json index 435af492e8..3a465b3c81 100644 --- a/dagre-d3/tsconfig.json +++ b/dagre-d3/tsconfig.json @@ -1,20 +1,21 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "node_modules/@types", - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "dagre-d3-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "node_modules/@types", + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dagre-d3-tests.ts" + ] +} \ No newline at end of file diff --git a/dagre/tsconfig.json b/dagre/tsconfig.json index 28b25cff31..4badf51de2 100644 --- a/dagre/tsconfig.json +++ b/dagre/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dat-gui/index.d.ts b/dat-gui/index.d.ts index 5a902b228b..a38699e0bb 100644 --- a/dat-gui/index.d.ts +++ b/dat-gui/index.d.ts @@ -1,7 +1,7 @@ -// Type definitions for dat.GUI v0.5 +// Type definitions for dat.GUI v0.6.1 // Project: https://github.com/dataarts/dat.gui -// Definitions by: Satoru Kimura -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Definitions by: Satoru Kimura , ZongJing Lu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace dat { export class GUI { @@ -23,11 +23,35 @@ declare namespace dat { addColor(target: Object, propName:string, rgba: number[]): GUIController; // rgb or rgba addColor(target: Object, propName:string, hsv:{h:number; s:number; v:number}): GUIController; + remove(controller: GUIController): void; + destroy(): void; + addFolder(propName:string): GUI; - close(): void; open(): void; - remember(target: Object): void; + close(): void; + + remember(target: Object, ...additionalTargets: Object[]): void; + getRoot(): GUI; + + getSaveObject(): Object; + save(): void; + saveAs(presetName:string): void; + revert(gui:GUI): void; + + listen(controller: GUIController): void; + updateDisplay(): void; + + // gui properties in dat/gui/GUI.js + readonly parent: GUI; + readonly scrollable: boolean; + readonly autoPlace: boolean; + preset: string; + width: number; + name: string; + closed: boolean; + readonly load: Object; + useLocalStorage: boolean; } export interface GUIParams{ @@ -41,17 +65,28 @@ declare namespace dat { export class GUIController { destroy(): void; - fire(): GUIController; - getValue(): any; - isModified(): boolean; - listen(): GUIController; - min(n: number): GUIController; - remove(target: GUIController): void; - setValue(value: any): GUIController; - step(n: number): GUIController; - updateDisplay(): void; + // Controller onChange: (value?: any) => void; onFinishChange: (value?: any) => void; + + setValue(value: any): GUIController; + getValue(): any; + updateDisplay(): void; + isModified(): boolean; + + // NumberController + min(n: number): GUIController; + max(n: number): GUIController; + step(n: number): GUIController; + + // FunctionController + fire(): GUIController; + + // augmentController in dat/gui/GUI.js + options(option:any):GUIController; + name(s: string): GUIController; + listen(): GUIController; + remove(): GUIController; } } diff --git a/dat-gui/tsconfig.json b/dat-gui/tsconfig.json index e279267ce1..c37d5ed72c 100644 --- a/dat-gui/tsconfig.json +++ b/dat-gui/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/data-driven/index.d.ts b/data-driven/index.d.ts index fc21425b54..e6fc06051d 100644 --- a/data-driven/index.d.ts +++ b/data-driven/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for data-driven.js +// Type definitions for data-driven.js // Project: https://github.com/fluentsoftware/data-driven // Definitions by: Adam Babcock // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/data-driven/tsconfig.json b/data-driven/tsconfig.json index f7dbe72695..c6a0e336a8 100644 --- a/data-driven/tsconfig.json +++ b/data-driven/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/datatables-buttons/tsconfig.json b/datatables-buttons/tsconfig.json index 6f5401331c..2fe9947e8c 100644 --- a/datatables-buttons/tsconfig.json +++ b/datatables-buttons/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/date-fns/tsconfig.json b/date-fns/tsconfig.json index 780e521b4a..625f0906c6 100644 --- a/date-fns/tsconfig.json +++ b/date-fns/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/date.format.js/tsconfig.json b/date.format.js/tsconfig.json index 850bf6e381..ab30747450 100644 --- a/date.format.js/tsconfig.json +++ b/date.format.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dateformat/tsconfig.json b/dateformat/tsconfig.json index 3486a6401d..faf27b5301 100644 --- a/dateformat/tsconfig.json +++ b/dateformat/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/datejs/index.d.ts b/datejs/index.d.ts index 856cdcaded..d7c1854253 100644 --- a/datejs/index.d.ts +++ b/datejs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for DateJS +// Type definitions for DateJS // Project: http://www.datejs.com/ // Definitions by: David Khristepher Santos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/datejs/sugarpak.d.ts b/datejs/sugarpak.d.ts index 5ed410740d..b4077960ad 100644 --- a/datejs/sugarpak.d.ts +++ b/datejs/sugarpak.d.ts @@ -1,4 +1,4 @@ -// Type definitions for DateJS - SugarPak Extensions +// Type definitions for DateJS - SugarPak Extensions // Project: http://www.datejs.com/ // Definitions by: David Khristepher Santos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/datejs/tsconfig.json b/datejs/tsconfig.json index ef42211300..fb85d4ab6d 100644 --- a/datejs/tsconfig.json +++ b/datejs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/daterangepicker/daterangepicker-tests.ts b/daterangepicker/daterangepicker-tests.ts index 0b8051b06a..38264bb0b3 100644 --- a/daterangepicker/daterangepicker-tests.ts +++ b/daterangepicker/daterangepicker-tests.ts @@ -1,4 +1,3 @@ -/// import moment = require("moment") function tests_simple() { diff --git a/daterangepicker/daterangepicker.d.ts b/daterangepicker/index.d.ts similarity index 98% rename from daterangepicker/daterangepicker.d.ts rename to daterangepicker/index.d.ts index 88cce7c0a2..68ae67c485 100644 --- a/daterangepicker/daterangepicker.d.ts +++ b/daterangepicker/index.d.ts @@ -167,6 +167,5 @@ declare namespace daterangepicker { } } -declare module "daterangepicker" { - export = daterangepicker; -} +export = daterangepicker; +export as namespace daterangepicker; diff --git a/daterangepicker/tsconfig.json b/daterangepicker/tsconfig.json index cbf48c5f61..3c70a56bd2 100644 --- a/daterangepicker/tsconfig.json +++ b/daterangepicker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "daterangepicker.d.ts", + "index.d.ts", "daterangepicker-tests.ts" ] } \ No newline at end of file diff --git a/db-migrate-base/tsconfig.json b/db-migrate-base/tsconfig.json index 9ddd2792ec..8d6e5dcde0 100644 --- a/db-migrate-base/tsconfig.json +++ b/db-migrate-base/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/db-migrate-pg/tsconfig.json b/db-migrate-pg/tsconfig.json index e31e52d255..953356144d 100644 --- a/db-migrate-pg/tsconfig.json +++ b/db-migrate-pg/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/db.js/db.js-tests.ts b/db.js/db.js-tests.ts index e7fb297aed..169d5725d1 100644 --- a/db.js/db.js-tests.ts +++ b/db.js/db.js-tests.ts @@ -1,4 +1,4 @@ -// Test file for db.js Definition file +import db = require("db.js"); /* Type for use in tests */ diff --git a/db.js/index.d.ts b/db.js/index.d.ts index 83e21fa529..fa962dc0a3 100644 --- a/db.js/index.d.ts +++ b/db.js/index.d.ts @@ -7,7 +7,7 @@ declare module DbJs { interface ErrorListener { (err: Error): void; } - + interface OpenOptions { server: string; version: number; @@ -29,14 +29,14 @@ declare module DbJs { interface CountableQuery { count(): ExecutableQuery; } - + interface KeysQuery extends DescableQuery, ExecutableQuery, FilterableQuery, DistinctableQuery, MappableQuery { - } + } interface KeyableQuery { keys(): KeysQuery; } - + interface FilterQuery extends KeyableQuery, ExecutableQuery, FilterableQuery, DescableQuery, DistinctableQuery, ModifiableQuery, LimitableQuery, MappableQuery { } @@ -44,14 +44,14 @@ declare module DbJs { filter(index: string, value: TValue): FilterQuery; filter(filter: (value: T) => boolean): FilterQuery; } - - interface DescQuery extends KeyableQuery, CountableQuery, ExecutableQuery, FilterableQuery, DescableQuery, ModifiableQuery, MappableQuery { + + interface DescQuery extends KeyableQuery, CountableQuery, ExecutableQuery, FilterableQuery, DescableQuery, ModifiableQuery, MappableQuery { } interface DescableQuery { desc(): DescQuery; } - + interface DistinctQuery extends KeyableQuery, ExecutableQuery, FilterableQuery, DescableQuery, ModifiableQuery, MappableQuery, CountableQuery { } @@ -71,7 +71,7 @@ declare module DbJs { interface MappableQuery { map(fn: (value: T) => TMap): Query; } - + interface Query extends Promise, KeyableQuery, ExecutableQuery, FilterableQuery, DescableQuery, DistinctableQuery, ModifiableQuery, LimitableQuery, MappableQuery, CountableQuery { } @@ -93,11 +93,11 @@ declare module DbJs { getIndexedDB(): IDBDatabase; close(): void; } - + interface IndexAccessibleServer { [store: string]: TypedObjectStoreServer; } - + interface ObjectStoreServer { add(table: string, entity: T): Promise; add(table: string, ...entities: T[]): Promise; @@ -142,11 +142,11 @@ declare module DbJs { query(index: string): IndexQuery; count(key: any): Promise; } - + type Server = DbJs.IndexAccessibleServer & DbJs.ObjectStoreServer & DbJs.BaseServer; } -declare module "db" { +declare module "db.js" { var db: DbJs.DbJsStatic; export = db; } diff --git a/db.js/tsconfig.json b/db.js/tsconfig.json index a6e592f497..3ef17b0d2f 100644 --- a/db.js/tsconfig.json +++ b/db.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dc/dc-1.6.0.d.ts b/dc/dc-1.6.0.d.ts index 03b5e9039b..9938d3bc45 100644 --- a/dc/dc-1.6.0.d.ts +++ b/dc/dc-1.6.0.d.ts @@ -58,7 +58,15 @@ export interface ILegendwidget { export var events: IEvents; export interface IListener { - on: (eventName: string, fnctn: (c:T) => void) => T; + on: { + (event: "preRender", fnctn: (c: T) => any): T; + (event: "postRender", fnctn: (c: T) => any): T; + (event: "preRedraw", fnctn: (c: T) => any): T; + (event: "postRedraw", fnctn: (c: T) => any): T; + (event: "filtered", fnctn: (c: T, filter: any) => any): T; + (event: "zoomed", fnctn: (c: T, filter: any) => any): T; + (event: string, fnctn: (c: T, ...args: any[]) => any): T; + }; } export interface ImarginObj { diff --git a/dc/index.d.ts b/dc/index.d.ts index ffea80fa05..b0291d703c 100644 --- a/dc/index.d.ts +++ b/dc/index.d.ts @@ -160,7 +160,16 @@ declare namespace DC { legend: IGetSet; options(optionsObject: any): T; renderlet(fn: (chart: T) => any): T; - on(event: string, fn: (chart: T) => any): T; + + on(event: "renderlet", fn: (chart: T, filter: any) => any): T; + on(event: "pretransition", fn: (chart: T, filter: any) => any): T; + on(event: "preRender", fn: (chart: T) => any): T; + on(event: "postRender", fn: (chart: T) => any): T; + on(event: "preRedraw", fn: (chart: T) => any): T; + on(event: "postRedraw", fn: (chart: T) => any): T; + on(event: "filtered", fn: (chart: T, filter: any) => any): T; + on(event: "zoomed", fn: (chart: T, filter: any) => any): T; + on(event: string, fn: (chart: T, ...args: any[]) => any): T; } export interface Margins { diff --git a/dc/tsconfig.json b/dc/tsconfig.json index 21ec9c0d67..6b2f1b0e6e 100644 --- a/dc/tsconfig.json +++ b/dc/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -17,4 +18,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} +} \ No newline at end of file diff --git a/debounce/tsconfig.json b/debounce/tsconfig.json index 0ba4adb034..b3ea25af57 100644 --- a/debounce/tsconfig.json +++ b/debounce/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/debug/tsconfig.json b/debug/tsconfig.json index d4c87e3328..6334c6c989 100644 --- a/debug/tsconfig.json +++ b/debug/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/decamelize/tsconfig.json b/decamelize/tsconfig.json index a54faea1e0..7f8a1d2364 100644 --- a/decamelize/tsconfig.json +++ b/decamelize/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/decimal.js/tsconfig.json b/decimal.js/tsconfig.json index 063a9e639e..d757c3e5c5 100644 --- a/decimal.js/tsconfig.json +++ b/decimal.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/decorum/tsconfig.json b/decorum/tsconfig.json index 5750ab6649..345760126c 100644 --- a/decorum/tsconfig.json +++ b/decorum/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "experimentalDecorators": true, diff --git a/deep-assign/deep-assign-tests.ts b/deep-assign/deep-assign-tests.ts new file mode 100644 index 0000000000..f38a1fc378 --- /dev/null +++ b/deep-assign/deep-assign-tests.ts @@ -0,0 +1,10 @@ +import * as deepAssign from 'deep-assign'; + +deepAssign({a: 1}); +deepAssign({a: 1}, {b: 2}); +deepAssign({a: 1, b: {c: 2}}, {b: {e: 33}, x: 11}); +deepAssign({}, {a: 1}, {b: 2}, {c: 3}); +deepAssign({}, {a: 1}, {b: 2}, {c: 3}, {d: 4}); +deepAssign({}, {a: 1}, {b: 2}, {c: 3}, {d: 4}, {e: 5}); +deepAssign({}, {a: 1}, {b: 2}, {c: 3}, {d: 4}, {e: 5}, {f: 6}); +deepAssign({}, {a: 1}, {b: 2}, {c: 3}, {d: 4}, {e: 5}, {f: 6}, {g: 7}); diff --git a/deep-assign/index.d.ts b/deep-assign/index.d.ts new file mode 100644 index 0000000000..46d4cf09f2 --- /dev/null +++ b/deep-assign/index.d.ts @@ -0,0 +1,77 @@ +// Type definitions for clone 0.1.11 +// Project: https://github.com/sindresorhus/deep-assign +// Definitions by: Ionut Costica +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Pretty much just returns the target object + * @param target Base object + */ +declare function deepAssign(target: T): T; +/** + * Deeply assigns all the properties of the source object to the + * target object + * @param target Base object + * @param source Extending object + */ +declare function deepAssign(target: T, source: U): T & U; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param source1 First extending object + * @param source2 Second extending object + */ +declare function deepAssign(target: T, source1: U, source2: V): T & U & V; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param source1 First extending object + * @param source2 Second extending object + * @param source3 Third extending object + */ +declare function deepAssign(target: T, source1: U, source2: V, source3: W): T & U & V & W; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param source1 First extending object + * @param source2 Second extending object + * @param source3 Third extending object + * @param source4 Fourth extending object + */ +declare function deepAssign(target: T, source1: U, source2: V, source3: W, source4: X): T & U & V & W & X; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param source1 First extending object + * @param source2 Second extending object + * @param source3 Third extending object + * @param source4 Fourth extending object + * @param source5 Fifth extending object + */ +declare function deepAssign(target: T, source1: U, source2: V, source3: W, source4: X, source5: Y): T & U & V & W & X & Y; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param source1 First extending object + * @param source2 Second extending object + * @param source3 Third extending object + * @param source4 Fourth extending object + * @param source5 Fifth extending object + * @param source6 Sixth extending object + */ +declare function deepAssign(target: T, source1: U, source2: V, source3: W, source4: X, source5: Y, source6: Z): T & U & V & W & X & Y & Z; +/** + * Deeply assigns all the properties of the source objects to the + * target object + * @param target Base object + * @param sources Extending objects + */ +declare function deepAssign(target: any, ...sources: any[]): any; + +declare namespace deepAssign {} +export = deepAssign; diff --git a/deep-assign/tsconfig.json b/deep-assign/tsconfig.json new file mode 100644 index 0000000000..be1b87d8f9 --- /dev/null +++ b/deep-assign/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "deep-assign-tests.ts" + ] +} \ No newline at end of file diff --git a/deep-diff/tsconfig.json b/deep-diff/tsconfig.json index b559cff207..807d552d7b 100644 --- a/deep-diff/tsconfig.json +++ b/deep-diff/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/deep-equal/tsconfig.json b/deep-equal/tsconfig.json index ba63b597fc..3b035b8b93 100644 --- a/deep-equal/tsconfig.json +++ b/deep-equal/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/deep-extend/tsconfig.json b/deep-extend/tsconfig.json index 461af90b1b..592919c89e 100644 --- a/deep-extend/tsconfig.json +++ b/deep-extend/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "index.d.ts", "deep-extend-tests.ts" ] -} +} \ No newline at end of file diff --git a/deep-freeze/tsconfig.json b/deep-freeze/tsconfig.json index 0d4a6b6cf7..0c7eb56e3f 100644 --- a/deep-freeze/tsconfig.json +++ b/deep-freeze/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/defaults/tsconfig.json b/defaults/tsconfig.json index d62145db41..0534365257 100644 --- a/defaults/tsconfig.json +++ b/defaults/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/deku/deku-tests.ts b/deku/deku-tests.ts new file mode 100644 index 0000000000..d123c7b8f7 --- /dev/null +++ b/deku/deku-tests.ts @@ -0,0 +1,208 @@ +// Example from deku/examples/basic +(function (){ + const {h, createApp} = deku + + function view(state = { count: 0 }, dispatch: Function){ + return ( + h('div', {}, [ + h('div', {}, 'Counter: ' + state.count), + h('button', {onClick: increment(dispatch)}, 'Increment'), + h('button', {onClick: decrement(dispatch)}, 'Decrement') + ]) + ) + } + + function increment(dispatch: Function){ + return () => dispatch({ + type: 'INCREMENT' + }) + } + + function decrement(dispatch: Function){ + return () => dispatch({ + type: 'DECREMENT' + }) + } + + let render = createApp(document.body) + + function main(state: any){ + let vnode = view(state, (action: any) => main({ count: 0 })) + + render(vnode) + } + + main({ count: 0 }) +})(); + +// Example from deku/docs/api/create-app +(function (){ + const {createApp, element} = deku + + const App = ({ props = { size: 'medium' } }) => { + return element('div', { class: `size-${ props.size }` }) + } + + const render = createApp(document.body) + + render(element(App, { size: 'small' })) + + render(element(App, { size: 'large' })) +})(); + +// Example from deku/docs/api/string +(function (){ + const { h } = deku + + const html = deku.string.render(h('div', {}, [ + h('header'), + h('sidebar'), + h('app'), + ])) +})(); + +// Example from deku/docs/api/element +(function (){ + const { element } = deku + + // Native elements + element('div', { class: 'greeting' }, [ + element('span', {}, ['Hello']) + ]) + + // Components + let App = { + render: ({ props = { name: '' } }) => element('div', {}, `Hello ${ props.name }!`) + } + + element(App, { name: 'Tom' }) +})(); + +// deku.createApp +(function (){ + const { createApp, element } = deku + + let render: Function = createApp(document.body) + + render(element('div')) + + render = createApp(document.body, (action: any) => { + render(element('div')) + }) + + render(element('div')) +})(); + +// deku.dom +(function (){ + const { dom, element } = deku + + let el: HTMLElement = dom.create(element('div'), '0.0', ()=>{}, {}) + + const update: (DOMElement: HTMLElement, action: any) => HTMLElement = dom.update(()=>{}, {}) + + el = update(el, {}) +})(); + +// deku.string +(function (){ + const { element } = deku + + let html: string = deku.string.render(element('div')) + + html = deku.string.render(element('div'), {}) +})(); + +// deku.element +(function (){ + const { element } = deku + + let v: deku.VirtualElement = element('div') + + v = element('div', {}) + + v = element('div', {}, []) + + v = element('div', {}, ['foo', 0, 'bar']) + + v = element('div', {}, 'foo') + + v = element('div', {}, 0) + + v = element('div', {}, 'foo', 'bar') + + let Component = { + render({}){ + return element('div') + } + } + + v = element(Component) + + v = element(Component, {}) + + v = element(Component, {}, []) +})(); + +// deku.diff +(function (){ + const { diff, element } = deku + + const { Actions } = diff + + let diffs: any[] = diff.diffNode(element('div'), element('span')) + + let actions: deku.diff.Actions[] = [ + Actions.setAttribute('class', 'foo', 'bar'), + Actions.removeAttribute('foo', {}), + Actions.insertChild({}, 0, '0.0'), + Actions.removeChild(0), + Actions.updateChild(0, []), + Actions.updateChildren([]), + Actions.insertBefore(0), + Actions.replaceNode({}, {}, '0.0'), + Actions.removeNode({}), + Actions.sameNode(), + Actions.updateThunk({}, {}, '0.0') + ] + + actions.forEach(action => { + Actions.case({ + setAttribute: (name: string, value: any, previousValue: any) => { + }, + _: () => { + } + }, action) + }) +})(); + +// deku.vnode +(function (){ + const { vnode, element } = deku + + let v: deku.VirtualElement = vnode.create('div') + + v = vnode.createTextElement('foo') + + const Component = { + render({}){ + return element('div') + } + } + + v = vnode.createThunkElement(Component.render, '', Component, [], {}) + + v = vnode.createEmptyElement() + + let b: boolean = vnode.isThunk(v) + + b = vnode.isText(v) + + b = vnode.isEmpty(v) + + b = vnode.isSameThunk(v, v) + + let path: string = vnode.createPath('0', '1', '2', '3') + + path = vnode.createPath(0, 1, 2, 3) +})(); diff --git a/deku/index.d.ts b/deku/index.d.ts new file mode 100644 index 0000000000..ff5a68f8bb --- /dev/null +++ b/deku/index.d.ts @@ -0,0 +1,136 @@ +// Type definitions for deku v2.0 +// Project: https://github.com/anthonyshort/deku +// Definitions by: Sho Fuji +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = deku; +export as namespace deku; + +declare namespace deku { + + interface VirtualElement { + type: string; + } + + /** + * Create a DOM renderer using a container element. + * Everything will be rendered inside of that container. + * Returns a function that accepts new state that can replace what is currently rendered. + */ + function createApp(el: HTMLElement, dispatch?: Dispatch): Render; + + namespace dom { + /** + * Create a real DOM element from a virtual element, recursively looping down. + * When it finds custom elements it will render them, cache them, and keep going, + * so they are treated like any other native element. + */ + function create(vnode: VirtualElement, path: string, dispatch: Dispatch, context: C): HTMLElement; + + /** + * Modify a DOM element given an array of actions. + */ + function update(dispatch: Dispatch, context: C): (DOMElement: HTMLElement, action: A) => HTMLElement; + } + + namespace string { + /** + * Render a virtual element to a string. You can pass in an option state context object that will be given to all components. + */ + function render(vnode: VirtualElement): string; + function render(vnode: VirtualElement, context: C): string; + } + + /** + * This function lets us create virtual nodes using a simple syntax. + * It is compatible with JSX transforms so you can use JSX to write nodes that will compile to this function. + */ + function element(type: string): VirtualElement; + function element(type: string, attributes: A, ...children: any[]): VirtualElement; + + function element(type: Thunk): VirtualElement; + function element(type: Thunk, attributes: A, ...children: any[]): VirtualElement; + + var h: typeof element; + + namespace diff { + /** + * Compare two virtual nodes and return an array of changes to turn the left into the right. + */ + function diffNode(prevNode: VirtualElement, nextNode: VirtualElement): any[]; + + class Actions { + private _keys: string[]; + private _name: string; + + static setAttribute(a: string, b: any, c: any): Actions; + static removeAttribute(a: string, b: any): Actions; + static insertChild(a: any, b: number, c: string): Actions; + static removeChild(a: number): Actions; + static updateChild(a: number, b: any[]): Actions; + static updateChildren(a: any[]): Actions; + static insertBefore(a: number): Actions; + static replaceNode(a: any, b: any, c: string): Actions; + static removeNode(a: any): Actions; + static sameNode(): Actions; + static updateThunk(a: any, b: any, c: string): Actions; + + static case(pat: any, action: Actions): any; + } + } + + namespace vnode { + var create: typeof element; + + /** + * Text nodes are stored as objects to keep things simple + */ + function createTextElement(text: string): VirtualElement; + + /** + * Lazily-rendered virtual nodes + */ + function createThunkElement(fn: (model: Model) => VirtualElement, key: string, props: P, children: T[], options: O): VirtualElement; + + function createEmptyElement(): VirtualElement; + + function isThunk(vnode: VirtualElement): boolean; + + function isText(vnode: VirtualElement): boolean; + + function isEmpty(vnode: VirtualElement): boolean; + + function isSameThunk(prevNode: VirtualElement, nextNode: VirtualElement): boolean; + + // function isValidAttribute(value: A): boolean; + + /** + * Create a node path, eg. (23,5,2,4) => '23.5.2.4' + */ + function createPath(...paths: (number|string)[]): string; + } +} + +interface Model { + props?: any, + children?: any[], + path?: string, + dispatch?: Dispatch, + context?: any +} + +interface Component { + render: (model: Model) => deku.VirtualElement; + onCreate?: (model: Model) => any; + onUpdate?: (model: Model) => any; + onRemove?: (model: Model) => any; +} + +/** + * Thunk object passed to `element` + */ +type Thunk = Component | ((model: Model) => deku.VirtualElement); + +type Render = (vnode: deku.VirtualElement, context?: any) => void; + +type Dispatch = (action: any) => any; diff --git a/deku/tsconfig.json b/deku/tsconfig.json new file mode 100644 index 0000000000..8c30d9ed1d --- /dev/null +++ b/deku/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "deku-tests.ts" + ] +} \ No newline at end of file diff --git a/del/tsconfig.json b/del/tsconfig.json index 9ded793146..c9851e781c 100644 --- a/del/tsconfig.json +++ b/del/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/denodeify/tsconfig.json b/denodeify/tsconfig.json index 0c036913c7..74cdb1bc30 100644 --- a/denodeify/tsconfig.json +++ b/denodeify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/deoxxa-content-type/tsconfig.json b/deoxxa-content-type/tsconfig.json index 93994f72e7..793886eb62 100644 --- a/deoxxa-content-type/tsconfig.json +++ b/deoxxa-content-type/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/depd/index.d.ts b/depd/index.d.ts index 499cd99b88..147393a332 100644 --- a/depd/index.d.ts +++ b/depd/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for depd 1.1.0 +// Type definitions for depd 1.1.0 // Project: https://github.com/dougwilson/nodejs-depd // Definitions by: Zhiyuan Wang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/depd/tsconfig.json b/depd/tsconfig.json index dcfb968663..f51907b8c9 100644 --- a/depd/tsconfig.json +++ b/depd/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/deployjava/tsconfig.json b/deployjava/tsconfig.json index 5becb6ceed..5cf5fed9e5 100644 --- a/deployjava/tsconfig.json +++ b/deployjava/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/detect-browser/tsconfig.json b/detect-browser/tsconfig.json index c4acdf52df..adaefa98d2 100644 --- a/detect-browser/tsconfig.json +++ b/detect-browser/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/detect-indent/tsconfig.json b/detect-indent/tsconfig.json index cb743fe007..94a792cb9d 100644 --- a/detect-indent/tsconfig.json +++ b/detect-indent/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/devexpress-web/index.d.ts b/devexpress-web/index.d.ts index 7c3eeda936..b52c31759d 100644 --- a/devexpress-web/index.d.ts +++ b/devexpress-web/index.d.ts @@ -2295,14 +2295,11 @@ interface ASPxClientDateEdit extends ASPxClientDropDownEditBase { */ GetTimeEdit(): ASPxClientTimeEdit; /** - * Sets the date editor's value. - * @param date A date object specifying the value to assign to the date editor. + * + * @param date */ - SetDate(date: Object): void; - /** - * Returns a date that is the date editor's value. - */ - GetDate(): Object; + SetDate(date: Date): void; + GetDate(): Date; /** * Returns the number of days in a range selected within a date edit. */ @@ -3000,14 +2997,11 @@ interface ASPxClientTimeEdit extends ASPxClientSpinEditBase { */ DateChanged: ASPxClientEvent>; /** - * Sets the time editor's value. - * @param date A date-time object specifying the value to assign to the time editor. + * + * @param date */ - SetDate(date: Object): void; - /** - * Returns a date that is the time editor's value. - */ - GetDate(): Object; + SetDate(date: Date): void; + GetDate(): Date; } /** * Represents a base for client-side static editors whose values cannot be visually changed by end users. @@ -4446,9 +4440,10 @@ interface ASPxClientCardViewBatchEditCardDeletingEventArgs extends ASPxClientCan */ interface ASPxClientCardViewBatchEditApi { /** - * Performs validation of CardView data when the CardView operates in Batch Edit mode. + * Performs validation of CardView data contained in the cards when the CardView operates in Batch Edit mode. + * @param validateOnlyModified true, if only modified cards should be validated; otherwise, false. */ - ValidateCards(): boolean; + ValidateCards(validateOnlyModified?: boolean): boolean; /** * Performs validation of CardView data contained in the specified card when the CardView operates in Batch Edit mode. * @param visibleIndex An integer value specifying the visible index of the validated card. @@ -6038,9 +6033,10 @@ interface ASPxClientGridViewCellInfo { */ interface ASPxClientGridViewBatchEditApi { /** - * Performs validation of grid data when the grid operates in Batch Edit mode. + * Performs validation of grid data contained in all rows when the grid operates in Batch Edit mode. + * @param validateOnlyModified true, if only modified rows should be validated; otherwise, false. */ - ValidateRows(): boolean; + ValidateRows(validateOnlyModified?: boolean): boolean; /** * Performs validation of grid data contained in the specified row when the grid operates in Batch Edit mode. * @param visibleIndex An integer value specifying the visible index of the validated row. @@ -7074,9 +7070,10 @@ interface ASPxClientVerticalGridCellInfo { */ interface ASPxClientVerticalGridBatchEditApi { /** - * Performs validation of grid data when the grid operates in Batch Edit mode. + * Performs validation of grid data contained in all records when the grid operates in batch edit mode. + * @param validateOnlyModified true, if only modified records should be validated; otherwise, false. */ - ValidateRecords(): boolean; + ValidateRecords(validateOnlyModified?: boolean): boolean; /** * Performs validation of grid data contained in the specified record when the grid operates in batch edit mode. * @param visibleIndex An integer value specifying the visible index of the validated record. @@ -8249,6 +8246,7 @@ interface ASPxClientRichEdit extends ASPxClientControl { * Value: A object that lists methods to work with the selection. */ selection: RichEditSelection; + unitConverter: RichEditUnitConverter; /** * Occurs after a custom command has been executed on the client side. */ @@ -8622,6 +8620,7 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ deleteBookmark: DeleteBookmarkCommand; + goToBookmark: GoToBookmarkCommand; /** * Gets a command to invoke the Hyperlink dialog window. * Value: A object that provides methods for executing the command and checking its state. @@ -8672,6 +8671,7 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ changePageOrientation: ChangePageOrientationCommand; + setPageSizeDialog: SetPageSizeDialogCommand; /** * Gets a command to invoke the Paper tab of the Page Setup dialog window. * Value: A object that provides methods for executing the command and checking its state. @@ -9022,6 +9022,7 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ changeTableCellPreferredWidth: ChangeTableCellPreferredWidthCommand; + toggleTableCellInsideBorders: ToggleTableCellInsideBordersCommand; /** * Gets a command to change the selected table columns' preferred width. * Value: A object that provides methods for executing the command and checking its state. @@ -9187,6 +9188,10 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ toggleTableCellBottomBorder: ToggleTableCellBottomBorderCommand; + /** + * Gets a command to toggle left borders for selected cells on/off. + * Value: A object that provides methods for executing the command and checking its state. + */ toggleTableCellLeftBorder: ToggleTableCellLeftBorderCommand; /** * Gets a command to remove the borders of the selected table cells. @@ -9263,7 +9268,12 @@ interface RichEditCommands { * Value: A object that provides methods for executing the command and checking its state. */ replaceNext: ReplaceNextCommand; + /** + * Gets a command to invoke the Spelling dialog window. + * Value: A object that provides methods for executing the command and checking its state. + */ openSpellingDialog: OpenSpellingDialogCommand; + assignShortcut: AssignShortcutCommand; } /** * Serves as a base for objects that implement different client command functionalities. @@ -9347,6 +9357,7 @@ interface RichEditDocument { * Value: An array of TableStyle objects storing information about table styles. */ tableStylesInfo: TableStyle[]; + spellingInfo: SpellingInfo; } /** * An abstract numbering list definition that defines the appearance and behavior of numbered paragraphs in a document. @@ -9354,43 +9365,6 @@ interface RichEditDocument { interface AbstractNumberingList { deleted: boolean; } -/** - * Exposes the settings providing the information about the essential document functionality. - */ -interface SubDocument { - id: number; - type: any; - /** - * Provides information about paragraphs contained in the document. - * Value: An array of Paragraph objects storing information about document paragraphs. - */ - paragraphsInfo: Paragraph[]; - /** - * Provides information about fields in the current document. - * Value: An array of Field objects storing information about document fields. - */ - fieldsInfo: Field[]; - /** - * Provides information about tables contained in the document. - * Value: An array of Table objects storing information about document tables. - */ - tablesInfo: Table[]; - /** - * Provides information about document bookmarks. - * Value: An array of Bookmark objects storing information about document bookmarks. - */ - bookmarksInfo: Bookmark[]; - /** - * Gets the document's textual representation. - * Value: A string value specifying the document's text. - */ - text: string; - /** - * Gets the character length of the document. - * Value: An integer that is the number of character positions in the document. - */ - length: number; -} /** * Defines a paragraph in the document. */ @@ -9405,6 +9379,7 @@ interface Paragraph { * Value: An integer value specifying the start position. */ start: number; + interval: Interval; /** * Gets the name of the paragraph style applied to the current paragraph (see name). * Value: A string value specifying the style name. @@ -9435,6 +9410,7 @@ interface Field { * Value: An integer value specifying the field length. */ length: number; + interval: Interval; /** * Gets or sets a URI to navigate to when the hyperlink (represented by the current field) is activated. * Value: A string representing an URI. @@ -9450,66 +9426,7 @@ interface Field { * Value: A string representing the bookmark's name. */ hyperlinkAnchor: string; -} -/** - * Defines a table in the document. - */ -interface Table { - /** - * Gets the table's start position in the document. - * Value: An integer value specifying the start position. - */ - start: number; - /** - * Gets the table length in characters. - * Value: A integer value specifying the character length of the table. - */ - length: number; - /** - * Provides access to a collection of table rows. - * Value: An array of TableRow objects storing information about individual table rows. - */ - rows: TableRow[]; - /** - * Gets the name of the style applied to the table (see name). - * Value: A string value specifying the style name. - */ - styleName: string; -} -/** - * Defines a table row in the document. - */ -interface TableRow { - /** - * Gets the table row's start position in the document. - * Value: An integer value specifying the start position. - */ - start: number; - /** - * Gets the table row's character length. - * Value: An integer value specifying the element length in characters. - */ - length: number; - /** - * Provides information about the table row's cells. - * Value: An array of TableCell objects storing information about cells. - */ - cells: TableCell[]; -} -/** - * Defines a table cell in the document. - */ -interface TableCell { - /** - * Gets the table cell's start position in the document. - * Value: An integer value specifying the start position. - */ - start: number; - /** - * Gets the table cell's character length. - * Value: An integer value specifying the element length in characters. - */ - length: number; + showCode: boolean; } /** * Defines a bookmark in the document. @@ -9525,6 +9442,7 @@ interface Bookmark { * Value: An integer value specifying the length of the bookmark. */ length: number; + interval: Interval; /** * Gets the name of a bookmark in the document. * Value: A string that is the unique bookmark's name. @@ -9545,6 +9463,7 @@ interface Section { * Value: An integer value specifying the element length in characters. */ length: number; + interval: Interval; /** * Provides access to the section's headers. * Value: An array of HeaderFooter objects storing information about the section's headers. @@ -9571,75 +9490,15 @@ interface HeaderFooter { */ subDocument: SubDocument; } -/** - * Serves as a base for objects implementing different element styles. - */ -interface StyleBase { - /** - * Gets or sets the name of the style. - * Value: A string specifying the style name. - */ - name: string; - /** - * Gets whether the specified style is marked as deleted. - * Value: true, if the style is deleted; otherwise, false. - */ - isDeleted: boolean; -} -/** - * Defines the paragraph style settings. - */ -interface ParagraphStyle extends StyleBase { - /** - * Gets or sets the linked style for the current style. - * Value: A object representing a character style linked to a current style. - */ - linkedStyle: CharacterStyle; - /** - * Gets or sets the default style for a paragraph that immediately follows the current paragraph. - * Value: A object specifying the style for the next paragraph. - */ - nextStyle: ParagraphStyle; - /** - * Gets the index of the list item associated with the paragraph formatted with the current style. - * Value: An integer value specifying the list item index. - */ - listIndex: number; - /** - * Gets the index of the list level applied to the paragraph formatted with the current style. - * Value: An integer that is the list level index. - */ - listLevelIndex: number; - /** - * Gets or sets the style from which the current style inherits. - * Value: A object representing the parent style. - */ - parent: ParagraphStyle; -} -/** - * Contains characteristics of a character style in a document. - */ -interface CharacterStyle extends StyleBase { - /** - * Gets or sets the linked style for the current style. - * Value: A object representing a paragraph style linked to a current style. - */ - linkedStyle: ParagraphStyle; - /** - * Gets the style form which the current style inherits. - * Value: A object representing the parent style. - */ - parent: CharacterStyle; -} -/** - * Defines the table style settings. - */ -interface TableStyle extends StyleBase { - /** - * Gets or sets the style from which the current style inherits. - * Value: A object that is the parent style. - */ - parent: TableStyle; +interface InlinePictureInfo { + id: number; + position: number; + initialWidth: number; + initialHeight: number; + scaleX: number; + scaleY: number; + actualWidth: number; + actualHeigth: number; } declare enum HeaderFooterType { First=0, @@ -9647,11 +9506,17 @@ declare enum HeaderFooterType { Primary=1, Even=2 } -declare enum SubDocumentType { - Main=0, - Header=1, - Footer=2, - TextBox=3 +declare enum DocumentFormat { + Undefined=0, + PlainText=1, + Rtf=2, + Html=3, + OpenXml=4, + Mht=5, + WordML=6, + OpenDocument=7, + ePub=9, + Doc=10 } /** * Contains a set of methods and properties to work with the document selection. @@ -9833,8 +9698,19 @@ interface RichEditSelection { * Selects the editor's entire content. */ selectAll(): void; + /** + * Moves the cursor to the main sub-document. + */ setMainSubDocumentAsActive(): void; + /** + * Moves the cursor to the footer of the specified document page. + * @param pageIndex An integer value specifying the page index. + */ setFooterSubDocumentAsActiveByPageIndex(pageIndex: number): void; + /** + * Moves the cursor to the header of the specified document page. + * @param pageIndex An integer value specifying the page index. + */ setHeaderSubDocumentAsActiveByPageIndex(pageIndex: number): void; } /** @@ -9852,6 +9728,216 @@ interface Interval { */ length: number; } +interface SpellingInfo { + spellCheckerState: any; + misspelledIntervals: MisspelledInterval[]; +} +declare enum SpellCheckerState { + Disabled=0, + InProgress=1, + Done=2 +} +interface MisspelledInterval { + start: number; + length: number; + interval: Interval; + errorType: any; + word: string; + suggestions: string[]; +} +declare enum SpellingErrorType { + Misspelling=0, + Repeating=1 +} +/** + * Serves as a base for objects implementing different element styles. + */ +interface StyleBase { + /** + * Gets or sets the name of the style. + * Value: A string specifying the style name. + */ + name: string; + /** + * Gets whether the specified style is marked as deleted. + * Value: true, if the style is deleted; otherwise, false. + */ + isDeleted: boolean; +} +/** + * Defines the paragraph style settings. + */ +interface ParagraphStyle extends StyleBase { + /** + * Gets or sets the linked style for the current style. + * Value: A object representing a character style linked to a current style. + */ + linkedStyle: CharacterStyle; + /** + * Gets or sets the default style for a paragraph that immediately follows the current paragraph. + * Value: A object specifying the style for the next paragraph. + */ + nextStyle: ParagraphStyle; + /** + * Gets the index of the list item associated with the paragraph formatted with the current style. + * Value: An integer value specifying the list item index. + */ + listIndex: number; + /** + * Gets the index of the list level applied to the paragraph formatted with the current style. + * Value: An integer that is the list level index. + */ + listLevelIndex: number; + /** + * Gets or sets the style from which the current style inherits. + * Value: A object representing the parent style. + */ + parent: ParagraphStyle; +} +/** + * Contains characteristics of a character style in a document. + */ +interface CharacterStyle extends StyleBase { + /** + * Gets or sets the linked style for the current style. + * Value: A object representing a paragraph style linked to a current style. + */ + linkedStyle: ParagraphStyle; + /** + * Gets the style form which the current style inherits. + * Value: A object representing the parent style. + */ + parent: CharacterStyle; +} +/** + * Defines the table style settings. + */ +interface TableStyle extends StyleBase { + /** + * Gets or sets the style from which the current style inherits. + * Value: A object that is the parent style. + */ + parent: TableStyle; +} +/** + * Exposes the settings providing the information about the essential document functionality. + */ +interface SubDocument { + id: number; + type: any; + /** + * Provides information about paragraphs contained in the document. + * Value: An array of Paragraph objects storing information about document paragraphs. + */ + paragraphsInfo: Paragraph[]; + /** + * Provides information about fields in the current document. + * Value: An array of Field objects storing information about document fields. + */ + fieldsInfo: Field[]; + /** + * Provides information about tables contained in the document. + * Value: An array of Table objects storing information about document tables. + */ + tablesInfo: Table[]; + /** + * Provides information about document bookmarks. + * Value: An array of Bookmark objects storing information about document bookmarks. + */ + bookmarksInfo: Bookmark[]; + inlinePicturesInfo: InlinePictureInfo[]; + /** + * Gets the document's textual representation. + * Value: A string value specifying the document's text. + */ + text: string; + /** + * Gets the character length of the document. + * Value: An integer that is the number of character positions in the document. + */ + length: number; +} +declare enum SubDocumentType { + Main=0, + Header=1, + Footer=2, + TextBox=3 +} +/** + * Defines a table in the document. + */ +interface Table { + /** + * Gets the table's start position in the document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the table length in characters. + * Value: A integer value specifying the character length of the table. + */ + length: number; + interval: Interval; + /** + * Provides access to a collection of table rows. + * Value: An array of TableRow objects storing information about individual table rows. + */ + rows: TableRow[]; + /** + * Gets the name of the style applied to the table (see name). + * Value: A string value specifying the style name. + */ + styleName: string; +} +/** + * Defines a table row in the document. + */ +interface TableRow { + /** + * Gets the table row's start position in the document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the table row's character length. + * Value: An integer value specifying the element length in characters. + */ + length: number; + interval: Interval; + /** + * Provides information about the table row's cells. + * Value: An array of TableCell objects storing information about cells. + */ + cells: TableCell[]; +} +/** + * Defines a table cell in the document. + */ +interface TableCell { + /** + * Gets the table cell's start position in the document. + * Value: An integer value specifying the start position. + */ + start: number; + /** + * Gets the table cell's character length. + * Value: An integer value specifying the element length in characters. + */ + length: number; + interval: Interval; +} +interface RichEditUnitConverter { + pixelsToTwips(value: number): number; + inchesToTwips(value: number): number; + pointsToTwips(value: number): number; + centimetersToTwips(value: number): number; + twipsToCentimeters(value: number): number; + pixelsToCentimeters(value: number): number; + twipsToInches(value: number): number; + pixelsToInches(value: number): number; + pixelsToPoints(value: number): number; + twipsToPoints(value: number): number; +} /** * A command to invoke the Bookmark dialog. */ @@ -10011,6 +10097,11 @@ interface GoToDataRecordCommand extends CommandBase { * @param activeRecordIndex An integer value specifying index of the next data record. */ execute(activeRecordIndex: number): boolean; + getState(): any; +} +interface DataRecordOptions { + activeRecordIndex: number; + recordCount: number; } /** * A command to navigate to the first data record of the bound data source. @@ -10957,9 +11048,10 @@ interface OpenSectionColumnsDialogCommand extends CommandWithSimpleStateBase { */ interface ChangeSectionColumnsCommand extends CommandBase { /** - * Executes the ChangeSectionColumnsCommand command by imitating the corresponding end-user action made in the RichEdit's UI. May result in taking no action if the command's state does not allow command execution. Use the object's getState method to check the command state. + * + * @param columns */ - execute(): boolean; + execute(columns: SectionColumn[]): boolean; /** * Gets information about the command state. */ @@ -11496,6 +11588,9 @@ declare enum ParagraphFirstLineIndent { Indented=1, Hanging=2 } +interface AssignShortcutCommand extends CommandWithSimpleStateBase { + execute(keyCode: number, callback: (arg1: string) => void): boolean; +} interface OpenSpellingDialogCommand extends CommandWithSimpleStateBase { execute(): boolean; } @@ -12756,7 +12851,7 @@ interface FontFormattingSettings { * Value: true, if characters are italicized; otherwise, false. */ italic: boolean; - boolean: boolean; + strikeout: boolean; /** * Gets or sets whether only word characters are underlined. * Value: true to underline only characters in words; false to underline all characters. @@ -16892,9 +16987,17 @@ interface ASPxClientControlsInitializedEventArgs extends ASPxClientEventArgs { isCallback: boolean; } interface ASPxClientControlPredicate { + /** + * + * @param control + */ (control: Object): boolean; } interface ASPxClientControlAction { + /** + * + * @param control + */ (control: Object): void; } /** @@ -16936,18 +17039,18 @@ interface ASPxClientControlCollection { */ GetByName(name: string): Object; /** - * - * @param predicate + * Returns all controls in the collection that satisfy the specified predicate. + * @param predicate An ASPxClientControlPredicate object that is a predicate used to search for controls in the collection. */ GetControlsByPredicate(predicate: ASPxClientControlPredicate): Object[]; /** - * - * @param type + * Returns all controls of the specified type. + * @param type The object specifying the client control type. */ GetControlsByType(type: Object): Object[]; /** - * - * @param action + * Performs the specified action for each control in the collection. + * @param action An ASPxClientControlAction object specifying an action to perform. */ ForEachControl(action: ASPxClientControlAction): void; } @@ -17900,6 +18003,10 @@ interface ASPxClientFileManagerFile extends ASPxClientFileManagerItem { * A client-side equivalent of the FileManagerFolder object. */ interface ASPxClientFileManagerFolder extends ASPxClientFileManagerItem { + /** + * Gets a value specifying whether an item is a parent folder. + * Value: true if an item is a parent folder; false if an item is a file or folder. + */ isParentFolder: boolean; } /** @@ -22329,7 +22436,7 @@ interface ASPxClientWebChartHitInfo { */ inChartTitle: boolean; /** - * Gets a value indicating whether the test point is within the . + * Gets a value indicating whether the test point is within the axis. * Value: true if the test point is within an axis; otherwise, false. */ inAxis: boolean; @@ -22559,17 +22666,17 @@ interface ASPxClientDiagramCoordinates { */ dateTimeValue: Date; /** - * Gets the X- of the diagram point. + * Gets the X-axis of the diagram point. * Value: An ASPxClientAxisBase descendant, representing the axis of arguments (X-axis). */ axisX: ASPxClientAxisBase; /** - * Gets the Y- of the diagram point. + * Gets the Y-axis of the diagram point. * Value: An ASPxClientAxisBase descendant, representing the axis of values (Y-axis). */ axisY: ASPxClientAxisBase; /** - * Gets the of the diagram point. + * Gets the pane of the diagram point. * Value: An ASPxClientXYDiagramPane descendant, representing the pane. */ pane: ASPxClientXYDiagramPane; @@ -22788,12 +22895,12 @@ interface ASPxClientXYDiagram2D extends ASPxClientXYDiagramBase { */ secondaryAxesY: ASPxClientAxis[]; /** - * Provides access to a default object. + * Provides access to a default pane object. * Value: An ASPxClientXYDiagramPane object which represents the default pane of a chart. */ defaultPane: ASPxClientXYDiagramPane; /** - * Provides access to an array of a diagram's . + * Provides access to an array of a diagram's panes. * Value: An array of ASPxClientXYDiagramPane objects. */ panes: ASPxClientXYDiagramPane[]; @@ -22925,7 +23032,7 @@ interface ASPxClientRadarAxis extends ASPxClientAxisBase { */ interface ASPxClientAxisTitle extends ASPxClientWebChartRequiredElement { /** - * Gets the to which the axis title belongs. + * Gets the axis to which the axis title belongs. * Value: An ASPxClientAxisBase descendant, which identifies the axis. */ axis: ASPxClientAxisBase; @@ -22940,7 +23047,7 @@ interface ASPxClientAxisTitle extends ASPxClientWebChartRequiredElement { */ interface ASPxClientAxisLabelItem extends ASPxClientWebChartRequiredElement { /** - * Gets the to which an axis label item belongs. + * Gets the axis to which an axis label item belongs. * Value: An ASPxClientAxisBase descendant, which identifies the axis. */ axis: ASPxClientAxisBase; @@ -24252,6 +24359,10 @@ interface ASPxClientReportDesigner extends ASPxClientControl { * Occurs each time a standard editor is created for a report parameter based on a parameter type. */ CustomizeParameterEditors: ASPxClientEvent>; + /** + * Occurs each time a look-up editor is created for a report parameter. + */ + CustomizeParameterLookUpSource: ASPxClientEvent>; /** * Occurs on the client side when the Report Designer is being closed. */ @@ -24392,6 +24503,9 @@ interface ASPxClientReportDesignerCustomizeMenuActionsEventArgs extends ASPxClie */ interface ASPxClientReportDesignerExitDesignerEventArgs extends ASPxClientEventArgs { } +interface ASPxClientReportDesignerCustomizeParameterLookUpSourceEventHandler { + (source: S, e: ASPxClientCustomizeParameterLookUpSourceEventArgs): void; +} /** * A method that will handle the CustomizeParameterEditors event. */ @@ -24565,6 +24679,11 @@ interface ASPxClientCustomizeParameterEditorsEventArgs extends ASPxClientEventAr */ info: ASPxDesignerElementSerializationInfo; } +interface ASPxClientCustomizeParameterLookUpSourceEventArgs extends ASPxClientEventArgs { + parameter: ASPxDesignerElementParameterDescriptor; + items: ASPxDesignerElementEditorItem[]; + dataSource: Object; +} /** * Provides general information about a report parameter. */ @@ -24707,6 +24826,10 @@ interface ASPxClientWebDocumentViewer extends ASPxClientControl { * Occurs each time a standard editor is created for a report parameter based on a parameter type. */ CustomizeParameterEditors: ASPxClientEvent>; + /** + * Occurs each time a look-up editor is created for a report parameter. + */ + CustomizeParameterLookUpSource: ASPxClientEvent>; /** * Provides access to the preview model of the ASPxClientWebDocumentViewer. */ @@ -24739,17 +24862,6 @@ interface ASPxClientWebDocumentViewer extends ASPxClientControl { */ UpdateLocalization(localization: { [key: string]: string; }): void; } -/** - * A method that will handle the CustomizeMenuActions event. - */ -interface ASPxClientWebDocumentViewerCustomizeMenuActionsEventHandler { - /** - * A method that will handle the CustomizeMenuActions event. - * @param source The event sender. - * @param e An ASPxClientWebDocumentViewerCustomizeMenuActionsEventArgs object that contains data related to the event. - */ - (source: S, e: ASPxClientWebDocumentViewerCustomizeMenuActionsEventArgs): void; -} /** * Provides settings to the actions listed in a Web Document Viewer menu. */ @@ -24810,6 +24922,17 @@ interface ASPxClientWebDocumentViewerCustomizeMenuActionsEventArgs extends ASPxC */ GetById(actionId: string): ASPxClientWebDocumentViewerMenuAction; } +/** + * A method that will handle the CustomizeMenuActions event. + */ +interface ASPxClientWebDocumentViewerCustomizeMenuActionsEventHandler { + /** + * A method that will handle the CustomizeMenuActions event. + * @param source The event sender. + * @param e An ASPxClientWebDocumentViewerCustomizeMenuActionsEventArgs object that contains data related to the event. + */ + (source: S, e: ASPxClientWebDocumentViewerCustomizeMenuActionsEventArgs): void; +} /** * A method that will handle the CustomizeParameterEditors event. */ @@ -24821,6 +24944,9 @@ interface ASPxClientWebDocumentViewerCustomizeParameterEditorsEventHandler { */ (source: S, e: ASPxClientCustomizeParameterEditorsEventArgs): void; } +interface ASPxClientWebDocumentViewerCustomizeParameterLookUpSourceEventHandler { + (source: S, e: ASPxClientCustomizeParameterEditorsEventArgs): void; +} interface MVCxClientDashboardViewerStatic extends ASPxClientDashboardViewerStatic { } @@ -25354,6 +25480,10 @@ interface ASPxClientButtonEditStatic extends ASPxClientButtonEditBaseStatic { Cast(obj: Object): ASPxClientButtonEdit; } interface ASPxClientTokenBoxStatic extends ASPxClientComboBoxStatic { + /** + * Converts the specified object to the current object's type. This method is effective when you utilize the Client API IntelliSense feature provided by DevExpress. + * @param obj The client object to be type cast. Represents an instance of a DevExpress web control's client object. + */ Cast(obj: Object): ASPxClientTokenBox; } interface ASPxClientTrackBarStatic extends ASPxClientEditStatic { @@ -26136,6 +26266,10 @@ interface ASPxClientPivotGridStatic extends ASPxClientControlStatic { interface ASPxClientPivotCustomizationStatic extends ASPxClientControlStatic { } interface ASPxClientRichEditStatic extends ASPxClientControlStatic { + /** + * Converts the specified object to the current object's type. This method is effective when you utilize the Client API IntelliSense feature provided by DevExpress. + * @param obj The client object to be type cast. Represents an instance of a DevExpress web control's client object. + */ Cast(obj: Object): ASPxClientRichEdit; } interface ASPxSchedulerDateTimeHelperStatic { @@ -26207,6 +26341,10 @@ interface ASPxClientSpellCheckerStatic extends ASPxClientControlStatic { Cast(obj: Object): ASPxClientSpellChecker; } interface ASPxClientSpreadsheetStatic extends ASPxClientControlStatic { + /** + * Converts the specified object to the current object's type. This method is effective when you utilize the Client API IntelliSense feature provided by DevExpress. + * @param obj The client object to be type cast. Represents an instance of a DevExpress web control's client object. + */ Cast(obj: Object): ASPxClientSpreadsheet; } interface ASPxClientTreeListStatic extends ASPxClientControlStatic { diff --git a/devexpress-web/tsconfig.json b/devexpress-web/tsconfig.json index 758e84ab1c..58b04034e5 100644 --- a/devexpress-web/tsconfig.json +++ b/devexpress-web/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/devextreme/devextreme-15.1.4.d.ts b/devextreme/devextreme-15.1.4.d.ts index 44881ea912..9f9ae875ed 100644 --- a/devextreme/devextreme-15.1.4.d.ts +++ b/devextreme/devextreme-15.1.4.d.ts @@ -1,4 +1,4 @@ -// Type definitions for DevExtreme 15.1.4 +// Type definitions for DevExtreme 15.1.4 // Project: http://js.devexpress.com/ // Definitions by: DevExpress Inc. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/devextreme/devextreme-15.2.10.d.ts b/devextreme/devextreme-15.2.10.d.ts new file mode 100644 index 0000000000..d8b1149efd --- /dev/null +++ b/devextreme/devextreme-15.2.10.d.ts @@ -0,0 +1,7504 @@ +// Type definitions for DevExtreme 15.2.10 +// Project: http://js.devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module DevExpress { + /** A mixin that provides a capability to fire and subscribe to events. */ + export interface EventsMixin { + /** Subscribes to a specified event. */ + on(eventName: string, eventHandler: Function): T; + /** Subscribes to the specified events. */ + on(events: { [eventName: string]: Function; }): T; + /** Detaches all event handlers from the specified event. */ + off(eventName: string): Object; + /** Detaches a particular event handler from the specified event. */ + off(eventName: string, eventHandler: Function): T; + } + /** An object that serves as a namespace for the methods required to perform validation. */ + export module validationEngine { + export interface IValidator { + validate(): ValidatorValidationResult; + reset(): void; + } + export interface ValidatorValidationResult { + isValid: boolean; + name?: string; + value: any; + brokenRule: any; + validationRules: any[]; + } + export interface ValidationGroupValidationResult { + isValid: boolean; + brokenRules: any[]; + validators: IValidator[]; + } + export interface GroupConfig extends EventsMixin { + group: any; + validators: IValidator[]; + validate(): ValidationGroupValidationResult; + reset(): void; + } + /** Provides access to the object that represents the specified validation group. */ + export function getGroupConfig(group: any): GroupConfig + /** Provides access to the object that represents the default validation group. */ + export function getGroupConfig(): GroupConfig + /** Validates rules of the validators that belong to the specified validation group. */ + export function validateGroup(group: any): ValidationGroupValidationResult; + /** Validates rules of the validators that belong to the default validation group. */ + export function validateGroup(): ValidationGroupValidationResult; + /** Resets the values and validation result of the editors that belong to the specified validation group. */ + export function resetGroup(group: any): void; + /** Resets the values and validation result of the editors that belong to the default validation group. */ + export function resetGroup(): void; + /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ + export function validateModel(model: Object): ValidationGroupValidationResult; + /** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */ + export function registerModelForValidation(model: Object) : void; + } + export var hardwareBackButton: JQueryCallback; + /** Processes the hardware back button click. */ + export function processHardwareBackButton(): void; + /** Hides the last displayed overlay widget. */ + export function hideTopOverlay(): boolean; + /** Specifies whether or not the entire application/site supports right-to-left representation. */ + export var rtlEnabled: boolean; + /** Registers a new component in the DevExpress.ui namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, componentClass: Object): void; + /** Registers a new component in the specified namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, namespace: Object, componentClass: Object): void; + export function requestAnimationFrame(callback: Function): number; + export function cancelAnimationFrame(requestID: number): void; + /** Custom Knockout binding that links an HTML element with a specific action. */ + export class Action { } + /** Used to get URLs that vary in a locally running application and the application running on production. */ + export class EndpointSelector { + constructor(options: { + [key: string]: { + local?: string; + production?: string; + } + }); + /** Returns a local or a productional URL depending on how the application is currently running. */ + urlFor(key: string): string; + } + /** An object that serves as a namespace for the methods that are used to animate UI elements. */ + export module fx { + /** Defines animation options. */ + export interface AnimationOptions { + /** A function called after animation is completed. */ + complete?: (element: JQuery, config: AnimationOptions) => void; + /** A number specifying wait time before animation execution. */ + delay?: number; + /** A number specifying the time period to wait before the animation of the next stagger item starts. */ + staggerDelay?: number; + /** A number specifying the time in milliseconds spent on animation. */ + duration?: number; + /** A string specifying the type of an easing function used for animation. */ + easing?: string; + /** Specifies the initial animation state. */ + from?: any; + /** A function called before animation is started. */ + start?: (element: JQuery, config: AnimationOptions) => void; + /** Specifies a final animation state. */ + to?: any; + /** A string value specifying the animation type. */ + type?: string; + /** Specifies the animation direction for the "slideIn" and "slideOut" animation types. */ + direction?: string; + } + /** Animates the specified element. */ + export function animate(element: HTMLElement, config: AnimationOptions): Object; + /** Returns a value indicating whether the specified element is being animated. */ + export function isAnimating(element: HTMLElement): boolean; + /** Stops the animation. */ + export function stop(element: HTMLElement, jumpToEnd: boolean): void; + } + /** The manager that performs several specified animations at a time. */ + export class TransitionExecutor { + /** Deletes all the animations registered in the Transition Executor by using the enter(elements, animation) and leave(elements, animation) methods. */ + reset(): void; + /** Registers a set of elements that should be animated as "entering" using the specified animation configuration. */ + enter(elements: JQuery, animation: any): void; + /** Registers a set of elements that should be animated as "leaving" using the specified animation configuration. */ + leave(elements: JQuery, animation: any): void; + /** Starts all the animations registered using the enter(elements, animation) and leave(elements, animation) methods beforehand. */ + start(config: Object): JQueryPromise; + /** Stops all started animations. */ + stop(): void; + } + export class AnimationPresetCollection { + /** Resets all the changes made in the animation repository. */ + resetToDefaults(): void; + /** Deletes the specified animation or clears all the animation repository, if an animation name is not passed. */ + clear(name: string): void; + /** Adds the specified animation preset to the animation repository by the specified name. */ + registerPreset(name: string, config: any): void; + /** Applies the changes made in the animation repository. */ + applyChanges(): void; + /** Returns the configuration of the animation found in the animation repository by the specified name for the current device. */ + getPreset(name: string): void; + /** Registers predefined animations in the animation repository. */ + registerDefaultPresets(): void; + } + /** A repository of animations. */ + export var animationPresets: AnimationPresetCollection; + /** The device object defines the device on which the application is running. */ + export interface Device { + /** Indicates whether or not the device platform is Android. */ + android?: boolean; + /** Specifies the type of the device on which the application is running. */ + deviceType?: string; + /** Indicates whether or not the device platform is generic, which means that the application will look and behave according to a generic "light" or "dark" theme. */ + generic?: boolean; + /** Indicates whether or not the device platform is iOS. */ + ios?: boolean; + /** Indicates whether or not the device type is 'phone'. */ + phone?: boolean; + /** Specifies the platform of the device on which the application is running. */ + platform?: string; + /** Indicates whether or not the device type is 'tablet'. */ + tablet?: boolean; + /** Specifies an array with the major and minor versions of the device platform. */ + version?: Array; + /** Indicates whether or not the device platform is Windows. */ + win?: boolean; + /** Specifies a performance grade of the current device. */ + grade?: string; + } + export class Devices implements EventsMixin { + constructor(options: { window: Window }); + /** Overrides actual device information to force the application to operate as if it was running on the specified device. */ + current(deviceName: any): void; + /** Returns information about the current device. */ + current(): Device; + orientationChanged: JQueryCallback; + /** Returns the current device orientation. */ + orientation(): string; + /** Returns real information about the current device regardless of the value passed to the devices.current(deviceName) method. */ + real(): Device; + on(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + on(eventName: string, eventHandler: Function): Devices; + on(events: { [eventName: string]: Function; }): Devices; + off(eventName: "orientationChanged"): Devices; + off(eventName: string): Devices; + off(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + off(eventName: string, eventHandler: Function): Devices; + } + /** An object that serves as a namespace for the methods and events specifying information on the current device. */ + export var devices: Devices; + /** The position object specifies the widget positioning options. */ + export interface PositionOptions { + /** The target element position that the widget is positioned against. */ + at?: any; + /** The element within which the widget is positioned. */ + boundary?: Object; + /** Specifies the horizontal and vertical offset from the window's boundaries. */ + boundaryOffset?: any; + /** Specifies how to move the widget if it overflows the screen. */ + collision?: any; + /** The position of the widget to align against the target element. */ + my?: any; + /** The target element that the widget is positioned against. */ + of?: Object; + /** Specifies horizontal and vertical offset in pixels. */ + offset?: any; + } + export interface ComponentOptions { + /** A handler for the initialized event. */ + onInitialized?: Function; + /** A handler for the optionChanged event. */ + onOptionChanged?: Function; + /** A handler for the disposing event. */ + onDisposing?: Function; + } + /** A base class for all components and widgets. */ + export class Component { + constructor(options?: ComponentOptions) + /** Prevents the component from refreshing until the endUpdate method is called. */ + beginUpdate(): void; + /** Enables the component to refresh after the beginUpdate method call. */ + endUpdate(): void; + /** Returns an instance of this component class. */ + instance(): Component; + /** Returns the configuration options of this component. */ + option(): { + [optionKey: string]: any; + }; + /** Sets one or more options of this component. */ + option(options: { + [optionKey: string]: any; + }): void; + /** Gets the value of the specified configuration option of this component. */ + option(optionName: string): any; + /** Sets a value to the specified configuration option of this component. */ + option(optionName: string, optionValue: any): void; + } + export interface DOMComponentOptions extends ComponentOptions { + /** Specifies whether or not the current component supports a right-to-left representation. */ + rtlEnabled?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the width of the widget. */ + width?: any; + /** A bag for holding any options that require two-way binding (Angular approach specific) */ + bindingOptions?: { [key: string]: any; }; + } + /** A base class for all components. */ + export class DOMComponent extends Component { + constructor(element: JQuery, options?: DOMComponentOptions); + constructor(element: HTMLElement, options?: DOMComponentOptions); + /** Returns the root HTML element of the widget. */ + element(): JQuery; + /** Specifies the device-dependent default configuration options for this component. */ + static defaultOptions(rule: { + device?: any; + options?: any; + }): void; + } + export module data { + export interface ODataError extends Error { + httpStatus?: number; + errorDetails?: any; + } + export interface StoreOptions { + /** A handler for the modified event. */ + onModified?: () => void; + /** A handler for the modifying event. */ + onModifying?: () => void; + /** A handler for the removed event. */ + onRemoved?: (key: any) => void; + /** A handler for the removing event. */ + onRemoving?: (key: any) => void; + /** A handler for the updated event. */ + onUpdated?: (key: any, values: Object) => void; + /** A handler for the updating event. */ + onUpdating?: (key: any, values: Object) => void; + /** A handler for the loaded event. */ + onLoaded?: (result: Array) => void; + /** A handler for the loading event. */ + onLoading?: (loadOptions: LoadOptions) => void; + /** A handler for the inserted event. */ + onInserted?: (values: Object, key: any) => void; + /** A handler for the inserting event. */ + onInserting?: (values: Object) => void; + /** Specifies the function called when the Store causes an error. */ + errorHandler?: (e: Error) => void; + /** Specifies the key properties within the data associated with the Store. */ + key?: any; + } + export interface LoadOptions { + filter?: Object; + sort?: Object; + select?: Object; + expand?: Object; + group?: Object; + skip?: number; + take?: number; + userData?: Object; + requireTotalCount?: boolean; + } + /** The base class for all Stores. */ + export class Store implements EventsMixin { + constructor(options?: StoreOptions); + /** Returns the data item specified by the key. */ + byKey(key: any): JQueryPromise; + /** Adds an item to the data associated with this Store. */ + insert(values: Object): JQueryPromise; + /** Returns the key expression specified via the key configuration option. */ + key(): any; + /** Returns the key of the Store item that matches the specified object. */ + keyOf(obj: Object): any; + /** Starts loading data. */ + load(obj?: LoadOptions): JQueryPromise; + /** Removes the data item specified by the key. */ + remove(key: any): JQueryPromise; + /** Obtains the total count of items that will be returned by the load() function. */ + totalCount(options?: { + filter?: Object; + group?: Object; + }): JQueryPromise; + /** Updates the data item specified by the key. */ + update(key: any, values: Object): JQueryPromise; + on(eventName: "removing", eventHandler: (key: any) => void): Store; + on(eventName: "removed", eventHandler: (key: any) => void): Store; + on(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "inserting", eventHandler: (values: Object) => void): Store; + on(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + on(eventName: "modifying", eventHandler: () => void): Store; + on(eventName: "modified", eventHandler: () => void): Store; + on(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + on(eventName: "loaded", eventHandler: (result: Array) => void): Store; + on(eventName: string, eventHandler: Function): Store; + on(events: { [eventName: string]: Function; }): Store; + off(eventName: "removing"): Store; + off(eventName: "removed"): Store; + off(eventName: "updating"): Store; + off(eventName: "updated"): Store; + off(eventName: "inserting"): Store; + off(eventName: "inserted"): Store; + off(eventName: "modifying"): Store; + off(eventName: "modified"): Store; + off(eventName: "loading"): Store; + off(eventName: "loaded"): Store; + off(eventName: string): Store; + off(eventName: "removing", eventHandler: (key: any) => void): Store; + off(eventName: "removed", eventHandler: (key: any) => void): Store; + off(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "inserting", eventHandler: (values: Object) => void): Store; + off(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + off(eventName: "modifying", eventHandler: () => void): Store; + off(eventName: "modified", eventHandler: () => void): Store; + off(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + off(eventName: "loaded", eventHandler: (result: Array) => void): Store; + off(eventName: string, eventHandler: Function): Store; + } + export interface ArrayStoreOptions extends StoreOptions { + /** Specifies the array associated with this Store. */ + data?: Array; + } + /** A Store accessing an in-memory array. */ + export class ArrayStore extends Store { + constructor(options?: ArrayStoreOptions); + /** Clears all data associated with the current ArrayStore. */ + clear(): void; + /** Creates the Query object for the underlying array. */ + createQuery(): Query; + } + interface Promise { + then(doneFn?: Function, failFn?: Function, progressFn?: Function): Promise; + } + export interface CustomStoreOptions extends StoreOptions { + /** Specifies whether or not the store combines the search expression with the filter expression. */ + useDefaultSearch?: boolean; + /** The user implementation of the byKey(key, extraOptions) method. */ + byKey?: (key: any) => Promise; + /** The user implementation of the insert(values) method. */ + insert?: (values: Object) => Promise; + /** The user implementation of the load(options) method. */ + load?: (options?: LoadOptions) => Promise; + /** The user implementation of the remove(key) method. */ + remove?: (key: any) => Promise; + /** The user implementation of the totalCount(options) method. */ + totalCount?: (options?: { + filter?: Object; + group?: Object; + }) => Promise; + /** The user implementation of the update(key, values) method. */ + update?: (key: any, values: Object) => Promise; + } + /** A Store object that enables you to implement your own data access logic. */ + export class CustomStore extends Store { + constructor(options: CustomStoreOptions); + } + export interface DataSourceOptions { + /** Specifies data filtering conditions. */ + filter?: Object; + /** Specifies data grouping conditions. */ + group?: Object; + /** The item mapping function. */ + map?: (record: any) => any; + /** Specifies the maximum number of items the page can contain. */ + pageSize?: number; + /** Specifies whether a DataSource loads data by pages, or all items at once. */ + paginate?: boolean; + /** The data post processing function. */ + postProcess?: (data: any[]) => any[]; + /** Specifies a value by which the required items are searched. */ + searchExpr?: Object; + /** Specifies the comparison operation used to search for the required items. */ + searchOperation?: string; + /** Specifies the value to which the search expression is compared. */ + searchValue?: Object; + /** Specifies the initial select option value. */ + select?: Object; + /** An array of the strings that represent the names of the navigation properties to be loaded simultaneously with the OData store's entity. */ + expand?: Object; + /** The bag of custom parameters passed to the query executed when the DataSource load operation is invoked. */ + customQueryParams?: Object; + /** Specifies whether or not the DataSource instance requests the total count of items available in the storage. */ + requireTotalCount?: boolean; + /** Specifies the initial sort option value. */ + sort?: Object; + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Error) => void; + } + export interface OperationPromise extends JQueryPromise { + operationId: number; + } + /** An object that provides access to a data web service or local data storage for collection container widgets. */ + export class DataSource implements EventsMixin { + constructor(url: string); + constructor(data: Array); + constructor(options: CustomStoreOptions); + constructor(options: DataSourceOptions); + /** Disposes all resources associated with this DataSource. */ + dispose(): void; + /** Returns the current filter option value. */ + filter(): Object; + /** Sets the filter option value. */ + filter(filterExpr: Object): void; + /** Returns the current group option value. */ + group(): Object; + /** Sets the group option value. */ + group(groupExpr: Object): void; + /** Indicates whether or not the current page contains fewer items than the number of items specified by the pageSize configuration option. */ + isLastPage(): boolean; + /** Indicates whether or not at least one load() method execution has successfully finished. */ + isLoaded(): boolean; + /** Indicates whether or not the DataSource is currently being loaded. */ + isLoading(): boolean; + /** Returns the array of items currently operated by the DataSource. */ + items(): Array; + /** Returns the key expression. */ + key(): any; + /** Starts loading data. */ + load(): OperationPromise>; + /** Clears currently loaded DataSource items and calls the load() method. */ + reload(): OperationPromise>; + /** Returns an object that would be passed to the load() method of the underlying Store according to the current data shaping option values of the current DataSource instance. */ + loadOptions(): Object; + /** Returns the current pageSize option value. */ + pageSize(): number; + /** Sets the pageSize option value. */ + pageSize(value: number): void; + /** Specifies the index of the currently loaded page. */ + pageIndex(): number; + /** Specifies the index of the page to be loaded during the next load() method execution. */ + pageIndex(newIndex: number): void; + /** Returns the current paginate option value. */ + paginate(): boolean; + /** Sets the paginate option value. */ + paginate(value: boolean): void; + /** Returns the searchExpr option value. */ + searchExpr(): Object; + /** Sets the searchExpr option value. */ + searchExpr(...expr: Object[]): void; + /** Returns the currently specified search operation. */ + searchOperation(): string; + /** Sets the current search operation. */ + searchOperation(op: string): void; + /** Returns the searchValue option value. */ + searchValue(): Object; + /** Sets the searchValue option value. */ + searchValue(value: Object): void; + /** Returns the current select option value. */ + select(): Object; + /** Sets the select option value. */ + select(expr: Object): void; + /** Returns the current requireTotalCount option value. */ + requireTotalCount(): boolean; + /** Sets the requireTotalCount option value. */ + requireTotalCount(value: boolean): void; + /** Returns the current sort option value. */ + sort(): Object; + /** Sets the sort option value. */ + sort(sortExpr: Object): void; + /** Returns the underlying Store instance. */ + store(): Store; + /** Returns the number of data items available in an underlying Store after the last load() operation without paging. */ + totalCount(): number; + /** Cancels the load operation associated with the specified identifier. */ + cancel(operationId: number): boolean; + on(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + on(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + on(eventName: "changed", eventHandler: () => void): DataSource; + on(eventName: string, eventHandler: Function): DataSource; + on(events: { [eventName: string]: Function; }): DataSource; + off(eventName: "loadingChanged"): DataSource; + off(eventName: "loadError"): DataSource; + off(eventName: "changed"): DataSource; + off(eventName: string): DataSource; + off(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + off(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + off(eventName: "changed", eventHandler: () => void): DataSource; + off(eventName: string, eventHandler: Function): DataSource; + } + /** An object used to work with primitive data types not supported by JavaScript when accessing an OData web service. */ + export class EdmLiteral { + /** Creates an EdmLiteral instance and assigns the specified value to it. */ + constructor(value: string); + /** Returns a string representation of the value associated with this EdmLiteral object. */ + valueOf(): string; + } + /** An object used to generate and hold the GUID. */ + export class Guid { + /** Creates a new Guid instance that holds the specified GUID. */ + constructor(value: string); + /** Creates a new Guid instance holding the generated GUID. */ + constructor(); + /** Returns a string representation of the Guid instance. */ + toString(): string; + /** Returns a string representation of the Guid instance. */ + valueOf(): string; + } + export interface LocalStoreOptions extends ArrayStoreOptions { + /** Specifies the time (in miliseconds) after the change operation, before the data is flushed. */ + flushInterval?: number; + /** Specifies whether the data is flushed immediatelly after each change operation, or after the delay specified via the flushInterval option. */ + immediate?: boolean; + /** The unique identifier used to distinguish the data within the HTML5 Web Storage. */ + name?: string; + } + /** A Store providing access to the HTML5 Web Storage. */ + export class LocalStore extends ArrayStore { + constructor(options?: LocalStoreOptions); + /** Removes all data associated with this Store. */ + clear(): void; + } + export interface ODataContextOptions extends ODataStoreOptions { + /** Specifies the list of entities to be accessed via the ODataContext. */ + entities?: Object; + /** Specifies the function called if the ODataContext causes an error. */ + errorHandler?: (e: Error) => void; + } + /** Provides access to the entire OData service. */ + export class ODataContext { + constructor(options?: ODataContextOptions); + /** Initiates the specified WebGet service operation that returns a value. For the information on service operations, refer to the OData documentation. */ + get(operationName: string, params: Object): JQueryPromise; + /** Initiates the specified WebGet service operation that returns nothing. For the information on service operations, refer to the OData documentation. */ + invoke(operationName: string, params: Object, httpMethod: Object): JQueryPromise; + /** Return a special proxy object to describe the entity link. */ + objectLink(entityAlias: string, key: any): Object; + } + export interface ODataStoreOptions extends StoreOptions { + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: { + url: string; + async: boolean; + method: string; + timeout: number; + params: Object; + payload: Object; + headers: Object; + }) => void; + /** Specifies whether the ODataStore uses the JSONP approach to access non-CORS-compatible remote services. */ + jsonp?: boolean; + /** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, and Guid. */ + keyType?: any; + /** Specifies whether or not dates found in the response are deserialized. */ + deserializeDates?: boolean; + /** Specifies the URL of the data service being accessed via the current ODataContext. */ + url?: string; + /** Specifies the version of the OData protocol used to interact with the data service. */ + version?: number; + /** Specifies the value of the withCredentials field of the underlying jqXHR object. */ + withCredentials?: boolean; + } + /** A Store providing access to a separate OData web service entity. */ + export class ODataStore extends Store { + constructor(options?: ODataStoreOptions); + /** Creates the Query object for the OData endpoint. */ + createQuery(loadOptions: Object): Object; + /** Returns the data item specified by the key. */ + byKey(key: any, extraOptions?: { expand?: Object }): JQueryPromise; + } + /** An universal chainable data query interface object. */ + export interface Query { + /** Calculates a custom summary for the items in the current Query. */ + aggregate(step: (accumulator: any, value: any) => any): JQueryPromise; + /** Calculates a custom summary for the items in the current Query. */ + aggregate(seed: any, step: (accumulator: any, value: any) => any, finalize: (result: any) => any): JQueryPromise; + /** Calculates the average item value for the current Query. */ + avg(getter: Object): JQueryPromise; + /** Finds the item with the maximum getter value. */ + max(getter: Object): JQueryPromise; + /** Finds the item with the maximum value in the Query. */ + max(): JQueryPromise; + /** Finds the item with the minimum value in the Query. */ + min(): JQueryPromise; + /** Finds the item with the minimum getter value. */ + min(getter: Object): JQueryPromise; + /** Calculates the average item value for the current Query, if each Query item has a numeric type. */ + avg(): JQueryPromise; + /** Returns the total count of items in the current Query. */ + count(): JQueryPromise; + /** Executes the Query. */ + enumerate(): JQueryPromise; + /** Filters the current Query data. */ + filter(criteria: Array): Query; + /** Filters the current Query data. */ + filter(predicate: (item: any) => boolean): Query; + /** Groups the current Query data. */ + groupBy(getter: Object): Query; + /** Applies the specified transformation to each item. */ + select(getter: Object): Query; + /** Limits the data item count. */ + slice(skip: number, take?: number): Query; + /** Sorts current Query data. */ + sortBy(getter: Object, desc: boolean): Query; + /** Sorts current Query data. */ + sortBy(getter: Object): Query; + /** Calculates the sum of item getter values in the current Query. */ + sum(getter: Object): JQueryPromise; + /** Calculates the sum of item values in the current Query. */ + sum(): JQueryPromise; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object): Query; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object, desc: boolean): Query; + /** Returns the array of current Query items. */ + toArray(): Array; + } + /** The global data layer error handler. */ + export var errorHandler: (e: Error) => void; + /** Encodes the specified string or array of bytes to base64 encoding. */ + export function base64_encode(input: any): string; + /** Creates a Query instance. */ + export function query(array: Array): Query; + /** Creates a Query instance for accessing the remote service specified by a URL. */ + export function query(url: string, queryOptions: Object): Query; + /** This section describes the utility objects provided by the DevExtreme data layer. */ + export var utils: { + /** Compiles a getter function from the getter expression. */ + compileGetter(expr: any): Function; + /** Compiles a setter function from the setter expression. */ + compileSetter(expr: any): Function; + odata: { + /** Holds key value converters for OData. */ + keyConverters: { + String(value: any): string; + Int32(value: any): number; + Int64(value: any): EdmLiteral; + Guid(value: any): Guid; + Boolean(value: any): boolean; + Single(value: any): EdmLiteral; + Decimal(value: any): EdmLiteral; + }; + } + } + } + /** An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications. */ + export module ui { + export interface WidgetOptions extends DOMComponentOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + /** Specifies whether or not the widget can be focused. */ + focusStateEnabled?: boolean; + /** Specifies a shortcut key that sets focus on the widget element. */ + accessKey?: string; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** Specifies the widget tab index. */ + tabIndex?: number; + /** Specifies the text of the hint displayed for the widget. */ + hint?: string; + } + /** The base class for widgets. */ + export class Widget extends DOMComponent { + constructor(options?: WidgetOptions); + /** Redraws the widget. */ + repaint(): void; + /** Sets focus on the widget. */ + focus(): void; + /** Registers a handler when a specified key is pressed. */ + registerKeyHandler(key: string, handler: Function): void; + } + export interface CollectionWidgetOptions extends WidgetOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** The time period in milliseconds before the onItemHold event is raised. */ + itemHoldTimeout?: number; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + loopItemFocus?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + onContentReady?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemContextMenu event. */ + onItemContextMenu?: Function; + /** A handler for the itemHold event. */ + onItemHold?: Function; + /** A handler for the itemRendered event. */ + onItemRendered?: Function; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** The index of the currently selected widget item. */ + selectedIndex?: number; + /** The selected item object. */ + selectedItem?: Object; + /** An array of currently selected item objects. */ + selectedItems?: Array; + /** A handler for the itemDeleting event. */ + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + } + /** The base class for widgets containing an item collection. */ + export class CollectionWidget extends Widget { + constructor(element: JQuery, options?: CollectionWidgetOptions); + constructor(element: HTMLElement, options?: CollectionWidgetOptions); + selectItem(itemElement: any): void; + unselectItem(itemElement: any): void; + deleteItem(itemElement: any): JQueryPromise; + isItemSelected(itemElement: any): boolean; + reorderItem(itemElement: any, toItemElement: any): JQueryPromise; + } + export interface DataExpressionMixinOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of a data source item field whose value is held in the value configuration option. */ + valueExpr?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** The currently selected value in the widget. */ + value?: Object; + } + export interface EditorOptions extends WidgetOptions { + /** The currently specified value. */ + value?: Object; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** A Boolean value specifying whether or not the widget is read-only. */ + readOnly?: boolean; + /** Holds the object that defines the error that occurred during validation. */ + validationError?: Object; + /** Specifies whether the editor's value is valid. */ + isValid?: boolean; + /** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ + validationMessageMode?: string; + } + /** A base class for editors. */ + export class Editor extends Widget { + /** Resets the editor's value to undefined. */ + reset(): void; + } + /** An object that serves as a namespace for methods displaying a message in an application/site. */ + export var dialog: { + /** Creates an alert dialog message containing a single "OK" button. */ + alert(message: string, title: string): JQueryPromise; + /** Creates a confirm dialog that contains "Yes" and "No" buttons. */ + confirm(message: string, title: string): JQueryPromise; + /** Creates a custom dialog using the options specified by the passed configuration object. */ + custom(options: { title?: string; message?: string; buttons?: Array; }): { + show(): JQueryPromise; + hide(): void; + hide(value: any): void; + }; + }; + /** Creates a toast message. */ + export function notify(message: any, type: string, displayTime: number): void; + /** Creates a toast message. */ + export function notify(options: Object): void; + /** An object that serves as a namespace for the methods that work with DevExtreme CSS Themes. */ + export var themes: { + /** Returns the name of the currently applied theme. */ + current(): string; + /** Changes the current theme to the specified one. */ + current(themeName: string): void; + }; + /** Sets a specified template engine. */ + export function setTemplateEngine(name: string): void; + /** Sets a custom template engine defined via custom compile and render functions. */ + export function setTemplateEngine(options: Object): void; + } + /** An object that serves as a namespace for utility methods that can be helpful when working with the DevExtreme framework and UI widgets. */ + export var utils: { + /** Sets parameters for the viewport meta tag. */ + initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + /** Requests that the browser call a specified function to update animation before the next repaint. */ + requestAnimationFrame(callback: Function): number; + /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ + cancelAnimationFrame(requestID: number): void; + }; + /** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */ + export module viz { + /** Applies a theme for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(theme: string): void; + /** Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(platform: string, colorScheme: string): void; + /** Registers a new theme based on the existing one. */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** Applies a predefined or registered custom palette to all visualization widgets at once. */ + export function currentPalette(paletteName: string): void; + /** Obtains the color sets of a predefined or registered palette. */ + export function getPalette(paletteName: string): Object; + /** Registers a new palette. */ + export function registerPalette(paletteName: string, palette: Object): void; + } +} +declare module DevExpress.ui { + export interface dxValidatorOptions extends DOMComponentOptions { + /** An array of validation rules to be checked for the editor with which the dxValidator object is associated. */ + validationRules?: Array; + /** Specifies the editor name to be used in the validation default messages. */ + name?: string; + /** An object that specifies what and when to validate and how to apply the validation result. */ + adapter?: Object; + /** Specifies the validation group the editor will be related to. */ + validationGroup?: string; + /** A handler for the validated event. */ + onValidated?: (params: validationEngine.ValidatorValidationResult) => void; + } + /** A widget that is used to validate the associated DevExtreme editors against the defined validation rules. */ + export class dxValidator extends DOMComponent implements validationEngine.IValidator { + constructor(element: JQuery, options?: dxValidatorOptions); + constructor(element: Element, options?: dxValidatorOptions); + /** Validates the value of the editor that is controlled by the current dxValidator object against the list of the specified validation rules. */ + validate(): validationEngine.ValidatorValidationResult; + /** Resets the value and validation result of the editor associated with the current dxValidator object. */ + reset(): void; + } + /** The widget that is used in the Knockout and Angular approaches to combine the editors to be validated. */ + export class dxValidationGroup extends DOMComponent { + constructor(element: JQuery); + constructor(element: Element); + /** Validates rules of the validators that belong to the current validation group. */ + validate(): validationEngine.ValidationGroupValidationResult; + /** Resets the value and validation result of the editors that are included to the current validation group. */ + reset(): void; + } + export interface dxValidationSummaryOptions extends CollectionWidgetOptions { + /** Specifies the validation group for which summary should be generated. */ + validationGroup?: string; + } + /** A widget for displaying the result of checking validation rules for editors. */ + export class dxValidationSummary extends CollectionWidget { + constructor(element: JQuery, options?: dxValidationSummaryOptions); + constructor(element: Element, options?: dxValidationSummaryOptions); + } + export interface dxResizableOptions extends DOMComponentOptions { + /** Specifies which borders of the widget element are used as a handle. */ + handles?: string; + /** Specifies the lower width boundary for resizing. */ + minWidth?: number; + /** Specifies the upper width boundary for resizing. */ + maxWidth?: number; + /** Specifies the lower height boundary for resizing. */ + minHeight?: number; + /** Specifies the upper height boundary for resizing. */ + maxHeight?: number; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + } + /** A widget that displays required content in a resizable element. */ + export class dxResizable extends DOMComponent { + constructor(element: JQuery, options?: dxResizableOptions); + constructor(element: Element, options?: dxResizableOptions); + } + export interface dxTooltipOptions extends dxPopoverOptions { + } + /** A tooltip widget. */ + export class dxTooltip extends dxPopover { + constructor(element: JQuery, options?: dxTooltipOptions); + constructor(element: Element, options?: dxTooltipOptions); + } + export interface dxDropDownListOptions extends dxDropDownEditorOptions, DataExpressionMixinOptions { + /** Returns the value currently displayed by the widget. */ + displayValue?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies whether or not the widget displays unfiltered values until a user types a number of characters exceeding the minSearchLength option value. */ + showDataBeforeSearch?: boolean; + /** Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */ + searchExpr?: any; + /** Specifies the binary operation used to filter data. */ + searchMode?: string; + /** Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed. */ + searchTimeout?: number; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget supports searching. */ + searchEnabled?: boolean; + /** + * Specifies whether or not the widget displays items by pages. + * @deprecated Use the DataSource paging opportunities instead. + */ + pagingEnabled?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** A handler for the itemClick event. */ + onItemClick?: Function; + onContentReady?: Function; + } + /** A base class for drop-down list widgets. */ + export class dxDropDownList extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDropDownListOptions); + constructor(element: Element, options?: dxDropDownListOptions); + } + export interface dxToolbarOptions extends CollectionWidgetOptions { + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** Informs the widget about its location in a view HTML markup. */ + renderAs?: string; + } + /** A toolbar widget. */ + export class dxToolbar extends CollectionWidget { + constructor(element: JQuery, options?: dxToolbarOptions); + constructor(element: Element, options?: dxToolbarOptions); + } + export interface dxToastOptions extends dxOverlayOptions { + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** The time span in milliseconds during which the dxToast widget is visible. */ + displayTime?: number; + height?: any; + /** The dxToast message text. */ + message?: string; + position?: PositionOptions; + shading?: boolean; + /** Specifies the dxToast widget type. */ + type?: string; + width?: any; + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user swipes it out of the screen boundaries. */ + closeOnSwipe?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user clicks it. */ + closeOnClick?: boolean; + } + /** The toast message widget. */ + export class dxToast extends dxOverlay { + constructor(element: JQuery, options?: dxToastOptions); + constructor(element: Element, options?: dxToastOptions); + } + export interface dxTextEditorOptions extends EditorOptions { + /** A handler for the change event. */ + onChange?: Function; + /** A handler for the copy event. */ + onCopy?: Function; + /** A handler for the cut event. */ + onCut?: Function; + /** A handler for the enterKey event. */ + onEnterKey?: Function; + /** A handler for the focusIn event. */ + onFocusIn?: Function; + /** A handler for the focusOut event. */ + onFocusOut?: Function; + /** A handler for the input event. */ + onInput?: Function; + /** A handler for the keyDown event. */ + onKeyDown?: Function; + /** A handler for the keyPress event. */ + onKeyPress?: Function; + /** A handler for the keyUp event. */ + onKeyUp?: Function; + /** A handler for the paste event. */ + onPaste?: Function; + /** The text displayed by the widget when the widget value is empty. */ + placeholder?: string; + /** Specifies whether to display the Clear button in the widget. */ + showClearButton?: boolean; + /** Specifies the current value displayed by the widget. */ + value?: any; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + /** Specifies HTML attributes applied to the inner input element of the widget. */ + attr?: Object; + /** The read-only option that holds the text displayed by the widget input element. */ + text?: string; + focusStateEnabled?: boolean; + hoverStateEnabled?: boolean; + /** The editor mask that specifies the format of the entered string. */ + mask?: string; + /** Specifies a mask placeholder character. */ + maskChar?: string; + /** Specifies custom mask rules. */ + maskRules?: Object; + /** A message displayed when the entered text does not match the specified pattern. */ + maskInvalidMessage?: string; + /** Specifies whether the value option holds only characters entered by a user or prompt characters as well. */ + useMaskedValue?: boolean; + } + /** A base class for text editing widgets. */ + export class dxTextEditor extends Editor { + constructor(element: JQuery, options?: dxTextEditorOptions); + constructor(element: Element, options?: dxTextEditorOptions); + /** Removes focus from the input element. */ + blur(): void; + /** Sets focus to the input element representing the widget. */ + focus(): void; + } + export interface dxTextBoxOptions extends dxTextEditorOptions { + /** Specifies the maximum number of characters you can enter into the textbox. */ + maxLength?: any; + /** The "mode" attribute value of the actual HTML input element representing the text box. */ + mode?: string; + } + /** A single-line text box widget. */ + export class dxTextBox extends dxTextEditor { + constructor(element: JQuery, options?: dxTextBoxOptions); + constructor(element: Element, options?: dxTextBoxOptions); + } + export interface dxTextAreaOptions extends dxTextBoxOptions { + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + } + /** A widget used to display and edit multi-line text. */ + export class dxTextArea extends dxTextBox { + constructor(element: JQuery, options?: dxTextAreaOptions); + constructor(element: Element, options?: dxTextAreaOptions); + } + export interface dxTabsOptions extends CollectionWidgetOptions { + /** Specifies whether the widget enables an end-user to select only a single item or multiple items. */ + selectionMode?: string; + /** Specifies whether or not an end-user can scroll tabs by swiping. */ + scrollByContent?: boolean; + /** Specifies whether or not an end-user can scroll tabs. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A tab strip used to switch between pages. */ + export class dxTabs extends CollectionWidget { + constructor(element: JQuery, options?: dxTabsOptions); + constructor(element: Element, options?: dxTabsOptions); + } + export interface dxTabPanelOptions extends dxMultiViewOptions { + /** A handler for the titleClick event. */ + onTitleClick?: any; + /** A handler for the titleHold event. */ + onTitleHold?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** A Boolean value specifying if the list is scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether to enable or disable scrolling. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A widget used to display a view and to switch between several views by clicking the appropriate tabs. */ + export class dxTabPanel extends dxMultiView { + constructor(element: JQuery, options?: dxTabPanelOptions); + constructor(element: Element, options?: dxTabPanelOptions); + } + export interface dxSelectBoxOptions extends dxDropDownListOptions { + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + /** The text that is provided as a hint in the select box editor. */ + placeholder?: string; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + } + /** A widget that allows you to select an item in a dropdown list. */ + export class dxSelectBox extends dxDropDownList { + constructor(element: JQuery, options?: dxSelectBoxOptions); + constructor(element: Element, options?: dxSelectBoxOptions); + } + export interface dxTagBoxOptions extends dxSelectBoxOptions { + /** Holds the list of selected values. */ + values?: Array; + /** A read-only option that holds the last selected value. */ + value?: Object; + } + /** A widget that allows you to select multiple items from a dropdown list. */ + export class dxTagBox extends dxSelectBox { + constructor(element: JQuery, options?: dxTagBoxOptions); + constructor(element: Element, options?: dxTagBoxOptions); + } + export interface dxScrollViewOptions extends dxScrollableOptions { + /** A handler for the pullDown event. */ + onPullDown?: Function; + /** Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the reachBottom event. */ + onReachBottom?: Function; + /** Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom. */ + reachBottomText?: string; + /** Specifies the text shown in the pullDown panel displayed when the content is being refreshed. */ + refreshingText?: string; + } + /** A widget used to display scrollable content. */ + export class dxScrollView extends dxScrollable { + constructor(element: JQuery, options?: dxScrollViewOptions); + constructor(element: Element, options?: dxScrollViewOptions); + /** Returns a value indicating if the scrollView content is larger then the widget container. */ + isFull(): boolean; + /** Locks the widget until the release(preventScrollBottom) method is called and executes the function passed to the onPullDown option and the handler assigned to the pullDown event. */ + refresh(): void; + /** Notifies the scroll view that data loading is finished. */ + release(preventScrollBottom: boolean): JQueryPromise; + /** Toggles the loading state of the widget. */ + toggleLoading(showOrHide: boolean): void; + } + export interface dxScrollableLocation { + top?: number; + left?: number; + } + export interface dxScrollableOptions extends DOMComponentOptions { + /** A string value specifying the available scrolling directions. */ + direction?: string; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A handler for the scroll event. */ + onScroll?: Function; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** A handler for the update event. */ + onUpdated?: Function; + /** Indicates whether to use native or simulated scrolling. */ + useNative?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content swiping it up or down. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content using the scrollbar. */ + scrollByThumb?: boolean; + } + /** A widget used to display scrollable content. */ + export class dxScrollable extends DOMComponent { + constructor(element: JQuery, options?: dxScrollableOptions); + constructor(element: Element, options?: dxScrollableOptions); + /** Returns the height of the scrollable widget in pixels. */ + clientHeight(): number; + /** Returns the width of the scrollable widget in pixels. */ + clientWidth(): number; + /** Returns an HTML element of the widget. */ + content(): JQuery; + /** Scrolls the widget content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Scrolls widget content by the specified number of pixels in horizontal and vertical directions. */ + scrollBy(distanceObject: dxScrollableLocation): void; + /** Returns the height of the scrollable content in pixels. */ + scrollHeight(): number; + /** Returns the current scroll position against the leftmost position. */ + scrollLeft(): number; + /** Returns how far the scrollable content is scrolled from the top and from the left. */ + scrollOffset(): dxScrollableLocation; + /** Scrolls widget content to the specified position. */ + scrollTo(targetLocation: number): void; + /** Scrolls widget content to a specified position. */ + scrollTo(targetLocation: dxScrollableLocation): void; + /** Scrolls widget content to the specified element. */ + scrollToElement(element: Element): void; + /** Returns the current scroll position against the topmost position. */ + scrollTop(): number; + /** Returns the width of the scrollable content in pixels. */ + scrollWidth(): number; + /** Updates the dimensions of the scrollable contents. */ + update(): void; + } + export interface dxRadioGroupOptions extends EditorOptions, DataExpressionMixinOptions { + activeStateEnabled?: boolean; + /** Specifies the radio group layout. */ + layout?: string; + } + /** A widget that enables a user to select one item within a list of items represented by radio buttons. */ + export class dxRadioGroup extends CollectionWidget { + constructor(element: JQuery, options?: dxRadioGroupOptions); + constructor(element: Element, options?: dxRadioGroupOptions); + } + export interface dxPopupButtonOptions { + /** Specifies whether or not a toolbar item must be displayed disabled. */ + disabled?: boolean; + /** Specifies html code inserted into the toolbar item element. */ + html?: string; + /** Specifies a location for the item on the toolbar. */ + location?: string; + /** Specifies a configuration object for the widget that presents a toolbar item. */ + options?: Object; + /** Specifies an item template that should be used to render this item only. */ + template?: any; + /** Specifies text displayed for the toolbar item. */ + text?: string; + /** Specifies whether the item is displayed on a top or bottom toolbar. */ + toolbar?: string; + /** Specifies whether or not a widget item must be displayed. */ + visible?: boolean; + /** A widget that presents a toolbar item. */ + widget?: string; + } + export interface dxPopupOptions extends dxOverlayOptions { + /** Specifies whether or not to allow a user to drag the popup window. */ + dragEnabled?: boolean; + /** A Boolean value specifying whether or not to display the widget in full-screen mode. */ + fullScreen?: boolean; + position?: PositionOptions; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showTitle?: boolean; + /** The title in the overlay window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + width?: any; + /** Specifies items displayed on the top or bottom toolbar of the popup window. */ + buttons?: Array; + /** Specifies whether or not the widget displays the Close button. */ + showCloseButton?: boolean; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + } + /** A widget that displays required content in a popup window. */ + export class dxPopup extends dxOverlay { + constructor(element: JQuery, options?: dxPopupOptions); + constructor(element: Element, options?: dxPopupOptions); + } + export interface dxPopoverOptions extends dxPopupOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** Specifies the height of the widget. */ + height?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + shading?: boolean; + /** A Boolean value specifying whether or not to display the title in the overlay window. */ + showTitle?: boolean; + /** The target element associated with a popover. */ + target?: any; + /** Specifies the width of the widget. */ + width?: any; + } + /** A widget that displays the required content in a popup window. */ + export class dxPopover extends dxPopup { + constructor(element: JQuery, options?: dxPopoverOptions); + constructor(element: Element, options?: dxPopoverOptions); + /** Displays the widget for the specified target element. */ + show(target?: any): JQueryPromise; + } + export interface dxOverlayOptions extends WidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** A Boolean value specifying whether or not the widget is closed if a user presses the Back hardware button. */ + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlapping window. */ + closeOnOutsideClick?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + /** Specifies whether or not an end-user can drag the widget. */ + dragEnabled?: boolean; + /** Specifies whether or not an end user can resize the widget. */ + resizeEnabled?: boolean; + /** The height of the widget in pixels. */ + height?: any; + /** Specifies the maximum height the widget can reach while resizing. */ + maxHeight?: any; + /** Specifies the maximum width the widget can reach while resizing. */ + maxWidth?: any; + /** Specifies the minimum height the widget can reach while resizing. */ + minHeight?: any; + /** Specifies the minimum width the widget can reach while resizing. */ + minWidth?: any; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** A Boolean value specifying whether or not the main screen is inactive while the widget is active. */ + shading?: boolean; + /** Specifies the shading color. */ + shadingColor?: string; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + onContentReady?: Function; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** The widget width in pixels. */ + width?: any; + } + /** A widget displaying the required content in an overlay window. */ + export class dxOverlay extends Widget { + constructor(element: JQuery, options?: dxOverlayOptions); + constructor(element: Element, options?: dxOverlayOptions); + /** An HTML element of the widget. */ + content(): JQuery; + /** Hides the widget. */ + hide(): JQueryPromise; + /** Recalculates the overlay's size and position. */ + repaint(): void; + /** Shows the widget. */ + show(): JQueryPromise; + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** A static method that specifies the base z-index for all overlay widgets. */ + static baseZIndex(zIndex: number): void; + } + export interface dxNumberBoxOptions extends dxTextEditorOptions { + /** The maximum value accepted by the number box. */ + max?: number; + /** The minimum value accepted by the number box. */ + min?: number; + /** Specifies whether or not to show spin buttons. */ + showSpinButtons?: boolean; + useTouchSpinButtons?: boolean; + /** Specifies by which value the widget value changes when a spin button is clicked. */ + step?: number; + /** The current number box value. */ + value?: number; + /** The "mode" attribute value of the actual HTML input element representing the widget. */ + mode?: string; + } + /** A textbox widget that enables a user to enter numeric values. */ + export class dxNumberBox extends dxTextEditor { + constructor(element: JQuery, options?: dxNumberBoxOptions); + constructor(element: Element, options?: dxNumberBoxOptions); + } + export interface dxNavBarOptions extends dxTabsOptions { + scrollingEnabled?: boolean; + } + /** A widget that contains items used to navigate through application views. */ + export class dxNavBar extends dxTabs { + constructor(element: JQuery, options?: dxNavBarOptions); + constructor(element: Element, options?: dxNavBarOptions); + } + export interface dxMultiViewOptions extends CollectionWidgetOptions { + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently displayed item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to change the selected index by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget used to display a view and to switch between several views. */ + export class dxMultiView extends CollectionWidget { + constructor(element: JQuery, options?: dxMultiViewOptions); + constructor(element: Element, options?: dxMultiViewOptions); + } + export interface dxMapOptions extends WidgetOptions { + /** Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route, or when creating a widget if it initially contains markers or routes. */ + autoAdjust?: boolean; + center?: { + /** The latitude location displayed in the center of the widget. */ + lat?: number; + /** The longitude location displayed in the center of the widget. */ + lng?: number; + }; + /** A handler for the click event. */ + onClick?: any; + /** Specifies whether or not map widget controls are available. */ + controls?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** A key used to authenticate the application within the required map provider. */ + key?: { + /** A key used to authenticate the application within the "Bing" map provider. */ + bing?: string; + /** A key used to authenticate the application within the "Google" map provider. */ + google?: string; + /** A key used to authenticate the application within the "Google Static" map provider. */ + googleStatic?: string; + } + /** A handler for the markerAdded event. */ + onMarkerAdded?: Function; + /** A URL pointing to the custom icon to be used for map markers. */ + markerIconSrc?: string; + /** A handler for the markerRemoved event. */ + onMarkerRemoved?: Function; + /** An array of markers displayed on a map. */ + markers?: Array; + /** The name of the current map data provider. */ + provider?: string; + /** A handler for the ready event. */ + onReady?: Function; + /** A handler for the routeAdded event. */ + onRouteAdded?: Function; + /** A handler for the routeRemoved event. */ + onRouteRemoved?: Function; + /** An array of routes shown on the map. */ + routes?: Array; + /** The type of a map to display. */ + type?: string; + /** Specifies the width of the widget. */ + width?: any; + /** The zoom level of the map. */ + zoom?: number; + } + /** An interactive map widget. */ + export class dxMap extends Widget { + constructor(element: JQuery, options?: dxMapOptions); + constructor(element: Element, options?: dxMapOptions); + /** Adds a marker to the map. */ + addMarker(markerOptions: Object): JQueryPromise; + /** Adds a route to the map. */ + addRoute(routeOptions: Object): JQueryPromise; + /** Removes a marker from the map. */ + removeMarker(marker: Object): JQueryPromise; + /** Removes a route from the map. */ + removeRoute(route: any): JQueryPromise; + } + export interface dxLookupOptions extends dxDropDownListOptions { + applyValueMode?: string; + /** An object that defines widget animation options. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + /** The text displayed on the Clear button. */ + clearButtonText?: string; + /** Specifies whether or not the widget cleans the search box when the popup window is displayed. */ + cleanSearchOnOpening?: boolean; + /** A Boolean value specifying whether or not a widget is closed if a user clicks outside of the overlaying window. */ + closeOnOutsideClick?: any; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** A Boolean value specifying whether or not to display the lookup in full-screen mode. */ + fullScreen?: boolean; + focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not to group widget items. */ + grouped?: boolean; + /** The name of the template used to display a group header. */ + groupTemplate?: any; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies the text shown in the pullDown panel, which is displayed when the widget is scrolled to the bottom. */ + pageLoadingText?: string; + /** The text displayed by the widget when nothing is selected. */ + placeholder?: string; + /** The height of the widget popup element. */ + popupHeight?: any; + /** The width of the widget popup element. */ + popupWidth?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the text displayed in the pullDown panel when the widget is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the widget is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + /** A Boolean value specifying whether or not the search bar is visible. */ + searchEnabled?: boolean; + /** The text that is provided as a hint in the lookup's search bar. */ + searchPlaceholder?: string; + /** A Boolean value specifying whether or not the main screen is inactive while the lookup is active. */ + shading?: boolean; + /** Specifies whether to display the Cancel button in the lookup window. */ + showCancelButton?: boolean; + /** + * A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. + * @deprecated Use the pageLoadMode option instead. + */ + showNextButton?: boolean; + /** The title of the lookup window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** Specifies whether or not to show lookup contents in a dxPopover widget. */ + usePopover?: boolean; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showPopupTitle?: boolean; + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + } + /** A widget that allows a user to select predefined values from a lookup window. */ + export class dxLookup extends dxDropDownList { + constructor(element: JQuery, options?: dxLookupOptions); + constructor(element: Element, options?: dxLookupOptions); + } + export interface dxLoadPanelOptions extends dxOverlayOptions { + /** An object defining the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** The delay in milliseconds after which the load panel is displayed. */ + delay?: number; + /** The height of the widget. */ + height?: number; + /** A URL pointing to an image to be used as a load indicator. */ + indicatorSrc?: string; + /** The text displayed in the load panel. */ + message?: string; + /** A Boolean value specifying whether or not to show a load indicator. */ + showIndicator?: boolean; + /** A Boolean value specifying whether or not to show the pane behind the load indicator. */ + showPane?: boolean; + /** The width of the widget. */ + width?: number; + } + /** A widget used to indicate whether or not an element is loading. */ + export class dxLoadPanel extends dxOverlay { + constructor(element: JQuery, options?: dxLoadPanelOptions); + constructor(element: Element, options?: dxLoadPanelOptions); + } + export interface dxLoadIndicatorOptions extends WidgetOptions { + /** Specifies the path to an image used as the indicator. */ + indicatorSrc?: string; + } + /** The widget used to indicate the loading process. */ + export class dxLoadIndicator extends Widget { + constructor(element: JQuery, options?: dxLoadIndicatorOptions); + constructor(element: Element, options?: dxLoadIndicatorOptions); + } + /** An object containing items for a context menu called for a list item. */ + export interface ListOptionsMenuItem { + /** Specifies the menu item text. */ + text?: string; + /** Specifies the function called when the menu item is clicked. */ + action?: (itemElement: Element, itemData: any) => void; + } + export interface dxListOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not to display a grouped list. */ + grouped?: boolean; + /** The template to be used for rendering item groups. */ + groupTemplate?: any; + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the groupRendered event. */ + onGroupRendered?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemSwipe event. */ + onItemSwipe?: Function; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies the text shown in the pullDown panel, which is displayed when the list is scrolled to the bottom. */ + pageLoadingText?: string; + /** Specifies the text displayed in the pullDown panel when the list is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the list is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + /** A Boolean value specifying whether to enable or disable list scrolling. */ + scrollingEnabled?: boolean; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying if the list is scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value specifying if the list is scrolled using the scrollbar. */ + scrollByThumb?: boolean; + onItemContextMenu?: Function; + onItemHold?: Function; + /** Specifies whether or not an end-user can collapse groups. */ + collapsibleGroups?: boolean; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies whether or not to display controls used to select list items. */ + showSelectionControls?: boolean; + /** Specifies item selection mode. */ + selectionMode?: string; + selectAllText?: string; + onSelectAllChanged?: Function; + /** Specifies the array of items for a context menu called for a list item. */ + menuItems?: Array; + /** Specifies whether an item context menu is shown when a user holds or swipes an item. */ + menuMode?: string; + /** Specifies whether or not an end user can delete list items. */ + allowItemDeleting?: boolean; + /** Specifies the way a user can delete items from the list. */ + itemDeleteMode?: string; + /** Specifies whether or not an end user can reorder list items. */ + allowItemReordering?: boolean; + /** Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ + indicateLoading?: boolean; + activeStateEnabled?: boolean; + } + /** A list widget. */ + export class dxList extends CollectionWidget { + constructor(element: JQuery, options?: dxListOptions); + constructor(element: Element, options?: dxListOptions); + /** Returns the height of the widget in pixels. */ + clientHeight(): number; + /** Removes the specified item from the list. */ + deleteItem(itemIndex: any): JQueryPromise; + /** Removes the specified item from the list. */ + deleteItem(itemElement: Element): JQueryPromise; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemIndex: any): boolean; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemElement: Element): boolean; + /** Reloads list data. */ + reload(): void; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemElement: Element, toItemElement: Element): JQueryPromise; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemIndex: any, toItemIndex: any): JQueryPromise; + /** Scrolls the list content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Returns the height of the list content in pixels. */ + scrollHeight(): number; + /** Scrolls list content to the specified position. */ + scrollTo(location: number): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemElement: Element): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemIndex: any): void; + /** Returns how far the list content is scrolled from the top. */ + scrollTop(): number; + /** Selects the specified item from the list. */ + selectItem(itemElement: Element): void; + /** Selects the specified item from the list. */ + selectItem(itemIndex: any): void; + /** Deselects the specified item from the list. */ + unselectItem(itemElement: Element): void; + /** Unselects the specified item from the list. */ + unselectItem(itemIndex: any): void; + /** Updates the widget scrollbar according to widget content size. */ + updateDimensions(): JQueryPromise; + /** Expands the specified group. */ + expandGroup(groupIndex: number): JQueryPromise; + /** Collapses the specified group. */ + collapseGroup(groupIndex: number): JQueryPromise; + } + export interface dxGalleryOptions extends CollectionWidgetOptions { + /** The time, in milliseconds, spent on slide animation. */ + animationDuration?: number; + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to allow users to switch between items by clicking an indicator. */ + indicatorEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently active gallery item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to display an indicator that points to the selected gallery item. */ + showIndicator?: boolean; + /** A Boolean value that specifies the availability of the "Forward" and "Back" navigation buttons. */ + showNavButtons?: boolean; + /** The time interval in milliseconds, after which the gallery switches to the next item. */ + slideshowDelay?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether or not to display parts of previous and next images along the sides of the current image. */ + wrapAround?: boolean; + /** Specifies if the widget stretches images to fit the total gallery width. */ + stretchImages?: boolean; + /** Specifies the width of an area used to display a single image. */ + initialItemWidth?: number; + } + /** An image gallery widget. */ + export class dxGallery extends CollectionWidget { + constructor(element: JQuery, options?: dxGalleryOptions); + constructor(element: Element, options?: dxGalleryOptions); + /** Shows the specified gallery item. */ + goToItem(itemIndex: number, animation: boolean): JQueryPromise; + /** Shows the next gallery item. */ + nextItem(animation: boolean): JQueryPromise; + /** Shows the previous gallery item. */ + prevItem(animation: boolean): JQueryPromise; + } + export interface dxDropDownEditorOptions extends dxTextBoxOptions { + /** Specifies the current value displayed by the widget. */ + value?: Object; + /** A handler for the closed event. */ + onClosed?: Function; + /** A handler for the opened event. */ + onOpened?: Function; + /** Specifies whether or not the drop-down editor is displayed. */ + opened?: boolean; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + /** Specifies the way an end-user applies the selected value. */ + applyValueMode?: string; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + activeStateEnabled?: boolean; + } + /** A drop-down editor widget. */ + export class dxDropDownEditor extends dxTextBox { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Closes the drop-down editor. */ + close(): void; + /** Opens the drop-down editor. */ + open(): void; + /** Resets the widget's value to null. */ + reset(): void; + /** Returns an <input> element of the widget. */ + field(): JQuery; + /** Returns an HTML element of the popup window content. */ + content(): JQuery; + } + export interface dxDateBoxOptions extends dxTextEditorOptions { + /** A format used to display date/time information. */ + format?: string; + /** A Globalize format string specifying the date display format. */ + formatString?: string; + /** The last date that can be selected within the widget. */ + max?: any; + /** The minimum date that can be selected within the widget. */ + min?: any; + /** The text displayed by the widget when the widget value is not yet specified. This text is also used as a title of the date picker. */ + placeholder?: string; + /** + * Specifies whether or not a user can pick out a date using the drop-down calendar. + * @deprecated Use the pickerType option instead. + */ + useCalendar?: boolean; + /** An object or a value, specifying the date and time currently selected using the date box. */ + value?: any; + /** + * Specifies whether or not the widget uses the native HTML input element. + * @deprecated Use the pickerType option instead. + */ + useNative?: boolean; + /** Specifies the interval between neighboring values in the popup list in minutes. */ + interval?: number; + /** Specifies the maximum zoom level of a calendar, which is used to pick the date. */ + maxZoomLevel?: string; + /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ + minZoomLevel?: string; + /** Specifies the type of date/time picker. */ + pickerType?: string; + /** Specifies the message displayed if the typed value is not a valid date or time. */ + invalidDateMessage?: string; + /** Specifies the message displayed if the specified date is later than the max value or earlier than the min value. */ + dateOutOfRangeMessage?: string; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + } + /** A date box widget. */ + export class dxDateBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDateBoxOptions); + constructor(element: Element, options?: dxDateBoxOptions); + } + export interface dxCheckBoxOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Specifies the widget state. */ + value?: boolean; + /** Specifies the text displayed by the check box. */ + text?: string; + } + /** A check box widget. */ + export class dxCheckBox extends Editor { + constructor(element: JQuery, options?: dxCheckBoxOptions); + constructor(element: Element, options?: dxCheckBoxOptions); + } + export interface dxCalendarOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Specifies a date displayed on the current calendar page. */ + currentDate?: Date; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** An object or a value, specifying the date and time currently selected in the calendar. */ + value?: any; + /** The latest date the widget allows to select. */ + max?: any; + /** The earliest date the widget allows to select. */ + min?: any; + /** Specifies whether or not the widget displays a button that selects the current date. */ + showTodayButton?: boolean; + /** Specifies the current calendar zoom level. */ + zoomLevel?: string; + /** Specifies the maximum zoom level of the calendar. */ + maxZoomLevel?: string; + /** Specifies the minimum zoom level of the calendar. */ + minZoomLevel?: string; + /** The template to be used for rendering calendar cells. */ + cellTemplate?: any; + } + /** A calendar widget. */ + export class dxCalendar extends Editor { + constructor(element: JQuery, options?: dxCalendarOptions); + constructor(element: Element, options?: dxCalendarOptions); + } + export interface dxButtonOptions extends WidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A handler for the click event. */ + onClick?: any; + /** Specifies the icon to be displayed on the button. */ + icon?: string; + iconSrc?: string; + /** A template to be used for rendering the dxButton widget. */ + template?: any; + /** The text displayed on the button. */ + text?: string; + /** Specifies the button type. */ + type?: string; + /** Specifies the name of the validation group to be accessed in the click event handler. */ + validationGroup?: string; + } + /** A button widget. */ + export class dxButton extends Widget { + constructor(element: JQuery, options?: dxButtonOptions); + constructor(element: Element, options?: dxButtonOptions); + } + export interface dxBoxOptions extends CollectionWidgetOptions { + /** Specifies how widget items are aligned along the main direction. */ + align?: string; + /** Specifies the direction of item positioning in the widget. */ + direction?: string; + /** Specifies how widget items are aligned cross-wise. */ + crossAlign?: string; + } + /** A container widget used to arrange inner elements. */ + export class dxBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxResponsiveBoxOptions extends CollectionWidgetOptions { + /** Specifies the collection of rows for the grid used to position layout elements. */ + rows?: Array; + /** Specifies the collection of columns for the grid used to position layout elements. */ + cols?: Array; + /** Specifies the function returning the screen factor depending on the screen width. */ + screenByWidth?: (width: number) => string; + /** Specifies the screen factor with which all elements are located in a single column. */ + singleColumnScreen?: string; + } + /** A widget used to build an adaptive markup that is dependent on screen resolution. */ + export class dxResponsiveBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxAutocompleteOptions extends dxDropDownListOptions { + /** Specifies the current value displayed by the widget. */ + value?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies the maximum count of items displayed by the widget. */ + maxItemCount?: number; + /** Gets the currently selected item. */ + selectedItem?: Object; + } + /** A textbox widget that supports autocompletion. */ + export class dxAutocomplete extends dxDropDownList { + constructor(element: JQuery, options?: dxAutocompleteOptions); + constructor(element: Element, options?: dxAutocompleteOptions); + /** Opens the drop-down editor. */ + open(): void; + /** Closes the drop-down editor. */ + close(): void; + } + export interface dxAccordionOptions extends CollectionWidgetOptions { + /** A number specifying the time in milliseconds spent on the animation of the expanding or collapsing of a panel. */ + animationDuration?: number; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies whether all items can be collapsed or whether at least one item must always be expanded. */ + collapsible?: boolean; + /** Specifies whether the widget can expand several items or only a single item at once. */ + multiple?: boolean; + /** The template to be used for rendering dxAccordion items. */ + itemTemplate?: any; + /** A handler for the itemTitleClick event. */ + onItemTitleClick?: any; + /** A handler for the itemTitleHold event. */ + onItemTitleHold?: Function; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** The index number of the currently selected item. */ + selectedIndex?: number; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget that displays data source items on collapsible panels. */ + export class dxAccordion extends CollectionWidget { + constructor(element: JQuery, options?: dxAccordionOptions); + constructor(element: Element, options?: dxAccordionOptions); + /** Collapses the specified item. */ + collapseItem(index: number): JQueryPromise; + /** Expands the specified item. */ + expandItem(index: number): JQueryPromise; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + } + export interface dxFileUploaderOptions extends EditorOptions { + /** A read-only option that holds a File instance representing the selected file. */ + value?: File; + /** Holds the File instances representing files selected in the widget. */ + values?: Array; + buttonText?: string; + /** The text displayed on the button that opens the file browser. */ + selectButtonText?: string; + /** The text displayed on the button that starts uploading. */ + uploadButtonText?: string; + /** Specifies the text displayed on the area to which an end-user can drop a file. */ + labelText?: string; + /** Specifies the value passed to the name attribute of the underlying input element. */ + name?: string; + /** Specifies whether the widget enables an end-user to select a single file or multiple files. */ + multiple?: boolean; + /** Specifies a file type or several types accepted by the widget. */ + accept?: string; + /** Specifies a target Url for the upload request. */ + uploadUrl?: string; + /** Specifies if an end user can remove a file from the selection and interrupt uploading. */ + allowCanceling?: boolean; + /** Specifies whether or not the widget displays the list of selected files. */ + showFileList?: boolean; + /** Gets the current progress in percentages. */ + progress?: number; + /** The message displayed by the widget when it is ready to upload the specified files. */ + readyToUploadMessage?: string; + /** The message displayed by the widget when uploading is finished. */ + uploadedMessage?: string; + /** The message displayed by the widget on uploading failure. */ + uploadFailedMessage?: string; + /** Specifies how the widget uploads files. */ + uploadMode?: string; + /** A handler for the uploaded event. */ + onUploaded?: Function; + /** A handler for the uploaded event. */ + onProgress?: Function; + /** A handler for the uploadError event. */ + onUploadError?: Function; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + } + /** A widget used to select and upload a file or multiple files. */ + export class dxFileUploader extends Editor { + constructor(element: JQuery, options?: dxFileUploaderOptions); + constructor(element: Element, options?: dxFileUploaderOptions); + } + export interface dxTrackBarOptions extends EditorOptions { + /** The minimum value the widget can accept. */ + min?: number; + /** The maximum value the widget can accept. */ + max?: number; + /** The current widget value. */ + value?: number; + } + /** A base class for track bar widgets. */ + export class dxTrackBar extends Editor { + constructor(element: JQuery, options?: dxTrackBarOptions); + constructor(element: Element, options?: dxTrackBarOptions); + } + export interface dxProgressBarOptions extends dxTrackBarOptions { + /** Specifies a format for the progress status. */ + statusFormat?: any; + /** Specifies whether or not the widget displays a progress status. */ + showStatus?: boolean; + /** A handler for the complete event. */ + onComplete?: Function; + } + /** A widget used to indicate progress. */ + export class dxProgressBar extends dxTrackBar { + constructor(element: JQuery, options?: dxProgressBarOptions); + constructor(element: Element, options?: dxProgressBarOptions); + } + export interface dxSliderOptions extends dxTrackBarOptions { + activeStateEnabled?: boolean; + /** The slider step size. */ + step?: number; + /** The current slider value. */ + value?: number; + /** Specifies whether or not to highlight a range selected within the widget. */ + showRange?: boolean; + /** Specifies the size of a step by which a slider handle is moved when a user uses the Page up or Page down keyboard shortcuts. */ + keyStep?: number; + /** Specifies options for the slider tooltip. */ + tooltip?: { + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies format for the tooltip. */ + format?: any; + /** Specifies whether the tooltip is located over or under the slider. */ + position?: string; + /** Specifies whether the widget always shows a tooltip or only when a pointer is over the slider. */ + showMode?: string; + }; + /** Specifies options for labels displayed at the min and max values. */ + label?: { + /** Specifies whether or not slider labels are visible. */ + visible?: boolean; + /** Specifies whether labels are located over or under the scale. */ + position?: string; + /** Specifies a format for labels. */ + format?: any; + }; + } + /** A widget that allows a user to select a numeric value within a given range. */ + export class dxSlider extends dxTrackBar { + constructor(element: JQuery, options?: dxSliderOptions); + constructor(element: Element, options?: dxSliderOptions); + } + export interface dxRangeSliderOptions extends dxSliderOptions { + /** The left edge of the interval currently selected using the range slider. */ + start?: number; + /** The right edge of the interval currently selected using the range slider. */ + end?: number; + } + /** A widget that enables a user to select a range of numeric values. */ + export class dxRangeSlider extends dxSlider { + constructor(element: JQuery, options?: dxRangeSliderOptions); + constructor(element: Element, options?: dxRangeSliderOptions); + } + export interface dxFormItemLabel { + /** Specifies the label text. */ + text?: string; + /** Specifies whether or not the label is visible. */ + visible?: boolean; + /** Specifies whether or not a colon is displayed at the end of the current label. */ + showColon?: boolean; + /** Specifies the location of a label against the editor. */ + location?: string; + /** Specifies the label horizontal alignment. */ + alignment?: string; + } + export interface dxFormItem { + /** Specifies the type of the current item. */ + itemType?: string; + /** Specifies whether or not the current form item is visible. */ + visible?: boolean; + /** Specifies the sequence number of the item in a form, group or tab. */ + visibleIndex?: number; + /** Specifies a CSS class to be applied to the form item. */ + cssClass?: string; + /** Specifies the number of columns spanned by the item. */ + colSpan?: number; + } + export interface dxFormEmptyItem extends dxFormItem { + /** Specifies the form item name. */ + name?: string; + } + export interface dxFormSimpleItem extends dxFormItem { + /** Specifies the path to the formData object field bound to the current form item. */ + dataField?: string; + /** Specifies the form item name. */ + name?: string; + /** Specifies which editor widget is used to display and edit the form item value. */ + editorType?: string; + /** Specifies configuration options for the editor widget of the current form item. */ + editorOptions?: Object; + /** A template to be used for rendering the form item. */ + template?: any; + /** Specifies the help text displayed for the current form item. */ + helpText?: string; + /** Specifies whether the current form item is required. */ + isRequired?: boolean; + /** Specifies options for the form item label. */ + label?: dxFormItemLabel; + /** An array of validation rules to be checked for the form item editor. */ + validationRules?: Array; + } + export interface dxFormGroupItem extends dxFormItem { + /** Specifies the group caption. */ + caption?: string; + /** A template to be used for rendering the group item. */ + template?: any; + /** The count of columns in the group layout. */ + colCount?: number; + /** Specifies whether or not all group item labels are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the group. */ + items?: Array; + } + export interface dxFormTab { + /** Specifies the tab title. */ + title?: string; + /** The count of columns in the tab layout. */ + colCount?: number; + /** Specifies whether or not labels of items displayed within the current tab are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the tab. */ + items?: Array; + /** Specifies a badge text for the tab. */ + badge?: string; + /** A Boolean value specifying whether or not the tab can respond to user interaction. */ + disabled?: boolean; + /** Specifies the icon to be displayed on the tab. */ + icon?: string; + /** The template to be used for rendering the tab. */ + tabTemplate?: any; + /** The template to be used for rendering the tab content. */ + template?: any; + } + export interface dxFormTabbedItem extends dxFormItem { + /** Holds a configuration object for the dxTabPanel widget used to display the current form item. */ + tabPanelOptions?: Object; + /** An array of tab configuration objects. */ + tabs?: Array; + } + export interface dxFormOptions extends WidgetOptions { + /** An object providing data for the form. */ + formData?: Object; + /** The count of columns in the form layout. */ + colCount?: any; + /** Specifies the location of a label against the editor. */ + labelLocation?: string; + /** Specifies whether or not all editors on the form are read-only. */ + readOnly?: boolean; + /** A handler for the fieldDataChanged event. */ + onFieldDataChanged?: (e: Object) => void; + /** A handler for the editorEnterKey event. */ + onEditorEnterKey?: (e: Object) => void; + /** Specifies a function that customizes a form item after it has been created. */ + customizeItem?: Function; + /** The minimum column width used for calculating column count in the form layout. */ + minColWidth?: number; + /** Specifies whether or not all root item labels are aligned. */ + alignItemLabels?: boolean; + /** Specifies whether or not item labels in all groups are aligned. */ + alignItemLabelsInAllGroups?: boolean; + /** Specifies whether or not a colon is displayed at the end of form labels. */ + showColonAfterLabel?: boolean; + /** Specifies whether or not the required mark is displayed for required fields. */ + showRequiredMark?: boolean; + /** Specifies whether or not the optional mark is displayed for optional fields. */ + showOptionalMark?: boolean; + /** The text displayed for required fields. */ + requiredMark?: string; + /** The text displayed for optional fields. */ + optionalMark?: string; + /** Specifies the message that is shown for end-users if a required field value is not specified. */ + requiredMessage?: string; + /** Specifies whether or not the total validation summary is displayed on the form. */ + showValidationSummary?: boolean; + /** Holds an array of form items. */ + items?: Array; + /** A Boolean value specifying whether to enable or disable form scrolling. */ + scrollingEnabled?: boolean; + onContentReady?: Function; + } + /** A form widget used to display and edit values of object fields. */ + export class dxForm extends Widget { + constructor(element: JQuery, options?: dxFormOptions); + constructor(element: Element, options?: dxFormOptions); + /** Updates the specified field of the formData object and the corresponding editor on the form. */ + updateData(dataField: string, value: any): void; + /** Updates the specified fields of the formData object and the corresponding editors on the form. */ + updateData(data: Object): void; + /** Updates the value of a form item option. */ + itemOption(field: string, option: string, value: any): void; + /** Updates the values of form item options. */ + itemOption(field: string, options: Object): void; + /** Returns an editor instance associated with the specified formData field. */ + getEditor(field: string): Object; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + /** Validates the values of all editors on the form against the list of the validation rules specified for each form item. */ + validate(): Object; + /** Resets the editor's value to undefined. */ + resetValues(): void; + } +} +interface JQuery { + dxProgressBar(): JQuery; + dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; + dxProgressBar(options: string): any; + dxProgressBar(options: string, ...params: any[]): any; + dxProgressBar(options: DevExpress.ui.dxProgressBarOptions): JQuery; + dxSlider(): JQuery; + dxSlider(options: "instance"): DevExpress.ui.dxSlider; + dxSlider(options: string): any; + dxSlider(options: string, ...params: any[]): any; + dxSlider(options: DevExpress.ui.dxSliderOptions): JQuery; + dxRangeSlider(): JQuery; + dxRangeSlider(options: "instance"): DevExpress.ui.dxRangeSlider; + dxRangeSlider(options: string): any; + dxRangeSlider(options: string, ...params: any[]): any; + dxRangeSlider(options: DevExpress.ui.dxRangeSliderOptions): JQuery; + dxFileUploader(): JQuery; + dxFileUploader(options: "instance"): DevExpress.ui.dxFileUploader; + dxFileUploader(options: string): any; + dxFileUploader(options: string, ...params: any[]): any; + dxFileUploader(options: DevExpress.ui.dxFileUploaderOptions): JQuery; + dxValidator(): JQuery; + dxValidator(options: "instance"): DevExpress.ui.dxValidator; + dxValidator(options: string): any; + dxValidator(options: string, ...params: any[]): any; + dxValidator(options: DevExpress.ui.dxValidatorOptions): JQuery; + dxValidationGroup(): JQuery; + dxValidationGroup(options: "instance"): DevExpress.ui.dxValidationGroup; + dxValidationGroup(options: string): any; + dxValidationGroup(options: string, ...params: any[]): any; + dxValidationSummary(): JQuery; + dxValidationSummary(options: "instance"): DevExpress.ui.dxValidationSummary; + dxValidationSummary(options: string): any; + dxValidationSummary(options: string, ...params: any[]): any; + dxValidationSummary(options: DevExpress.ui.dxValidationSummaryOptions): JQuery; + dxTooltip(): JQuery; + dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; + dxTooltip(options: string): any; + dxTooltip(options: string, ...params: any[]): any; + dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; + dxResizable(): JQuery; + dxResizable(options: "instance"): DevExpress.ui.dxResizable; + dxResizable(options: string): any; + dxResizable(options: string, ...params: any[]): any; + dxResizable(options: DevExpress.ui.dxResizableOptions): JQuery; + dxDropDownList(): JQuery; + dxDropDownList(options: "instance"): DevExpress.ui.dxDropDownList; + dxDropDownList(options: string): any; + dxDropDownList(options: string, ...params: any[]): any; + dxDropDownList(options: DevExpress.ui.dxDropDownListOptions): JQuery; + dxToolbar(): JQuery; + dxToolbar(options: "instance"): DevExpress.ui.dxToolbar; + dxToolbar(options: string): any; + dxToolbar(options: string, ...params: any[]): any; + dxToolbar(options: DevExpress.ui.dxToolbarOptions): JQuery; + dxToast(): JQuery; + dxToast(options: "instance"): DevExpress.ui.dxToast; + dxToast(options: string): any; + dxToast(options: string, ...params: any[]): any; + dxToast(options: DevExpress.ui.dxToastOptions): JQuery; + dxTextEditor(): JQuery; + dxTextEditor(options: "instance"): DevExpress.ui.dxTextEditor; + dxTextEditor(options: string): any; + dxTextEditor(options: string, ...params: any[]): any; + dxTextEditor(options: DevExpress.ui.dxTextEditorOptions): JQuery; + dxTextBox(): JQuery; + dxTextBox(options: "instance"): DevExpress.ui.dxTextBox; + dxTextBox(options: string): any; + dxTextBox(options: string, ...params: any[]): any; + dxTextBox(options: DevExpress.ui.dxTextBoxOptions): JQuery; + dxTextArea(): JQuery; + dxTextArea(options: "instance"): DevExpress.ui.dxTextArea; + dxTextArea(options: string): any; + dxTextArea(options: string, ...params: any[]): any; + dxTextArea(options: DevExpress.ui.dxTextAreaOptions): JQuery; + dxTabs(): JQuery; + dxTabs(options: "instance"): DevExpress.ui.dxTabs; + dxTabs(options: string): any; + dxTabs(options: string, ...params: any[]): any; + dxTabs(options: DevExpress.ui.dxTabsOptions): JQuery; + dxTabPanel(): JQuery; + dxTabPanel(options: "instance"): DevExpress.ui.dxTabPanel; + dxTabPanel(options: string): any; + dxTabPanel(options: string, ...params: any[]): any; + dxTabPanel(options: DevExpress.ui.dxTabPanelOptions): JQuery; + dxSelectBox(): JQuery; + dxSelectBox(options: "instance"): DevExpress.ui.dxSelectBox; + dxSelectBox(options: string): any; + dxSelectBox(options: string, ...params: any[]): any; + dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery; + dxTagBox(): JQuery; + dxTagBox(options: "instance"): DevExpress.ui.dxTagBox; + dxTagBox(options: string): any; + dxTagBox(options: string, ...params: any[]): any; + dxTagBox(options: DevExpress.ui.dxTagBoxOptions): JQuery; + dxScrollView(): JQuery; + dxScrollView(options: "instance"): DevExpress.ui.dxScrollView; + dxScrollView(options: string): any; + dxScrollView(options: string, ...params: any[]): any; + dxScrollView(options: DevExpress.ui.dxScrollViewOptions): JQuery; + dxScrollable(): JQuery; + dxScrollable(options: "instance"): DevExpress.ui.dxScrollable; + dxScrollable(options: string): any; + dxScrollable(options: string, ...params: any[]): any; + dxScrollable(options: DevExpress.ui.dxScrollableOptions): JQuery; + dxRadioGroup(): JQuery; + dxRadioGroup(options: "instance"): DevExpress.ui.dxRadioGroup; + dxRadioGroup(options: string): any; + dxRadioGroup(options: string, ...params: any[]): any; + dxRadioGroup(options: DevExpress.ui.dxRadioGroupOptions): JQuery; + dxPopup(): JQuery; + dxPopup(options: "instance"): DevExpress.ui.dxPopup; + dxPopup(options: string): any; + dxPopup(options: string, ...params: any[]): any; + dxPopup(options: DevExpress.ui.dxPopupOptions): JQuery; + dxPopover(): JQuery; + dxPopover(options: "instance"): DevExpress.ui.dxPopover; + dxPopover(options: string): any; + dxPopover(options: string, ...params: any[]): any; + dxPopover(options: DevExpress.ui.dxPopoverOptions): JQuery; + dxOverlay(): JQuery; + dxOverlay(options: "instance"): DevExpress.ui.dxOverlay; + dxOverlay(options: string): any; + dxOverlay(options: string, ...params: any[]): any; + dxOverlay(options: DevExpress.ui.dxOverlayOptions): JQuery; + dxNumberBox(): JQuery; + dxNumberBox(options: "instance"): DevExpress.ui.dxNumberBox; + dxNumberBox(options: string): any; + dxNumberBox(options: string, ...params: any[]): any; + dxNumberBox(options: DevExpress.ui.dxNumberBoxOptions): JQuery; + dxNavBar(): JQuery; + dxNavBar(options: "instance"): DevExpress.ui.dxNavBar; + dxNavBar(options: string): any; + dxNavBar(options: string, ...params: any[]): any; + dxNavBar(options: DevExpress.ui.dxNavBarOptions): JQuery; + dxMultiView(): JQuery; + dxMultiView(options: "instance"): DevExpress.ui.dxMultiView; + dxMultiView(options: string): any; + dxMultiView(options: string, ...params: any[]): any; + dxMultiView(options: DevExpress.ui.dxMultiViewOptions): JQuery; + dxMap(): JQuery; + dxMap(options: "instance"): DevExpress.ui.dxMap; + dxMap(options: string): any; + dxMap(options: string, ...params: any[]): any; + dxMap(options: DevExpress.ui.dxMapOptions): JQuery; + dxLookup(): JQuery; + dxLookup(options: "instance"): DevExpress.ui.dxLookup; + dxLookup(options: string): any; + dxLookup(options: string, ...params: any[]): any; + dxLookup(options: DevExpress.ui.dxLookupOptions): JQuery; + dxLoadPanel(): JQuery; + dxLoadPanel(options: "instance"): DevExpress.ui.dxLoadPanel; + dxLoadPanel(options: string): any; + dxLoadPanel(options: string, ...params: any[]): any; + dxLoadPanel(options: DevExpress.ui.dxLoadPanelOptions): JQuery; + dxLoadIndicator(): JQuery; + dxLoadIndicator(options: "instance"): DevExpress.ui.dxLoadIndicator; + dxLoadIndicator(options: string): any; + dxLoadIndicator(options: string, ...params: any[]): any; + dxLoadIndicator(options: DevExpress.ui.dxLoadIndicatorOptions): JQuery; + dxList(): JQuery; + dxList(options: "instance"): DevExpress.ui.dxList; + dxList(options: string): any; + dxList(options: string, ...params: any[]): any; + dxList(options: DevExpress.ui.dxListOptions): JQuery; + dxGallery(): JQuery; + dxGallery(options: "instance"): DevExpress.ui.dxGallery; + dxGallery(options: string): any; + dxGallery(options: string, ...params: any[]): any; + dxGallery(options: DevExpress.ui.dxGalleryOptions): JQuery; + dxDropDownEditor(): JQuery; + dxDropDownEditor(options: "instance"): DevExpress.ui.dxDropDownEditor; + dxDropDownEditor(options: string): any; + dxDropDownEditor(options: string, ...params: any[]): any; + dxDropDownEditor(options: DevExpress.ui.dxDropDownEditorOptions): JQuery; + dxDateBox(): JQuery; + dxDateBox(options: "instance"): DevExpress.ui.dxDateBox; + dxDateBox(options: string): any; + dxDateBox(options: string, ...params: any[]): any; + dxDateBox(options: DevExpress.ui.dxDateBoxOptions): JQuery; + dxCheckBox(): JQuery; + dxCheckBox(options: "instance"): DevExpress.ui.dxCheckBox; + dxCheckBox(options: string): any; + dxCheckBox(options: string, ...params: any[]): any; + dxCheckBox(options: DevExpress.ui.dxCheckBoxOptions): JQuery; + dxBox(): JQuery; + dxBox(options: "instance"): DevExpress.ui.dxBox; + dxBox(options: string): any; + dxBox(options: string, ...params: any[]): any; + dxBox(options: DevExpress.ui.dxBoxOptions): JQuery; + dxButton(): JQuery; + dxButton(options: "instance"): DevExpress.ui.dxButton; + dxButton(options: string): any; + dxButton(options: string, ...params: any[]): any; + dxButton(options: DevExpress.ui.dxButtonOptions): JQuery; + dxCalendar(): JQuery; + dxCalendar(options: "instance"): DevExpress.ui.dxCalendar; + dxCalendar(options: string): any; + dxCalendar(options: string, ...params: any[]): any; + dxCalendar(options: DevExpress.ui.dxCalendarOptions): JQuery; + dxAccordion(): JQuery; + dxAccordion(options: "instance"): DevExpress.ui.dxAccordion; + dxAccordion(options: string): any; + dxAccordion(options: string, ...params: any[]): any; + dxAccordion(options: DevExpress.ui.dxAccordionOptions): JQuery; + dxResponsiveBox(): JQuery; + dxResponsiveBox(options: "instance"): DevExpress.ui.dxResponsiveBox; + dxResponsiveBox(options: string): any; + dxResponsiveBox(options: string, ...params: any[]): any; + dxResponsiveBox(options: DevExpress.ui.dxResponsiveBoxOptions): JQuery; + dxAutocomplete(): JQuery; + dxAutocomplete(options: "instance"): DevExpress.ui.dxAutocomplete; + dxAutocomplete(options: string): any; + dxAutocomplete(options: string, ...params: any[]): any; + dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; + dxForm(): JQuery; + dxForm(options: "instance"): DevExpress.ui.dxForm; + dxForm(options: string): any; + dxForm(options: string, ...params: any[]): any; + dxForm(options: DevExpress.ui.dxFormOptions): JQuery; +} + +declare module DevExpress.ui { + export interface dxTileViewOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the height of the base tile view item. */ + baseItemHeight?: number; + /** Specifies the width of the base tile view item. */ + baseItemWidth?: number; + /** Specifies whether tiles are placed horizontally or vertically. */ + direction?: string; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the distance in pixels between adjacent tiles. */ + itemMargin?: number; + /** A Boolean value specifying whether or not to display a scrollbar. */ + showScrollbar?: boolean; + } + /** A widget displaying several blocks of data as tiles. */ + export class dxTileView extends CollectionWidget { + constructor(element: JQuery, options?: dxTileViewOptions); + constructor(element: Element, options?: dxTileViewOptions); + /** Returns the current scroll position of the widget content. */ + scrollPosition(): number; + } + export interface dxSwitchOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Text displayed when the widget is in a disabled state. */ + offText?: string; + /** Text displayed when the widget is in an enabled state. */ + onText?: string; + /** A Boolean value specifying whether the current switch state is "On" or "Off". */ + value?: boolean; + } + /** A switch widget. */ + export class dxSwitch extends Editor { + constructor(element: JQuery, options?: dxSwitchOptions); + constructor(element: Element, options?: dxSwitchOptions); + } + export interface dxSlideOutViewOptions extends WidgetOptions { + /** Specifies the current menu position. */ + menuPosition?: string; + /** Specifies whether or not the menu panel is visible. */ + menuVisible?: boolean; + /** Specifies whether or not the menu is shown when a user swipes the widget content. */ + swipeEnabled?: boolean; + /** A template to be used for rendering menu panel content. */ + menuTemplate?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal a custom menu. */ + export class dxSlideOutView extends Widget { + constructor(element: JQuery, options?: dxSlideOutViewOptions); + constructor(element: Element, options?: dxSlideOutViewOptions); + /** Returns an HTML element of the widget menu block. */ + menuContent(): JQuery; + /** Returns an HTML element of the widget content block. */ + content(): JQuery; + /** Displays the widget's menu block. */ + showMenu(): JQueryPromise; + /** Hides the widget's menu block. */ + hideMenu(): JQueryPromise; + /** Toggles the visibility of the widget's menu block. */ + toggleMenuVisibility(): JQueryPromise; + } + export interface dxSlideOutOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not to display a grouped menu. */ + menuGrouped?: boolean; + /** Specifies the current menu position. */ + menuPosition?: string; + /** The name of the template used to display a group header. */ + menuGroupTemplate?: any; + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** A handler for the menuGroupRendered event. */ + onMenuGroupRendered?: Function; + /** A handler for the menuItemRendered event. */ + onMenuItemRendered?: Function; + /** Specifies whether or not the slide-out menu is displayed. */ + menuVisible?: boolean; + /** Indicates whether the menu can be shown/hidden by swiping the widget's main panel. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal an item list. */ + export class dxSlideOut extends CollectionWidget { + constructor(element: JQuery, options?: dxSlideOutOptions); + constructor(element: Element, options?: dxSlideOutOptions); + /** Hides the widget's slide-out menu. */ + hideMenu(): JQueryPromise; + /** Displays the widget's slide-out menu. */ + showMenu(): JQueryPromise; + /** Toggles the visibility of the widget's slide-out menu. */ + toggleMenuVisibility(showing: boolean): JQueryPromise; + } + export interface dxPivotOptions extends CollectionWidgetOptions { + /** The index of the currently active pivot item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + } + /** A widget that is similar to a traditional tab control, but optimized for the phone with simplified end-user interaction. */ + export class dxPivot extends CollectionWidget { + constructor(element: JQuery, options?: dxPivotOptions); + constructor(element: Element, options?: dxPivotOptions); + } + export interface dxPanoramaOptions extends CollectionWidgetOptions { + /** An object exposing options for setting a background image for the panorama. */ + backgroundImage?: { + /** Specifies the height of the panorama's background image. */ + height?: number; + /** Specifies the URL of the image that is used as the panorama's background image. */ + url?: string; + /** Specifies the width of the panorama's background image. */ + width?: number; + }; + /** The index of the currently active panorama item. */ + selectedIndex?: number; + /** Specifies the widget content title. */ + title?: string; + } + /** A widget displaying the required content in a long horizontal canvas that extends beyond the frames of the screen. */ + export class dxPanorama extends CollectionWidget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + } + export interface dxDropDownMenuOptions extends WidgetOptions { + /** A handler for the buttonClick event. */ + onButtonClick?: any; + /** The name of the icon to be displayed by the DropDownMenu button. */ + buttonIcon?: string; + /** The text displayed in the DropDownMenu button. */ + buttonText?: string; + buttonIconSrc?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** Specifies whether or not to show the drop down menu within a dxPopover widget. */ + usePopover?: boolean; + /** The width of the menu popup in pixels. */ + popupWidth?: any; + /** The height of the menu popup in pixels. */ + popupHeight?: any; + /** Specifies whether or not the drop-down menu is displayed. */ + opened?: boolean; + hoverStateEnabled?: boolean; + activeStateEnabled?: boolean; + } + /** A drop-down menu widget. */ + export class dxDropDownMenu extends Widget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Opens the drop-down menu. */ + open(): void; + /** Closes the drop-down menu. */ + close(): void; + } + export interface dxActionSheetOptions extends CollectionWidgetOptions { + /** A handler for the cancelClick event. */ + onCancelClick?: any; + /** The text displayed in the button that closes the action sheet. */ + cancelText?: string; + /** Specifies whether or not to display the Cancel button in action sheet. */ + showCancelButton?: boolean; + /** A Boolean value specifying whether or not the title of the action sheet is visible. */ + showTitle?: boolean; + /** Specifies the element the action sheet popover points at. */ + target?: any; + /** The title of the action sheet. */ + title?: string; + /** Specifies whether or not to show the action sheet within a dxPopover widget. */ + usePopover?: boolean; + /** A Boolean value specifying whether or not the dxActionSheet widget is visible. */ + visible?: boolean; + } + /** A widget consisting of a set of choices related to a certain task. */ + export class dxActionSheet extends CollectionWidget { + constructor(element: JQuery, options?: dxActionSheetOptions); + constructor(element: Element, options?: dxActionSheetOptions); + /** Hides the widget. */ + hide(): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Shows or hides the widget depending on the Boolean value passed as the parameter. */ + toggle(showing: boolean): JQueryPromise; + } +} +interface JQuery { + dxTileView(): JQuery; + dxTileView(options: "instance"): DevExpress.ui.dxTileView; + dxTileView(options: string): any; + dxTileView(options: string, ...params: any[]): any; + dxTileView(options: DevExpress.ui.dxTileViewOptions): JQuery; + dxSwitch(): JQuery; + dxSwitch(options: "instance"): DevExpress.ui.dxSwitch; + dxSwitch(options: string): any; + dxSwitch(options: string, ...params: any[]): any; + dxSwitch(options: DevExpress.ui.dxSwitchOptions): JQuery; + dxSlideOut(): JQuery; + dxSlideOut(options: "instance"): DevExpress.ui.dxSlideOut; + dxSlideOut(options: string): any; + dxSlideOut(options: string, ...params: any[]): any; + dxSlideOut(options: DevExpress.ui.dxSlideOutOptions): JQuery; + dxPivot(): JQuery; + dxPivot(options: "instance"): DevExpress.ui.dxPivot; + dxPivot(options: string): any; + dxPivot(options: string, ...params: any[]): any; + dxPivot(options: DevExpress.ui.dxPivotOptions): JQuery; + dxPanorama(): JQuery; + dxPanorama(options: "instance"): DevExpress.ui.dxPanorama; + dxPanorama(options: string): any; + dxPanorama(options: string, ...params: any[]): any; + dxPanorama(options: DevExpress.ui.dxPanoramaOptions): JQuery; + dxActionSheet(): JQuery; + dxActionSheet(options: "instance"): DevExpress.ui.dxActionSheet; + dxActionSheet(options: string): any; + dxActionSheet(options: string, ...params: any[]): any; + dxActionSheet(options: DevExpress.ui.dxActionSheetOptions): JQuery; + dxDropDownMenu(): JQuery; + dxDropDownMenu(options: "instance"): DevExpress.ui.dxDropDownMenu; + dxDropDownMenu(options: string): any; + dxDropDownMenu(options: string, ...params: any[]): any; + dxDropDownMenu(options: DevExpress.ui.dxDropDownMenuOptions): JQuery; +} +declare module DevExpress.data { + export interface XmlaStoreOptions { + /** The HTTP address to an XMLA OLAP server. */ + url?: string; + /** The name of the database associated with the Store. */ + catalog?: string; + /** The cube name. */ + cube?: string; + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: Object) => void; + } + /** A Store that provides access to an OLAP cube using the XMLA standard. */ + export class XmlaStore { + constructor(options: XmlaStoreOptions); + } + export interface PivotGridField { + index?: number; + /** A boolean value specifying whether or not the field is visible in the pivot grid and the Field Chooser. */ + visible?: boolean; + /** Name of the data source field containing data for the pivot grid field. */ + dataField?: string; + /** A caption that will be displayed in the pivot grid's field chooser to identify the field. */ + caption?: string; + /** Specifies a type of field values. */ + dataType?: string; + /** Specifies how the values of the current field are combined into groups. Cannot be used for the XmlaStore store type. */ + groupInterval?: any; + /** Specifies how to aggregate field data. Cannot be used for the XmlaStore store type. */ + summaryType?: string; + /** Allows you to use a custom aggregate function to calculate the summary values. Cannot be used for the XmlaStore store type. */ + calculateCustomSummary?: (options: { + summaryProcess?: string; + value?: any; + totalValue?: any; + }) => void; + /** Specifies the function that determines how to split data from the data source into ranges for header items. Cannot be used for the XmlaStore store type. */ + selector?: (data: Object) => any; + /** Type of the area where the field is located. */ + area?: string; + /** Index among the other fields displayed within the same area. */ + areaIndex?: number; + /** The name of the folder in which the field is located. */ + displayFolder?: string; + /** The name of the group to which the field belongs. */ + groupName?: string; + /** The index of the field within a group. */ + groupIndex?: number; + /** Specifies the sort order of field values. */ + sortOrder?: string; + /** Specifies how field data should be sorted. Can be used for the XmlaStore store type only. */ + sortBy?: string; + /** Sorts the header items of this field by the summary values of another field. */ + sortBySummaryField?: string; + /** The array of field names that specify a path to column/row whose summary field is used for sorting of this field's header items. */ + sortBySummaryPath?: Array; + /** The filter values for the current field. */ + filterValues?: Array; + /** The filter type for the current field. */ + filterType?: string; + /** Indicates whether all header items of the field's header level are expanded. */ + expanded?: boolean; + /** Specifies whether the field should be treated as a Data Field. */ + isMeasure?: boolean; + /** Specifies a display format for field values. */ + format?: string; + /** Specifies a callback function that returns the text to be displayed in the cells of a field. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** Specifies a precision for formatted field values. */ + precision?: number; + /** Specifies how to sort the header items. */ + sortingMethod?: (a: Object, b: Object) => number; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies the absolute width of the field in the pivot grid. */ + width?: number; + /** Specifies the summary post-processing algorithm. */ + summaryDisplayMode?: string; + /** Specifies whether to summarize each next summary value with the previous one by rows or columns. */ + runningTotal?: string; + /** Specifies whether to allow the predefined summary post-processing functions ('absoluteVariation' and 'percentVariation') and runningTotal to take values of different groups into account. */ + allowCrossGroupCalculation?: boolean; + /** Specifies a callback function that allows you to modify summary values after they are calculated. */ + calculateSummaryValue?: (e: Object) => number; + /** Specifies whether or not to display Total values for the field. */ + showTotals?: boolean; + /** Specifies whether or not to display Grand Total values for the field. */ + showGrandTotals?: boolean; + } + export class SummaryCell { + /** Gets the parent cell in a specified direction. */ + parent(direction: string): SummaryCell; + /** Gets all children cells in a specified direction. */ + children(direction: string): Array; + /** Gets a partial Grand Total cell of a row or column. */ + grandTotal(direction: string): SummaryCell; + /** Gets the Grand Total of the entire pivot grid. */ + grandTotal(): SummaryCell; + /** Gets the cell next to the current one in a specified direction. */ + next(direction: string): SummaryCell; + /** Gets the cell next to current in a specified direction. */ + next(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the cell prior to the current one in a specified direction. */ + prev(direction: string): SummaryCell; + /** Gets the cell previous to current in a specified direction. */ + prev(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the child cell in a specified direction. */ + child(direction: string, fieldValue: any): SummaryCell; + /** Gets the cell located by the path of the source cell with one field value changed. */ + slice(field: PivotGridField, value: any): SummaryCell; + /** Gets the header cell of a row or column field to which the current cell belongs. */ + field(area: string): PivotGridField; + /** Gets the value of the current cell. */ + value(): any; + /** Gets the value of the current cell. */ + value(isCalculatedValue: boolean): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField, isCalculatedValue: boolean): any; + } + export interface PivotGridDataSourceOptions { + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** Indicates whether or not the automatic field generation from data in the Store is enabled. */ + retrieveFields?: boolean; + /** Specifies data filtering conditions. Cannot be used for the XmlaStore store type. */ + filter?: Object; + /** An array of pivot grid fields. */ + fields?: Array; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Object) => void; + /** A handler for the fieldsPrepared event. */ + onFieldsPrepared?: (e?: Array) => void; + } + /** An object that provides access to data for the dxPivotGrid widget. */ + export class PivotGridDataSource implements EventsMixin { + constructor(options?: PivotGridDataSource); + /** Starts reloading data from any store and updating the data source. */ + reload(): JQueryPromise; + /** Starts updating the data source. Reloads data from the XMLA store only. */ + load(): JQueryPromise; + /** Indicates whether or not the PivotGridDataSource is currently being loaded. */ + isLoading(): boolean; + /** Gets data displayed in a PivotGrid. */ + getData(): Object; + /** Gets all fields within a specified area. */ + getAreaFields(area: string, collectGroups: boolean): Array; + /** Gets all fields from the data source. */ + fields(): Array; + /** Sets the fields option. */ + fields(fields: Array): void; + /** Gets current options of a specified field. */ + field(id: any): PivotGridField; + /** Sets one or more options of a specified field. */ + field(id: any, field: PivotGridField): void; + /** Collapses a specified header item. */ + collapseHeaderItem(area: string, path: Array): void; + /** Expands a specified header item. */ + expandHeaderItem(area: string, path: Array): void; + /** Expands all header items of a field. */ + expandAll(id: any): void; + /** Collapses all header items of a field. */ + collapseAll(id: any): void; + /** Disposes of all resources associated with this PivotGridDataSource. */ + dispose(): void; + /** Gets the current filter expression. Cannot be used for the XmlaStore store type. */ + filter(): Object; + /** Applies a new filter expression. Cannot be used for the XmlaStore store type. */ + filter(filterExpr: Object): void; + /** Provides access to a list of records (facts) that were used to calculate a specific summary. */ + createDrillDownDataSource(options: { + columnPath?: Array; + rowPath?: Array; + dataIndex?: number; + maxRowCount?: number; + customColumns?: Array; + }): DevExpress.data.DataSource; + /** Gets the current PivotGridDataSource state (fields configuration, sorting, filters, expanded headers, etc.) */ + state(): Object; + /** Sets the PivotGridDataSource state. */ + state(state: Object): void; + on(eventName: string, eventHandler: Function): PivotGridDataSource; + on(events: { [eventName: string]: Function; }): PivotGridDataSource; + off(eventName: string): PivotGridDataSource; + off(eventName: string, eventHandler: Function): PivotGridDataSource; + } +} +declare module DevExpress.ui { + export interface dxSchedulerOptions extends WidgetOptions { + /** Specifies a date displayed on the current scheduler view by default. */ + currentDate?: any; + /** The earliest date the widget allows you to select. */ + min?: Date; + /** The latest date the widget allows you to select. */ + max?: Date; + /** Specifies the view used in the scheduler by default. */ + currentView?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** The template to be used for rendering appointments. */ + appointmentTemplate?: any; + /** The template to be used for rendering an appointment tooltip. */ + appointmentTooltipTemplate?: any; + /** Lists the views to be available within the scheduler's View Selector. */ + views?: Array; + /** Specifies the resource kinds by which the scheduler's appointments are grouped in a timetable. */ + groups?: Array; + /** Specifies a start hour in the scheduler view's time interval. */ + startDayHour?: number; + /** Specifies an end hour in the scheduler view's time interval. */ + endDayHour?: number; + /** Specifies whether or not the "All-day" panel is visible. */ + showAllDayPanel?: boolean; + /** Specifies cell duration in minutes. */ + cellDuration?: number; + /** Specifies the edit mode for recurring appointments. */ + recurrenceEditMode?: string; + /** Specifies which editing operations an end-user can perform on appointments. */ + editing?: { + /** Specifies whether or not an end-user can add appointments. */ + allowAdding?: boolean; + /** Specifies whether or not an end-user can change appointment options. */ + allowUpdating?: boolean; + /** Specifies whether or not an end-user can delete appointments. */ + allowDeleting?: boolean; + /** Specifies whether or not an end-user can change an appointment duration. */ + allowResizing?: boolean; + /** Specifies whether or not an end-user can drag appointments. */ + allowDragging?: boolean; + } + /** Specifies an array of resources available in the scheduler. */ + resources?: Array<{ + /** Indicates whether or not several resources of this kind can be assigned to an appointment. */ + allowMultiple?: boolean; + /** + * Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. + * @deprecated Use the useColorAsDefault option instead. + */ + mainColor?: boolean; + /** Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. */ + useColorAsDefault?: boolean; + /** A data source used to fetch resources to be available in the scheduler. */ + dataSource?: any; + /** Specifies the resource object field whose value is displayed by the Resource editor in the Appointment popup window. */ + displayExpr?: any; + /** Specifies the resource object field that is used as a value of the Resource editor in the Appointment popup window. */ + valueExpr?: any; + /** The name of the appointment object field that specifies a resource of this kind. */ + field?: string; + /** Specifies the label of the Appointment popup window field that allows end users to assign a resource of this kind. */ + label?: string; + }>; + /** A handler for the AppointmentAdding event. */ + onAppointmentAdding?: Function; + /** A handler for the appointmentAdded event. */ + onAppointmentAdded?: Function; + /** A handler for the AppointmentUpdating event. */ + onAppointmentUpdating?: Function; + /** A handler for the appointmentUpdated event. */ + onAppointmentUpdated?: Function; + /** A handler for the AppointmentDeleting event. */ + onAppointmentDeleting?: Function; + /** A handler for the appointmentDeleted event. */ + onAppointmentDeleted?: Function; + /** A handler for the appointmentRendered event. */ + onAppointmentRendered?: Function; + /** A handler for the appointmentClick event. */ + onAppointmentClick?: any; + /** A handler for the appointmentDblClick event. */ + onAppointmentDblClick?: any; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the appointmentFormCreated event. */ + onAppointmentFormCreated?: Function; + /** Specifies whether or not an end-user can scroll the view horizontally. */ + horizontalScrollingEnabled?: boolean; + /** Specifies whether a user can switch views using tabs or a drop-down menu. */ + useDropDownViewSwitcher?: boolean; + /** Specifies the name of the data source item field that defines the start of an appointment. */ + startDateExpr?: string; + /** Specifies the name of the data source item field that defines the ending of an appointment. */ + endDateExpr?: string; + /** Specifies the name of the data source item field that holds the subject of an appointment. */ + textExpr?: string; + /** Specifies the name of the data source item field whose value holds the description of the corresponding appointment. */ + descriptionExpr?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding appointment is an all-day appointment. */ + allDayExpr?: string; + /** Specifies the name of the data source item field that defines a recurrence rule for generating recurring appointments. */ + recurrenceRuleExpr?: string; + /** Specifies the name of the data source item field that defines exceptions for the current recurring appointment. */ + recurrenceExceptionExpr?: string; + /** Specifies whether filtering is performed on the server or client side. */ + remoteFiltering?: boolean; + } + /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ + export class dxScheduler extends Widget { + constructor(element: JQuery, options?: dxSchedulerOptions); + constructor(element: Element, options?: dxSchedulerOptions); + /** Add the appointment defined by the object passed as a parameter to the data associated with the widget. */ + addAppointment(appointment: Object): void; + /** Updates the appointment specified by the first method parameter by the appointment object specified by the second method parameter in the the data associated with the widget. */ + updateAppointment(target: Object, appointment: Object): void; + /** Deletes the appointment defined by the parameter from the the data associated with the widget. */ + deleteAppointment(appointment: Object): void; + /** Scrolls the scheduler work space to the specified time of the specified day. */ + scrollToTime(hours: number, minutes: number, date: Date): void; + /** Displayes the Appointment Details popup. */ + showAppointmentPopup(appointmentData: Object, createNewAppointment?: boolean, currentAppointmentData?: Object): void; + } + export interface dxColorBoxOptions extends dxDropDownEditorOptions { + /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ + applyButtonText?: string; + applyValueMode?: string; + /** Specifies the text displayed on the button that cancels changes and closes the drop-down editor. */ + cancelButtonText?: string; + /** Specifies whether or not the widget value includes the alpha channel component. */ + editAlphaChannel?: boolean; + /** Specifies the size of a step by which a handle is moved using a keyboard shortcut. */ + keyStep?: number; + } + /** A widget used to specify a color value. */ + export class dxColorBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxColorBoxOptions); + constructor(element: Element, options?: dxColorBoxOptions); + } + export interface HierarchicalCollectionWidgetOptions extends CollectionWidgetOptions { + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of the data source item field used as a key. */ + keyExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is selected. */ + selectedExpr?: any; + /** Specifies the name of the data source item field that contains an array of nested items. */ + itemsExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is disabled. */ + disabledExpr?: any; + /** Specifies the name of the data source item field that holds the key of the parent item. */ + parentIdExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is expanded. */ + expandedExpr?: any; + hoverStateEnabled?: boolean; + focusStateEnabled?: boolean; + } + export class HierarchicalCollectionWidget extends CollectionWidget { + } + export interface dxTreeViewOptions extends HierarchicalCollectionWidgetOptions { + /** Specifies whether or not to animate item collapsing and expanding. */ + animationEnabled?: boolean; + /** Specifies whether a nested or plain array is used as a data source. */ + dataStructure?: string; + /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ + expandAllEnabled?: boolean; + /** + * Specifies whether or not a check box is displayed at each tree view item. + * @deprecated Use the showCheckBoxesMode options instead. + */ + showCheckBoxes?: boolean; + /** Specifies the current check boxes display mode. */ + showCheckBoxesMode?: string; + /** Specifies whether or not to select nodes recursively. */ + selectNodesRecursive?: boolean; + /** Specifies whether or not all parent nodes of an initially expanded node are displayed expanded. */ + expandNodesRecursive?: boolean; + /** + * Specifies whether the "Select All" check box is displayed over the tree view. + * @deprecated Use the showCheckBoxesMode options instead. + */ + selectAllEnabled?: boolean; + /** Specifies the text displayed at the "Select All" check box. */ + selectAllText?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node includes child nodes. */ + hasItemsExpr?: any; + /** Specifies if the virtual mode is enabled. */ + virtualModeEnabled?: boolean; + /** Specifies the parent ID value of the root item. */ + rootValue?: any; + /** Specifies the current value used to filter tree view items. */ + searchValue?: string; + /** A string value specifying available scrolling directions. */ + scrollDirection?: string; + /** A handler for the itemSelected event. */ + onItemSelected?: Function; + /** A handler for the itemExpanded event. */ + onItemExpanded?: Function; + /** A handler for the itemCollapsed event. */ + onItemCollapsed?: Function; + onItemClick?: Function; + onItemContextMenu?: Function; + onItemRendered?: Function; + onItemHold?: Function; + } + /** A widget displaying specified data items as a tree. */ + export class dxTreeView extends HierarchicalCollectionWidget { + constructor(element: JQuery, options?: dxTreeViewOptions); + constructor(element: Element, options?: dxTreeViewOptions); + /** Updates the tree view scrollbars according to the current size of the widget content. */ + updateDimensions(): JQueryPromise; + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + /** Expands the specified item. */ + expandItem(itemElement: any): void; + /** Collapses the specified item. */ + collapseItem(itemElement: any): void; + /** Returns all nodes of the tree view. */ + getNodes(): Array; + /** Selects all widget items. */ + selectAll(): void; + /** Unselects all widget items. */ + unselectAll(): void; + } + export interface dxMenuBaseOptions extends HierarchicalCollectionWidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the name of the CSS class associated with the menu. */ + cssClass?: string; + /** Holds an array of menu items. */ + items?: Array; + /** Specifies whether or not an item becomes selected if an end-user clicks it. */ + selectionByClick?: boolean; + /** Specifies the selection mode supported by the menu. */ + selectionMode?: string; + /** Specifies options of submenu showing and hiding. */ + showSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay of submenu show and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + } + export class dxMenuBase extends HierarchicalCollectionWidget { + constructor(element: JQuery, options?: dxMenuBaseOptions); + constructor(element: Element, options?: dxMenuBaseOptions); + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + } + export interface dxMenuOptions extends dxMenuBaseOptions { + /** Specifies whether or not the submenu is hidden when the mouse pointer leaves it. */ + hideSubmenuOnMouseLeave?: boolean; + /** Specifies whether the menu has horizontal or vertical orientation. */ + orientation?: string; + /** Specifies options for showing and hiding the first level submenu. */ + showFirstSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay in submenu showing and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + /** Specifies the direction at which the submenus are displayed. */ + submenuDirection?: string; + /** A handler for the submenuHidden event. */ + onSubmenuHidden?: Function; + /** A handler for the submenuHiding event. */ + onSubmenuHiding?: Function; + /** A handler for the submenuShowing event. */ + onSubmenuShowing?: Function; + /** A handler for the submenuShown event. */ + onSubmenuShown?: Function; + } + /** A menu widget. */ + export class dxMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxMenuOptions); + constructor(element: Element, options?: dxMenuOptions); + } + export interface dxContextMenuOptions extends dxMenuBaseOptions { + /** Holds an object that specifies options of alternative menu invocation. */ + alternativeInvocationMode?: { + /** Specifies whether or not the standard context menu invocation (on a right mouse click or on a long tap) is disabled. */ + enabled?: Boolean; + /** Specifies the element used to invoke the context menu. */ + invokingElement?: any; + }; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** A handler for the positioning event. */ + onPositioning?: Function; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the direction at which submenus are displayed. */ + submenuDirection?: string; + /** The target element associated with a popover. */ + target?: any; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + } + /** A context menu widget. */ + export class dxContextMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxContextMenuOptions); + constructor(element: Element, options?: dxContextMenuOptions); + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Hides the widget. */ + hide(): JQueryPromise; + } + export interface dxRemoteOperations { + /** Specifies whether or not filtering must be performed on the server side. */ + filtering?: boolean; + /** Specifies whether or not paging must be performed on the server side. */ + paging?: boolean; + /** Specifies whether or not sorting must be performed on the server side. */ + sorting?: boolean; + /** Specifies whether or not grouping must be performed on the server side. */ + grouping?: boolean; + /** Specifies whether or not summaries calculation must be performed on the server side. */ + summary?: boolean; + } + export interface dxDataGridRow { + /** The data object represented by the row. */ + data: Object; + /** The key of the data object represented by the row. */ + key: any; + /** The visible index of the row. */ + rowIndex: number; + /** The type of the row. */ + rowType: string; + } + export interface dxDataGridColumn { + /** Specifies the content alignment within column cells. */ + alignment?: string; + /** Specifies whether the values in a column can be edited at runtime. Setting this option makes sense only when editing is enabled for a grid. */ + allowEditing?: boolean; + /** Specifies whether or not a column can be used for filtering grid records. Setting this option makes sense only when the filter row and column header filtering are visible. */ + allowFiltering?: boolean; + /** Specifies whether or not to allow filtering by this column using its header. */ + allowHeaderFiltering?: boolean; + /** Specifies whether or not the column can be anchored to a grid edge by end users. Setting this option makes sense only when the columnFixing | enabled option is set to true. */ + allowFixing?: boolean; + /** Specifies if a column can be used for searching grid records. Setting this option makes sense only when the search panel is visible. */ + allowSearch?: boolean; + /** Specifies whether a column can be used for grouping grid records at runtime. Setting this option makes sense only when the group panel is visible. */ + allowGrouping?: boolean; + /** Specifies whether or not a column can be hidden by a user. Setting this option makes sense only when the column chooser is visible. */ + allowHiding?: boolean; + /** Specifies whether or not a particular column can be used in column reordering. Setting this option makes sense only when the allowColumnReordering option is set to true. */ + allowReordering?: boolean; + /** Specifies whether or not a particular column can be resized by a user. Setting this option makes sense only when the allowColumnResizing option is true. */ + allowResizing?: boolean; + /** Specifies whether grid records can be sorted by a specific column at runtime. Setting this option makes sense only when the sorting mode differs from none. */ + allowSorting?: boolean; + /** Specifies whether groups appear expanded or not when records are grouped by a specific column. Setting this option makes sense only when grouping is allowed for this column. */ + autoExpandGroup?: boolean; + /** Specifies a callback function that returns a value to be displayed in a column cell. */ + calculateCellValue?: (rowData: Object) => string; + /** Specifies a callback function to be invoked after the cell value is edited by an end-user and before the new value is saved to the data source. */ + setCellValue?: (rowData: Object, value: any) => void; + /** Specifies a callback function that defines filters for customary calculated grid cells. */ + calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string, target: string) => Array; + /** Specifies a caption for a column. */ + caption?: string; + /** Specifies a custom template for grid column cells. */ + cellTemplate?: any; + /** Specifies a CSS class to be applied to a column. */ + cssClass?: string; + /** Specifies how to get a value to be displayed in a cell when it is not in an editing state. */ + calculateDisplayValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for grouping column cells. */ + calculateGroupValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for sorting column cells. */ + calculateSortValue?: any; + /** Specifies a callback function that returns the text to be displayed in the cells of a column. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** Specifies the field of a data source that provides data for a column. */ + dataField?: string; + /** Specifies the required type of column values. */ + dataType?: string; + /** Specifies a custom template for the cell of a grid column when it is in an editing state. */ + editCellTemplate?: any; + /** Specifies configuration options for the editor widget of the current column. */ + editorOptions?: Object; + /** Specifies whether HTML tags are displayed as plain text or applied to the values of the column. */ + encodeHtml?: boolean; + /** In a boolean column, replaces all false items with a specified text. */ + falseText?: string; + /** Specifies the set of available filter operations. */ + filterOperations?: Array; + /** Specifies a filter value for a column. */ + filterValue?: any; + /** Specifies initial filter values for the column's header filter. */ + filterValues?: Array; + /** Specifies whether to include or exclude the records with the values selected in the column's header filter. */ + filterType?: string; + /** Indicates whether the column takes part in horizontal grid scrolling or is anchored to a grid edge. */ + fixed?: boolean; + /** Specifies the grid edge to which the column is anchored. */ + fixedPosition?: string; + /** Specifies a format for the values displayed in a column. */ + format?: string; + /** Specifies a custom template for the group cell of a grid column. */ + groupCellTemplate?: any; + /** Specifies the index of a column when grid records are grouped by the values of this column. */ + groupIndex?: number; + /** Specifies a custom template for the header of a grid column. */ + headerCellTemplate?: any; + /** Specifies options of a lookup column. */ + lookup?: { + /** Specifies whether or not a user can nullify values of a lookup column. */ + allowClearing?: boolean; + /** Specifies the data source providing data for a lookup column. */ + dataSource?: any; + /** Specifies the expression defining the data source field whose values must be displayed. */ + displayExpr?: any; + /** Specifies the expression defining the data source field whose values must be replaced. */ + valueExpr?: string; + }; + /** Specifies column-level options for filtering using a column header filter. */ + headerFilter?: { + /** Specifies the data source to be used for the header filter. */ + dataSource?: any; + /** Specifies how header filter values should be combined into groups. */ + groupInterval?: any; + }; + /** Specifies a precision for formatted values displayed in a column. */ + precision?: number; + /** Specifies a filter operation applied to a column. */ + selectedFilterOperation?: string; + /** Specifies whether or not the column displays its values by using editors. */ + showEditorAlways?: boolean; + /** Specifies whether or not to display the column when grid records are grouped by it. */ + showWhenGrouped?: boolean; + /** Specifies the index of a column when grid records are sorted by the values of this column. */ + sortIndex?: number; + /** Specifies the initial sort order of column values. */ + sortOrder?: string; + /** In a boolean column, replaces all true items with a specified text. */ + trueText?: string; + /** Specifies whether a column is visible or not. */ + visible?: boolean; + /** Specifies the sequence number of the column in the grid. */ + visibleIndex?: number; + /** Specifies a column width in pixels or percentages. */ + width?: any; + /** Specifies an array of validation rules to be checked when updating column cell values. */ + validationRules?: Array; + /** Specifies whether or not to display the header of a hidden column in the column chooser. */ + showInColumnChooser?: boolean; + /** Specifies the identifier of the column. */ + name?: string; + /** The form item configuration object. Used only when the editing mode is "form". */ + formItem?: DevExpress.ui.dxFormItem; + } + export interface dxDataGridOptions extends WidgetOptions { + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** Indicates whether to show the error row for the grid. */ + errorRowEnabled?: boolean; + /** A handler for the rowValidating event. */ + onRowValidating?: (e: Object) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** A handler for the initNewRow event. */ + onInitNewRow?: (e: { data: Object }) => void; + /** A handler for the rowInserted event. */ + onRowInserted?: (e: { data: Object; key: any }) => void; + /** A handler for the rowInserting event. */ + onRowInserting?: (e: { data: Object; cancel: any }) => void; + /** A handler for the rowRemoved event. */ + onRowRemoved?: (e: { data: Object; key: any }) => void; + /** A handler for the rowRemoving event. */ + onRowRemoving?: (e: { data: Object; key: any; cancel: any }) => void; + /** A handler for the rowUpdated event. */ + onRowUpdated?: (e: { data: Object; key: any }) => void; + /** A handler for the rowUpdating event. */ + onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: any }) => void; + /** Enables a hint that appears when a user hovers the mouse pointer over a cell with truncated content. */ + cellHintEnabled?: boolean; + /** Specifies whether or not grid columns can be reordered by a user. */ + allowColumnReordering?: boolean; + /** Specifies whether or not grid columns can be resized by a user. */ + allowColumnResizing?: boolean; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the cellHoverChanged event. */ + onCellHoverChanged?: (e: Object) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: Object) => void; + /** Specifies whether or not the width of grid columns depends on column content. */ + columnAutoWidth?: boolean; + /** Specifies the options of a column chooser. */ + columnChooser?: { + /** Specifies text displayed by the column chooser panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether a user can invoke the column chooser or not. */ + enabled?: boolean; + /** Specifies the height of the column chooser panel. */ + height?: number; + /** Specifies text displayed in the title of the column chooser panel. */ + title?: string; + /** Specifies the width of the column chooser panel. */ + width?: number; + }; + /** Specifies options for column fixing. */ + columnFixing?: { + /** Indicates if column fixing is enabled. */ + enabled?: boolean; + /** Contains options that specify texts for column-fixing related commands in the column header's context menu. */ + texts?: { + /** Specifies text for a context menu item that fixes the column for which the context menu is invoked. */ + fix?: string; + /** Specifies text for a context menu item that unfixes the column for which the context menu is invoked. */ + unfix?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the left grid edge. */ + leftPosition?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the right grid edge. */ + rightPosition?: string; + }; + }; + /** Specifies options for filtering using a column header filter. */ + headerFilter?: { + /** Indicates whether or not the column header filter button is visible. */ + visible?: boolean; + /** Specifies the height of the dropdown menu invoked when using a column header filter. */ + height?: number; + /** Specifies the width of the dropdown menu invoked when using a column header filter. */ + width?: number; + /** Contains options that specify texts for the dropdown menu invoked when you use a column header filter. */ + texts?: { + /** Specifies text for the item specifying an empty value in the column header filter's dropdown menu. */ + emptyValue?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu and applies specified filtering. */ + ok?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu without applying performed selection. */ + cancel?: string; + } + }; + /** An array of grid columns. */ + columns?: Array; + onContentReady?: Function; + /** Specifies a function that customizes grid columns after they are created. */ + customizeColumns?: (columns: Array) => void; + /** Specifies a data source for the grid. */ + dataSource?: any; + /** Specifies whether or not to enable data caching. */ + cacheEnabled?: boolean; + /** A handler for the editingStart event. */ + onEditingStart?: (e: { + data: Object; + key: any; + cancel: boolean; + column: dxDataGridColumn + }) => void; + /** A handler for the editorPrepared event. */ + onEditorPrepared?: (e: Object) => void; + /** A handler for the editorPreparing event. */ + onEditorPreparing?: (e: Object) => void; + /** Contains options that specify how grid content can be changed. */ + editing?: { + editMode?: string; + editEnabled?: boolean; + insertEnabled?: boolean; + removeEnabled?: boolean; + /** Specifies how grid values can be edited manually. */ + mode?: string; + /** Specifies whether or not grid records can be edited at runtime. */ + allowUpdating?: boolean; + /** Specifies whether or not new grid records can be added at runtime. */ + allowAdding?: boolean; + /** Specifies whether or not grid records can be deleted at runtime. */ + allowDeleting?: boolean; + /** The form configuration object. Used only when the editing mode is "form". */ + form?: DevExpress.ui.dxFormOptions; + /** Contains options that specify texts for editing-related grid controls. */ + texts?: { + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Save" button. Setting this option makes sense only when the editMode option is set to batch. */ + saveAllChanges?: string; + /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + cancelRowChanges?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Revert" button. Setting this option makes sense only when the editMode option is set to batch. */ + cancelAllChanges?: string; + /** Specifies a message to be displayed by a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteMessage?: string; + /** Specifies text to be displayed in the title of a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteTitle?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Cancel changes" button. Setting this option makes sense only when the editMode option is set to cell and the validation capabilities are enabled. */ + validationCancelChanges?: string; + /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the allowDeleting option is set to true. */ + deleteRow?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Add" button. Setting this option makes sense only when the allowAdding option is true. */ + addRow?: string; + /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + editRow?: string; + /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + saveRowChanges?: string; + /** Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the allowDeleting option is set to true. */ + undeleteRow?: string; + }; + }; + /** Specifies filter row options. */ + filterRow?: { + /** Specifies when to apply a filter. */ + applyFilter?: string; + /** Specifies text for the hint that pops up when a user hovers the mouse pointer over the "Apply Filter" button. */ + applyFilterText?: string; + /** Specifies descriptions for filter operations. */ + operationDescriptions?: { + "=": string; + "<>": string; + "<": string; + "<=": string; + ">": string; + ">=": string; + "startswith": string; + "contains": string; + "notcontains": string; + "endswith": string; + }; + /** Specifies text for the reset operation in a filter list. */ + resetOperationText?: string; + /** Specifies text for the operation of clearing the applied filter when a select box is used. */ + showAllText?: string; + /** Specifies text for the range start in the 'between' filter type. */ + betweenStartText?: string; + /** Specifies text for the range end in the 'between' filter type. */ + betweenEndText?: string; + /** Specifies whether or not an icon that allows the user to choose a filter operation is visible. */ + showOperationChooser?: boolean; + /** Specifies whether the filter row is visible or not. */ + visible?: boolean; + }; + /** Specifies the behavior of grouped grid records. */ + grouping?: { + /** Specifies whether the user can collapse grouped records in a grid or not. */ + allowCollapsing?: boolean; + /** Specifies whether groups appear expanded or not. */ + autoExpandAll?: boolean; + /** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */ + groupContinuedMessage?: string; + /** Specifies the message displayed in a group row when the corresponding group continues on the next page. */ + groupContinuesMessage?: string; + }; + /** Specifies options that configure the group panel. */ + groupPanel?: { + /** Specifies whether columns can be dragged onto or from the group panel. */ + allowColumnDragging?: boolean; + /** Specifies text displayed by the group panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether the group panel is visible or not. */ + visible?: boolean; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Specifies whether to show the load panel or not. */ + enabled?: boolean; + /** Specifies the height of the load panel in pixels. */ + height?: number; + /** Specifies a URL pointing to an image to be used as a loading indicator. */ + indicatorSrc?: string; + /** Specifies whether or not a loading indicator must be displayed on the load panel. */ + showIndicator?: boolean; + /** Specifies whether or not the pane of the load panel must be displayed. */ + showPane?: boolean; + /** Specifies text displayed by the load panel. */ + text?: string; + /** Specifies the width of the load panel in pixels. */ + width?: number; + }; + /** Specifies text displayed when a grid does not contain any records. */ + noDataText?: string; + /** Specifies the options of a grid pager. */ + pager?: { + /** Specifies the page sizes that can be selected at runtime. */ + allowedPageSizes?: any; + /** Specifies whether to show the page size selector or not. */ + showPageSizeSelector?: boolean; + /** Specifies whether to show the pager or not. */ + visible?: any; + /** Specifies the text accompanying the page navigator. */ + infoText?: string; + /** Specifies whether or not to display the text accompanying the page navigator. This text is specified by the infoText option. */ + showInfo?: boolean; + /** Specifies whether or not to display buttons that switch the grid to the previous or next page. */ + showNavigationButtons?: boolean; + }; + /** Specifies paging options. */ + paging?: { + /** Specifies whether dxDataGrid loads data page by page or all at once. */ + enabled?: boolean; + /** Specifies the grid page that should be displayed by default. */ + pageIndex?: number; + /** Specifies the size of grid pages. */ + pageSize?: number; + }; + /** Specifies whether or not grid rows must be shaded in a different way. */ + rowAlternationEnabled?: boolean; + /** Specifies whether to enable two-way data binding. */ + twoWayBindingEnabled?: boolean; + /** A handler for the rowClick event. */ + onRowClick?: any; + /** A handler for the rowPrepared event. */ + onRowPrepared?: (e: Object) => void; + /** Specifies a custom template for grid rows. */ + rowTemplate?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not a grid must preload pages adjacent to the current page when using virtual scrolling. */ + preloadEnabled?: boolean; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + /** Specifies the scrollbar display policy. */ + showScrollbar?: string; + /** Specifies whether or not the scrolling by content is enabled. */ + scrollByContent?: boolean; + /** Specifies whether or not the scrollbar thumb scrolling enabled. */ + scrollByThumb?: boolean; + }; + /** Specifies options of the search panel. */ + searchPanel?: { + /** Specifies whether or not search strings in the located grid records should be highlighted. */ + highlightSearchText?: boolean; + /** Specifies text displayed by the search panel when no search string was typed. */ + placeholder?: string; + /** Specifies whether the search panel is visible or not. */ + visible?: boolean; + /** Specifies the width of the search panel in pixels. */ + width?: number; + /** Sets a search string for the search panel. */ + text?: string; + }; + /** Specifies the operations that must be performed on the server side. */ + remoteOperations?: any; + /** Allows you to sort groups according to the values of group summary items. */ + sortByGroupSummaryInfo?: Array<{ + /** Specifies the group summary item whose values must be used to sort groups. */ + summaryItem?: string; + /** Specifies the identifier of the column that must be used in grouping so that sorting by group summary item values be applied. */ + groupColumn?: string; + /** Specifies the sort order of group summary item values. */ + sortOrder?: string; + }>; + /** Allows you to build a master-detail interface in the grid. */ + masterDetail?: { + /** Enables an end-user to expand/collapse detail sections. */ + enabled?: boolean; + /** Specifies whether detail sections appear expanded or collapsed. */ + autoExpandAll?: boolean; + /** Specifies the template for detail sections. */ + template?: any; + }; + /** Specifies options for exporting grid data. */ + export?: { + /** Indicates if the export feature is enabled in the grid. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies whether to enable Excel filtering for the exported data in the resulting XLSX file. */ + excelFilterEnabled?: boolean; + /** Specifies whether to enable word wrapping for the exported data in the resulting XLSX file. */ + excelWrapTextEnabled?: boolean; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + proxyUrl?: string; + /** Indicates whether to allow end users to export not only the data displayed in the grid, but the selected rows only. */ + allowExportSelectedData?: boolean; + /** Contains options that specify texts for the export-related commands and hints. */ + texts?: { + /** Specifies text for the Export button when this button invokes a dropdown menu so you can choose the required export format. */ + exportTo?: string; + /** Specifies text for the Export button's hint when this button exports to the XSLX format without invoking the drop-down menu. */ + exportToExcel?: string; + /** Specifies text for the item in the Export dropdown menu that exports grid data to Excel. */ + excelFormat?: string; + /** Specifies text for the option in the Export dropdown menu that allows you to choose whether to export all the grid data or the selected rows only. */ + selectedRows?: string; + } + }; + /** Specifies the keys of the records that must appear selected initially. */ + selectedRowKeys?: Array; + /** Specifies options of runtime selection. */ + selection?: { + /** Specifies the checkbox row display policy in the multiple mode. */ + showCheckBoxesMode?: string; + /** Specifies whether the user can select all grid records at once. */ + allowSelectAll?: boolean; + /** Specifies the selection mode. */ + mode?: string; + }; + /** A handler for the dataErrorOccured event. */ + onDataErrorOccurred?: (e: { error: Error }) => void; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + currentSelectedRowKeys: Array; + currentDeselectedRowKeys: Array; + selectedRowKeys: Array; + selectedRowsData: Array; + }) => void; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A handler for the keyDown event. */ + onKeyDown?: (e: Object) => void; + /** A handler for the rowExpanding event. */ + onRowExpanding?: (e: Object) => void; + /** A handler for the rowExpanded event. */ + onRowExpanded?: (e: Object) => void; + /** A handler for the rowCollapsing event. */ + onRowCollapsing?: (e: Object) => void; + /** A handler for the rowCollapsed event. */ + onRowCollapsed?: (e: Object) => void; + /** Specifies whether column headers are visible or not. */ + showColumnHeaders?: boolean; + /** Specifies whether or not vertical lines separating one grid column from another are visible. */ + showColumnLines?: boolean; + /** Specifies whether or not horizontal lines separating one grid row from another are visible. */ + showRowLines?: boolean; + /** Specifies options of runtime sorting. */ + sorting?: { + /** Specifies text for the context menu item that sets an ascending sort order in a column. */ + ascendingText?: string; + /** Specifies text for the context menu item that resets sorting settings for a column. */ + clearText?: string; + /** Specifies text for the context menu item that sets a descending sort order in a column. */ + descendingText?: string; + /** Specifies the runtime sorting mode. */ + mode?: string; + }; + /** Specifies options of state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (state: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + /** Specifies the options of the grid summary. */ + summary?: { + /** Contains options that specify text patterns for summary items. */ + texts?: { + /** Specifies a pattern for the 'sum' summary items when they are displayed in the parent column. */ + sum?: string; + /** Specifies a pattern for the 'sum' summary items displayed in a group row or in any other column rather than the parent one. */ + sumOtherColumn?: string; + /** Specifies a pattern for the 'min' summary items when they are displayed in the parent column. */ + min?: string; + /** Specifies a pattern for the 'min' summary items displayed in a group row or in any other column rather than the parent one. */ + minOtherColumn?: string; + /** Specifies a pattern for the 'max' summary items when they are displayed in the parent column. */ + max?: string; + /** Specifies a pattern for the 'max' summary items displayed in a group row or in any other column rather than the parent one. */ + maxOtherColumn?: string; + /** Specifies a pattern for the 'avg' summary items when they are displayed in the parent column. */ + avg?: string; + /** Specifies a pattern for the 'avg' summary items displayed in a group row or in any other column rather than the parent one. */ + avgOtherColumn?: string; + /** Specifies a pattern for the 'count' summary items. */ + count?: string; + }; + /** Specifies items of the group summary. */ + groupItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the column that provides data for a group summary item. */ + column?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** Specifies a precision for the summary item value of a numeric format. */ + precision?: number; + /** Specifies whether or not a summary item must be displayed in the group footer. */ + showInGroupFooter?: boolean; + /** Indicates whether to display group summary items in parentheses after the group row header or to align them by the corresponding columns within the group row. */ + alignByColumn?: boolean; + /** Specifies the column that must hold the summary item when this item is displayed in the group footer or aligned by a column in the group row. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: string; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + }>; + /** Specifies items of the total summary. */ + totalItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the alignment of a summary item. */ + alignment?: string; + /** Specifies the column that provides data for a summary item. */ + column?: string; + /** Specifies a CSS class to be applied to a summary item. */ + cssClass?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** Specifies a precision for the summary item value of a numeric format. */ + precision?: number; + /** Specifies the column that must hold the summary item. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: string; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + }>; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + /** Allows you to use a custom aggregate function to calculate the value of a summary item. */ + calculateCustomSummary?: (options: { + component: dxDataGrid; + name?: string; + value: any; + totalValue: any; + summaryProcess: string + }) => void; + }; + /** Specifies whether text that does not fit into a column should be wrapped. */ + wordWrapEnabled?: boolean; + } + /** A data grid widget. */ + export class dxDataGrid extends Widget { + constructor(element: JQuery, options?: dxDataGridOptions); + constructor(element: Element, options?: dxDataGridOptions); + /** Ungroups grid records. */ + clearGrouping(): void; + /** Clears sorting settings of all grid columns at once. */ + clearSorting(): void; + /** Allows you to obtain a cell by its row index and the data field of its column. */ + getCellElement(rowIndex: number, dataField: string): any; + /** Allows you to obtain a cell by its row index and the visible index of its column. */ + getCellElement(rowIndex: number, visibleColumnIndex: number): any; + /** Returns the current state of the grid. */ + state(): Object; + /** Sets the grid state. */ + state(state: Object): void; + /** Allows you to obtain the row index by a data key. */ + getRowIndexByKey(key: any): number; + /** Allows you to obtain the data key by a row index. */ + getKeyByRowIndex(rowIndex: number): any; + /** Adds a new column to a grid. */ + addColumn(columnOptions: dxDataGridColumn): void; + /** Removes the column from the grid. */ + deleteColumn(id: any): void; + /** Displays the load panel. */ + beginCustomLoading(messageText: string): void; + /** Discards changes made in a grid. */ + cancelEditData(): void; + /** Checks whether or not the grid contains unsaved changes. */ + hasEditData(): boolean; + /** Clears all the filters of a specific type applied to grid records. */ + clearFilter(): void; + /** Deselects all grid records. */ + clearSelection(): void; + /** Draws the cell being edited from the editing state. Use this method when the edit mode is batch. */ + closeEditCell(): void; + /** Collapses groups or master rows in a grid. */ + collapseAll(groupIndex?: number): void; + /** Returns the number of data columns in a grid. */ + columnCount(): number; + /** Returns the value of a specific column option. */ + columnOption(id: any, optionName: string): any; + /** Sets an option of a specific column. */ + columnOption(id: any, optionName: string, optionValue: any): void; + /** Returns the options of a column by an identifier. */ + columnOption(id: any): Object; + /** Sets several options of a column at once. */ + columnOption(id: any, options: Object): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, visibleColumnIndex: number): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, dataField: string): void; + /** Sets a specific row into the editing state. */ + editRow(rowIndex: number): void; + /** Gets the cell value. */ + cellValue(rowIndex: number, dataField: string): any; + /** Gets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number): any; + /** Sets the cell value. */ + cellValue(rowIndex: number, dataField: string, value: any): void; + /** Sets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number, value: any): void; + /** Hides the load panel. */ + endCustomLoading(): void; + /** Expands groups or master rows in a grid. */ + expandAll(groupIndex: number): void; + /** Allows you to find out whether a specific group or master row is expanded or collapsed. */ + isRowExpanded(key: any): boolean; + /** Allows you to expand a specific group or master row by its key. */ + expandRow(key: any): void; + /** Allows you to collapse a specific group or master row by its key. */ + collapseRow(key: any): void; + /** Applies a filter to the grid's data source. */ + filter(filterExpr?: any): void; + /** Returns a filter expression applied to the grid's data source using the filter(filterExpr) method. */ + filter(): any; + /** Returns a filter expression applied to the grid using all possible scenarious. */ + getCombinedFilter(): any; + /** Gets the keys of currently selected grid records. */ + getSelectedRowKeys(): Array; + /** Gets the data objects of currently selected grid records. */ + getSelectedRowsData(): Array; + /** Hides the column chooser panel. */ + hideColumnChooser(): void; + /** Adds a new data row to a grid. */ + addRow(): void; + /** + * Adds a new data row to a grid. + * @deprecated Use the addRow() method instead. + */ + insertRow(): void; + /** Returns the key corresponding to the passed data object. */ + keyOf(obj: Object): any; + /** Switches a grid to a specified page. */ + pageIndex(newIndex: number): void; + /** Gets the index of the current page. */ + pageIndex(): number; + /** Sets the page size. */ + pageSize(value: number): void; + /** Gets the current page size. */ + pageSize(): number; + /** Refreshes grid data. */ + refresh(): void; + /** Removes a specific row from a grid. */ + deleteRow(rowIndex: number): void; + /** + * Removes a specific row from a grid. + * @deprecated Use the deleteRow(rowIndex) method instead. + */ + removeRow(rowIndex: number): void; + /** Saves changes made in a grid. */ + saveEditData(): void; + /** Searches grid records by a search string. */ + searchByText(text: string): void; + /** Selects all grid records. */ + selectAll(): void; + /** Deselects the rows that are currently selected within the applied filter. */ + deselectAll(): void; + /** Selects specific grid records. */ + selectRows(keys: Array, preserve: boolean): void; + /** Deselects specific grid records. */ + deselectRows(keys: Array): void; + /** Selects grid rows by indexes. */ + selectRowsByIndexes(indexes: Array): void; + /** Allows you to find out whether a row is selected or not. */ + isRowSelected(key: any): boolean; + /** Invokes the column chooser panel. */ + showColumnChooser(): void; + startSelectionWithCheckboxes(): boolean; + /** Returns the number of records currently held by a grid. */ + totalCount(): number; + /** Recovers a row deleted in the batch edit mode. */ + undeleteRow(rowIndex: number): void; + /** Allows you to obtain a data object by its key. */ + byKey(key: any): JQueryPromise; + /** Gets the value of a total summary item. */ + getTotalSummaryValue(summaryItemName: string): any; + /** Exports grid data to Excel. */ + exportToExcel(selectionOnly: boolean): void; + /** Updates the grid to the size of its content. */ + updateDimensions(): void; + /** Focuses the specified cell element in the grid. */ + focus(element?: JQuery): void; + } + export interface dxPivotGridOptions extends WidgetOptions { + onContentReady?: Function; + /** Specifies a data source for the pivot grid. */ + dataSource?: any; + useNativeScrolling?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + }; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies whether to display the Total rows. */ + showRowTotals?: boolean; + /** Specifies whether to display the Grand Total row. */ + showRowGrandTotals?: boolean; + /** Specifies whether to display the Total columns. */ + showColumnTotals?: boolean; + /** Specifies whether to display the Grand Total column. */ + showColumnGrandTotals?: boolean; + /** Specifies whether or not to hide rows and columns with no data. */ + hideEmptySummaryCells?: boolean; + /** Specifies where to show the total rows or columns. */ + showTotalsPrior?: string; + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** The Field Chooser configuration options. */ + fieldChooser?: { + /** Enables or disables the field chooser. */ + enabled?: boolean; + /** Specifies the field chooser layout. */ + layout?: number; + /** Specifies the text to display as a title of the field chooser popup window. */ + title?: string; + /** Specifies the field chooser width. */ + width?: number; + /** Specifies the field chooser height. */ + height?: number; + /** Strings that can be changed or localized in the pivot grid's integrated Field Chooser. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** Strings that can be changed or localized in the dxPivotGrid widget. */ + texts?: { + /** The string to display as a header of the Grand Total row and column. */ + grandTotal?: string; + /** The string to display as a header of the Total row and column. */ + total?: string; + /** Specifies the text displayed when a pivot grid does not contain any fields. */ + noData?: string; + /** The string to display as a Show Field Chooser context menu item. */ + showFieldChooser?: string; + /** The string to display as an Expand All context menu item. */ + expandAll?: string; + /** The string to display as a Collapse All context menu item. */ + collapseAll?: string; + /** The string to display as a Sort Column by Summary Value context menu item. */ + sortColumnBySummary?: string; + /** The string to display as a Sort Row by Summary Value context menu item. */ + sortRowBySummary?: string; + /** The string to display as a Remove All Sorting context menu item. */ + removeAllSorting?: string; + /** The string to display as an Export to Excel file context menu item. */ + exportToExcel?: string; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Enables or disables the load panel. */ + enabled?: boolean; + /** Specifies the height of the load panel. */ + height?: number; + /** Specifies the URL pointing to an image that will be used as a load indicator. */ + indicatorSrc?: string; + /** Specifies whether or not to show a load indicator. */ + showIndicator?: boolean; + /** Specifies whether or not to show load panel background. */ + showPane?: boolean; + /** Specifies the text to display inside a load panel. */ + text?: string; + /** Specifies the width of the load panel. */ + width?: number; + }; + /** A handler for the cellClick event. */ + onCellClick?: (e: any) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: any) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** Specifies options for exporting pivot grid data. */ + export?: { + /** Indicates whether the export feature is enabled for the pivot grid. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + proxyUrl?: string; + }; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A configuration object specifying options related to state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (gridState: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + } + /** A data summarization widget for multi-dimensional data analysis and data mining. */ + export class dxPivotGrid extends Widget { + constructor(element: JQuery, options?: dxPivotGridOptions); + constructor(element: Element, options?: dxPivotGridOptions); + /** Gets the PivotGridDataSource instance. */ + getDataSource(): DevExpress.data.PivotGridDataSource; + /** Gets the dxPopup instance of the field chooser window. */ + getFieldChooserPopup(): DevExpress.ui.dxPopup; + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + /** Exports pivot grid data to the Excel file. */ + exportToExcel(): void; + } + export interface dxPivotGridFieldChooserOptions extends WidgetOptions { + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the field chooser layout. */ + layout?: number; + /** The data source of a dxPivotGrid widget. */ + dataSource?: DevExpress.data.PivotGridDataSource; + onContentReady?: Function; + /** Strings that can be changed or localized in the dxPivotGridFieldChooser widget. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** A complementary widget for dxPivotGrid that allows you to manage data displayed in the dxPivotGrid. */ + export class dxPivotGridFieldChooser extends Widget { + constructor(element: JQuery, options?: dxPivotGridFieldChooserOptions); + constructor(element: Element, options?: dxPivotGridFieldChooserOptions); + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + } +} +interface JQuery { + dxTreeView(): JQuery; + dxTreeView(options: "instance"): DevExpress.ui.dxTreeView; + dxTreeView(options: string): any; + dxTreeView(options: string, ...params: any[]): any; + dxTreeView(options: DevExpress.ui.dxTreeViewOptions): JQuery; + dxMenuBase(): JQuery; + dxMenuBase(options: "instance"): DevExpress.ui.dxMenuBase; + dxMenuBase(options: string): any; + dxMenuBase(options: string, ...params: any[]): any; + dxMenuBase(options: DevExpress.ui.dxMenuBaseOptions): JQuery; + dxMenu(): JQuery; + dxMenu(options: "instance"): DevExpress.ui.dxMenu; + dxMenu(options: string): any; + dxMenu(options: string, ...params: any[]): any; + dxMenu(options: DevExpress.ui.dxMenuOptions): JQuery; + dxContextMenu(): JQuery; + dxContextMenu(options: "instance"): DevExpress.ui.dxContextMenu; + dxContextMenu(options: string): any; + dxContextMenu(options: string, ...params: any[]): any; + dxContextMenu(options: DevExpress.ui.dxContextMenuOptions): JQuery; + dxColorBox(): JQuery; + dxColorBox(options: "instance"): DevExpress.ui.dxColorBox; + dxColorBox(options: string): any; + dxColorBox(options: string, ...params: any[]): any; + dxColorBox(options: DevExpress.ui.dxColorBoxOptions): JQuery; + dxDataGrid(): JQuery; + dxDataGrid(options: "instance"): DevExpress.ui.dxDataGrid; + dxDataGrid(options: string): any; + dxDataGrid(options: string, ...params: any[]): any; + dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; + dxPivotGrid(): JQuery; + dxPivotGrid(options: "instance"): DevExpress.ui.dxPivotGrid; + dxPivotGrid(options: string): any; + dxPivotGrid(options: string, ...params: any[]): any; + dxPivotGrid(options: DevExpress.ui.dxPivotGridOptions): JQuery; + dxPivotGridFieldChooser(): JQuery; + dxPivotGridFieldChooser(options: "instance"): DevExpress.ui.dxPivotGridFieldChooser; + dxPivotGridFieldChooser(options: string): any; + dxPivotGridFieldChooser(options: string, ...params: any[]): any; + dxPivotGridFieldChooser(options: DevExpress.ui.dxPivotGridFieldChooserOptions): JQuery; + dxScheduler(): JQuery; + dxScheduler(options: "instance"): DevExpress.ui.dxScheduler; + dxScheduler(options: string): any; + dxScheduler(options: string, ...params: any[]): any; + dxScheduler(options: DevExpress.ui.dxSchedulerOptions): JQuery; +} +declare module DevExpress.framework { + /** An object used to store information on the views displayed in an application. */ + export class ViewCache { + viewRemoved: JQueryCallback; + /** Removes all the viewInfo objects from the cache. */ + clear(): void; + /** Obtains a viewInfo object from the cache by the specified key. */ + getView(key: string): Object; + /** Checks whether or not a viewInfo object is contained in the view cache under the specified key. */ + hasView(key: string): boolean; + /** Removes a viewInfo object from the cache by the specified key. */ + removeView(key: string): Object; + /** Adds the specified viewInfo object to the cache under the specified key. */ + setView(key: string, viewInfo: Object): void; + } + export interface dxCommandOptions extends DOMComponentOptions { + /** Specifies an action performed when the execute() method of the command is called. */ + onExecute?: any; + /** Indicates whether or not the widget that displays this command is disabled. */ + disabled?: boolean; + /** Specifies whether the current command is rendered when a view is being rendered or after a view is shown. */ + renderStage?: string; + /** Specifies the name of the icon shown inside the widget associated with this command. */ + icon?: string; + iconSrc?: string; + /** The identifier of the command. */ + id?: string; + /** Specifies the title of the widget associated with this command. */ + title?: string; + /** Specifies the type of the button, if the command is rendered as a dxButton widget. */ + type?: string; + /** A Boolean value specifying whether or not the widget associated with this command is visible. */ + visible?: boolean; + } + /** A markup component used to define markup options for a command. */ + export class dxCommand extends DOMComponent { + constructor(element: JQuery, options: dxCommandOptions); + constructor(options: dxCommandOptions); + /** Executes the action associated with this command. */ + execute(): void; + } + /** An object responsible for routing. */ + export class Router { + /** Adds a routing rule to the list of registered rules. */ + register(pattern: string, defaults?: Object, constraints?: Object): void; + /** Decodes the specified URI to an object using the registered routing rules. */ + parse(uri: string): Object; + /** Formats an object to a URI. */ + format(obj: Object): string; + } + export interface StateManagerOptions { + /** A storage to which the state manager saves the application state. */ + storage?: Object; + } + /** An object used to store the current application state. */ + export class StateManager { + constructor(options?: StateManagerOptions); + /** Adds an object that implements an interface of a state source to the state manager's collection of state sources. */ + addStateSource(stateSource: Object): void; + /** Removes a specified state source from the state manager's collection of state sources. */ + removeStateSource(stateSource: Object): void; + /** Saves the current application state. */ + saveState(): void; + /** Restores the application state that has been saved by the saveState() method to the state storage. */ + restoreState(): void; + /** Removes the application state that has been saved by the saveState() method to the state storage. */ + clearState(): void; + } + export module html { + export var layoutSets: Array; + export var animationSets: { [animationSetName: string]: AnimationSet }; + export interface AnimationSet { + [animationName: string]: any + } + export interface HtmlApplicationOptions { + /** Specifies where the commands that are defined in the application's views must be displayed. */ + commandMapping?: Object; + /** Specifies whether or not view caching is disabled. */ + disableViewCache?: boolean; + /** An array of layout controllers that should be used to show application views in the current navigation context. */ + layoutSet?: any; + /** Specifies the animation presets that are used to animate different UI elements in the current application. */ + animationSet?: AnimationSet; + /** Specifies whether the current application must behave as a mobile or web application. */ + mode?: string; + /** Specifies the object that represents a root namespace of the application. */ + namespace?: Object; + /** Specifies application behavior when the user navigates to a root view. */ + navigateToRootViewMode?: string; + /** An array of dxCommand configuration objects used to define commands available from the application's global navigation. */ + navigation?: Array; + /** A state manager to be used in the application. */ + stateManager?: StateManager; + /** Specifies the storage to be used by the application's state manager to store the application state. */ + stateStorage?: Object; + /** Indicates whether on not to use the title of the previously displayed view as text on the Back button. */ + useViewTitleAsBackText?: boolean; + /** A custom view cache to be used in the application. */ + viewCache?: Object; + /** Specifies a limit for the views that can be cached. */ + viewCacheSize?: number; + /** Specifies the current version of application templates. */ + templatesVersion?: string; + /** Specifies options for the viewport meta tag of a mobile browser. */ + viewPort?: JQuery; + /** A custom router to be used in the application. */ + router?: Router; + } + /** An object used to manage views, as well as control the application life cycle. */ + export class HtmlApplication implements EventsMixin { + constructor(options: HtmlApplicationOptions); + afterViewSetup: JQueryCallback; + beforeViewSetup: JQueryCallback; + initialized: JQueryCallback; + navigating: JQueryCallback; + navigatingBack: JQueryCallback; + resolveLayoutController: JQueryCallback; + resolveViewCacheKey: JQueryCallback; + viewDisposed: JQueryCallback; + viewDisposing: JQueryCallback; + viewHidden: JQueryCallback; + viewRendered: JQueryCallback; + viewShowing: JQueryCallback; + viewShown: JQueryCallback; + /** Provides access to the ViewCache object. */ + viewCache: ViewCache; + /** An array of dxCommand components that are created based on the application's navigation option value. */ + navigation: Array; + /** Provides access to the StateManager object. */ + stateManager: StateManager; + /** Provides access to the Router object. */ + router: Router; + /** Navigates to the URI preceding the current one in the navigation history. */ + back(): void; + /** Returns a Boolean value indicating whether or not backwards navigation is currently possible. */ + canBack(): boolean; + /** Calls the clearState() method of the application's StateManager object. */ + clearState(): void; + /** Creates global navigation commands. */ + createNavigation(navigationConfig: Array): void; + /** Returns an HTML template of the specified view. */ + getViewTemplate(viewName: string): JQuery; + /** Returns a configuration object used to create a dxView component for a specified view. */ + getViewTemplateInfo(viewName: string): Object; + /** Adds a specified HTML template to a collection of view or layout templates. */ + loadTemplates(source: any): JQueryPromise; + /** Navigates to the specified URI. */ + navigate(uri?: any, options?: Object): void; + /** Renders navigation commands to the navigation command containers that are located in the layouts used in the application. */ + renderNavigation(): void; + /** Calls the restoreState() method of the application's StateManager object. */ + restoreState(): void; + /** Calls the saveState method of the application's StateManager object. */ + saveState(): void; + /** Provides access to the object that defines the current context to be considered when choosing an appropriate template for a view. */ + templateContext(): Object; + on(eventName: "initialized", eventHandler: () => void): HtmlApplication; + on(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + on(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + on(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + on(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: string, eventHandler: Function): HtmlApplication; + on(events: { [eventName: string]: Function; }): HtmlApplication; + off(eventName: "initialized"): HtmlApplication; + off(eventName: "afterViewSetup"): HtmlApplication; + off(eventName: "beforeViewSetup"): HtmlApplication; + off(eventName: "navigating"): HtmlApplication; + off(eventName: "navigatingBack"): HtmlApplication; + off(eventName: "resolveLayoutController"): HtmlApplication; + off(eventName: "resolveViewCacheKey"): HtmlApplication; + off(eventName: "viewDisposed"): HtmlApplication; + off(eventName: "viewDisposing"): HtmlApplication; + off(eventName: "viewHidden"): HtmlApplication; + off(eventName: "viewRendered"): HtmlApplication; + off(eventName: "viewShowing"): HtmlApplication; + off(eventName: "viewShown"): HtmlApplication; + off(eventName: string): HtmlApplication; + off(eventName: "initialized", eventHandler: () => void): HtmlApplication; + off(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + off(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + off(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + off(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: string, eventHandler: Function): HtmlApplication; + } + } +} +declare module DevExpress.viz.core { + /** + * Applies a theme for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. + */ + export function currentTheme(theme: string): void; + /** + * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. + */ + export function currentTheme(platform: string, colorScheme: string): void; + /** + * Registers a new theme based on the existing one. + * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. + */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** + * Applies a predefined or registered custom palette to all visualization widgets at once. + * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. + */ + export function currentPalette(paletteName: string): void; + /** + * Obtains the color sets of a predefined or registered palette. + * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. + */ + export function getPalette(paletteName: string): Object; + /** + * Registers a new palette. + * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. + */ + export function registerPalette(paletteName: string, palette: Object): void; + export interface Border { + /** Sets a border color for a selected series. */ + color?: string; + /** Sets border visibility for a selected series. */ + visible?: boolean; + /** Sets a border width for a selected series. */ + width?: number; + } + export interface DashedBorder extends Border { + /** Specifies a dash style for the border of a selected series point. */ + dashStyle?: string; + } + export interface DashedBorderWithOpacity extends DashedBorder { + /** Specifies the opacity of the tooltip's border. */ + opacity?: number; + } + export interface Font { + /** Specifies the font color for a strip label. */ + color?: string; + /** Specifies the font family for a strip label. */ + family?: string; + /** Specifies the font opacity for a strip label. */ + opacity?: number; + /** Specifies the font size for a strip label. */ + size?: any; + /** Specifies the font weight for the text displayed in strips. */ + weight?: number; + } + export interface Hatching { + direction?: string; + /** Specifies the opacity of hatching lines. */ + opacity?: number; + /** Specifies the distance between hatching lines in pixels. */ + step?: number; + /** Specifies the width of hatching lines in pixels. */ + width?: number; + } + export interface Margins { + /** Specifies the distance in pixels between the bottom side of the title and the surrounding widget elements. */ + bottom?: number; + /** Specifies the distance in pixels between the left side of the title and the surrounding widget elements. */ + left?: number; + /** Specifies the distance between the right side of the title and surrounding widget elements in pixels. */ + right?: number; + /** Specifies the distance between the top side of the title and surrounding widget elements in pixels. */ + top?: number; + } + export interface Size { + /** Specifies the width of the widget. */ + width?: number; + /** Specifies the height of the widget. */ + height?: number; + } + export interface Title { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies the widget title's horizontal position. */ + horizontalAlignment?: string; + /** Specifies the widget title's position in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the distance between the title and surrounding widget elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies text for the title. */ + text?: string; + /** Specifies a subtitle for the widget. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } + } + export interface Tooltip { + /** Specifies the length of the tooltip's arrow in pixels. */ + arrowLength?: number; + /** Specifies the appearance of the tooltip's border. */ + border?: viz.core.DashedBorderWithOpacity; + /** Specifies a color for the tooltip. */ + color?: string; + /** Specifies the z-index for tooltips. */ + zIndex?: number; + /** Specifies the container to draw tooltips inside of it. */ + container?: any; + /** Specifies text and appearance of a set of tooltips. */ + customizeTooltip?: (arg: Object) => { color?: string; text?: string }; + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies font options for the text displayed by the tooltip. */ + font?: Font; + /** Specifies a format for the text displayed by the tooltip. */ + format?: string; + /** Specifies the opacity of a tooltip. */ + opacity?: number; + /** Specifies a distance from the tooltip's left/right boundaries to the inner text in pixels. */ + paddingLeftRight?: number; + /** Specifies a distance from the tooltip's top/bottom boundaries to the inner text in pixels. */ + paddingTopBottom?: number; + /** Specifies a precision for formatted values displayed by the tooltip. */ + precision?: number; + /** Specifies options of the tooltip's shadow. */ + shadow?: { + /** Specifies the blur distance of the tooltip's shadow. */ + blur?: number; + /** Specifies the color of the tooltip's shadow. */ + color?: string; + /** Specifies the horizontal offset of the tooltip's shadow relative to the tooltip in pixels. */ + offsetX?: number; + /** Specifies the vertical offset of the tooltip's shadow relative to the tooltip in pixels. */ + offsetY?: number; + /** Specifies the opacity of the tooltip's shadow. */ + opacity?: number; + }; + } + export interface Animation { + /** Determines how long animation runs. */ + duration?: number; + /** Specifies the animation easing mode. */ + easing?: string; + /** Indicates whether or not animation is enabled. */ + enabled?: boolean; + } + export interface LoadingIndicator { + /** Specifies a color for the loading indicator background. */ + backgroundColor?: string; + /** Specifies font options for the loading indicator text. */ + font?: viz.core.Font; + /** Specifies whether to show the loading indicator or not. */ + show?: boolean; + /** Specifies a text to be displayed by the loading indicator. */ + text?: string; + } + export interface LegendBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies a radius for the corners of the legend border. */ + cornerRadius?: number; + } + export interface BaseLegend { + /** Specifies the color of the legend's background. */ + backgroundColor?: string; + /** Specifies legend border settings. */ + border?: viz.core.LegendBorder; + /** Specifies how many columns must be taken to arrange legend items. */ + columnCount?: number; + /** Specifies the spacing between a pair of neighboring legend columns in pixels. */ + columnItemSpacing?: number; + /** Specifies font options for legend items. */ + font?: viz.core.Font; + /** Specifies the legend's position on the map. */ + horizontalAlignment?: string; + /** Specifies the alignment of legend items. */ + itemsAlignment?: string; + /** Specifies the position of text relative to the item marker. */ + itemTextPosition?: string; + /** Specifies the distance between the legend and the container borders in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of item markers in the legend in pixels. */ + markerSize?: number; + /** Specifies whether to arrange legend items horizontally or vertically. */ + orientation?: string; + /** Specifies the spacing between the legend left/right border and legend items in pixels. */ + paddingLeftRight?: number; + /** Specifies the spacing between the legend top/bottom border and legend items in pixels. */ + paddingTopBottom?: number; + /** Specifies how many rows must be taken to arrange legend items. */ + rowCount?: number; + /** Specifies the spacing between a pair of neighboring legend rows in pixels. */ + rowItemSpacing?: number; + /** Specifies the legend's position on the map. */ + verticalAlignment?: string; + /** Specifies whether or not the legend is visible on the map. */ + visible?: boolean; + } + export interface BaseWidgetOptions extends DOMComponentOptions { + /** A handler for the drawn event. */ + onDrawn?: (e: { + component: BaseWidget; + element: Element; + }) => void; + /** A handler for the incidentOccurred event. */ + onIncidentOccurred?: ( + component: BaseWidget, + element: Element, + target: { + id: string; + type: string; + args: any; + text: string; + widget: string; + version: string; + } + ) => void; + /** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */ + pathModified?: boolean; + /** Specifies whether or not the widget supports right-to-left representation. */ + rtlEnabled?: boolean; + /** Sets the name of the theme to be used in the widget. */ + theme?: string; + } + /** This section describes options and methods that are common to all widgets. */ + export class BaseWidget extends DOMComponent { + /** Returns the widget's SVG markup. */ + svg(): string; + } +} +declare module DevExpress.viz.charts { + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface BaseSeries { + /** Provides information about the state of the series object. */ + fullState: number; + /** Returns the type of the series. */ + type: string; + /** Unselects all the selected points of the series. The points are displayed in an initial style. */ + clearSelection(): void; + /** Gets the color of a particular series. */ + getColor(): string; + /** Gets points from the series point collection based on the specified argument. */ + getPointsByArg(pointArg: any): Array; + /** Gets a point from the series point collection based on the specified point position. */ + getPointByPos(positionIndex: number): Object; + /** Selects the series. The series is displayed in a 'selected' style until another series is selected or the current series is deselected programmatically. */ + select(): void; + /** Selects the specified point. The point is displayed in a 'selected' style. */ + selectPoint(point: BasePoint): void; + /** Deselects the specified point. The point is displayed in an initial style. */ + deselectPoint(point: BasePoint): void; + /** Returns an array of all points in the series. */ + getAllPoints(): Array; + /** Returns visible series points. */ + getVisiblePoints(): Array; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): boolean; + /** Provides information about the selection state of a series. */ + isSelected(): boolean; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface BasePoint { + /** Provides information about the state of the point object. */ + fullState: number; + /** Returns the point's argument value that was set in the data source. */ + originalArgument: any; + /** Returns the point's value that was set in the data source. */ + originalValue: any; + /** Returns the tag of the point. */ + tag: string; + /** Deselects the point. */ + clearSelection(): void; + /** Gets the color of a particular point. */ + getColor(): string; + /** Hides the tooltip of the point. */ + hideTooltip(): void; + /** Provides information about the hover state of a point. */ + isHovered(): boolean; + /** Provides information about the selection state of a point. */ + isSelected(): boolean; + /** Selects the point. The point is displayed in a 'selected' style until another point is selected or the current point is deselected programmatically. */ + select(): void; + /** Shows the tooltip of the point. */ + showTooltip(): void; + /** Allows you to obtain the label of a series point. */ + getLabel(): any; + /** Returns the series object to which the point belongs. */ + series: BaseSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface ChartSeries extends BaseSeries { + /** Returns the name of the series pane. */ + pane: string; + /** Returns the name of the value axis of the series. */ + axis: string; + selectPoint(point: ChartPoint): void; + deselectPoint(point: ChartPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface ChartPoint extends BasePoint { + /** Contains the close value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalCloseValue: any; + /** Contains the high value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalHighValue: any; + /** Contains the low value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalLowValue: any; + /** Contains the first value of the point. This field is useful for points belonging to a series of the range area or range bar type only. */ + originalMinValue: any; + /** Contains the open value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalOpenValue: any; + /** Contains the size of the bubble as it was set in the data source. This field is useful for points belonging to a series of the bubble type only. */ + size: any; + /** Gets the parameters of the point's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + series: ChartSeries; + } + /** This section describes the methods that can be used in code to manipulate the Label object. */ + export interface Label { + /** Gets the parameters of the label's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + /** Hides the point label. */ + hide(): void; + /** Shows the point label. */ + show(): void; + } + export interface PieSeries extends BaseSeries { + selectPoint(point: PiePoint): void; + deselectPoint(point: PiePoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PiePoint extends BasePoint { + /** Gets the percentage value of the specific point. */ + percent: any; + /** Provides information about the visibility state of a point. */ + isVisible(): boolean; + /** Makes a specific point visible. */ + show(): void; + /** Hides a specific point. */ + hide(): void; + series: PieSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface PolarSeries extends BaseSeries { + /** Returns the name of the value axis of the series. */ + axis: string; + selectPoint(point: PolarPoint): void; + deselectPoint(point: PolarPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PolarPoint extends BasePoint { + series: PolarSeries; + } + export interface Strip { + /** Specifies a color for a strip. */ + color?: string; + /** An object that defines the label configuration options of a strip. */ + label?: { + /** Specifies the text displayed in a strip. */ + text?: string; + }; + /** Specifies a start value for a strip. */ + startValue?: any; + /** Specifies an end value for a strip. */ + endValue?: any; + } + export interface BaseSeriesConfigLabel { + /** Specifies a format for arguments displayed by point labels. */ + argumentFormat?: string; + /** Specifies a precision for formatted point arguments displayed in point labels. */ + argumentPrecision?: number; + /** Specifies a background color for point labels. */ + backgroundColor?: string; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies connector options for series point labels. */ + connector?: { + /** Specifies the color of label connectors. */ + color?: string; + /** Indicates whether or not label connectors are visible. */ + visible?: boolean; + /** Specifies the width of label connectors. */ + width?: number; + }; + /** Specifies a callback function that returns the text to be displayed by point labels. */ + customizeText?: (pointInfo: Object) => string; + /** Specifies font options for the text displayed in point labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed by point labels. */ + format?: string; + position?: string; + /** Specifies a precision for formatted point values displayed in point labels. */ + precision?: number; + /** Specifies the angle used to rotate point labels from their initial position. */ + rotationAngle?: number; + /** Specifies the visibility of point labels. */ + visible?: boolean; + } + export interface SeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies whether or not to show a label when the point has a zero value. */ + showForZeroValues?: boolean; + } + export interface ChartSeriesConfigLabel extends SeriesConfigLabel { + /** Specifies how to align point labels relative to the corresponding data points that they represent. */ + alignment?: string; + /** Specifies how to shift point labels horizontally from their initial positions. */ + horizontalOffset?: number; + /** Specifies how to shift point labels vertically from their initial positions. */ + verticalOffset?: number; + /** Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. */ + percentPrecision?: number; + } + export interface BaseCommonSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + axis?: string; + /** An object defining the label configuration options for a series in the dxChart widget. */ + label?: ChartSeriesConfigLabel; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the dash style of the series' line. */ + dashStyle?: string; + hoverMode?: string; + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /**

Sets a color for a series when it is hovered over.

*/ + color?: string; + /** Specifies the dash style for the line in a hovered series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a hovered series. */ + width?: number; + }; + /** Specifies whether a chart ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies the minimal length of a displayed bar in pixels. */ + minBarSize?: number; + /** Specifies opacity for a series. */ + opacity?: number; + /** Specifies the series elements to highlight when the series is selected. */ + selectionMode?: string; + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the dash style for the line in a selected series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a selected series. */ + width?: number; + }; + /** Specifies whether or not to show the series in the chart's legend. */ + showInLegend?: boolean; + /** Specifies the name of the stack where the values of the _stackedBar_ series must be located. */ + stack?: string; + /** Specifies the name of the data source field that provides data about a point. */ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + /** Specifies the visibility of a series. */ + visible?: boolean; + /** Specifies a line width. */ + width?: number; + /** Configures error bars. */ + valueErrorBar?: { + /** Specifies whether error bars must be displayed in full or partially. */ + displayMode?: string; + /** Specifies the data field that provides data for low error values. */ + lowValueField?: string; + /** Specifies the data field that provides data for high error values. */ + highValueField?: string; + /** Specifies how error bar values must be calculated. */ + type?: string; + /** Specifies the value to be used for generating error bars. */ + value?: number; + /** Specifies the color of error bars. */ + color?: string; + /** Specifies the opacity of error bars. */ + opacity?: number; + /** Specifies the length of the lines that indicate the error bar edges. */ + edgeLength?: number; + /** Specifies the width of the error bar line. */ + lineWidth?: number; + }; + } + export interface CommonPointOptions { + /** Specifies border options for points in the line and area series. */ + border?: viz.core.Border; + /** Specifies the points color. */ + color?: string; + /** Specifies what series points to highlight when a point is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered point. */ + hoverStyle?: { + /** An object defining the border options for a hovered point. */ + border?: viz.core.Border; + /** Sets a color for a point when it is hovered over. */ + color?: string; + /** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies what series points to highlight when a point is selected. */ + selectionMode?: string; + /** An object defining configuration options for a selected point. */ + selectionStyle?: { + /** An object defining the border options for a selected point. */ + border?: viz.core.Border; + /**

Sets a color for a point when it is selected.

*/ + color?: string; + /** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */ + size?: number; + /** Specifies a symbol for presenting points of the line and area series. */ + symbol?: string; + visible?: boolean; + } + export interface ChartCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: any; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: any; + /** Specifies the width of an image that is used as a point marker. */ + width?: any; + }; + } + export interface PolarCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: number; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: string; + /** Specifies the width of an image that is used as a point marker. */ + width?: number; + }; + } + /** An object that defines configuration options for chart series. */ + export interface CommonSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies the data source field that provides a 'close' value for a _candleStick_ or _stock_ series. */ + closeValueField?: string; + /** Specifies a radius for bar corners. */ + cornerRadius?: number; + /** Specifies the data source field that provides a 'high' value for a _candleStick_ or _stock_ series. */ + highValueField?: string; + /** Specifies the color for the body (rectangle) of a _candleStick_ series. */ + innerColor?: string; + /** Specifies the data source field that provides a 'low' value for a _candleStick_ or _stock_ series. */ + lowValueField?: string; + /** Specifies the data source field that provides an 'open' value for a _candleStick_ or _stock_ series. */ + openValueField?: string; + /** Specifies the pane that will be used to display a series. */ + pane?: string; + /** An object defining configuration options for points in line-, scatter- and area-like series. */ + point?: ChartCommonPointOptions; + /** Specifies the data source field that provides values for one end of a range series. To set the data source field for the other end of the range series, use the rangeValue2Field property. */ + rangeValue1Field?: string; + /** Specifies the data source field that provides values for the second end of a range series. To set the data source field for the other end of the range series, use the rangeValue1Field property. */ + rangeValue2Field?: string; + /** Specifies reduction options for the stock or candleStick series. */ + reduction?: { + /** Specifies a color for the points whose reduction level price is lower in comparison to the value in the previous point. */ + color?: string; + /** Specifies for which price level (open, high, low or close) to enable reduction options in the series. */ + level?: string; + }; + /** Specifies the data source field that defines the size of bubbles. */ + sizeField?: string; + } + export interface CommonSeriesSettings extends CommonSeriesConfig { + /**

An object that specifies configuration options for all series of the area type in the chart.

*/ + area?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the bubble type in the chart. */ + bubble?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _candleStick_ type in the chart. */ + candlestick?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedArea_ type in the chart. */ + fullstackedarea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Full-Stacked Spline Area type in the chart. */ + fullstackedsplinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedBar_ type in the chart. */ + fullstackedbar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedLine_ type in the chart. */ + fullstackedline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Full-Stacked Spline type in the chart. */ + fullstackedspline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _rangeArea_ type in the chart. */ + rangearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _rangeBar_ type in the chart. */ + rangebar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _spline_ type in the chart. */ + spline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _splineArea_ type in the chart. */ + splinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedArea_ type in the chart. */ + stackedarea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Stacked Spline Area type in the chart. */ + stackedsplinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedLine_ type in the chart. */ + stackedline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Stacked Spline type in the chart. */ + stackedspline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stepArea_ type in the chart. */ + steparea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stepLine_ type in the chart. */ + stepline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stock_ type in the chart. */ + stock?: CommonSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface SeriesConfig extends CommonSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + /** An object that defines configuration options for polar chart series. */ + export interface CommonPolarSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies whether or not to close the chart by joining the end point with the first point. */ + closed?: boolean; + label?: SeriesConfigLabel; + point?: PolarCommonPointOptions; + } + export interface CommonPolarSeriesSettings extends CommonPolarSeriesConfig { + /** An object that specifies configuration options for all series of the area type in the chart. */ + area?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonPolarSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface PolarSeriesConfig extends CommonPolarSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + export interface PieSeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies how to shift labels from their initial position in a radial direction in pixels. */ + radialOffset?: number; + /** Specifies a precision for the percentage values displayed in labels. */ + percentPrecision?: number; + } + /** An object that defines configuration options for chart series. */ + export interface CommonPieSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + /** Specifies the required type for series arguments. */ + argumentType?: string; + /** An object defining the series border configuration options. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the chart elements to highlight when a series is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered series. */ + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /** Sets a color for the series when it is hovered over. */ + color?: string; + /** Specifies the hatching options to be applied when a point is hovered over. */ + hatching?: viz.core.Hatching; + }; + /** + * Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. + * @deprecated Use the innerRadius option instead. + */ + innerRadius?: number; + /** An object defining the label configuration options. */ + label?: PieSeriesConfigLabel; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies a minimal size of a displayed pie segment. */ + minSegmentSize?: number; + /** + * Specifies the direction in which the dxPieChart series points are located. + * @deprecated Use the segmentsDirection option instead. + */ + segmentsDirection?: string; + /**

Specifies the chart elements to highlight when the series is selected.

*/ + selectionMode?: string; + /** An object defining configuration options for the series when it is selected. */ + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the hatching options to be applied when a point is selected. */ + hatching?: viz.core.Hatching; + }; + /** Specifies chart segment grouping options. */ + smallValuesGrouping?: { + /** Specifies the name of the grouped chart segment. This name represents the segment in the chart legend. */ + groupName?: string; + /** Specifies the segment grouping mode. */ + mode?: string; + /** Specifies a threshold for segment values. */ + threshold?: number; + /** Specifies how many segments must not be grouped. */ + topCount?: number; + }; + /** + * Specifies a start angle for a pie chart in arc degrees. + * @deprecated Use the startAngle option instead. + */ + startAngle?: number; + /**

Specifies the name of the data source field that provides data about a point.

*/ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + } + export interface CommonPieSeriesSettings extends CommonPieSeriesConfig { + /** + * Specifies the type of the pie chart series. + * @deprecated Use the type option instead. + */ + type?: string; + } + export interface PieSeriesConfig extends CommonPieSeriesConfig { + /** + * Sets the series type. + * @deprecated Use the type option instead. + */ + type?: string; + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + } + export interface SeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => SeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface PolarSeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => PolarSeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface ChartCommonConstantLineLabel { + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + /** Specifies the position of the constant line label relative to the chart plot. */ + position?: string; + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + } + export interface PolarCommonConstantLineLabel { + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + } + export interface ConstantLineStyle { + /** Specifies a color for a constant line. */ + color?: string; + /** Specifies a dash style for a constant line. */ + dashStyle?: string; + /** Specifies a constant line width in pixels. */ + width?: number; + } + export interface ChartCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartCommonConstantLineLabel; + /** Specifies the space between the constant line label and the left/right side of the constant line. */ + paddingLeftRight?: number; + /** Specifies the space between the constant line label and the top/bottom side of the constant line. */ + paddingTopBottom?: number; + } + export interface PolarCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarCommonConstantLineLabel; + } + export interface CommonAxisLabel { + /** Specifies font options for axis labels. */ + font?: viz.core.Font; + /** Specifies the spacing between an axis and its labels in pixels. */ + indentFromAxis?: number; + /** Indicates whether or not axis labels are visible. */ + visible?: boolean; + } + export interface ChartCommonAxisLabel extends CommonAxisLabel { + /** Specifies the label's position relative to the tick (grid line). */ + alignment?: string; + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: { + /** Specifies how to arrange axis labels. */ + mode?: string; + /** Specifies the angle used to rotate axis labels. */ + rotationAngle?: number; + /** Specifies the spacing that must be set between staggered rows when the 'stagger' algorithm is applied. */ + staggeringSpacing?: number; + }; + } + export interface PolarCommonAxisLabel extends CommonAxisLabel { + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: string; + } + export interface CommonAxisTitle { + /** Specifies font options for an axis title. */ + font?: viz.core.Font; + /** Specifies a margin for an axis title in pixels. */ + margin?: number; + } + export interface BaseCommonAxisSettings { + /** Specifies the color of the line that represents an axis. */ + color?: string; + /** Specifies whether ticks/grid lines of a discrete axis are located between labels or cross the labels. */ + discreteAxisDivisionMode?: string; + /** An object defining the configuration options for the grid lines of an axis in the dxPolarChart widget. */ + grid?: { + /** Specifies a color for grid lines. */ + color?: string; + /** Specifies an opacity for grid lines. */ + opacity?: number; + /** Indicates whether or not the grid lines of an axis are visible. */ + visible?: boolean; + /** Specifies the width of grid lines. */ + width?: number; + }; + /** Specifies the options of the minor grid. */ + minorGrid?: { + /** Specifies a color for the lines of the minor grid. */ + color?: string; + /** Specifies an opacity for the lines of the minor grid. */ + opacity?: number; + /** Indicates whether the minor grid is visible or not. */ + visible?: boolean; + /** Specifies a width for the lines of the minor grid. */ + width?: number; + }; + /** Indicates whether or not an axis is inverted. */ + inverted?: boolean; + /** Specifies the opacity of the line that represents an axis. */ + opacity?: number; + /** Indicates whether or not to set ticks/grid lines of a continuous axis of the 'date-time' type at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** An object defining the configuration options for axis ticks. */ + tick?: { + /** Specifies ticks color. */ + color?: string; + /** Specifies tick opacity. */ + opacity?: number; + /** Indicates whether or not ticks are visible on an axis. */ + visible?: boolean; + /** Specifies tick width. */ + width?: number; + /** Specifies tick length. */ + length?: number; + }; + /** Specifies the options of the minor ticks. */ + minorTick?: { + /** Specifies a color for the minor ticks. */ + color?: string; + /** Specifies an opacity for the minor ticks. */ + opacity?: number; + /** Indicates whether or not the minor ticks are displayed on an axis. */ + visible?: boolean; + /** Specifies minor tick width. */ + width?: number; + /** Specifies minor tick length. */ + length?: number; + }; + /** Indicates whether or not the line that represents an axis in a chart is visible. */ + visible?: boolean; + /** Specifies the width of the line that represents an axis in the chart. */ + width?: number; + } + export interface ChartCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxChart widget. */ + label?: ChartCommonAxisLabel; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + /** Specifies, in pixels, the space reserved for an axis. */ + placeholderSize?: number; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + /** Specifies the label's position on a strip. */ + horizontalAlignment?: string; + /** Specifies a label's position on a strip. */ + verticalAlignment?: string; + }; + /** Specifies the spacing, in pixels, between the left/right strip border and the strip label. */ + paddingLeftRight?: number; + /** Specifies the spacing, in pixels, between the top/bottom strip borders and the strip label. */ + paddingTopBottom?: number; + }; + /** An object defining the title configuration options that are common for all axes in the dxChart widget. */ + title?: CommonAxisTitle; + /** Indicates whether or not to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + } + export interface PolarCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: PolarCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxPolarChart widget. */ + label?: PolarCommonAxisLabel; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + }; + }; + } + export interface ChartConstantLineLabel extends ChartCommonConstantLineLabel { + /** Specifies the horizontal alignment of a constant line label. */ + horizontalAlignment?: string; + /** Specifies the vertical alignment of a constant line label. */ + verticalAlignment?: string; + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface PolarConstantLineLabel extends PolarCommonConstantLineLabel { + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface AxisLabel { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */ + customizeHint?: (argument: { value: any; valueText: string }) => string; + /** Specifies a callback function that returns the text to be displayed in value axis labels. */ + customizeText?: (argument: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed by axis labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the axis labels. */ + precision?: number; + } + export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { } + export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { } + export interface AxisTitle extends CommonAxisTitle { + /** Specifies the text for the value axis title. */ + text?: string; + } + export interface ChartConstantLineStyle extends ChartCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartConstantLineLabel; + } + export interface ChartConstantLine extends ChartConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface PolarConstantLine extends PolarCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface Axis { + /** Specifies a coefficient for dividing the value axis. */ + axisDivisionFactor?: number; + /** Specifies the order in which discrete values are arranged on the value axis. */ + categories?: Array; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic axis. */ + logarithmBase?: number; + /** Specifies an interval between axis ticks/grid lines. */ + tickInterval?: any; + /** Specifies the interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the number of minor ticks between two neighboring major ticks. */ + minorTickCount?: number; + /** Specifies the required type of the value axis. */ + type?: string; + /** Specifies the pane on which the current value axis will be displayed. */ + pane?: string; + /** Specifies options for value axis strips. */ + strips?: Array; + } + export interface ChartAxis extends ChartCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies the appearance options for the constant lines of the value axis. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** Specifies options for value axis labels. */ + label?: ChartAxisLabel; + /** Specifies the maximum value on the value axis. */ + max?: any; + /** Specifies the minimum value on the value axis. */ + min?: any; + /** Specifies the position of the value axis on a chart. */ + position?: string; + /** Specifies the title for a value axis. */ + title?: any; + } + export interface PolarAxis extends PolarCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies options for value axis labels. */ + label?: PolarAxisLabel; + } + export interface ArgumentAxis { + /** Specifies the desired type of axis values. */ + argumentType?: string; + /** Specifies the elements that will be highlighted when the argument axis is hovered over. */ + hoverMode?: string; + } + export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis { } + export interface PolarArgumentAxis extends PolarAxis, ArgumentAxis { + /** Specifies the angle in arc degrees to which the argument axis should be rotated. The positive values rotate the axis clockwise. */ + startAngle?: number; + /** Specifies whether or not to display the first point at the angle specified by the startAngle option. */ + firstPointOnStartAngle?: boolean; + /** Specifies the value to be used as the origin for the argument axis. */ + originValue?: number; + /** Specifies the period of the argument values in the data source. */ + period?: number; + } + export interface ValueAxis { + /** Specifies the name of the value axis. */ + name?: string; + /** Specifies whether or not to indicate a zero value on the value axis. */ + showZero?: boolean; + /** Specifies the desired type of axis values. */ + valueType?: string; + } + export interface ChartValueAxis extends ChartAxis, ValueAxis { + /** Specifies the spacing, in pixels, between multiple value axes in a chart. */ + multipleAxesSpacing?: number; + /** Specifies the value by which the chart's value axes are synchronized. */ + synchronizedValue?: number; + } + export interface PolarValueAxis extends PolarAxis, ValueAxis { + /** Indicates whether to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + tick?: { + visible?: boolean; + } + } + export interface CommonPane { + /** Specifies a background color in a pane. */ + backgroundColor?: string; + /** Specifies the border options of a chart's pane. */ + border?: PaneBorder; + } + export interface Pane extends CommonPane { + /** Specifies the name of a pane. */ + name?: string; + } + export interface PaneBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies the bottom border's visibility state in a pane. */ + bottom?: boolean; + /** Specifies the left border's visibility state in a pane. */ + left?: boolean; + /** Specifies the right border's visibility state in a pane. */ + right?: boolean; + /** Specifies the top border's visibility state in a pane. */ + top?: boolean; + } + export interface ChartAnimation extends viz.core.Animation { + /** Specifies the maximum series point count in the chart that the animation supports. */ + maxPointCountSupported?: number; + } + export interface BaseChartTooltip extends viz.core.Tooltip { + /** Specifies a format for arguments of the chart's series points. */ + argumentFormat?: string; + /** Specifies a precision for formatted arguments displayed in tooltips. */ + argumentPrecision?: number; + /** Specifies a precision for a percent value displayed in tooltips for stacked series and dxPieChart series. */ + percentPrecision?: number; + } + export interface BaseChartOptions extends viz.core.BaseWidgetOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies the width of the widget that is small enough for the layout to begin adapting. */ + width?: number; + /** Specifies the height of the widget that is small enough for the layout to begin adapting. */ + height?: number; + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies animation options. */ + animation?: ChartAnimation; + /** Specifies a callback function that returns an object with options for a specific point label. */ + customizeLabel?: (labelInfo: Object) => Object; + /** Specifies a callback function that returns an object with options for a specific point. */ + customizePoint?: (pointInfo: Object) => Object; + /** Specifies a data source for the chart. */ + dataSource?: any; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies options of a dxChart's (dxPieChart's) legend. */ + legend?: core.BaseLegend; + /** Specifies the blank space between the chart's extreme elements and the boundaries of the area provided for the widget (see size) in pixels. */ + margin?: viz.core.Margins; + /** Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** A handler for the done event. */ + onDone?: (e: { + component: BaseChart; + element: Element; + }) => void; + /** A handler for the pointClick event. */ + onPointClick?: any; + /** A handler for the pointHoverChanged event. */ + onPointHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + /** A handler for the pointSelectionChanged event. */ + onPointSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + /** Specifies whether a single point or multiple points can be selected in the chart. */ + pointSelectionMode?: string; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies options for the dxChart and dxPieChart widget series. */ + series?: any; + /** Specifies the size of the widget in pixels. */ + size?: viz.core.Size; + /** Specifies a title for the chart. */ + title?: viz.core.Title; + /** Specifies tooltip options. */ + tooltip?: BaseChartTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + } + /** A base class for all chart widgets included in the ChartJS library. */ + export class BaseChart extends viz.core.BaseWidget { + /** Deselects the chart's selected series. The series is displayed in an initial style. */ + clearSelection(): void; + /** Gets the current size of the widget. */ + getSize(): { width: number; height: number }; + /** Returns an array of all series in the chart. */ + getAllSeries(): Array; + /** Gets a series within the chart's series collection by the specified name (see the name option). */ + getSeriesByName(seriesName: string): BaseSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): BaseSeries; + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Hides all widget tooltips. */ + hideTooltip(): void; + /** Redraws a widget. */ + render(renderOptions?: { + force?: boolean; + animate?: boolean; + asyncSeriesRendering?: boolean; + }): void; + } + export interface AdvancedLegend extends core.BaseLegend { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /**

Specifies a callback function that returns the text to be displayed by legend items.

*/ + customizeText?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /** Specifies what series elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + } + export interface AdvancedOptions extends BaseChartOptions { + /** A handler for the argumentAxisClick event. */ + onArgumentAxisClick?: any; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate the values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort the series points. */ + sortingMethod?: any; + }; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** A handler for the seriesClick event. */ + onSeriesClick?: any; + /** A handler for the seriesHoverChanged event. */ + onSeriesHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** A handler for the seriesSelectionChanged event. */ + onSeriesSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** Specifies whether a single series or multiple series can be selected in the chart. */ + seriesSelectionMode?: string; + /** Specifies how the chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + /** Specifies whether or not all bars in a series must have the same angle, or may have different angles if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; + /** Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ + negativesAsZeroes?: boolean; + } + export interface Legend extends AdvancedLegend { + /** Specifies whether the legend is located outside or inside the chart's plot. */ + position?: string; + } + export interface ChartTooltip extends BaseChartTooltip { + /** Specifies whether the tooltip must be located in the center of a bar or on its edge. Applies to the Bar and Bubble series. */ + location?: string; + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxChartOptions extends AdvancedOptions { + adaptiveLayout?: { + keepLabels?: boolean; + }; + /** Indicates whether or not to synchronize value axes when they are displayed on a single pane. */ + synchronizeMultiAxes?: boolean; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Indicates whether or not to adjust a value axis to the current minimum and maximum values of a zoomed chart. */ + adjustOnZoom?: boolean; + /** Specifies argument axis options for the dxChart widget. */ + argumentAxis?: ChartArgumentAxis; + /** An object defining the configuration options that are common for all axes of the dxChart widget. */ + commonAxisSettings?: ChartCommonAxisSettings; + /** An object defining the configuration options that are common for all panes in the dxChart widget. */ + commonPaneSettings?: CommonPane; + /** An object defining the configuration options that are common for all series of the dxChart widget. */ + commonSeriesSettings?: CommonSeriesSettings; + /** An object that specifies the appearance options of the chart crosshair. */ + crosshair?: { + /** Specifies a color for the crosshair lines. */ + color?: string; + /** Specifies a dash style for the crosshair lines. */ + dashStyle?: string; + /** Specifies whether to enable the crosshair or not. */ + enabled?: boolean; + /** Specifies the opacity of the crosshair lines. */ + opacity?: number; + /** Specifies the width of the crosshair lines. */ + width?: number; + /** Specifies the appearance of the horizontal crosshair line. */ + horizontalLine?: CrosshaierWithLabel; + /** Specifies the appearance of the vertical crosshair line. */ + verticalLine?: CrosshaierWithLabel; + /** Specifies the options of the crosshair labels. */ + label?: { + /** Specifies a color for the background of the crosshair labels. */ + backgroundColor?: string; + /** Specifies whether the crosshair labels are visible or not. */ + visible?: boolean; + /** Specifies font options for the text of the crosshair labels. */ + font?: viz.core.Font; + /** Specifies the format of the values displayed by crosshair labels. */ + format?: string; + /** Specifies a precision for formatted values. */ + precision?: number; + /** Customizes the text displayed by the crosshair labels. */ + customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; + } + }; + /** Specifies a default pane for the chart series. */ + defaultPane?: string; + /** Specifies a coefficient determining the diameter of the largest bubble. */ + maxBubbleSize?: number; + /** Specifies the diameter of the smallest bubble measured in pixels. */ + minBubbleSize?: number; + /** Defines the dxChart widget's pane(s). */ + panes?: Array; + /** Swaps the axes round so that the value axis becomes horizontal and the argument axes becomes vertical. */ + rotated?: boolean; + /** Specifies the options of a chart's legend. */ + legend?: Legend; + /** Specifies options for dxChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: SeriesTemplate; + /** Specifies tooltip options. */ + tooltip?: ChartTooltip; + /** Specifies value axis options for the dxChart widget. */ + valueAxis?: Array; + /** Enables scrolling in your chart. */ + scrollingMode?: string; + /** Enables zooming in your chart. */ + zoomingMode?: string; + /** Specifies the settings of the scroll bar. */ + scrollBar?: { + /** Specifies whether the scroll bar is visible or not. */ + visible?: boolean; + /** Specifies the spacing between the scroll bar and the chart's plot in pixels. */ + offset?: number; + /** Specifies the color of the scroll bar. */ + color?: string; + /** Specifies the width of the scroll bar in pixels. */ + width?: number; + /** Specifies the opacity of the scroll bar. */ + opacity?: number; + /** Specifies the position of the scroll bar in the chart. */ + position?: string; + }; + } + /** A widget used to embed charts into HTML JS applications. */ + export class dxChart extends BaseChart { + constructor(element: JQuery, options?: dxChartOptions); + constructor(element: Element, options?: dxChartOptions); + /** Sets the specified start and end values for the chart's argument axis. */ + zoomArgument(startValue: any, endValue: any): void; + } + interface CrosshaierWithLabel extends viz.core.DashedBorderWithOpacity { + /** Configures the label that belongs to the horizontal crosshair line. */ + label?: { + /** Specifies a color for the background of the label that belongs to the horizontal crosshair line. */ + backgroundColor?: string; + /** Specifies whether the label of the horizontal crosshair line is visible or not. */ + visible?: boolean; + /** Specifies font options for the text of the label that belongs to the horizontal crosshair line. */ + font?: viz.core.Font; + /** Specifies the format of the values displayed by crosshair labels. */ + format?: string; + /** Specifies a precision for formatted values. */ + precision?: number; + /** Customizes the text displayed by the crosshair label that accompany the horizontal line. */ + customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; + } + } + export interface PolarChartTooltip extends BaseChartTooltip { + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxPolarChartOptions extends AdvancedOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + width?: number; + height?: number; + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Indicates whether or not to display a "spider web". */ + useSpiderWeb?: boolean; + /** Specifies argument axis options for the dxPolarChart widget. */ + argumentAxis?: PolarArgumentAxis; + /** An object defining the configuration options that are common for all axes of the dxPolarChart widget. */ + commonAxisSettings?: PolarCommonAxisSettings; + /** An object defining the configuration options that are common for all series of the dxPolarChart widget. */ + commonSeriesSettings?: CommonPolarSeriesSettings; + /** Specifies the options of a chart's legend. */ + legend?: AdvancedLegend; + /** Specifies options for dxPolarChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: PolarSeriesTemplate; + /** Specifies tooltip options. */ + tooltip?: PolarChartTooltip; + /** Specifies value axis options for the dxPolarChart widget. */ + valueAxis?: PolarValueAxis; + } + /** A chart widget displaying data in a polar coordinate system. */ + export class dxPolarChart extends BaseChart { + constructor(element: JQuery, options?: dxPolarChartOptions); + constructor(element: Element, options?: dxPolarChartOptions); + } + export interface PieLegend extends core.BaseLegend { + /** Specifies what chart elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + /** Specifies a callback function that returns the text to be displayed by a legend item. */ + customizeText?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + } + export interface dxPieChartOptions extends BaseChartOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies dxPieChart legend options. */ + legend?: PieLegend; + /** Specifies options for the series of the dxPieChart widget. */ + series?: Array; + /** Specifies the diameter of the pie. */ + diameter?: number; + /** Specifies the direction that the pie chart segments will occupy. */ + segmentsDirection?: string; + /** Specifies the angle in arc degrees from which the first segment of a pie chart should start. */ + startAngle?: number; + /** Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. The value should be between 0 and 1. */ + innerRadius?: number; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** Specifies how a chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + /** An object defining the configuration options that are common for all series of the dxPieChart widget. */ + commonSeriesSettings?: CommonPieSeriesSettings; + /** Specifies the type of the pie chart series. */ + type?: string; + } + /** A circular chart widget for HTML JS applications. */ + export class dxPieChart extends BaseChart { + constructor(element: JQuery, options?: dxPieChartOptions); + constructor(element: Element, options?: dxPieChartOptions); + /** + * Provides access to the dxPieChart series. + * @deprecated Use the getAllSeries() method instead. + */ + getSeries(): PieSeries; + } +} +interface JQuery { + dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; + dxChart(methodName: string, ...params: any[]): any; + dxChart(methodName: "instance"): DevExpress.viz.charts.dxChart; + dxPieChart(options?: DevExpress.viz.charts.dxPieChartOptions): JQuery; + dxPieChart(methodName: string, ...params: any[]): any; + dxPieChart(methodName: "instance"): DevExpress.viz.charts.dxPieChart; + dxPolarChart(options?: DevExpress.viz.charts.dxPolarChartOptions): JQuery; + dxPolarChart(methodName: string, ...params: any[]): any; + dxPolarChart(methodName: "instance"): DevExpress.viz.charts.dxPolarChart; +} +declare module DevExpress.viz.gauges { + export interface BaseRangeContainer { + /** Specifies a range container's background color. */ + backgroundColor?: string; + /** Specifies the offset of the range container from an invisible scale line in pixels. */ + offset?: number; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** An array of objects representing ranges contained in the range container. */ + ranges?: Array<{ startValue: number; endValue: number; color: string }>; + /** Specifies a color of a range. */ + color?: string; + /** Specifies an end value of a range. */ + endValue?: number; + /** Specifies a start value of a range. */ + startValue?: number; + } + export interface ScaleTick { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** + * Specifies an array of custom minor ticks. + * @deprecated Use the scale | customMinorTicks option instead. + */ + customTickValues?: Array; + /** Specifies the length of the scale's minor ticks. */ + length?: number; + /** + * Indicates whether automatically calculated minor ticks are visible or not. + * @deprecated This feature is no longer available. + */ + showCalculatedTicks?: boolean; + /** + * Specifies an interval between minor ticks. + * @deprecated Use the scale | minorTickInterval option instead. + */ + tickInterval?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + } + export interface ScaleMajorTick extends ScaleTick { + /** + * Specifies whether or not to expand the current major tick interval if labels overlap each other. + * @deprecated Use the overlappingBehavior | useAutoArrangement option instead. + */ + useTicksAutoArrangement?: boolean; + } + export interface ScaleMinorTick extends ScaleTick { + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + } + export interface BaseScaleLabel { + /** Specifies whether or not scale labels should be colored similarly to their corresponding ranges in the range container. */ + useRangeColors?: boolean; + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: number; valueText: string }) => string; + /** Specifies the overlap resolving options to be applied to scale labels. */ + overlappingBehavior?: { + /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + useAutoArrangement?: boolean; + /** Specifies what label to hide in case of overlapping. */ + hideFirstOrLast?: string; + }; + /** Specifies font options for the text displayed in the scale labels of the gauge. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the scale labels. */ + precision?: number; + /** Specifies whether or not scale labels are visible on the gauge. */ + visible?: boolean; + } + export interface BaseScale { + /** Specifies the end value for the scale of the gauge. */ + endValue?: number; + /** + * Specifies whether or not to hide the first scale label. + * @deprecated This feature is no longer available. + */ + hideFirstLabel?: boolean; + /** + * Specifies whether or not to hide the first major tick on the scale. + * @deprecated This feature is no longer available. + */ + hideFirstTick?: boolean; + /** + * Specifies whether or not to hide the last scale label. + * @deprecated This feature is no longer available. + */ + hideLastLabel?: boolean; + /** + * Specifies whether or not to hide the last major tick on the scale. + * @deprecated This feature is no longer available. + */ + hideLastTick?: boolean; + /** Specifies an interval between major ticks. */ + tickInterval?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: number; + /** Specifies an array of custom major ticks. */ + customTicks?: Array; + /** Specifies an array of custom minor ticks. */ + customMinorTicks?: Array; + /** Specifies common options for scale labels. */ + label?: BaseScaleLabel; + /** + * Specifies options of the gauge's major ticks. + * @deprecated Use the tick option instead. + */ + majorTick?: ScaleMajorTick; + /** Specifies options of the gauge's major ticks. */ + tick?: { + /** Specifies the color of the scale's major ticks. */ + color?: string; + /** Specifies the length of the scale's major ticks. */ + length?: number; + /** Indicates whether scale major ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's major ticks. */ + width?: number; + /** Specifies the opacity of the scale's major ticks. */ + opacity?: number; + }; + /** Specifies options of the gauge's minor ticks. */ + minorTick?: ScaleMinorTick; + /** Specifies the start value for the scale of the gauge. */ + startValue?: number; + } + export interface BaseValueIndicator { + /** Specifies the type of subvalue indicators. */ + type?: string; + /** Specifies the background color for the indicator of the rangeBar type. */ + backgroundColor?: string; + /** Specifies the base value for the indicator of the rangeBar type. */ + baseValue?: number; + /** Specifies a color of the indicator. */ + color?: string; + /** Specifies the range bar size for an indicator of the rangeBar type. */ + size?: number; + text?: { + /** Specifies a callback function that returns the text to be displayed in an indicator. */ + customizeText?: (indicatedValue: { value: number; valueText: string }) => string; + font?: viz.core.Font; + /** Specifies a format for the text displayed in an indicator. */ + format?: string; + /** Specifies the range bar's label indent in pixels. */ + indent?: number; + /** Specifies a precision for the formatted value displayed by an indicator. */ + precision?: number; + }; + offset?: number; + length?: number; + width?: number; + /** Specifies the length of an arrow for the indicator of the textCloud type in pixels. */ + arrowLength?: number; + /** Sets the array of colors to be used for coloring subvalue indicators. */ + palette?: Array; + /** Specifies the distance between the needle and the center of a gauge for the indicator of a needle-like type. */ + indentFromCenter?: number; + /** Specifies the second color for the indicator of the twoColorNeedle type. */ + secondColor?: string; + /** Specifies the length of a twoNeedleColor type indicator tip as a percentage. */ + secondFraction?: number; + /** Specifies the spindle's diameter in pixels for the indicator of a needle-like type. */ + spindleSize?: number; + /** Specifies the inner diameter in pixels, so that the spindle has the shape of a ring. */ + spindleGapSize?: number; + /** Specifies the orientation of the rangeBar indicator on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of the rangeBar indicator on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface SharedGaugeOptions { + /** Specifies animation options. */ + animation?: viz.core.Animation; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies the size of the widget in pixels. */ + size?: viz.core.Size; + /** + * Specifies a subtitle for the widget. + * @deprecated Use the title | subtitle option instead. + */ + subtitle?: { + /** + * Specifies font options for the subtitle. + * @deprecated Use the title | subtitle | font option instead. + */ + font?: viz.core.Font; + /** + * Specifies a text for the subtitle. + * @deprecated Use the title | subtitle | text option instead. + */ + text?: string; + }; + /** Specifies a title for a gauge. */ + title?: { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** + * Specifies a title's position on the gauge. + * @deprecated Use the horizontalAlignment and verticalAlignment options instead. + */ + position?: string; + /** Specifies the distance between the title and surrounding gauge elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies the gauge title's position in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the gauge title's horizontal position. */ + horizontalAlignment?: string; + /** Specifies text for the title. */ + text?: string; + /** Specifies a subtitle for the widget. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } + }; + /** Specifies options for gauge tooltips. */ + tooltip?: viz.core.Tooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + } + export interface BaseGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies the blank space in pixels between the widget's extreme elements and the boundaries of the area provided for the widget (see the size option). */ + margin?: viz.core.Margins; + /** Specifies options of the gauge's range container. */ + rangeContainer?: BaseRangeContainer; + /** Specifies a gauge's scale options. */ + scale?: BaseScale; + /** Specifies the appearance options of subvalue indicators. */ + subvalueIndicator?: BaseValueIndicator; + /** Specifies a set of subvalues to be designated by the subvalue indicators. */ + subvalues?: Array; + /** Specifies the main value on a gauge. */ + value?: number; + /** Specifies the appearance options of the value indicator. */ + valueIndicator?: BaseValueIndicator; + } + /** A gauge widget. */ + export class dxBaseGauge extends viz.core.BaseWidget { + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(): void; + /** Returns the main gauge value. */ + value(): number; + /** Updates a gauge value. */ + value(value: number): void; + /** Returns an array of gauge subvalues. */ + subvalues(): Array; + /** Updates gauge subvalues. */ + subvalues(subvalues: Array): void; + } + export interface LinearRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of a range container on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + /** Specifies the width of the range container's start and end boundaries in the dxLinearGauge widget. */ + width?: any; + /** Specifies an end width of a range container. */ + end?: number; + /** Specifies a start width of a range container. */ + start?: number; + } + export interface LinearScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface LinearScale extends BaseScale { + /** Specifies the orientation of scale ticks on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + label?: LinearScaleLabel; + /** Specifies the orientation of scale ticks on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface dxLinearGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxLinearGauge widget. */ + geometry?: { + /** Indicates whether to display the dxLinearGauge widget vertically or horizontally. */ + orientation?: string; + }; + /** Specifies gauge range container options. */ + rangeContainer?: LinearRangeContainer; + scale?: LinearScale; + } + /** A widget that represents a gauge with a linear scale. */ + export class dxLinearGauge extends dxBaseGauge { + constructor(element: JQuery, options?: dxLinearGaugeOptions); + constructor(element: Element, options?: dxLinearGaugeOptions); + } + export interface CircularRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container in the dxCircularGauge widget. */ + orientation?: string; + /** Specifies the range container's width in pixels. */ + width?: number; + } + export interface CircularScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface CircularScale extends BaseScale { + label?: CircularScaleLabel; + /** Specifies the orientation of scale ticks. */ + orientation?: string; + } + export interface dxCircularGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxCircularGauge widget. */ + geometry?: { + /** Specifies the end angle of the circular gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the circular gauge's arc. */ + startAngle?: number; + }; + /** Specifies gauge range container options. */ + rangeContainer?: CircularRangeContainer; + scale?: CircularScale; + } + /** A widget that represents a gauge with a circular scale. */ + export class dxCircularGauge extends dxBaseGauge { + constructor(element: JQuery, options?: dxCircularGaugeOptions); + constructor(element: Element, options?: dxCircularGaugeOptions); + } + export interface dxBarGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies a color for the remaining segment of the bar's track. */ + backgroundColor?: string; + /** Specifies a distance between bars in pixels. */ + barSpacing?: number; + /** Specifies a base value for bars. */ + baseValue?: number; + /** Specifies an end value for the gauge's invisible scale. */ + endValue?: number; + /** Defines the shape of the gauge's arc. */ + geometry?: { + /** Specifies the end angle of the bar gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the bar gauge's arc. */ + startAngle?: number; + }; + /** Specifies the options of the labels that accompany gauge bars. */ + label?: { + /** Specifies a color for the label connector text. */ + connectorColor?: string; + /** Specifies the width of the label connector in pixels. */ + connectorWidth?: number; + /** Specifies a callback function that returns a text for labels. */ + customizeText?: (barValue: { value: number; valueText: string }) => string; + /** Specifies font options for bar labels. */ + font?: viz.core.Font; + /** Specifies a format for bar labels. */ + format?: string; + /** Specifies the distance between the upper bar and bar labels in pixels. */ + indent?: number; + /** Specifies a precision for the formatted value displayed by labels. */ + precision?: number; + /** Specifies whether bar labels appear on a gauge or not. */ + visible?: boolean; + }; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** Defines the radius of the bar that is closest to the center relatively to the radius of the topmost bar. */ + relativeInnerRadius?: number; + /** Specifies a start value for the gauge's invisible scale. */ + startValue?: number; + /** Specifies the array of values to be indicated on a bar gauge. */ + values?: Array; + } + /** A circular bar widget. */ + export class dxBarGauge extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxBarGaugeOptions); + constructor(element: Element, options?: dxBarGaugeOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws the widget. */ + render(): void; + /** Returns an array of gauge values. */ + values(): Array; + /** Updates the values displayed by a gauge. */ + values(values: Array): void; + } +} +interface JQuery { + dxLinearGauge(options?: DevExpress.viz.gauges.dxLinearGaugeOptions): JQuery; + dxLinearGauge(methodName: string, ...params: any[]): any; + dxLinearGauge(methodName: "instance"): DevExpress.viz.gauges.dxLinearGauge; + dxCircularGauge(options?: DevExpress.viz.gauges.dxCircularGaugeOptions): JQuery; + dxCircularGauge(methodName: string, ...params: any[]): any; + dxCircularGauge(methodName: "instance"): DevExpress.viz.gauges.dxCircularGauge; + dxBarGauge(options?: DevExpress.viz.gauges.dxBarGaugeOptions): JQuery; + dxBarGauge(methodName: string, ...params: any[]): any; + dxBarGauge(methodName: "instance"): DevExpress.viz.gauges.dxBarGauge; +} +declare module DevExpress.viz.rangeSelector { + export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions { + /** Specifies the options for the range selector's background. */ + background?: { + /** Specifies the background color for the dxRangeSelector. */ + color?: string; + /** Specifies image options. */ + image?: { + /** Specifies a location for the image in the background of a range selector. */ + location?: string; + /** Specifies the image's URL. */ + url?: string; + }; + /** Indicates whether or not the background (background color and/or image) is visible. */ + visible?: boolean; + }; + /** Specifies a title for the range selector. */ + title?: viz.core.Title; + /** Specifies the dxRangeSelector's behavior options. */ + behavior?: { + /** Indicates whether or not you can swap sliders. */ + allowSlidersSwap?: boolean; + /** Indicates whether or not animation is enabled. */ + animationEnabled?: boolean; + /** Specifies when to call the onSelectedRangeChanged function. */ + callSelectedRangeChanged?: string; + /** Indicates whether or not an end user can specify the range using a mouse, without the use of sliders. */ + manualRangeSelectionEnabled?: boolean; + /** Indicates whether or not an end user can shift the selected range to the required location on a scale by clicking. */ + moveSelectedRangeByClick?: boolean; + /** Indicates whether to snap a slider to ticks. */ + snapToTicks?: boolean; + }; + /** Specifies the options required to display a chart as the range selector's background. */ + chart?: { + /** Specifies a coefficient for determining an indent from the bottom background boundary to the lowest chart point. */ + bottomIndent?: number; + /** An object defining the common configuration options for the chart’s series. */ + commonSeriesSettings?: viz.charts.CommonSeriesSettings; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort series points. */ + sortingMethod?: any; + }; + /** Specifies whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; + /** Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ + negativesAsZeroes?: boolean; + /** Sets the name of the palette to be used in the range selector's chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** An object defining the chart’s series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: viz.charts.SeriesTemplate; + /** Specifies a coefficient for determining an indent from the background's top boundary to the topmost chart point. */ + topIndent?: number; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Specifies options for the chart's value axis. */ + valueAxis?: { + /** Indicates whether or not the chart's value axis must be inverted. */ + inverted?: boolean; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic value axis. */ + logarithmBase?: number; + /** Specifies the maximum value of the chart's value axis. */ + max?: number; + /** Specifies the minimum value of the chart's value axis. */ + min?: number; + /** Specifies the type of the value axis. */ + type?: string; + /** Specifies the desired type of axis values. */ + valueType?: string; + }; + }; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies a data source for the scale values and for the chart at the background. */ + dataSource?: any; + /** Specifies the data source field that provides data for the scale. */ + dataSourceField?: string; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies the blank space in pixels between the dxRangeSelector widget's extreme elements and the boundaries of the area provided for the widget (see size). */ + margin?: viz.core.Margins; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies options of the range selector's scale. */ + scale?: { + /** Specifies the scale's end value. */ + endValue?: any; + /** Specifies common options for scale labels. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: any; valueText: string; }) => string; + /** Specifies font options for the text displayed in the range selector's scale labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the scale labels. */ + precision?: number; + /** Specifies a spacing between scale labels and the background bottom edge. */ + topIndent?: number; + /** Specifies whether or not the scale's labels are visible. */ + visible?: boolean; + }; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic scale. */ + logarithmBase?: number; + /** + * Specifies an interval between major ticks. + * @deprecated Use the tickInterval option instead. + */ + majorTickInterval?: any; + /** Specifies an interval between axis ticks. */ + tickInterval?: any; + /** Specifies options for the date-time scale's markers. */ + marker?: { + /** Defines the options that can be set for the text that is displayed by the scale markers. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale markers. */ + customizeText?: (markerValue: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed in scale markers. */ + format?: string; + }; + /** Specifies the height of the marker's separator. */ + separatorHeight?: number; + /** Specifies the space between the marker label and the marker separator. */ + textLeftIndent?: number; + /** Specifies the space between the marker's label and the top edge of the marker's separator. */ + textTopIndent?: number; + /** Specified the indent between the marker and the scale lables. */ + topIndent?: number; + /** Indicates whether scale markers are visible. */ + visible?: boolean; + }; + /** Specifies the maximum range that can be selected. */ + maxRange?: any; + /** Specifies the number of minor ticks between neighboring major ticks. */ + minorTickCount?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the minimum range that can be selected. */ + minRange?: any; + /** Specifies the height of the space reserved for the scale in pixels. */ + placeholderHeight?: number; + /** Indicates whether or not to set ticks of a date-time scale at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** Specifies whether or not to show ticks for the boundary scale values, when neither major ticks nor minor ticks are created for these values. */ + showCustomBoundaryTicks?: boolean; + /** + * Indicates whether or not to show minor ticks on the scale. + * @deprecated Use the minorTick | visible option instead. + */ + showMinorTicks?: boolean; + /** Specifies the scale's start value. */ + startValue?: any; + /** Specifies options defining the appearance of scale ticks. */ + tick?: { + /** Specifies the color of scale ticks (both major and minor ticks). */ + color?: string; + /** Specifies the opacity of scale ticks (both major and minor ticks). */ + opacity?: number; + /** Specifies the width of the scale's ticks (both major and minor ticks). */ + width?: number; + }; + /** Specifies options of the range selector's minor ticks. */ + minorTick?: { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + }; + /** Specifies the type of the scale. */ + type?: string; + /** Specifies whether or not to expand the current tick interval if labels overlap each other. */ + useTicksAutoArrangement?: boolean; + /** Specifies the type of values on the scale. */ + valueType?: string; + /** Specifies the order of arguments on a discrete scale. */ + categories?: Array; + }; + /** Specifies the range to be selected when displaying the dxRangeSelector. */ + selectedRange?: { + /** Specifies the start value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + startValue?: any; + /** Specifies the end value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + endValue?: any; + }; + /** Specifies the color of the selected range. */ + selectedRangeColor?: string; + /** Range selector's indent options. */ + indent?: { + /** Specifies range selector's left indent. */ + left?: number; + /** Specifies range selector's right indent. */ + right?: number; + }; + /** A handler for the selectedRangeChanged event. */ + onSelectedRangeChanged?: (e: { + startValue: any; + endValue: any; + component: dxRangeSelector; + element: Element; + }) => void; + /** Specifies range selector shutter options. */ + shutter?: { + /** Specifies shutter color. */ + color?: string; + /** Specifies the opacity of the color of shutters. */ + opacity?: number; + }; + /** Specifies in pixels the size of the dxRangeSelector widget. */ + size?: viz.core.Size; + /** Specifies the appearance of the range selector's slider handles. */ + sliderHandle?: { + /** Specifies the color of the slider handles. */ + color?: string; + /** Specifies the opacity of the slider handles. */ + opacity?: number; + /** Specifies the width of the slider handles. */ + width?: number; + }; + /** Defines the options of the range selector slider markers. */ + sliderMarker?: { + /** Specifies the color of the slider markers. */ + color?: string; + /** Specifies a callback function that returns the text to be displayed by slider markers. */ + customizeText?: (scaleValue: { value: any; valueText: any; }) => string; + /** Specifies font options for the text displayed by the range selector slider markers. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in slider markers. */ + format?: string; + /** Specifies the color used for the slider marker text when the currently selected range does not match the minRange and maxRange values. */ + invalidRangeColor?: string; + /** + * Specifies the empty space between the marker's border and the marker’s text. + * @deprecated Use the paddingTopBottom and paddingLeftRight options instead. + */ + padding?: number; + /** Specifies the empty space between the marker's top and bottom borders and the marker's text. */ + paddingTopBottom?: number; + /** Specifies the empty space between the marker's left and right borders and the marker's text. */ + paddingLeftRight?: number; + /** Specifies the placeholder height of the slider marker. */ + placeholderHeight?: number; + /** + * Specifies in pixels the height and width of the space reserved for the range selector slider markers. + * @deprecated Use the placeholderHeight and indent options instead. + */ + placeholderSize?: { + /** Specifies the height of the placeholder for the left and right slider markers. */ + height?: number; + /** Specifies the width of the placeholder for the left and right slider markers. */ + width?: { + /** Specifies the width of the left slider marker's placeholder. */ + left?: number; + /** Specifies the width of the right slider marker's placeholder. */ + right?: number; + }; + }; + /** Specifies a precision for the formatted value displayed in slider markers. */ + precision?: number; + /** Indicates whether or not the slider markers are visible. */ + visible?: boolean; + }; + } + /** A widget that allows end users to select a range of values on a scale. */ + export class dxRangeSelector extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxRangeSelectorOptions); + constructor(element: Element, options?: dxRangeSelectorOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(skipChartAnimation?: boolean): void; + /** Returns the currently selected range. */ + getSelectedRange(): { startValue: any; endValue: any; }; + /** Sets a specified range. */ + setSelectedRange(selectedRange: { startValue: any; endValue: any; }): void; + } +} +interface JQuery { + dxRangeSelector(options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; + dxRangeSelector(methodName: string, ...params: any[]): any; + dxRangeSelector(methodName: "instance"): DevExpress.viz.rangeSelector.dxRangeSelector; +} +declare module DevExpress.viz.map { + /** This section describes the fields and methods that can be used in code to manipulate the Layer object. */ + export interface MapLayer { + /** The name of the layer. */ + name: string; + /** The layer index in the layers array. */ + index: number; + /** The layer type. Can be "area", "line" or "marker". */ + type: string; + /** The type of the layer elements. */ + elementType: string; + /** Gets all layer elements. */ + getElements(): Array; + /** Deselects all layer elements. */ + clearSelection(): void; + } + /** This section describes the fields and methods that can be used in code to manipulate the Layer Element object. */ + export interface MapLayerElement { + /** The parent layer of the layer element. */ + layer: MapLayer; + /** Gets the layer element coordinates. */ + coordinates(): Object; + /** Sets the value of an attribute. */ + attribute(name: string, value: any): void; + /** Gets the value of an attribute. */ + attribute(name: string): any; + /** Gets the selection state of the layer element. */ + selected(): boolean; + /** Sets the selection state of the layer element. */ + selected(state: boolean): void; + /** Applies the layer element settings and updates element appearance. */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Area object. + * @deprecated Use the Layer Element instead. + */ + export interface Area { + /** + * Contains the element type. + * @deprecated Use the Layer | type instead. + */ + type: string; + /** + * Return the value of an attribute. + * @deprecated Use the Layer Element | attribute(name, value) method instead. + */ + attribute(name: string): any; + /** + * Provides information about the selection state of an area. + * @deprecated Use the Layer Element | selected() method instead. + */ + selected(): boolean; + /** + * Sets a new selection state for an area. + * @deprecated Use the Layer Element | selected(state) method instead. + */ + selected(state: boolean): void; + /** + * Applies the area settings specified as a parameter and updates the area appearance. + * @deprecated Use the Layer Element | applySettings(settings) method instead. + */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Markers object. + * @deprecated Use the Layer Element instead. + */ + export interface Marker { + /** + * Contains the descriptive text accompanying the map marker. + * @deprecated Get the text using the Layer Element | attribute(name) method. The name parameter value for text is set at the dataField option. + */ + text: string; + /** + * Contains the type of the element. + * @deprecated Use the Layer | type instead. + */ + type: string; + /** + * Contains the URL of an image map marker. + * @deprecated Get the image URL using the Layer Element | attribute(name) method. The name parameter value for the image URL is set at the dataField option. + */ + url: string; + /** + * Contains the value of a bubble map marker. + * @deprecated Get the bubble value using the Layer Element | attribute(name) method. The name parameter for the bubble value is set at the dataField option. + */ + value: number; + /** + * Contains the values of a pie map marker. + * @deprecated Get the pie values using the Layer Element | attribute(name) method. The name parameter for pie values is set at the dataField option. + */ + values: Array; + /** + * Returns the value of an attribute. + * @deprecated Use the Layer Element | attribute(name, value) method instead. + */ + attribute(name: string): any; + /** + * Returns the coordinates of a specific marker. + * @deprecated Use the Layer Element | coordinates() method instead. + */ + coordinates(): Array; + /** + * Provides information about the selection state of a marker. + * @deprecated Use the Layer Element | selected() method instead. + */ + selected(): boolean; + /** + * Sets a new selection state for a marker. + * @deprecated Use the Layer Element | selected(state) method instead. + */ + selected(state: boolean): void; + /** + * Applies the marker settings specified as a parameter and updates marker appearance. + * @deprecated Use the Layer Element | applySettings(settings) method instead. + */ + applySettings(settings: any): void; + } + export interface MapLayerSettings { + /** Specifies the layer name. */ + name?: string; + /** Specifies layer type. */ + type?: string; + /** Specifies the type of a marker element. Setting this option makes sense only if the layer type is "marker". */ + elementType?: string; + /** Specifies a data source for the layer. */ + dataSource?: any; + /** Specifies the line width (for layers of a line type) or width of the layer elements border in pixels. */ + borderWidth?: number; + /** Specifies a color for the border of the layer elements. */ + borderColor?: string; + /** Specifies a color for layer elements. */ + color?: string; + /** Specifies a color for the border of the layer element when it is hovered over. */ + hoveredBorderColor?: string; + /** Specifies the pixel-measured line width (for layers of a line type) or width for the border of the layer element when it is hovered over. */ + hoveredBorderWidth?: number; + /** Specifies a color for a layer element when it is hovered over. */ + hoveredColor?: string; + /** Specifies a pixel-measured line width (for layers of a line type) or width for the border of the layer element when it is selected. */ + selectedBorderWidth?: number; + /** Specifies a color for the border of the layer element when it is selected. */ + selectedBorderColor?: string; + /** Specifies a color for the layer element when it is selected. */ + selectedColor?: string; + /** Specifies the layer opacity (from 0 to 1). */ + opacity?: number; + /** Specifies the size of markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "dot", "pie" or "image". */ + size?: number; + /** Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if the layer type is "marker". */ + minSize?: number; + /** Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if the layer type is "marker". */ + maxSize?: number; + /** Specifies whether or not to change the appearance of a layer element when it is hovered over. */ + hoverEnabled?: boolean; + /** Specifies whether single or multiple map elements can be selected on a vector map. */ + selectionMode?: string; + /** Specifies the name of the palette or a custom range of colors to be used for coloring a layer. */ + palette?: any; + /** Specifies the number of colors in a palette. */ + paletteSize?: number; + /** Allows you to paint layer elements with similar attributes in the same color. */ + colorGroups?: Array; + /** Specifies the field that provides data to be used for coloring of layer elements. */ + colorGroupingField?: string; + /** Allows you to display bubbles with similar attributes in the same size. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroups?: Array; + /** Specifies the field that provides data to be used for sizing bubble markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroupingField?: string; + /** Specifies the name of the attribute containing marker data. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble", "pie" or "image". */ + dataField?: string; + /** Specifies the function that customizes each layer element individually. */ + customize?: (eleemnts: Array) => void; + /** Specifies marker label options. */ + label?: { + /** The name of the dataSource attribute containing marker texts. */ + dataField?: string; + /** Enables marker labels. */ + enabled?: boolean; + /** Specifies font options for marker labels. */ + font?: viz.core.Font; + }; + } + export interface AreaSettings { + /** + * Specifies the width of the area border in pixels. + * @deprecated Use the layers | borderWidth option instead. + */ + borderWidth?: number; + /** + * Specifies a color for the area border. + * @deprecated Use the layers | borderColor option instead. + */ + borderColor?: string; + /** + * Specifies a color for an area. + * @deprecated Use the layers | color option instead. + */ + color?: string; + /** + * Specifies the function that customizes each area individually. + * @deprecated Use the layers | customize option instead. + */ + customize?: (areaInfo: Area) => AreaSettings; + /** + * Specifies a color for the area border when the area is hovered over. + * @deprecated Use the layers | hoveredBorderColor option instead. + */ + hoveredBorderColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is hovered over. + * @deprecated Use the layers | hoveredBorderWidth option instead. + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for an area when this area is hovered over. + * @deprecated Use the layers | hoveredColor option instead. + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of an area when it is hovered over. + * @deprecated Use the layers | hoverEnabled option instead. + */ + hoverEnabled?: boolean; + /** + * Configures area labels. + * @deprecated Use the layers | label option instead. + */ + label?: { + /** + * Specifies the data field that provides data for area labels. + * @deprecated Use the layers | label | dataField option instead. + */ + dataField?: string; + /** + * Enables area labels. + * @deprecated Use the layers | label | enabled option instead. + */ + enabled?: boolean; + /** + * Specifies font options for area labels. + * @deprecated Use the layers | label | font option instead. + */ + font?: viz.core.Font; + }; + /** + * Specifies the name of the palette or a custom range of colors to be used for coloring a map. + * @deprecated Use the layers | palette option instead. + */ + palette?: any; + /** + * Specifies the number of colors in a palette. + * @deprecated Use the layers | paletteSize option instead. + */ + paletteSize?: number; + /** + * Allows you to paint areas with similar attributes in the same color. + * @deprecated Use the layers | colorGroups option instead. + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring areas. + * @deprecated Use the layers | colorGroupingField option instead. + */ + colorGroupingField?: string; + /** + * Specifies a color for the area border when the area is selected. + * @deprecated Use the layers | selectedBorderColor option instead. + */ + selectedBorderColor?: string; + /** + * Specifies a color for an area when this area is selected. + * @deprecated Use the layers | selectedColor option instead. + */ + selectedColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is selected. + * @deprecated Use the layers | selectedBorderWidth option instead. + */ + selectedBorderWidth?: number; + /** + * Specifies whether single or multiple areas can be selected on a vector map. + * @deprecated Use the layers | selectionMode option instead. + */ + selectionMode?: string; + } + export interface MarkerSettings { + /** + * Specifies a color for the marker border. + * @deprecated Use the layers | borderColor option instead. + */ + borderColor?: string; + /** + * Specifies the width of the marker border in pixels. + * @deprecated Use the layers | borderWidth option instead. + */ + borderWidth?: number; + /** + * Specifies a color for a marker of the dot or bubble type. + * @deprecated Use the layers | color option instead. + */ + color?: string; + /** + * Specifies the function that customizes each marker individually. + * @deprecated Use the layers | customize option instead. + */ + customize?: (markerInfo: Marker) => MarkerSettings; + /** + * Specifies the pixel-measured width of the marker border when the marker is hovered over. + * @deprecated Use the layers | hoveredBorderWidth option instead. + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is hovered over. + * @deprecated Use the layers | hoveredBorderColor option instead. + */ + hoveredBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is hovered over. + * @deprecated Use the layers | hoveredColor option instead. + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of a marker when it is hovered over. + * @deprecated Use the layers | hoverEnabled option instead. + */ + hoverEnabled?: boolean; + /** + * Specifies marker label options. + * @deprecated Use the layers | label option instead. + */ + label?: { + /** + * Enables marker labels. + * @deprecated Use the layers | label | enabled option instead. + */ + enabled?: boolean; + /** + * Specifies font options for marker labels. + * @deprecated Use the layers | label | font option instead. + */ + font?: viz.core.Font; + }; + /** + * Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | maxSize option instead. + */ + maxSize?: number; + /** + * Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | minSize option instead. + */ + minSize?: number; + /** + * Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | opacity option instead. + */ + opacity?: number; + /** + * Specifies the pixel-measured width of the marker border when the marker is selected. + * @deprecated Use the layers | selectedBorderWidth option instead. + */ + selectedBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is selected. + * @deprecated Use the layers | selectedBorderColor option instead. + */ + selectedBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is selected. + * @deprecated Use the layers | selectedColor option instead. + */ + selectedColor?: string; + /** + * Specifies whether a single or multiple markers can be selected on a vector map. + * @deprecated Use the layers | selectionMode option instead. + */ + selectionMode?: string; + /** + * Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. + * @deprecated Use the layers | size option instead. + */ + size?: number; + /** + * Specifies the type of markers to be used on the map. + * @deprecated Use the layers | elementType option instead. + */ + type?: string; + /** + * Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. + * @deprecated Use the layers | palette option instead. + */ + palette?: any; + /** + * Allows you to paint markers with similar attributes in the same color. + * @deprecated Use the layers | colorGroups option instead. + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring markers. + * @deprecated Use the layers | colorGroupingField option instead. + */ + colorGroupingField?: string; + /** + * Allows you to display bubbles with similar attributes in the same size. + * @deprecated Use the layers | sizeGroups option instead. + */ + sizeGroups?: Array; + /** + * Specifies the field that provides data to be used for sizing bubble markers. + * @deprecated Use the layers | sizeGroupingField option instead. + */ + sizeGroupingField?: string; + } + export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions { + /** + * An object specifying options for the map areas. + * @deprecated Use the "area" type element of the layers array. + */ + areaSettings?: AreaSettings; + /** Specifies the options for the map background. */ + background?: { + /** Specifies a color for the background border. */ + borderColor?: string; + /** Specifies a color for the background. */ + color?: string; + }; + /** Specifies options for dxVectorMap widget layers. */ + layers?: Array; + /** Specifies the map projection. */ + projection?: Object; + /** Specifies the positioning of a map in geographical coordinates. */ + bounds?: Array; + /** Specifies the options of the control bar. */ + controlBar?: { + /** Specifies a color for the outline of the control bar elements. */ + borderColor?: string; + /** Specifies a color for the inner area of the control bar elements. */ + color?: string; + /** Specifies whether or not to display the control bar. */ + enabled?: boolean; + /** Specifies the margin of the control bar in pixels. */ + margin?: number; + /** Specifies the position of the control bar. */ + horizontalAlignment?: string; + /** Specifies the position of the control bar. */ + verticalAlignment?: string; + /** Specifies the opacity of the control bar. */ + opacity?: number; + }; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** + * Specifies a data source for the map area. + * @deprecated Use the layers | dataSource option instead. + */ + mapData?: any; + /** + * Specifies a data source for the map markers. + * @deprecated Use the layers | dataSource option instead. + */ + markers?: any; + /** + * An object specifying options for the map markers. + * @deprecated Use the "marker" type element of the layers array. + */ + markerSettings?: MarkerSettings; + /** Specifies the size of the dxVectorMap widget. */ + size?: viz.core.Size; + /** Specifies a title for the vector map. */ + title?: viz.core.Title; + /** Specifies tooltip options. */ + tooltip?: viz.core.Tooltip; + /** Configures map legends. */ + legends?: Array; + /** Specifies whether or not the map should respond when a user rolls the mouse wheel. */ + wheelEnabled?: boolean; + /** Specifies whether the map should respond to touch gestures. */ + touchEnabled?: boolean; + /** Disables the zooming capability. */ + zoomingEnabled?: boolean; + /** Specifies the geographical coordinates of the center for a map. */ + center?: Array; + /** A handler for the centerChanged event. */ + onCenterChanged?: (e: { + center: Array; + component: dxVectorMap; + element: Element; + }) => void; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** Specifies a number that is used to zoom a map initially. */ + zoomFactor?: number; + /** Specifies a map's maximum zoom factor. */ + maxZoomFactor?: number; + /** A handler for the zoomFactorChanged event. */ + onZoomFactorChanged?: (e: { + component: dxVectorMap; + element: Element; + zoomFactor: number; + }) => void; + /** A handler for the click event. */ + onClick?: any; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + component: dxVectorMap; + element: Element; + target: MapLayerElement; + }) => void; + /** + * A handler for the areaClick event. + * @deprecated Use the onClick option instead. + */ + onAreaClick?: any; + /** + * A handler for the areaSelectionChanged event. + * @deprecated Use the onSelectionChanged option instead. + */ + onAreaSelectionChanged?: (e: { + target: Area; + component: dxVectorMap; + element: Element; + }) => void; + /** + * A handler for the markerClick event. + * @deprecated Use the onClick option instead. + */ + onMarkerClick?: any; + /** + * A handler for the markerSelectionChanged event. + * @deprecated Use the onSelecitonChanged option instead. + */ + onMarkerSelectionChanged?: (e: { + target: Marker; + component: dxVectorMap; + element: Element; + }) => void; + /** Disables the panning capability. */ + panningEnabled?: boolean; + } + export interface Legend extends viz.core.BaseLegend { + /** Specifies the color of item markers in the legend. The specified color applied only when the legend uses 'size' source. */ + markerColor?: string; + /** Specifies text for legend items. */ + customizeText?: (itemInfo: { start: number; end: number; index: number; color: string; size: number; }) => string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item. */ + customizeHint?: (itemInfo: { start: number; end: number; index: number; color: string; size: number }) => string; + /** Specifies the source of data for the legend. */ + source?: { + /** Specifies a layer to which the legend belongs. */ + layer?: string; + /** Specifies the type of the legend grouping. */ + grouping?: string; + } + } + /** A vector map widget. */ + export class dxVectorMap extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxVectorMapOptions); + constructor(element: Element, options?: dxVectorMapOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(): void; + /** Gets the current coordinates of the map center. */ + center(): Array; + /** Sets the coordinates of the map center. */ + center(centerCoordinates: Array): void; + /** + * Deselects all the selected areas on a map. The areas are displayed in their initial style after. + * @deprecated Use the layer's clearSelection() method instead. + */ + clearAreaSelection(): void; + /** + * Deselects all the selected markers on a map. The markers are displayed in their initial style after. + * @deprecated Use the layer's clearSelection() method instead. + */ + clearMarkerSelection(): void; + /** Deselects all the selected area and markers on a map at once. The areas and markers are displayed in their initial style after. */ + clearSelection(): void; + /** Converts client area coordinates into map coordinates. */ + convertCoordinates(x: number, y: number): Array; + /** Gets all map layers. */ + getLayers(): Array; + /** Gets the layer by its index. */ + getLayerByIndex(index: number): MapLayer; + /** Gets the layer by its name. */ + getLayerByName(name: string): MapLayer; + /** + * Returns an array with all the map areas. + * @deprecated Use the layer's getElements() method instead. + */ + getAreas(): Array; + /** + * Returns an array with all the map markers. + * @deprecated Use the layer's getElements() method instead. + */ + getMarkers(): Array; + /** Gets the current coordinates of the map viewport. */ + viewport(): Array; + /** Sets the coordinates of the map viewport. */ + viewport(viewportCoordinates: Array): void; + /** Gets the current value of the map zoom factor. */ + zoomFactor(): number; + /** Sets the value of the map zoom factor. */ + zoomFactor(zoomFactor: number): void; + } + export var projection: ProjectionCreator; + export interface ProjectionCreator { + /** Creates a new projection. */ + (data: { + to?: (coordinates: Array) => Array; + from?: (coordinates: Array) => Array; + aspectRatio?: number; + }): Object; + /** Gets the default or custom projection from the projection storage. */ + get(name: string): Object; + /** Adds a new projection to the internal projections storage. */ + add(name: string, projection: Object): void; + } +} +interface JQuery { + dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; + dxVectorMap(methodName: string, ...params: any[]): any; + dxVectorMap(methodName: "instance"): DevExpress.viz.map.dxVectorMap; +} +declare module DevExpress.viz.sparklines { + export interface SparklineTooltip extends viz.core.Tooltip { + /** + * Specifies how a tooltip is horizontally aligned relative to the graph. + * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. + */ + horizontalAlignment?: string; + /** + * Specifies how a tooltip is vertically aligned relative to the graph. + * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. + */ + verticalAlignment?: string; + } + export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions { + /** Specifies the blank space between the widget's extreme elements and the boundaries of the area provided for the widget in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of the widget. */ + size?: viz.core.Size; + /** Specifies tooltip options. */ + tooltip?: SparklineTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + } + /** Overridden by descriptions for particular widgets. */ + export class BaseSparkline extends viz.core.BaseWidget { + /** Redraws a widget. */ + render(): void; + } + export interface dxBulletOptions extends BaseSparkline { + /** Specifies a color for the bullet bar. */ + color?: string; + /** Specifies an end value for the invisible scale. */ + endScaleValue?: number; + /** Specifies whether or not to show the target line. */ + showTarget?: boolean; + /** Specifies whether or not to show the line indicating zero on the invisible scale. */ + showZeroLevel?: boolean; + /** Specifies a start value for the invisible scale. */ + startScaleValue?: number; + /** Specifies the value indicated by the target line. */ + target?: number; + /** Specifies a color for both the target and zero level lines. */ + targetColor?: string; + /** Specifies the width of the target line. */ + targetWidth?: number; + /** Specifies the primary value indicated by the bullet bar. */ + value?: number; + } + /** A bullet graph widget. */ + export class dxBullet extends BaseSparkline { + constructor(element: JQuery, options?: dxBulletOptions); + constructor(element: Element, options?: dxBulletOptions); + } + export interface dxSparklineOptions extends BaseSparklineOptions { + /** Specifies the data source field that provides arguments for a sparkline. */ + argumentField?: string; + /** Sets a color for the bars indicating negative values. Available for a sparkline of the bar type only. */ + barNegativeColor?: string; + /** Sets a color for the bars indicating positive values. Available for a sparkline of the bar type only. */ + barPositiveColor?: string; + /** Specifies a data source for the sparkline. */ + dataSource?: any; + /** Sets a color for the boundary of both the first and last points on a sparkline. */ + firstLastColor?: string; + /** Specifies whether a sparkline ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Sets a color for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineColor?: string; + /** Specifies a width for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineWidth?: number; + /** Sets a color for the bars indicating the values that are less than the winloss threshold. Available for a sparkline of the winloss type only. */ + lossColor?: string; + /** Sets a color for the boundary of the maximum point on a sparkline. */ + maxColor?: string; + /** Sets a color for the boundary of the minimum point on a sparkline. */ + minColor?: string; + /** Sets a color for points on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointColor?: string; + /** Specifies the diameter of sparkline points in pixels. Available for the sparklines of line- and area-like types. */ + pointSize?: number; + /** Specifies a symbol to use as a point marker on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointSymbol?: string; + /** Specifies whether or not to indicate both the first and last values on a sparkline. */ + showFirstLast?: boolean; + /** Specifies whether or not to indicate both the minimum and maximum values on a sparkline. */ + showMinMax?: boolean; + /** Determines the type of a sparkline. */ + type?: string; + /** Specifies the data source field that provides values for a sparkline. */ + valueField?: string; + /** Sets a color for the bars indicating the values greater than a winloss threshold. Available for a sparkline of the winloss type only. */ + winColor?: string; + /** Specifies a value that serves as a threshold for the sparkline of the winloss type. */ + winlossThreshold?: number; + /** Specifies the minimum value of the sparkline value axis. */ + minValue?: number; + /** Specifies the maximum value of the sparkline's value axis. */ + maxValue?: number; + } + /** A sparkline widget. */ + export class dxSparkline extends BaseSparkline { + constructor(element: JQuery, options?: dxSparklineOptions); + constructor(element: Element, options?: dxSparklineOptions); + } +} +interface JQuery { + dxBullet(options?: DevExpress.viz.sparklines.dxBulletOptions): JQuery; + dxBullet(methodName: string, ...params: any[]): any; + dxBullet(methodName: "instance"): DevExpress.viz.sparklines.dxBullet; + dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery; + dxSparkline(methodName: string, ...params: any[]): any; + dxSparkline(methodName: "instance"): DevExpress.viz.sparklines.dxSparkline; +} \ No newline at end of file diff --git a/devextreme/devextreme-15.2.12.d.ts b/devextreme/devextreme-15.2.12.d.ts new file mode 100644 index 0000000000..bdba712122 --- /dev/null +++ b/devextreme/devextreme-15.2.12.d.ts @@ -0,0 +1,7531 @@ +// Type definitions for DevExtreme 15.2.12 +// Project: http://js.devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module DevExpress { + /** A mixin that provides a capability to fire and subscribe to events. */ + export interface EventsMixin { + /** Subscribes to a specified event. */ + on(eventName: string, eventHandler: Function): T; + /** Subscribes to the specified events. */ + on(events: { [eventName: string]: Function; }): T; + /** Detaches all event handlers from the specified event. */ + off(eventName: string): Object; + /** Detaches a particular event handler from the specified event. */ + off(eventName: string, eventHandler: Function): T; + } + /** An object that serves as a namespace for the methods required to perform validation. */ + export module validationEngine { + export interface IValidator { + validate(): ValidatorValidationResult; + reset(): void; + } + export interface ValidatorValidationResult { + isValid: boolean; + name?: string; + value: any; + brokenRule: any; + validationRules: any[]; + } + export interface ValidationGroupValidationResult { + isValid: boolean; + brokenRules: any[]; + validators: IValidator[]; + } + export interface GroupConfig extends EventsMixin { + group: any; + validators: IValidator[]; + validate(): ValidationGroupValidationResult; + reset(): void; + } + /** Provides access to the object that represents the specified validation group. */ + export function getGroupConfig(group: any): GroupConfig + /** Provides access to the object that represents the default validation group. */ + export function getGroupConfig(): GroupConfig + /** Validates rules of the validators that belong to the specified validation group. */ + export function validateGroup(group: any): ValidationGroupValidationResult; + /** Validates rules of the validators that belong to the default validation group. */ + export function validateGroup(): ValidationGroupValidationResult; + /** Resets the values and validation result of the editors that belong to the specified validation group. */ + export function resetGroup(group: any): void; + /** Resets the values and validation result of the editors that belong to the default validation group. */ + export function resetGroup(): void; + /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ + export function validateModel(model: Object): ValidationGroupValidationResult; + /** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */ + export function registerModelForValidation(model: Object) : void; + } + export var hardwareBackButton: JQueryCallback; + /** Processes the hardware back button click. */ + export function processHardwareBackButton(): void; + /** Hides the last displayed overlay widget. */ + export function hideTopOverlay(): boolean; + /** Specifies whether or not the entire application/site supports right-to-left representation. */ + export var rtlEnabled: boolean; + /** Registers a new component in the DevExpress.ui namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, componentClass: Object): void; + /** Registers a new component in the specified namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, namespace: Object, componentClass: Object): void; + export function requestAnimationFrame(callback: Function): number; + export function cancelAnimationFrame(requestID: number): void; + /** Custom Knockout binding that links an HTML element with a specific action. */ + export class Action { } + /** Used to get URLs that vary in a locally running application and the application running on production. */ + export class EndpointSelector { + constructor(options: { + [key: string]: { + local?: string; + production?: string; + } + }); + /** Returns a local or a productional URL depending on how the application is currently running. */ + urlFor(key: string): string; + } + /** An object that serves as a namespace for the methods that are used to animate UI elements. */ + export module fx { + /** Defines animation options. */ + export interface AnimationOptions { + /** A function called after animation is completed. */ + complete?: (element: JQuery, config: AnimationOptions) => void; + /** A number specifying wait time before animation execution. */ + delay?: number; + /** A number specifying the time period to wait before the animation of the next stagger item starts. */ + staggerDelay?: number; + /** A number specifying the time in milliseconds spent on animation. */ + duration?: number; + /** A string specifying the type of an easing function used for animation. */ + easing?: string; + /** Specifies the initial animation state. */ + from?: any; + /** A function called before animation is started. */ + start?: (element: JQuery, config: AnimationOptions) => void; + /** Specifies a final animation state. */ + to?: any; + /** A string value specifying the animation type. */ + type?: string; + /** Specifies the animation direction for the "slideIn" and "slideOut" animation types. */ + direction?: string; + } + /** Animates the specified element. */ + export function animate(element: HTMLElement, config: AnimationOptions): Object; + /** Returns a value indicating whether the specified element is being animated. */ + export function isAnimating(element: HTMLElement): boolean; + /** Stops the animation. */ + export function stop(element: HTMLElement, jumpToEnd: boolean): void; + } + /** The manager that performs several specified animations at a time. */ + export class TransitionExecutor { + /** Deletes all the animations registered in the Transition Executor by using the enter(elements, animation) and leave(elements, animation) methods. */ + reset(): void; + /** Registers a set of elements that should be animated as "entering" using the specified animation configuration. */ + enter(elements: JQuery, animation: any): void; + /** Registers a set of elements that should be animated as "leaving" using the specified animation configuration. */ + leave(elements: JQuery, animation: any): void; + /** Starts all the animations registered using the enter(elements, animation) and leave(elements, animation) methods beforehand. */ + start(config: Object): JQueryPromise; + /** Stops all started animations. */ + stop(): void; + } + export class AnimationPresetCollection { + /** Resets all the changes made in the animation repository. */ + resetToDefaults(): void; + /** Deletes the specified animation or clears all the animation repository, if an animation name is not passed. */ + clear(name: string): void; + /** Adds the specified animation preset to the animation repository by the specified name. */ + registerPreset(name: string, config: any): void; + /** Applies the changes made in the animation repository. */ + applyChanges(): void; + /** Returns the configuration of the animation found in the animation repository by the specified name for the current device. */ + getPreset(name: string): void; + /** Registers predefined animations in the animation repository. */ + registerDefaultPresets(): void; + } + /** A repository of animations. */ + export var animationPresets: AnimationPresetCollection; + /** The device object defines the device on which the application is running. */ + export interface Device { + /** Indicates whether or not the device platform is Android. */ + android?: boolean; + /** Specifies the type of the device on which the application is running. */ + deviceType?: string; + /** Indicates whether or not the device platform is generic, which means that the application will look and behave according to a generic "light" or "dark" theme. */ + generic?: boolean; + /** Indicates whether or not the device platform is iOS. */ + ios?: boolean; + /** Indicates whether or not the device type is 'phone'. */ + phone?: boolean; + /** Specifies the platform of the device on which the application is running. */ + platform?: string; + /** Indicates whether or not the device type is 'tablet'. */ + tablet?: boolean; + /** Specifies an array with the major and minor versions of the device platform. */ + version?: Array; + /** Indicates whether or not the device platform is Windows. */ + win?: boolean; + /** Specifies a performance grade of the current device. */ + grade?: string; + } + export class Devices implements EventsMixin { + constructor(options: { window: Window }); + /** Overrides actual device information to force the application to operate as if it was running on the specified device. */ + current(deviceName: any): void; + /** Returns information about the current device. */ + current(): Device; + orientationChanged: JQueryCallback; + /** Returns the current device orientation. */ + orientation(): string; + /** Returns real information about the current device regardless of the value passed to the devices.current(deviceName) method. */ + real(): Device; + on(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + on(eventName: string, eventHandler: Function): Devices; + on(events: { [eventName: string]: Function; }): Devices; + off(eventName: "orientationChanged"): Devices; + off(eventName: string): Devices; + off(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + off(eventName: string, eventHandler: Function): Devices; + } + /** An object that serves as a namespace for the methods and events specifying information on the current device. */ + export var devices: Devices; + /** The position object specifies the widget positioning options. */ + export interface PositionOptions { + /** The target element position that the widget is positioned against. */ + at?: any; + /** The element within which the widget is positioned. */ + boundary?: Object; + /** Specifies the horizontal and vertical offset from the window's boundaries. */ + boundaryOffset?: any; + /** Specifies how to move the widget if it overflows the screen. */ + collision?: any; + /** The position of the widget to align against the target element. */ + my?: any; + /** The target element that the widget is positioned against. */ + of?: Object; + /** Specifies horizontal and vertical offset in pixels. */ + offset?: any; + } + export interface ComponentOptions { + /** A handler for the initialized event. */ + onInitialized?: Function; + /** A handler for the optionChanged event. */ + onOptionChanged?: Function; + /** A handler for the disposing event. */ + onDisposing?: Function; + } + /** A base class for all components and widgets. */ + export class Component { + constructor(options?: ComponentOptions) + /** Prevents the component from refreshing until the endUpdate method is called. */ + beginUpdate(): void; + /** Enables the component to refresh after the beginUpdate method call. */ + endUpdate(): void; + /** Returns an instance of this component class. */ + instance(): Component; + /** Returns the configuration options of this component. */ + option(): { + [optionKey: string]: any; + }; + /** Sets one or more options of this component. */ + option(options: { + [optionKey: string]: any; + }): void; + /** Gets the value of the specified configuration option of this component. */ + option(optionName: string): any; + /** Sets a value to the specified configuration option of this component. */ + option(optionName: string, optionValue: any): void; + } + export interface DOMComponentOptions extends ComponentOptions { + /** Specifies whether or not the current component supports a right-to-left representation. */ + rtlEnabled?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the width of the widget. */ + width?: any; + /** A bag for holding any options that require two-way binding (Angular approach specific) */ + bindingOptions?: { [key: string]: any; }; + } + /** A base class for all components. */ + export class DOMComponent extends Component { + constructor(element: JQuery, options?: DOMComponentOptions); + constructor(element: HTMLElement, options?: DOMComponentOptions); + /** Returns the root HTML element of the widget. */ + element(): JQuery; + /** Specifies the device-dependent default configuration options for this component. */ + static defaultOptions(rule: { + device?: any; + options?: any; + }): void; + } + export module data { + export interface ODataError extends Error { + httpStatus?: number; + errorDetails?: any; + } + export interface StoreOptions { + /** A handler for the modified event. */ + onModified?: () => void; + /** A handler for the modifying event. */ + onModifying?: () => void; + /** A handler for the removed event. */ + onRemoved?: (key: any) => void; + /** A handler for the removing event. */ + onRemoving?: (key: any) => void; + /** A handler for the updated event. */ + onUpdated?: (key: any, values: Object) => void; + /** A handler for the updating event. */ + onUpdating?: (key: any, values: Object) => void; + /** A handler for the loaded event. */ + onLoaded?: (result: Array) => void; + /** A handler for the loading event. */ + onLoading?: (loadOptions: LoadOptions) => void; + /** A handler for the inserted event. */ + onInserted?: (values: Object, key: any) => void; + /** A handler for the inserting event. */ + onInserting?: (values: Object) => void; + /** Specifies the function called when the Store causes an error. */ + errorHandler?: (e: Error) => void; + /** Specifies the key properties within the data associated with the Store. */ + key?: any; + } + export interface LoadOptions { + filter?: Object; + sort?: Object; + select?: Object; + expand?: Object; + group?: Object; + skip?: number; + take?: number; + userData?: Object; + requireTotalCount?: boolean; + } + /** The base class for all Stores. */ + export class Store implements EventsMixin { + constructor(options?: StoreOptions); + /** Returns the data item specified by the key. */ + byKey(key: any): JQueryPromise; + /** Adds an item to the data associated with this Store. */ + insert(values: Object): JQueryPromise; + /** Returns the key expression specified via the key configuration option. */ + key(): any; + /** Returns the key of the Store item that matches the specified object. */ + keyOf(obj: Object): any; + /** Starts loading data. */ + load(obj?: LoadOptions): JQueryPromise; + /** Removes the data item specified by the key. */ + remove(key: any): JQueryPromise; + /** Obtains the total count of items that will be returned by the load() function. */ + totalCount(options?: { + filter?: Object; + group?: Object; + }): JQueryPromise; + /** Updates the data item specified by the key. */ + update(key: any, values: Object): JQueryPromise; + on(eventName: "removing", eventHandler: (key: any) => void): Store; + on(eventName: "removed", eventHandler: (key: any) => void): Store; + on(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "inserting", eventHandler: (values: Object) => void): Store; + on(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + on(eventName: "modifying", eventHandler: () => void): Store; + on(eventName: "modified", eventHandler: () => void): Store; + on(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + on(eventName: "loaded", eventHandler: (result: Array) => void): Store; + on(eventName: string, eventHandler: Function): Store; + on(events: { [eventName: string]: Function; }): Store; + off(eventName: "removing"): Store; + off(eventName: "removed"): Store; + off(eventName: "updating"): Store; + off(eventName: "updated"): Store; + off(eventName: "inserting"): Store; + off(eventName: "inserted"): Store; + off(eventName: "modifying"): Store; + off(eventName: "modified"): Store; + off(eventName: "loading"): Store; + off(eventName: "loaded"): Store; + off(eventName: string): Store; + off(eventName: "removing", eventHandler: (key: any) => void): Store; + off(eventName: "removed", eventHandler: (key: any) => void): Store; + off(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "inserting", eventHandler: (values: Object) => void): Store; + off(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + off(eventName: "modifying", eventHandler: () => void): Store; + off(eventName: "modified", eventHandler: () => void): Store; + off(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + off(eventName: "loaded", eventHandler: (result: Array) => void): Store; + off(eventName: string, eventHandler: Function): Store; + } + export interface ArrayStoreOptions extends StoreOptions { + /** Specifies the array associated with this Store. */ + data?: Array; + } + /** A Store accessing an in-memory array. */ + export class ArrayStore extends Store { + constructor(options?: ArrayStoreOptions); + /** Clears all data associated with the current ArrayStore. */ + clear(): void; + /** Creates the Query object for the underlying array. */ + createQuery(): Query; + } + interface Promise { + then(doneFn?: Function, failFn?: Function, progressFn?: Function): Promise; + } + export interface CustomStoreOptions extends StoreOptions { + /** Specifies whether or not the store combines the search expression with the filter expression. */ + useDefaultSearch?: boolean; + /** The user implementation of the byKey(key, extraOptions) method. */ + byKey?: (key: any) => Promise; + /** The user implementation of the insert(values) method. */ + insert?: (values: Object) => Promise; + /** The user implementation of the load(options) method. */ + load?: (options?: LoadOptions) => Promise; + /** The user implementation of the remove(key) method. */ + remove?: (key: any) => Promise; + /** The user implementation of the totalCount(options) method. */ + totalCount?: (options?: { + filter?: Object; + group?: Object; + }) => Promise; + /** The user implementation of the update(key, values) method. */ + update?: (key: any, values: Object) => Promise; + } + /** A Store object that enables you to implement your own data access logic. */ + export class CustomStore extends Store { + constructor(options: CustomStoreOptions); + } + export interface DataSourceOptions { + /** Specifies data filtering conditions. */ + filter?: Object; + /** Specifies data grouping conditions. */ + group?: Object; + /** The item mapping function. */ + map?: (record: any) => any; + /** Specifies the maximum number of items the page can contain. */ + pageSize?: number; + /** Specifies whether a DataSource loads data by pages, or all items at once. */ + paginate?: boolean; + /** The data post processing function. */ + postProcess?: (data: any[]) => any[]; + /** Specifies a value by which the required items are searched. */ + searchExpr?: Object; + /** Specifies the comparison operation used to search for the required items. */ + searchOperation?: string; + /** Specifies the value to which the search expression is compared. */ + searchValue?: Object; + /** Specifies the initial select option value. */ + select?: Object; + /** An array of the strings that represent the names of the navigation properties to be loaded simultaneously with the OData store's entity. */ + expand?: Object; + /** The bag of custom parameters passed to the query executed when the DataSource load operation is invoked. */ + customQueryParams?: Object; + /** Specifies whether or not the DataSource instance requests the total count of items available in the storage. */ + requireTotalCount?: boolean; + /** Specifies the initial sort option value. */ + sort?: Object; + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Error) => void; + } + export interface OperationPromise extends JQueryPromise { + operationId: number; + } + /** An object that provides access to a data web service or local data storage for collection container widgets. */ + export class DataSource implements EventsMixin { + constructor(url: string); + constructor(data: Array); + constructor(options: CustomStoreOptions); + constructor(options: DataSourceOptions); + /** Disposes all resources associated with this DataSource. */ + dispose(): void; + /** Returns the current filter option value. */ + filter(): Object; + /** Sets the filter option value. */ + filter(filterExpr: Object): void; + /** Returns the current group option value. */ + group(): Object; + /** Sets the group option value. */ + group(groupExpr: Object): void; + /** Indicates whether or not the current page contains fewer items than the number of items specified by the pageSize configuration option. */ + isLastPage(): boolean; + /** Indicates whether or not at least one load() method execution has successfully finished. */ + isLoaded(): boolean; + /** Indicates whether or not the DataSource is currently being loaded. */ + isLoading(): boolean; + /** Returns the array of items currently operated by the DataSource. */ + items(): Array; + /** Returns the key expression. */ + key(): any; + /** Starts loading data. */ + load(): OperationPromise>; + /** Clears currently loaded DataSource items and calls the load() method. */ + reload(): OperationPromise>; + /** Returns an object that would be passed to the load() method of the underlying Store according to the current data shaping option values of the current DataSource instance. */ + loadOptions(): Object; + /** Returns the current pageSize option value. */ + pageSize(): number; + /** Sets the pageSize option value. */ + pageSize(value: number): void; + /** Specifies the index of the currently loaded page. */ + pageIndex(): number; + /** Specifies the index of the page to be loaded during the next load() method execution. */ + pageIndex(newIndex: number): void; + /** Returns the current paginate option value. */ + paginate(): boolean; + /** Sets the paginate option value. */ + paginate(value: boolean): void; + /** Returns the searchExpr option value. */ + searchExpr(): Object; + /** Sets the searchExpr option value. */ + searchExpr(...expr: Object[]): void; + /** Returns the currently specified search operation. */ + searchOperation(): string; + /** Sets the current search operation. */ + searchOperation(op: string): void; + /** Returns the searchValue option value. */ + searchValue(): Object; + /** Sets the searchValue option value. */ + searchValue(value: Object): void; + /** Returns the current select option value. */ + select(): Object; + /** Sets the select option value. */ + select(expr: Object): void; + /** Returns the current requireTotalCount option value. */ + requireTotalCount(): boolean; + /** Sets the requireTotalCount option value. */ + requireTotalCount(value: boolean): void; + /** Returns the current sort option value. */ + sort(): Object; + /** Sets the sort option value. */ + sort(sortExpr: Object): void; + /** Returns the underlying Store instance. */ + store(): Store; + /** Returns the number of data items available in an underlying Store after the last load() operation without paging. */ + totalCount(): number; + /** Cancels the load operation associated with the specified identifier. */ + cancel(operationId: number): boolean; + on(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + on(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + on(eventName: "changed", eventHandler: () => void): DataSource; + on(eventName: string, eventHandler: Function): DataSource; + on(events: { [eventName: string]: Function; }): DataSource; + off(eventName: "loadingChanged"): DataSource; + off(eventName: "loadError"): DataSource; + off(eventName: "changed"): DataSource; + off(eventName: string): DataSource; + off(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + off(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + off(eventName: "changed", eventHandler: () => void): DataSource; + off(eventName: string, eventHandler: Function): DataSource; + } + /** An object used to work with primitive data types not supported by JavaScript when accessing an OData web service. */ + export class EdmLiteral { + /** Creates an EdmLiteral instance and assigns the specified value to it. */ + constructor(value: string); + /** Returns a string representation of the value associated with this EdmLiteral object. */ + valueOf(): string; + } + /** An object used to generate and hold the GUID. */ + export class Guid { + /** Creates a new Guid instance that holds the specified GUID. */ + constructor(value: string); + /** Creates a new Guid instance holding the generated GUID. */ + constructor(); + /** Returns a string representation of the Guid instance. */ + toString(): string; + /** Returns a string representation of the Guid instance. */ + valueOf(): string; + } + export interface LocalStoreOptions extends ArrayStoreOptions { + /** Specifies the time (in miliseconds) after the change operation, before the data is flushed. */ + flushInterval?: number; + /** Specifies whether the data is flushed immediatelly after each change operation, or after the delay specified via the flushInterval option. */ + immediate?: boolean; + /** The unique identifier used to distinguish the data within the HTML5 Web Storage. */ + name?: string; + } + /** A Store providing access to the HTML5 Web Storage. */ + export class LocalStore extends ArrayStore { + constructor(options?: LocalStoreOptions); + /** Removes all data associated with this Store. */ + clear(): void; + } + export interface ODataContextOptions extends ODataStoreOptions { + /** Specifies the list of entities to be accessed via the ODataContext. */ + entities?: Object; + /** Specifies the function called if the ODataContext causes an error. */ + errorHandler?: (e: Error) => void; + } + /** Provides access to the entire OData service. */ + export class ODataContext { + constructor(options?: ODataContextOptions); + /** Initiates the specified WebGet service operation that returns a value. For the information on service operations, refer to the OData documentation. */ + get(operationName: string, params: Object): JQueryPromise; + /** Initiates the specified WebGet service operation that returns nothing. For the information on service operations, refer to the OData documentation. */ + invoke(operationName: string, params: Object, httpMethod: Object): JQueryPromise; + /** Return a special proxy object to describe the entity link. */ + objectLink(entityAlias: string, key: any): Object; + } + export interface ODataStoreOptions extends StoreOptions { + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: { + url: string; + async: boolean; + method: string; + timeout: number; + params: Object; + payload: Object; + headers: Object; + }) => void; + /** Specifies whether the ODataStore uses the JSONP approach to access non-CORS-compatible remote services. */ + jsonp?: boolean; + /** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, and Guid. */ + keyType?: any; + /** Specifies whether or not dates found in the response are deserialized. */ + deserializeDates?: boolean; + /** Specifies the URL of the data service being accessed via the current ODataContext. */ + url?: string; + /** Specifies the version of the OData protocol used to interact with the data service. */ + version?: number; + /** Specifies the value of the withCredentials field of the underlying jqXHR object. */ + withCredentials?: boolean; + } + /** A Store providing access to a separate OData web service entity. */ + export class ODataStore extends Store { + constructor(options?: ODataStoreOptions); + /** Creates the Query object for the OData endpoint. */ + createQuery(loadOptions: Object): Object; + /** Returns the data item specified by the key. */ + byKey(key: any, extraOptions?: { expand?: Object }): JQueryPromise; + } + /** An universal chainable data query interface object. */ + export interface Query { + /** Calculates a custom summary for the items in the current Query. */ + aggregate(step: (accumulator: any, value: any) => any): JQueryPromise; + /** Calculates a custom summary for the items in the current Query. */ + aggregate(seed: any, step: (accumulator: any, value: any) => any, finalize: (result: any) => any): JQueryPromise; + /** Calculates the average item value for the current Query. */ + avg(getter: Object): JQueryPromise; + /** Finds the item with the maximum getter value. */ + max(getter: Object): JQueryPromise; + /** Finds the item with the maximum value in the Query. */ + max(): JQueryPromise; + /** Finds the item with the minimum value in the Query. */ + min(): JQueryPromise; + /** Finds the item with the minimum getter value. */ + min(getter: Object): JQueryPromise; + /** Calculates the average item value for the current Query, if each Query item has a numeric type. */ + avg(): JQueryPromise; + /** Returns the total count of items in the current Query. */ + count(): JQueryPromise; + /** Executes the Query. */ + enumerate(): JQueryPromise; + /** Filters the current Query data. */ + filter(criteria: Array): Query; + /** Filters the current Query data. */ + filter(predicate: (item: any) => boolean): Query; + /** Groups the current Query data. */ + groupBy(getter: Object): Query; + /** Applies the specified transformation to each item. */ + select(getter: Object): Query; + /** Limits the data item count. */ + slice(skip: number, take?: number): Query; + /** Sorts current Query data. */ + sortBy(getter: Object, desc: boolean): Query; + /** Sorts current Query data. */ + sortBy(getter: Object): Query; + /** Calculates the sum of item getter values in the current Query. */ + sum(getter: Object): JQueryPromise; + /** Calculates the sum of item values in the current Query. */ + sum(): JQueryPromise; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object): Query; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object, desc: boolean): Query; + /** Returns the array of current Query items. */ + toArray(): Array; + } + /** The global data layer error handler. */ + export var errorHandler: (e: Error) => void; + /** Encodes the specified string or array of bytes to base64 encoding. */ + export function base64_encode(input: any): string; + /** Creates a Query instance. */ + export function query(array: Array): Query; + /** Creates a Query instance for accessing the remote service specified by a URL. */ + export function query(url: string, queryOptions: Object): Query; + /** This section describes the utility objects provided by the DevExtreme data layer. */ + export var utils: { + /** Compiles a getter function from the getter expression. */ + compileGetter(expr: any): Function; + /** Compiles a setter function from the setter expression. */ + compileSetter(expr: any): Function; + odata: { + /** Holds key value converters for OData. */ + keyConverters: { + String(value: any): string; + Int32(value: any): number; + Int64(value: any): EdmLiteral; + Guid(value: any): Guid; + Boolean(value: any): boolean; + Single(value: any): EdmLiteral; + Decimal(value: any): EdmLiteral; + }; + } + } + } + /** An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications. */ + export module ui { + export interface WidgetOptions extends DOMComponentOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + /** Specifies whether or not the widget can be focused. */ + focusStateEnabled?: boolean; + /** Specifies a shortcut key that sets focus on the widget element. */ + accessKey?: string; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** Specifies the widget tab index. */ + tabIndex?: number; + /** Specifies the text of the hint displayed for the widget. */ + hint?: string; + } + /** The base class for widgets. */ + export class Widget extends DOMComponent { + constructor(options?: WidgetOptions); + /** Redraws the widget. */ + repaint(): void; + /** Sets focus on the widget. */ + focus(): void; + /** Registers a handler when a specified key is pressed. */ + registerKeyHandler(key: string, handler: Function): void; + } + export interface CollectionWidgetOptions extends WidgetOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** The time period in milliseconds before the onItemHold event is raised. */ + itemHoldTimeout?: number; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + loopItemFocus?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + onContentReady?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemContextMenu event. */ + onItemContextMenu?: Function; + /** A handler for the itemHold event. */ + onItemHold?: Function; + /** A handler for the itemRendered event. */ + onItemRendered?: Function; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** The index of the currently selected widget item. */ + selectedIndex?: number; + /** The selected item object. */ + selectedItem?: Object; + /** An array of currently selected item objects. */ + selectedItems?: Array; + /** A handler for the itemDeleting event. */ + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + } + /** The base class for widgets containing an item collection. */ + export class CollectionWidget extends Widget { + constructor(element: JQuery, options?: CollectionWidgetOptions); + constructor(element: HTMLElement, options?: CollectionWidgetOptions); + selectItem(itemElement: any): void; + unselectItem(itemElement: any): void; + deleteItem(itemElement: any): JQueryPromise; + isItemSelected(itemElement: any): boolean; + reorderItem(itemElement: any, toItemElement: any): JQueryPromise; + } + export interface DataExpressionMixinOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of a data source item field whose value is held in the value configuration option. */ + valueExpr?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** The currently selected value in the widget. */ + value?: Object; + } + export interface EditorOptions extends WidgetOptions { + /** The currently specified value. */ + value?: Object; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** A Boolean value specifying whether or not the widget is read-only. */ + readOnly?: boolean; + /** Holds the object that defines the error that occurred during validation. */ + validationError?: Object; + /** Specifies whether the editor's value is valid. */ + isValid?: boolean; + /** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ + validationMessageMode?: string; + } + /** A base class for editors. */ + export class Editor extends Widget { + /** Resets the editor's value to undefined. */ + reset(): void; + } + /** An object that serves as a namespace for methods displaying a message in an application/site. */ + export var dialog: { + /** Creates an alert dialog message containing a single "OK" button. */ + alert(message: string, title: string): JQueryPromise; + /** Creates a confirm dialog that contains "Yes" and "No" buttons. */ + confirm(message: string, title: string): JQueryPromise; + /** Creates a custom dialog using the options specified by the passed configuration object. */ + custom(options: { title?: string; message?: string; buttons?: Array; }): { + show(): JQueryPromise; + hide(): void; + hide(value: any): void; + }; + }; + /** Creates a toast message. */ + export function notify(message: any, type: string, displayTime: number): void; + /** Creates a toast message. */ + export function notify(options: Object): void; + /** An object that serves as a namespace for the methods that work with DevExtreme CSS Themes. */ + export var themes: { + /** Returns the name of the currently applied theme. */ + current(): string; + /** Changes the current theme to the specified one. */ + current(themeName: string): void; + }; + /** Sets a specified template engine. */ + export function setTemplateEngine(name: string): void; + /** Sets a custom template engine defined via custom compile and render functions. */ + export function setTemplateEngine(options: Object): void; + } + /** An object that serves as a namespace for utility methods that can be helpful when working with the DevExtreme framework and UI widgets. */ + export var utils: { + /** Sets parameters for the viewport meta tag. */ + initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + /** Requests that the browser call a specified function to update animation before the next repaint. */ + requestAnimationFrame(callback: Function): number; + /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ + cancelAnimationFrame(requestID: number): void; + }; + /** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */ + export module viz { + /** Applies a theme for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(theme: string): void; + /** Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(platform: string, colorScheme: string): void; + /** Registers a new theme based on the existing one. */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** Applies a predefined or registered custom palette to all visualization widgets at once. */ + export function currentPalette(paletteName: string): void; + /** Obtains the color sets of a predefined or registered palette. */ + export function getPalette(paletteName: string): Object; + /** Registers a new palette. */ + export function registerPalette(paletteName: string, palette: Object): void; + } +} +declare module DevExpress.ui { + export interface dxValidatorOptions extends DOMComponentOptions { + /** An array of validation rules to be checked for the editor with which the dxValidator object is associated. */ + validationRules?: Array; + /** Specifies the editor name to be used in the validation default messages. */ + name?: string; + /** An object that specifies what and when to validate and how to apply the validation result. */ + adapter?: Object; + /** Specifies the validation group the editor will be related to. */ + validationGroup?: string; + /** A handler for the validated event. */ + onValidated?: (params: validationEngine.ValidatorValidationResult) => void; + } + /** A widget that is used to validate the associated DevExtreme editors against the defined validation rules. */ + export class dxValidator extends DOMComponent implements validationEngine.IValidator { + constructor(element: JQuery, options?: dxValidatorOptions); + constructor(element: Element, options?: dxValidatorOptions); + /** Validates the value of the editor that is controlled by the current dxValidator object against the list of the specified validation rules. */ + validate(): validationEngine.ValidatorValidationResult; + /** Resets the value and validation result of the editor associated with the current dxValidator object. */ + reset(): void; + } + /** The widget that is used in the Knockout and Angular approaches to combine the editors to be validated. */ + export class dxValidationGroup extends DOMComponent { + constructor(element: JQuery); + constructor(element: Element); + /** Validates rules of the validators that belong to the current validation group. */ + validate(): validationEngine.ValidationGroupValidationResult; + /** Resets the value and validation result of the editors that are included to the current validation group. */ + reset(): void; + } + export interface dxValidationSummaryOptions extends CollectionWidgetOptions { + /** Specifies the validation group for which summary should be generated. */ + validationGroup?: string; + } + /** A widget for displaying the result of checking validation rules for editors. */ + export class dxValidationSummary extends CollectionWidget { + constructor(element: JQuery, options?: dxValidationSummaryOptions); + constructor(element: Element, options?: dxValidationSummaryOptions); + } + export interface dxResizableOptions extends DOMComponentOptions { + /** Specifies which borders of the widget element are used as a handle. */ + handles?: string; + /** Specifies the lower width boundary for resizing. */ + minWidth?: number; + /** Specifies the upper width boundary for resizing. */ + maxWidth?: number; + /** Specifies the lower height boundary for resizing. */ + minHeight?: number; + /** Specifies the upper height boundary for resizing. */ + maxHeight?: number; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + } + /** A widget that displays required content in a resizable element. */ + export class dxResizable extends DOMComponent { + constructor(element: JQuery, options?: dxResizableOptions); + constructor(element: Element, options?: dxResizableOptions); + } + export interface dxTooltipOptions extends dxPopoverOptions { + } + /** A tooltip widget. */ + export class dxTooltip extends dxPopover { + constructor(element: JQuery, options?: dxTooltipOptions); + constructor(element: Element, options?: dxTooltipOptions); + } + export interface dxDropDownListOptions extends dxDropDownEditorOptions, DataExpressionMixinOptions { + /** Returns the value currently displayed by the widget. */ + displayValue?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies whether or not the widget displays unfiltered values until a user types a number of characters exceeding the minSearchLength option value. */ + showDataBeforeSearch?: boolean; + /** Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */ + searchExpr?: any; + /** Specifies the binary operation used to filter data. */ + searchMode?: string; + /** Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed. */ + searchTimeout?: number; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget supports searching. */ + searchEnabled?: boolean; + /** + * Specifies whether or not the widget displays items by pages. + * @deprecated Use the DataSource paging opportunities instead. + */ + pagingEnabled?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** A handler for the itemClick event. */ + onItemClick?: Function; + onContentReady?: Function; + } + /** A base class for drop-down list widgets. */ + export class dxDropDownList extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDropDownListOptions); + constructor(element: Element, options?: dxDropDownListOptions); + } + export interface dxToolbarOptions extends CollectionWidgetOptions { + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** Informs the widget about its location in a view HTML markup. */ + renderAs?: string; + } + /** A toolbar widget. */ + export class dxToolbar extends CollectionWidget { + constructor(element: JQuery, options?: dxToolbarOptions); + constructor(element: Element, options?: dxToolbarOptions); + } + export interface dxToastOptions extends dxOverlayOptions { + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** The time span in milliseconds during which the dxToast widget is visible. */ + displayTime?: number; + height?: any; + /** The dxToast message text. */ + message?: string; + position?: PositionOptions; + shading?: boolean; + /** Specifies the dxToast widget type. */ + type?: string; + width?: any; + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user swipes it out of the screen boundaries. */ + closeOnSwipe?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user clicks it. */ + closeOnClick?: boolean; + } + /** The toast message widget. */ + export class dxToast extends dxOverlay { + constructor(element: JQuery, options?: dxToastOptions); + constructor(element: Element, options?: dxToastOptions); + } + export interface dxTextEditorOptions extends EditorOptions { + /** A handler for the change event. */ + onChange?: Function; + /** A handler for the copy event. */ + onCopy?: Function; + /** A handler for the cut event. */ + onCut?: Function; + /** A handler for the enterKey event. */ + onEnterKey?: Function; + /** A handler for the focusIn event. */ + onFocusIn?: Function; + /** A handler for the focusOut event. */ + onFocusOut?: Function; + /** A handler for the input event. */ + onInput?: Function; + /** A handler for the keyDown event. */ + onKeyDown?: Function; + /** A handler for the keyPress event. */ + onKeyPress?: Function; + /** A handler for the keyUp event. */ + onKeyUp?: Function; + /** A handler for the paste event. */ + onPaste?: Function; + /** The text displayed by the widget when the widget value is empty. */ + placeholder?: string; + /** Specifies whether to display the Clear button in the widget. */ + showClearButton?: boolean; + /** Specifies the current value displayed by the widget. */ + value?: any; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + /** Specifies HTML attributes applied to the inner input element of the widget. */ + attr?: Object; + /** The read-only option that holds the text displayed by the widget input element. */ + text?: string; + focusStateEnabled?: boolean; + hoverStateEnabled?: boolean; + /** The editor mask that specifies the format of the entered string. */ + mask?: string; + /** Specifies a mask placeholder character. */ + maskChar?: string; + /** Specifies custom mask rules. */ + maskRules?: Object; + /** A message displayed when the entered text does not match the specified pattern. */ + maskInvalidMessage?: string; + /** Specifies whether the value option holds only characters entered by a user or prompt characters as well. */ + useMaskedValue?: boolean; + } + /** A base class for text editing widgets. */ + export class dxTextEditor extends Editor { + constructor(element: JQuery, options?: dxTextEditorOptions); + constructor(element: Element, options?: dxTextEditorOptions); + /** Removes focus from the input element. */ + blur(): void; + /** Sets focus to the input element representing the widget. */ + focus(): void; + } + export interface dxTextBoxOptions extends dxTextEditorOptions { + /** Specifies the maximum number of characters you can enter into the textbox. */ + maxLength?: any; + /** The "mode" attribute value of the actual HTML input element representing the text box. */ + mode?: string; + } + /** A single-line text box widget. */ + export class dxTextBox extends dxTextEditor { + constructor(element: JQuery, options?: dxTextBoxOptions); + constructor(element: Element, options?: dxTextBoxOptions); + } + export interface dxTextAreaOptions extends dxTextBoxOptions { + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + } + /** A widget used to display and edit multi-line text. */ + export class dxTextArea extends dxTextBox { + constructor(element: JQuery, options?: dxTextAreaOptions); + constructor(element: Element, options?: dxTextAreaOptions); + } + export interface dxTabsOptions extends CollectionWidgetOptions { + /** Specifies whether the widget enables an end-user to select only a single item or multiple items. */ + selectionMode?: string; + /** Specifies whether or not an end-user can scroll tabs by swiping. */ + scrollByContent?: boolean; + /** Specifies whether or not an end-user can scroll tabs. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A tab strip used to switch between pages. */ + export class dxTabs extends CollectionWidget { + constructor(element: JQuery, options?: dxTabsOptions); + constructor(element: Element, options?: dxTabsOptions); + } + export interface dxTabPanelOptions extends dxMultiViewOptions { + /** A handler for the titleClick event. */ + onTitleClick?: any; + /** A handler for the titleHold event. */ + onTitleHold?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** A Boolean value specifying if tabs in the title are scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean indicating whether or not to add scrolling support for tabs in the title. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A widget used to display a view and to switch between several views by clicking the appropriate tabs. */ + export class dxTabPanel extends dxMultiView { + constructor(element: JQuery, options?: dxTabPanelOptions); + constructor(element: Element, options?: dxTabPanelOptions); + } + export interface dxSelectBoxOptions extends dxDropDownListOptions { + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + /** The text that is provided as a hint in the select box editor. */ + placeholder?: string; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + } + /** A widget that allows you to select an item in a dropdown list. */ + export class dxSelectBox extends dxDropDownList { + constructor(element: JQuery, options?: dxSelectBoxOptions); + constructor(element: Element, options?: dxSelectBoxOptions); + } + export interface dxTagBoxOptions extends dxSelectBoxOptions { + /** Holds the list of selected values. */ + values?: Array; + /** A read-only option that holds the last selected value. */ + value?: Object; + } + /** A widget that allows you to select multiple items from a dropdown list. */ + export class dxTagBox extends dxSelectBox { + constructor(element: JQuery, options?: dxTagBoxOptions); + constructor(element: Element, options?: dxTagBoxOptions); + } + export interface dxScrollViewOptions extends dxScrollableOptions { + /** A handler for the pullDown event. */ + onPullDown?: Function; + /** Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the reachBottom event. */ + onReachBottom?: Function; + /** Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom. */ + reachBottomText?: string; + /** Specifies the text shown in the pullDown panel displayed when the content is being refreshed. */ + refreshingText?: string; + } + /** A widget used to display scrollable content. */ + export class dxScrollView extends dxScrollable { + constructor(element: JQuery, options?: dxScrollViewOptions); + constructor(element: Element, options?: dxScrollViewOptions); + /** Returns a value indicating if the scrollView content is larger then the widget container. */ + isFull(): boolean; + /** Locks the widget until the release(preventScrollBottom) method is called and executes the function passed to the onPullDown option and the handler assigned to the pullDown event. */ + refresh(): void; + /** Notifies the scroll view that data loading is finished. */ + release(preventScrollBottom: boolean): JQueryPromise; + /** Toggles the loading state of the widget. */ + toggleLoading(showOrHide: boolean): void; + } + export interface dxScrollableLocation { + top?: number; + left?: number; + } + export interface dxScrollableOptions extends DOMComponentOptions { + /** A string value specifying the available scrolling directions. */ + direction?: string; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A handler for the scroll event. */ + onScroll?: Function; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** A handler for the update event. */ + onUpdated?: Function; + /** Indicates whether to use native or simulated scrolling. */ + useNative?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content swiping it up or down. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content using the scrollbar. */ + scrollByThumb?: boolean; + } + /** A widget used to display scrollable content. */ + export class dxScrollable extends DOMComponent { + constructor(element: JQuery, options?: dxScrollableOptions); + constructor(element: Element, options?: dxScrollableOptions); + /** Returns the height of the scrollable widget in pixels. */ + clientHeight(): number; + /** Returns the width of the scrollable widget in pixels. */ + clientWidth(): number; + /** Returns an HTML element of the widget. */ + content(): JQuery; + /** Scrolls the widget content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Scrolls widget content by the specified number of pixels in horizontal and vertical directions. */ + scrollBy(distanceObject: dxScrollableLocation): void; + /** Returns the height of the scrollable content in pixels. */ + scrollHeight(): number; + /** Returns the current scroll position against the leftmost position. */ + scrollLeft(): number; + /** Returns how far the scrollable content is scrolled from the top and from the left. */ + scrollOffset(): dxScrollableLocation; + /** Scrolls widget content to the specified position. */ + scrollTo(targetLocation: number): void; + /** Scrolls widget content to a specified position. */ + scrollTo(targetLocation: dxScrollableLocation): void; + /** Scrolls widget content to the specified element. */ + scrollToElement(element: Element): void; + /** Returns the current scroll position against the topmost position. */ + scrollTop(): number; + /** Returns the width of the scrollable content in pixels. */ + scrollWidth(): number; + /** Updates the dimensions of the scrollable contents. */ + update(): void; + } + export interface dxRadioGroupOptions extends EditorOptions, DataExpressionMixinOptions { + activeStateEnabled?: boolean; + /** Specifies the radio group layout. */ + layout?: string; + } + /** A widget that enables a user to select one item within a list of items represented by radio buttons. */ + export class dxRadioGroup extends CollectionWidget { + constructor(element: JQuery, options?: dxRadioGroupOptions); + constructor(element: Element, options?: dxRadioGroupOptions); + } + export interface dxPopupButtonOptions { + /** Specifies whether or not a toolbar item must be displayed disabled. */ + disabled?: boolean; + /** Specifies html code inserted into the toolbar item element. */ + html?: string; + /** Specifies a location for the item on the toolbar. */ + location?: string; + /** Specifies a configuration object for the widget that presents a toolbar item. */ + options?: Object; + /** Specifies an item template that should be used to render this item only. */ + template?: any; + /** Specifies text displayed for the toolbar item. */ + text?: string; + /** Specifies whether the item is displayed on a top or bottom toolbar. */ + toolbar?: string; + /** Specifies whether or not a widget item must be displayed. */ + visible?: boolean; + /** A widget that presents a toolbar item. */ + widget?: string; + } + export interface dxPopupOptions extends dxOverlayOptions { + /** Specifies whether or not to allow a user to drag the popup window. */ + dragEnabled?: boolean; + /** A Boolean value specifying whether or not to display the widget in full-screen mode. */ + fullScreen?: boolean; + position?: PositionOptions; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showTitle?: boolean; + /** The title in the overlay window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + width?: any; + /** Specifies items displayed on the top or bottom toolbar of the popup window. */ + buttons?: Array; + /** Specifies whether or not the widget displays the Close button. */ + showCloseButton?: boolean; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + } + /** A widget that displays required content in a popup window. */ + export class dxPopup extends dxOverlay { + constructor(element: JQuery, options?: dxPopupOptions); + constructor(element: Element, options?: dxPopupOptions); + } + export interface dxPopoverOptions extends dxPopupOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** Specifies the height of the widget. */ + height?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + shading?: boolean; + /** A Boolean value specifying whether or not to display the title in the overlay window. */ + showTitle?: boolean; + /** The target element associated with a popover. */ + target?: any; + /** Specifies the width of the widget. */ + width?: any; + } + /** A widget that displays the required content in a popup window. */ + export class dxPopover extends dxPopup { + constructor(element: JQuery, options?: dxPopoverOptions); + constructor(element: Element, options?: dxPopoverOptions); + /** Displays the widget for the specified target element. */ + show(target?: any): JQueryPromise; + } + export interface dxOverlayOptions extends WidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** A Boolean value specifying whether or not the widget is closed if a user presses the Back hardware button. */ + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlapping window. */ + closeOnOutsideClick?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + /** Specifies whether or not an end-user can drag the widget. */ + dragEnabled?: boolean; + /** Specifies whether or not an end user can resize the widget. */ + resizeEnabled?: boolean; + /** The height of the widget in pixels. */ + height?: any; + /** Specifies the maximum height the widget can reach while resizing. */ + maxHeight?: any; + /** Specifies the maximum width the widget can reach while resizing. */ + maxWidth?: any; + /** Specifies the minimum height the widget can reach while resizing. */ + minHeight?: any; + /** Specifies the minimum width the widget can reach while resizing. */ + minWidth?: any; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** A Boolean value specifying whether or not the main screen is inactive while the widget is active. */ + shading?: boolean; + /** Specifies the shading color. */ + shadingColor?: string; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + onContentReady?: Function; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** The widget width in pixels. */ + width?: any; + } + /** A widget displaying the required content in an overlay window. */ + export class dxOverlay extends Widget { + constructor(element: JQuery, options?: dxOverlayOptions); + constructor(element: Element, options?: dxOverlayOptions); + /** An HTML element of the widget. */ + content(): JQuery; + /** Hides the widget. */ + hide(): JQueryPromise; + /** Recalculates the overlay's size and position. */ + repaint(): void; + /** Shows the widget. */ + show(): JQueryPromise; + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** A static method that specifies the base z-index for all overlay widgets. */ + static baseZIndex(zIndex: number): void; + } + export interface dxNumberBoxOptions extends dxTextEditorOptions { + /** The maximum value accepted by the number box. */ + max?: number; + /** The minimum value accepted by the number box. */ + min?: number; + /** Specifies whether or not to show spin buttons. */ + showSpinButtons?: boolean; + useTouchSpinButtons?: boolean; + /** Specifies by which value the widget value changes when a spin button is clicked. */ + step?: number; + /** The current number box value. */ + value?: number; + /** The "mode" attribute value of the actual HTML input element representing the widget. */ + mode?: string; + } + /** A textbox widget that enables a user to enter numeric values. */ + export class dxNumberBox extends dxTextEditor { + constructor(element: JQuery, options?: dxNumberBoxOptions); + constructor(element: Element, options?: dxNumberBoxOptions); + } + export interface dxNavBarOptions extends dxTabsOptions { + scrollingEnabled?: boolean; + } + /** A widget that contains items used to navigate through application views. */ + export class dxNavBar extends dxTabs { + constructor(element: JQuery, options?: dxNavBarOptions); + constructor(element: Element, options?: dxNavBarOptions); + } + export interface dxMultiViewOptions extends CollectionWidgetOptions { + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently displayed item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to change the selected index by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget used to display a view and to switch between several views. */ + export class dxMultiView extends CollectionWidget { + constructor(element: JQuery, options?: dxMultiViewOptions); + constructor(element: Element, options?: dxMultiViewOptions); + } + export interface dxMapOptions extends WidgetOptions { + /** Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route, or when creating a widget if it initially contains markers or routes. */ + autoAdjust?: boolean; + center?: { + /** The latitude location displayed in the center of the widget. */ + lat?: number; + /** The longitude location displayed in the center of the widget. */ + lng?: number; + }; + /** A handler for the click event. */ + onClick?: any; + /** Specifies whether or not map widget controls are available. */ + controls?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** A key used to authenticate the application within the required map provider. */ + key?: { + /** A key used to authenticate the application within the "Bing" map provider. */ + bing?: string; + /** A key used to authenticate the application within the "Google" map provider. */ + google?: string; + /** A key used to authenticate the application within the "Google Static" map provider. */ + googleStatic?: string; + } + /** A handler for the markerAdded event. */ + onMarkerAdded?: Function; + /** A URL pointing to the custom icon to be used for map markers. */ + markerIconSrc?: string; + /** A handler for the markerRemoved event. */ + onMarkerRemoved?: Function; + /** An array of markers displayed on a map. */ + markers?: Array; + /** The name of the current map data provider. */ + provider?: string; + /** A handler for the ready event. */ + onReady?: Function; + /** A handler for the routeAdded event. */ + onRouteAdded?: Function; + /** A handler for the routeRemoved event. */ + onRouteRemoved?: Function; + /** An array of routes shown on the map. */ + routes?: Array; + /** The type of a map to display. */ + type?: string; + /** Specifies the width of the widget. */ + width?: any; + /** The zoom level of the map. */ + zoom?: number; + } + /** An interactive map widget. */ + export class dxMap extends Widget { + constructor(element: JQuery, options?: dxMapOptions); + constructor(element: Element, options?: dxMapOptions); + /** Adds a marker to the map. */ + addMarker(markerOptions: Object): JQueryPromise; + /** Adds a route to the map. */ + addRoute(routeOptions: Object): JQueryPromise; + /** Removes a marker from the map. */ + removeMarker(marker: Object): JQueryPromise; + /** Removes a route from the map. */ + removeRoute(route: any): JQueryPromise; + } + export interface dxLookupOptions extends dxDropDownListOptions { + applyValueMode?: string; + /** An object that defines widget animation options. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + /** The text displayed on the Clear button. */ + clearButtonText?: string; + /** Specifies whether or not the widget cleans the search box when the popup window is displayed. */ + cleanSearchOnOpening?: boolean; + /** A Boolean value specifying whether or not a widget is closed if a user clicks outside of the overlaying window. */ + closeOnOutsideClick?: any; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** A Boolean value specifying whether or not to display the lookup in full-screen mode. */ + fullScreen?: boolean; + focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not to group widget items. */ + grouped?: boolean; + /** The name of the template used to display a group header. */ + groupTemplate?: any; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies the text shown in the pullDown panel, which is displayed when the widget is scrolled to the bottom. */ + pageLoadingText?: string; + /** The text displayed by the widget when nothing is selected. */ + placeholder?: string; + /** The height of the widget popup element. */ + popupHeight?: any; + /** The width of the widget popup element. */ + popupWidth?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the text displayed in the pullDown panel when the widget is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the widget is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + /** A Boolean value specifying whether or not the search bar is visible. */ + searchEnabled?: boolean; + /** The text that is provided as a hint in the lookup's search bar. */ + searchPlaceholder?: string; + /** A Boolean value specifying whether or not the main screen is inactive while the lookup is active. */ + shading?: boolean; + /** Specifies whether to display the Cancel button in the lookup window. */ + showCancelButton?: boolean; + /** + * A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. + * @deprecated Use the pageLoadMode option instead. + */ + showNextButton?: boolean; + /** The title of the lookup window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** Specifies whether or not to show lookup contents in a dxPopover widget. */ + usePopover?: boolean; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showPopupTitle?: boolean; + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + } + /** A widget that allows a user to select predefined values from a lookup window. */ + export class dxLookup extends dxDropDownList { + constructor(element: JQuery, options?: dxLookupOptions); + constructor(element: Element, options?: dxLookupOptions); + } + export interface dxLoadPanelOptions extends dxOverlayOptions { + /** An object defining the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** The delay in milliseconds after which the load panel is displayed. */ + delay?: number; + /** The height of the widget. */ + height?: number; + /** A URL pointing to an image to be used as a load indicator. */ + indicatorSrc?: string; + /** The text displayed in the load panel. */ + message?: string; + /** A Boolean value specifying whether or not to show a load indicator. */ + showIndicator?: boolean; + /** A Boolean value specifying whether or not to show the pane behind the load indicator. */ + showPane?: boolean; + /** The width of the widget. */ + width?: number; + } + /** A widget used to indicate whether or not an element is loading. */ + export class dxLoadPanel extends dxOverlay { + constructor(element: JQuery, options?: dxLoadPanelOptions); + constructor(element: Element, options?: dxLoadPanelOptions); + } + export interface dxLoadIndicatorOptions extends WidgetOptions { + /** Specifies the path to an image used as the indicator. */ + indicatorSrc?: string; + } + /** The widget used to indicate the loading process. */ + export class dxLoadIndicator extends Widget { + constructor(element: JQuery, options?: dxLoadIndicatorOptions); + constructor(element: Element, options?: dxLoadIndicatorOptions); + } + /** An object containing items for a context menu called for a list item. */ + export interface ListOptionsMenuItem { + /** Specifies the menu item text. */ + text?: string; + /** Specifies the function called when the menu item is clicked. */ + action?: (itemElement: Element, itemData: any) => void; + } + export interface dxListOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not to display a grouped list. */ + grouped?: boolean; + /** The template to be used for rendering item groups. */ + groupTemplate?: any; + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the groupRendered event. */ + onGroupRendered?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemSwipe event. */ + onItemSwipe?: Function; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies the text shown in the pullDown panel, which is displayed when the list is scrolled to the bottom. */ + pageLoadingText?: string; + /** Specifies the text displayed in the pullDown panel when the list is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the list is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + /** A Boolean value specifying whether to enable or disable list scrolling. */ + scrollingEnabled?: boolean; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying if the list is scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value specifying if the list is scrolled using the scrollbar. */ + scrollByThumb?: boolean; + onItemContextMenu?: Function; + onItemHold?: Function; + /** Specifies whether or not an end-user can collapse groups. */ + collapsibleGroups?: boolean; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies whether or not to display controls used to select list items. */ + showSelectionControls?: boolean; + /** Specifies item selection mode. */ + selectionMode?: string; + selectAllText?: string; + onSelectAllChanged?: Function; + /** Specifies the array of items for a context menu called for a list item. */ + menuItems?: Array; + /** Specifies whether an item context menu is shown when a user holds or swipes an item. */ + menuMode?: string; + /** Specifies whether or not an end user can delete list items. */ + allowItemDeleting?: boolean; + /** Specifies the way a user can delete items from the list. */ + itemDeleteMode?: string; + /** Specifies whether or not an end user can reorder list items. */ + allowItemReordering?: boolean; + /** Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ + indicateLoading?: boolean; + activeStateEnabled?: boolean; + } + /** A list widget. */ + export class dxList extends CollectionWidget { + constructor(element: JQuery, options?: dxListOptions); + constructor(element: Element, options?: dxListOptions); + /** Returns the height of the widget in pixels. */ + clientHeight(): number; + /** Removes the specified item from the list. */ + deleteItem(itemIndex: any): JQueryPromise; + /** Removes the specified item from the list. */ + deleteItem(itemElement: Element): JQueryPromise; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemIndex: any): boolean; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemElement: Element): boolean; + /** Reloads list data. */ + reload(): void; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemElement: Element, toItemElement: Element): JQueryPromise; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemIndex: any, toItemIndex: any): JQueryPromise; + /** Scrolls the list content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Returns the height of the list content in pixels. */ + scrollHeight(): number; + /** Scrolls list content to the specified position. */ + scrollTo(location: number): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemElement: Element): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemIndex: any): void; + /** Returns how far the list content is scrolled from the top. */ + scrollTop(): number; + /** Selects the specified item from the list. */ + selectItem(itemElement: Element): void; + /** Selects the specified item from the list. */ + selectItem(itemIndex: any): void; + /** Deselects the specified item from the list. */ + unselectItem(itemElement: Element): void; + /** Unselects the specified item from the list. */ + unselectItem(itemIndex: any): void; + /** Updates the widget scrollbar according to widget content size. */ + updateDimensions(): JQueryPromise; + /** Expands the specified group. */ + expandGroup(groupIndex: number): JQueryPromise; + /** Collapses the specified group. */ + collapseGroup(groupIndex: number): JQueryPromise; + } + export interface dxGalleryOptions extends CollectionWidgetOptions { + /** The time, in milliseconds, spent on slide animation. */ + animationDuration?: number; + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to allow users to switch between items by clicking an indicator. */ + indicatorEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently active gallery item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to display an indicator that points to the selected gallery item. */ + showIndicator?: boolean; + /** A Boolean value that specifies the availability of the "Forward" and "Back" navigation buttons. */ + showNavButtons?: boolean; + /** The time interval in milliseconds, after which the gallery switches to the next item. */ + slideshowDelay?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether or not to display parts of previous and next images along the sides of the current image. */ + wrapAround?: boolean; + /** Specifies if the widget stretches images to fit the total gallery width. */ + stretchImages?: boolean; + /** Specifies the width of an area used to display a single image. */ + initialItemWidth?: number; + } + /** An image gallery widget. */ + export class dxGallery extends CollectionWidget { + constructor(element: JQuery, options?: dxGalleryOptions); + constructor(element: Element, options?: dxGalleryOptions); + /** Shows the specified gallery item. */ + goToItem(itemIndex: number, animation: boolean): JQueryPromise; + /** Shows the next gallery item. */ + nextItem(animation: boolean): JQueryPromise; + /** Shows the previous gallery item. */ + prevItem(animation: boolean): JQueryPromise; + } + export interface dxDropDownEditorOptions extends dxTextBoxOptions { + /** Specifies the current value displayed by the widget. */ + value?: Object; + /** A handler for the closed event. */ + onClosed?: Function; + /** A handler for the opened event. */ + onOpened?: Function; + /** Specifies whether or not the drop-down editor is displayed. */ + opened?: boolean; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + /** Specifies the way an end-user applies the selected value. */ + applyValueMode?: string; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + activeStateEnabled?: boolean; + } + /** A drop-down editor widget. */ + export class dxDropDownEditor extends dxTextBox { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Closes the drop-down editor. */ + close(): void; + /** Opens the drop-down editor. */ + open(): void; + /** Resets the widget's value to null. */ + reset(): void; + /** Returns an <input> element of the widget. */ + field(): JQuery; + /** Returns an HTML element of the popup window content. */ + content(): JQuery; + } + export interface dxDateBoxOptions extends dxTextEditorOptions { + /** A format used to display date/time information. */ + format?: string; + /** A Globalize format string specifying the date display format. */ + formatString?: string; + /** The last date that can be selected within the widget. */ + max?: any; + /** The minimum date that can be selected within the widget. */ + min?: any; + /** The text displayed by the widget when the widget value is not yet specified. This text is also used as a title of the date picker. */ + placeholder?: string; + /** + * Specifies whether or not a user can pick out a date using the drop-down calendar. + * @deprecated Use the pickerType option instead. + */ + useCalendar?: boolean; + /** An object or a value, specifying the date and time currently selected using the date box. */ + value?: any; + /** + * Specifies whether or not the widget uses the native HTML input element. + * @deprecated Use the pickerType option instead. + */ + useNative?: boolean; + /** Specifies the interval between neighboring values in the popup list in minutes. */ + interval?: number; + /** Specifies the maximum zoom level of a calendar, which is used to pick the date. */ + maxZoomLevel?: string; + /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ + minZoomLevel?: string; + /** Specifies the type of date/time picker. */ + pickerType?: string; + /** Specifies the message displayed if the typed value is not a valid date or time. */ + invalidDateMessage?: string; + /** Specifies the message displayed if the specified date is later than the max value or earlier than the min value. */ + dateOutOfRangeMessage?: string; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + } + /** A date box widget. */ + export class dxDateBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDateBoxOptions); + constructor(element: Element, options?: dxDateBoxOptions); + } + export interface dxCheckBoxOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Specifies the widget state. */ + value?: boolean; + /** Specifies the text displayed by the check box. */ + text?: string; + } + /** A check box widget. */ + export class dxCheckBox extends Editor { + constructor(element: JQuery, options?: dxCheckBoxOptions); + constructor(element: Element, options?: dxCheckBoxOptions); + } + export interface dxCalendarOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Specifies a date displayed on the current calendar page. */ + currentDate?: Date; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** An object or a value, specifying the date and time currently selected in the calendar. */ + value?: any; + /** The latest date the widget allows to select. */ + max?: any; + /** The earliest date the widget allows to select. */ + min?: any; + /** Specifies whether or not the widget displays a button that selects the current date. */ + showTodayButton?: boolean; + /** Specifies the current calendar zoom level. */ + zoomLevel?: string; + /** Specifies the maximum zoom level of the calendar. */ + maxZoomLevel?: string; + /** Specifies the minimum zoom level of the calendar. */ + minZoomLevel?: string; + /** The template to be used for rendering calendar cells. */ + cellTemplate?: any; + } + /** A calendar widget. */ + export class dxCalendar extends Editor { + constructor(element: JQuery, options?: dxCalendarOptions); + constructor(element: Element, options?: dxCalendarOptions); + } + export interface dxButtonOptions extends WidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A handler for the click event. */ + onClick?: any; + /** Specifies the icon to be displayed on the button. */ + icon?: string; + iconSrc?: string; + /** A template to be used for rendering the dxButton widget. */ + template?: any; + /** The text displayed on the button. */ + text?: string; + /** Specifies the button type. */ + type?: string; + /** Specifies the name of the validation group to be accessed in the click event handler. */ + validationGroup?: string; + } + /** A button widget. */ + export class dxButton extends Widget { + constructor(element: JQuery, options?: dxButtonOptions); + constructor(element: Element, options?: dxButtonOptions); + } + export interface dxBoxOptions extends CollectionWidgetOptions { + /** Specifies how widget items are aligned along the main direction. */ + align?: string; + /** Specifies the direction of item positioning in the widget. */ + direction?: string; + /** Specifies how widget items are aligned cross-wise. */ + crossAlign?: string; + } + /** A container widget used to arrange inner elements. */ + export class dxBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxResponsiveBoxOptions extends CollectionWidgetOptions { + /** Specifies the collection of rows for the grid used to position layout elements. */ + rows?: Array; + /** Specifies the collection of columns for the grid used to position layout elements. */ + cols?: Array; + /** Specifies the function returning the screen factor depending on the screen width. */ + screenByWidth?: (width: number) => string; + /** Specifies the screen factor with which all elements are located in a single column. */ + singleColumnScreen?: string; + } + /** A widget used to build an adaptive markup that is dependent on screen resolution. */ + export class dxResponsiveBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxAutocompleteOptions extends dxDropDownListOptions { + /** Specifies the current value displayed by the widget. */ + value?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies the maximum count of items displayed by the widget. */ + maxItemCount?: number; + /** Gets the currently selected item. */ + selectedItem?: Object; + } + /** A textbox widget that supports autocompletion. */ + export class dxAutocomplete extends dxDropDownList { + constructor(element: JQuery, options?: dxAutocompleteOptions); + constructor(element: Element, options?: dxAutocompleteOptions); + /** Opens the drop-down editor. */ + open(): void; + /** Closes the drop-down editor. */ + close(): void; + } + export interface dxAccordionOptions extends CollectionWidgetOptions { + /** A number specifying the time in milliseconds spent on the animation of the expanding or collapsing of a panel. */ + animationDuration?: number; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies whether all items can be collapsed or whether at least one item must always be expanded. */ + collapsible?: boolean; + /** Specifies whether the widget can expand several items or only a single item at once. */ + multiple?: boolean; + /** The template to be used for rendering dxAccordion items. */ + itemTemplate?: any; + /** A handler for the itemTitleClick event. */ + onItemTitleClick?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** The index number of the currently selected item. */ + selectedIndex?: number; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget that displays data source items on collapsible panels. */ + export class dxAccordion extends CollectionWidget { + constructor(element: JQuery, options?: dxAccordionOptions); + constructor(element: Element, options?: dxAccordionOptions); + /** Collapses the specified item. */ + collapseItem(index: number): JQueryPromise; + /** Expands the specified item. */ + expandItem(index: number): JQueryPromise; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + } + export interface dxFileUploaderOptions extends EditorOptions { + /** A read-only option that holds a File instance representing the selected file. */ + value?: File; + /** Holds the File instances representing files selected in the widget. */ + values?: Array; + buttonText?: string; + /** The text displayed on the button that opens the file browser. */ + selectButtonText?: string; + /** The text displayed on the button that starts uploading. */ + uploadButtonText?: string; + /** Specifies the text displayed on the area to which an end-user can drop a file. */ + labelText?: string; + /** Specifies the value passed to the name attribute of the underlying input element. */ + name?: string; + /** Specifies whether the widget enables an end-user to select a single file or multiple files. */ + multiple?: boolean; + /** Specifies a file type or several types accepted by the widget. */ + accept?: string; + /** Specifies a target Url for the upload request. */ + uploadUrl?: string; + /** Specifies if an end user can remove a file from the selection and interrupt uploading. */ + allowCanceling?: boolean; + /** Specifies whether or not the widget displays the list of selected files. */ + showFileList?: boolean; + /** Gets the current progress in percentages. */ + progress?: number; + /** The message displayed by the widget when it is ready to upload the specified files. */ + readyToUploadMessage?: string; + /** The message displayed by the widget when uploading is finished. */ + uploadedMessage?: string; + /** The message displayed by the widget on uploading failure. */ + uploadFailedMessage?: string; + /** Specifies how the widget uploads files. */ + uploadMode?: string; + /** A handler for the uploaded event. */ + onUploaded?: Function; + /** A handler for the uploaded event. */ + onProgress?: Function; + /** A handler for the uploadError event. */ + onUploadError?: Function; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + } + /** A widget used to select and upload a file or multiple files. */ + export class dxFileUploader extends Editor { + constructor(element: JQuery, options?: dxFileUploaderOptions); + constructor(element: Element, options?: dxFileUploaderOptions); + } + export interface dxTrackBarOptions extends EditorOptions { + /** The minimum value the widget can accept. */ + min?: number; + /** The maximum value the widget can accept. */ + max?: number; + /** The current widget value. */ + value?: number; + } + /** A base class for track bar widgets. */ + export class dxTrackBar extends Editor { + constructor(element: JQuery, options?: dxTrackBarOptions); + constructor(element: Element, options?: dxTrackBarOptions); + } + export interface dxProgressBarOptions extends dxTrackBarOptions { + /** Specifies a format for the progress status. */ + statusFormat?: any; + /** Specifies whether or not the widget displays a progress status. */ + showStatus?: boolean; + /** A handler for the complete event. */ + onComplete?: Function; + } + /** A widget used to indicate progress. */ + export class dxProgressBar extends dxTrackBar { + constructor(element: JQuery, options?: dxProgressBarOptions); + constructor(element: Element, options?: dxProgressBarOptions); + } + export interface dxSliderOptions extends dxTrackBarOptions { + activeStateEnabled?: boolean; + /** The slider step size. */ + step?: number; + /** The current slider value. */ + value?: number; + /** Specifies whether or not to highlight a range selected within the widget. */ + showRange?: boolean; + /** Specifies the size of a step by which a slider handle is moved when a user uses the Page up or Page down keyboard shortcuts. */ + keyStep?: number; + /** Specifies options for the slider tooltip. */ + tooltip?: { + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies format for the tooltip. */ + format?: any; + /** Specifies whether the tooltip is located over or under the slider. */ + position?: string; + /** Specifies whether the widget always shows a tooltip or only when a pointer is over the slider. */ + showMode?: string; + }; + /** Specifies options for labels displayed at the min and max values. */ + label?: { + /** Specifies whether or not slider labels are visible. */ + visible?: boolean; + /** Specifies whether labels are located over or under the scale. */ + position?: string; + /** Specifies a format for labels. */ + format?: any; + }; + } + /** A widget that allows a user to select a numeric value within a given range. */ + export class dxSlider extends dxTrackBar { + constructor(element: JQuery, options?: dxSliderOptions); + constructor(element: Element, options?: dxSliderOptions); + } + export interface dxRangeSliderOptions extends dxSliderOptions { + /** The left edge of the interval currently selected using the range slider. */ + start?: number; + /** The right edge of the interval currently selected using the range slider. */ + end?: number; + } + /** A widget that enables a user to select a range of numeric values. */ + export class dxRangeSlider extends dxSlider { + constructor(element: JQuery, options?: dxRangeSliderOptions); + constructor(element: Element, options?: dxRangeSliderOptions); + } + export interface dxFormItemLabel { + /** Specifies the label text. */ + text?: string; + /** Specifies whether or not the label is visible. */ + visible?: boolean; + /** Specifies whether or not a colon is displayed at the end of the current label. */ + showColon?: boolean; + /** Specifies the location of a label against the editor. */ + location?: string; + /** Specifies the label horizontal alignment. */ + alignment?: string; + } + export interface dxFormItem { + /** Specifies the type of the current item. */ + itemType?: string; + /** Specifies whether or not the current form item is visible. */ + visible?: boolean; + /** Specifies the sequence number of the item in a form, group or tab. */ + visibleIndex?: number; + /** Specifies a CSS class to be applied to the form item. */ + cssClass?: string; + /** Specifies the number of columns spanned by the item. */ + colSpan?: number; + } + export interface dxFormEmptyItem extends dxFormItem { + /** Specifies the form item name. */ + name?: string; + } + export interface dxFormSimpleItem extends dxFormItem { + /** Specifies the path to the formData object field bound to the current form item. */ + dataField?: string; + /** Specifies the form item name. */ + name?: string; + /** Specifies which editor widget is used to display and edit the form item value. */ + editorType?: string; + /** Specifies configuration options for the editor widget of the current form item. */ + editorOptions?: Object; + /** A template to be used for rendering the form item. */ + template?: any; + /** Specifies the help text displayed for the current form item. */ + helpText?: string; + /** Specifies whether the current form item is required. */ + isRequired?: boolean; + /** Specifies options for the form item label. */ + label?: dxFormItemLabel; + /** An array of validation rules to be checked for the form item editor. */ + validationRules?: Array; + } + export interface dxFormGroupItem extends dxFormItem { + /** Specifies the group caption. */ + caption?: string; + /** A template to be used for rendering the group item. */ + template?: any; + /** The count of columns in the group layout. */ + colCount?: number; + /** Specifies whether or not all group item labels are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the group. */ + items?: Array; + } + export interface dxFormTab { + /** Specifies the tab title. */ + title?: string; + /** The count of columns in the tab layout. */ + colCount?: number; + /** Specifies whether or not labels of items displayed within the current tab are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the tab. */ + items?: Array; + /** Specifies a badge text for the tab. */ + badge?: string; + /** A Boolean value specifying whether or not the tab can respond to user interaction. */ + disabled?: boolean; + /** Specifies the icon to be displayed on the tab. */ + icon?: string; + /** The template to be used for rendering the tab. */ + tabTemplate?: any; + /** The template to be used for rendering the tab content. */ + template?: any; + } + export interface dxFormTabbedItem extends dxFormItem { + /** Holds a configuration object for the dxTabPanel widget used to display the current form item. */ + tabPanelOptions?: Object; + /** An array of tab configuration objects. */ + tabs?: Array; + } + export interface dxFormOptions extends WidgetOptions { + /** An object providing data for the form. */ + formData?: Object; + /** The count of columns in the form layout. */ + colCount?: any; + /** Specifies the location of a label against the editor. */ + labelLocation?: string; + /** Specifies whether or not all editors on the form are read-only. */ + readOnly?: boolean; + /** A handler for the fieldDataChanged event. */ + onFieldDataChanged?: (e: Object) => void; + /** A handler for the editorEnterKey event. */ + onEditorEnterKey?: (e: Object) => void; + /** Specifies a function that customizes a form item after it has been created. */ + customizeItem?: Function; + /** The minimum column width used for calculating column count in the form layout. */ + minColWidth?: number; + /** Specifies whether or not all root item labels are aligned. */ + alignItemLabels?: boolean; + /** Specifies whether or not item labels in all groups are aligned. */ + alignItemLabelsInAllGroups?: boolean; + /** Specifies whether or not a colon is displayed at the end of form labels. */ + showColonAfterLabel?: boolean; + /** Specifies whether or not the required mark is displayed for required fields. */ + showRequiredMark?: boolean; + /** Specifies whether or not the optional mark is displayed for optional fields. */ + showOptionalMark?: boolean; + /** The text displayed for required fields. */ + requiredMark?: string; + /** The text displayed for optional fields. */ + optionalMark?: string; + /** Specifies the message that is shown for end-users if a required field value is not specified. */ + requiredMessage?: string; + /** Specifies whether or not the total validation summary is displayed on the form. */ + showValidationSummary?: boolean; + /** Holds an array of form items. */ + items?: Array; + /** A Boolean value specifying whether to enable or disable form scrolling. */ + scrollingEnabled?: boolean; + onContentReady?: Function; + } + /** A form widget used to display and edit values of object fields. */ + export class dxForm extends Widget { + constructor(element: JQuery, options?: dxFormOptions); + constructor(element: Element, options?: dxFormOptions); + /** Updates the specified field of the formData object and the corresponding editor on the form. */ + updateData(dataField: string, value: any): void; + /** Updates the specified fields of the formData object and the corresponding editors on the form. */ + updateData(data: Object): void; + /** Updates the value of a form item option. */ + itemOption(field: string, option: string, value: any): void; + /** Updates the values of form item options. */ + itemOption(field: string, options: Object): void; + /** Returns an editor instance associated with the specified formData field. */ + getEditor(field: string): Object; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + /** Validates the values of all editors on the form against the list of the validation rules specified for each form item. */ + validate(): Object; + /** Resets the editor's value to undefined. */ + resetValues(): void; + } + export interface dxDeferRenderingOptions extends WidgetOptions { + /** Indicates if a load indicator should be shown until the widget's content is rendered. */ + showLoadIndicator?: boolean; + /** Specifies a jQuery.Promise or a boolean value, which upon resolving forces widget content to render. */ + renderWhen?: any; + /** Specifies the animation to be used to show the rendered content. */ + animation?: fx.AnimationOptions; + /** Specifies a jQuery selector of items that should be rendered using a staggered animation. */ + staggerItemSelector?: string; + /** Specifies a callback function that is called when the widget's content has finished rendering but is not yet shown. */ + onRendered?: Function; + /** Specifies a callback function that is called when widget content is shown and animation has completed. */ + onShown?: Function; + } + /** A container for elements that must be rendered at a specified moment. */ + export class dxDeferRendering extends Widget { + constructor(element: JQuery, options?: dxDeferRenderingOptions); + constructor(element: Element, options?: dxDeferRenderingOptions); + } +} +interface JQuery { + dxProgressBar(): JQuery; + dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; + dxProgressBar(options: string): any; + dxProgressBar(options: string, ...params: any[]): any; + dxProgressBar(options: DevExpress.ui.dxProgressBarOptions): JQuery; + dxSlider(): JQuery; + dxSlider(options: "instance"): DevExpress.ui.dxSlider; + dxSlider(options: string): any; + dxSlider(options: string, ...params: any[]): any; + dxSlider(options: DevExpress.ui.dxSliderOptions): JQuery; + dxRangeSlider(): JQuery; + dxRangeSlider(options: "instance"): DevExpress.ui.dxRangeSlider; + dxRangeSlider(options: string): any; + dxRangeSlider(options: string, ...params: any[]): any; + dxRangeSlider(options: DevExpress.ui.dxRangeSliderOptions): JQuery; + dxFileUploader(): JQuery; + dxFileUploader(options: "instance"): DevExpress.ui.dxFileUploader; + dxFileUploader(options: string): any; + dxFileUploader(options: string, ...params: any[]): any; + dxFileUploader(options: DevExpress.ui.dxFileUploaderOptions): JQuery; + dxValidator(): JQuery; + dxValidator(options: "instance"): DevExpress.ui.dxValidator; + dxValidator(options: string): any; + dxValidator(options: string, ...params: any[]): any; + dxValidator(options: DevExpress.ui.dxValidatorOptions): JQuery; + dxValidationGroup(): JQuery; + dxValidationGroup(options: "instance"): DevExpress.ui.dxValidationGroup; + dxValidationGroup(options: string): any; + dxValidationGroup(options: string, ...params: any[]): any; + dxValidationSummary(): JQuery; + dxValidationSummary(options: "instance"): DevExpress.ui.dxValidationSummary; + dxValidationSummary(options: string): any; + dxValidationSummary(options: string, ...params: any[]): any; + dxValidationSummary(options: DevExpress.ui.dxValidationSummaryOptions): JQuery; + dxTooltip(): JQuery; + dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; + dxTooltip(options: string): any; + dxTooltip(options: string, ...params: any[]): any; + dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; + dxResizable(): JQuery; + dxResizable(options: "instance"): DevExpress.ui.dxResizable; + dxResizable(options: string): any; + dxResizable(options: string, ...params: any[]): any; + dxResizable(options: DevExpress.ui.dxResizableOptions): JQuery; + dxDropDownList(): JQuery; + dxDropDownList(options: "instance"): DevExpress.ui.dxDropDownList; + dxDropDownList(options: string): any; + dxDropDownList(options: string, ...params: any[]): any; + dxDropDownList(options: DevExpress.ui.dxDropDownListOptions): JQuery; + dxToolbar(): JQuery; + dxToolbar(options: "instance"): DevExpress.ui.dxToolbar; + dxToolbar(options: string): any; + dxToolbar(options: string, ...params: any[]): any; + dxToolbar(options: DevExpress.ui.dxToolbarOptions): JQuery; + dxToast(): JQuery; + dxToast(options: "instance"): DevExpress.ui.dxToast; + dxToast(options: string): any; + dxToast(options: string, ...params: any[]): any; + dxToast(options: DevExpress.ui.dxToastOptions): JQuery; + dxTextEditor(): JQuery; + dxTextEditor(options: "instance"): DevExpress.ui.dxTextEditor; + dxTextEditor(options: string): any; + dxTextEditor(options: string, ...params: any[]): any; + dxTextEditor(options: DevExpress.ui.dxTextEditorOptions): JQuery; + dxTextBox(): JQuery; + dxTextBox(options: "instance"): DevExpress.ui.dxTextBox; + dxTextBox(options: string): any; + dxTextBox(options: string, ...params: any[]): any; + dxTextBox(options: DevExpress.ui.dxTextBoxOptions): JQuery; + dxTextArea(): JQuery; + dxTextArea(options: "instance"): DevExpress.ui.dxTextArea; + dxTextArea(options: string): any; + dxTextArea(options: string, ...params: any[]): any; + dxTextArea(options: DevExpress.ui.dxTextAreaOptions): JQuery; + dxTabs(): JQuery; + dxTabs(options: "instance"): DevExpress.ui.dxTabs; + dxTabs(options: string): any; + dxTabs(options: string, ...params: any[]): any; + dxTabs(options: DevExpress.ui.dxTabsOptions): JQuery; + dxTabPanel(): JQuery; + dxTabPanel(options: "instance"): DevExpress.ui.dxTabPanel; + dxTabPanel(options: string): any; + dxTabPanel(options: string, ...params: any[]): any; + dxTabPanel(options: DevExpress.ui.dxTabPanelOptions): JQuery; + dxSelectBox(): JQuery; + dxSelectBox(options: "instance"): DevExpress.ui.dxSelectBox; + dxSelectBox(options: string): any; + dxSelectBox(options: string, ...params: any[]): any; + dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery; + dxTagBox(): JQuery; + dxTagBox(options: "instance"): DevExpress.ui.dxTagBox; + dxTagBox(options: string): any; + dxTagBox(options: string, ...params: any[]): any; + dxTagBox(options: DevExpress.ui.dxTagBoxOptions): JQuery; + dxScrollView(): JQuery; + dxScrollView(options: "instance"): DevExpress.ui.dxScrollView; + dxScrollView(options: string): any; + dxScrollView(options: string, ...params: any[]): any; + dxScrollView(options: DevExpress.ui.dxScrollViewOptions): JQuery; + dxScrollable(): JQuery; + dxScrollable(options: "instance"): DevExpress.ui.dxScrollable; + dxScrollable(options: string): any; + dxScrollable(options: string, ...params: any[]): any; + dxScrollable(options: DevExpress.ui.dxScrollableOptions): JQuery; + dxRadioGroup(): JQuery; + dxRadioGroup(options: "instance"): DevExpress.ui.dxRadioGroup; + dxRadioGroup(options: string): any; + dxRadioGroup(options: string, ...params: any[]): any; + dxRadioGroup(options: DevExpress.ui.dxRadioGroupOptions): JQuery; + dxPopup(): JQuery; + dxPopup(options: "instance"): DevExpress.ui.dxPopup; + dxPopup(options: string): any; + dxPopup(options: string, ...params: any[]): any; + dxPopup(options: DevExpress.ui.dxPopupOptions): JQuery; + dxPopover(): JQuery; + dxPopover(options: "instance"): DevExpress.ui.dxPopover; + dxPopover(options: string): any; + dxPopover(options: string, ...params: any[]): any; + dxPopover(options: DevExpress.ui.dxPopoverOptions): JQuery; + dxOverlay(): JQuery; + dxOverlay(options: "instance"): DevExpress.ui.dxOverlay; + dxOverlay(options: string): any; + dxOverlay(options: string, ...params: any[]): any; + dxOverlay(options: DevExpress.ui.dxOverlayOptions): JQuery; + dxNumberBox(): JQuery; + dxNumberBox(options: "instance"): DevExpress.ui.dxNumberBox; + dxNumberBox(options: string): any; + dxNumberBox(options: string, ...params: any[]): any; + dxNumberBox(options: DevExpress.ui.dxNumberBoxOptions): JQuery; + dxNavBar(): JQuery; + dxNavBar(options: "instance"): DevExpress.ui.dxNavBar; + dxNavBar(options: string): any; + dxNavBar(options: string, ...params: any[]): any; + dxNavBar(options: DevExpress.ui.dxNavBarOptions): JQuery; + dxMultiView(): JQuery; + dxMultiView(options: "instance"): DevExpress.ui.dxMultiView; + dxMultiView(options: string): any; + dxMultiView(options: string, ...params: any[]): any; + dxMultiView(options: DevExpress.ui.dxMultiViewOptions): JQuery; + dxMap(): JQuery; + dxMap(options: "instance"): DevExpress.ui.dxMap; + dxMap(options: string): any; + dxMap(options: string, ...params: any[]): any; + dxMap(options: DevExpress.ui.dxMapOptions): JQuery; + dxLookup(): JQuery; + dxLookup(options: "instance"): DevExpress.ui.dxLookup; + dxLookup(options: string): any; + dxLookup(options: string, ...params: any[]): any; + dxLookup(options: DevExpress.ui.dxLookupOptions): JQuery; + dxLoadPanel(): JQuery; + dxLoadPanel(options: "instance"): DevExpress.ui.dxLoadPanel; + dxLoadPanel(options: string): any; + dxLoadPanel(options: string, ...params: any[]): any; + dxLoadPanel(options: DevExpress.ui.dxLoadPanelOptions): JQuery; + dxLoadIndicator(): JQuery; + dxLoadIndicator(options: "instance"): DevExpress.ui.dxLoadIndicator; + dxLoadIndicator(options: string): any; + dxLoadIndicator(options: string, ...params: any[]): any; + dxLoadIndicator(options: DevExpress.ui.dxLoadIndicatorOptions): JQuery; + dxList(): JQuery; + dxList(options: "instance"): DevExpress.ui.dxList; + dxList(options: string): any; + dxList(options: string, ...params: any[]): any; + dxList(options: DevExpress.ui.dxListOptions): JQuery; + dxGallery(): JQuery; + dxGallery(options: "instance"): DevExpress.ui.dxGallery; + dxGallery(options: string): any; + dxGallery(options: string, ...params: any[]): any; + dxGallery(options: DevExpress.ui.dxGalleryOptions): JQuery; + dxDropDownEditor(): JQuery; + dxDropDownEditor(options: "instance"): DevExpress.ui.dxDropDownEditor; + dxDropDownEditor(options: string): any; + dxDropDownEditor(options: string, ...params: any[]): any; + dxDropDownEditor(options: DevExpress.ui.dxDropDownEditorOptions): JQuery; + dxDateBox(): JQuery; + dxDateBox(options: "instance"): DevExpress.ui.dxDateBox; + dxDateBox(options: string): any; + dxDateBox(options: string, ...params: any[]): any; + dxDateBox(options: DevExpress.ui.dxDateBoxOptions): JQuery; + dxCheckBox(): JQuery; + dxCheckBox(options: "instance"): DevExpress.ui.dxCheckBox; + dxCheckBox(options: string): any; + dxCheckBox(options: string, ...params: any[]): any; + dxCheckBox(options: DevExpress.ui.dxCheckBoxOptions): JQuery; + dxBox(): JQuery; + dxBox(options: "instance"): DevExpress.ui.dxBox; + dxBox(options: string): any; + dxBox(options: string, ...params: any[]): any; + dxBox(options: DevExpress.ui.dxBoxOptions): JQuery; + dxButton(): JQuery; + dxButton(options: "instance"): DevExpress.ui.dxButton; + dxButton(options: string): any; + dxButton(options: string, ...params: any[]): any; + dxButton(options: DevExpress.ui.dxButtonOptions): JQuery; + dxCalendar(): JQuery; + dxCalendar(options: "instance"): DevExpress.ui.dxCalendar; + dxCalendar(options: string): any; + dxCalendar(options: string, ...params: any[]): any; + dxCalendar(options: DevExpress.ui.dxCalendarOptions): JQuery; + dxAccordion(): JQuery; + dxAccordion(options: "instance"): DevExpress.ui.dxAccordion; + dxAccordion(options: string): any; + dxAccordion(options: string, ...params: any[]): any; + dxAccordion(options: DevExpress.ui.dxAccordionOptions): JQuery; + dxResponsiveBox(): JQuery; + dxResponsiveBox(options: "instance"): DevExpress.ui.dxResponsiveBox; + dxResponsiveBox(options: string): any; + dxResponsiveBox(options: string, ...params: any[]): any; + dxResponsiveBox(options: DevExpress.ui.dxResponsiveBoxOptions): JQuery; + dxAutocomplete(): JQuery; + dxAutocomplete(options: "instance"): DevExpress.ui.dxAutocomplete; + dxAutocomplete(options: string): any; + dxAutocomplete(options: string, ...params: any[]): any; + dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; + dxForm(): JQuery; + dxForm(options: "instance"): DevExpress.ui.dxForm; + dxForm(options: string): any; + dxForm(options: string, ...params: any[]): any; + dxForm(options: DevExpress.ui.dxFormOptions): JQuery; +} + +declare module DevExpress.ui { + export interface dxTileViewOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the height of the base tile view item. */ + baseItemHeight?: number; + /** Specifies the width of the base tile view item. */ + baseItemWidth?: number; + /** Specifies whether tiles are placed horizontally or vertically. */ + direction?: string; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the distance in pixels between adjacent tiles. */ + itemMargin?: number; + /** A Boolean value specifying whether or not to display a scrollbar. */ + showScrollbar?: boolean; + } + /** A widget displaying several blocks of data as tiles. */ + export class dxTileView extends CollectionWidget { + constructor(element: JQuery, options?: dxTileViewOptions); + constructor(element: Element, options?: dxTileViewOptions); + /** Returns the current scroll position of the widget content. */ + scrollPosition(): number; + } + export interface dxSwitchOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Text displayed when the widget is in a disabled state. */ + offText?: string; + /** Text displayed when the widget is in an enabled state. */ + onText?: string; + /** A Boolean value specifying whether the current switch state is "On" or "Off". */ + value?: boolean; + } + /** A switch widget. */ + export class dxSwitch extends Editor { + constructor(element: JQuery, options?: dxSwitchOptions); + constructor(element: Element, options?: dxSwitchOptions); + } + export interface dxSlideOutViewOptions extends WidgetOptions { + /** Specifies the current menu position. */ + menuPosition?: string; + /** Specifies whether or not the menu panel is visible. */ + menuVisible?: boolean; + /** Specifies whether or not the menu is shown when a user swipes the widget content. */ + swipeEnabled?: boolean; + /** A template to be used for rendering menu panel content. */ + menuTemplate?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal a custom menu. */ + export class dxSlideOutView extends Widget { + constructor(element: JQuery, options?: dxSlideOutViewOptions); + constructor(element: Element, options?: dxSlideOutViewOptions); + /** Returns an HTML element of the widget menu block. */ + menuContent(): JQuery; + /** Returns an HTML element of the widget content block. */ + content(): JQuery; + /** Displays the widget's menu block. */ + showMenu(): JQueryPromise; + /** Hides the widget's menu block. */ + hideMenu(): JQueryPromise; + /** Toggles the visibility of the widget's menu block. */ + toggleMenuVisibility(): JQueryPromise; + } + export interface dxSlideOutOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not to display a grouped menu. */ + menuGrouped?: boolean; + /** Specifies the current menu position. */ + menuPosition?: string; + /** The name of the template used to display a group header. */ + menuGroupTemplate?: any; + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** A handler for the menuGroupRendered event. */ + onMenuGroupRendered?: Function; + /** A handler for the menuItemRendered event. */ + onMenuItemRendered?: Function; + /** Specifies whether or not the slide-out menu is displayed. */ + menuVisible?: boolean; + /** Indicates whether the menu can be shown/hidden by swiping the widget's main panel. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal an item list. */ + export class dxSlideOut extends CollectionWidget { + constructor(element: JQuery, options?: dxSlideOutOptions); + constructor(element: Element, options?: dxSlideOutOptions); + /** Hides the widget's slide-out menu. */ + hideMenu(): JQueryPromise; + /** Displays the widget's slide-out menu. */ + showMenu(): JQueryPromise; + /** Toggles the visibility of the widget's slide-out menu. */ + toggleMenuVisibility(showing: boolean): JQueryPromise; + } + export interface dxPivotOptions extends CollectionWidgetOptions { + /** The index of the currently active pivot item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + } + /** A widget that is similar to a traditional tab control, but optimized for the phone with simplified end-user interaction. */ + export class dxPivot extends CollectionWidget { + constructor(element: JQuery, options?: dxPivotOptions); + constructor(element: Element, options?: dxPivotOptions); + } + export interface dxPanoramaOptions extends CollectionWidgetOptions { + /** An object exposing options for setting a background image for the panorama. */ + backgroundImage?: { + /** Specifies the height of the panorama's background image. */ + height?: number; + /** Specifies the URL of the image that is used as the panorama's background image. */ + url?: string; + /** Specifies the width of the panorama's background image. */ + width?: number; + }; + /** The index of the currently active panorama item. */ + selectedIndex?: number; + /** Specifies the widget content title. */ + title?: string; + } + /** A widget displaying the required content in a long horizontal canvas that extends beyond the frames of the screen. */ + export class dxPanorama extends CollectionWidget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + } + export interface dxDropDownMenuOptions extends WidgetOptions { + /** A handler for the buttonClick event. */ + onButtonClick?: any; + /** The name of the icon to be displayed by the DropDownMenu button. */ + buttonIcon?: string; + /** The text displayed in the DropDownMenu button. */ + buttonText?: string; + buttonIconSrc?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** Specifies whether or not to show the drop down menu within a dxPopover widget. */ + usePopover?: boolean; + /** The width of the menu popup in pixels. */ + popupWidth?: any; + /** The height of the menu popup in pixels. */ + popupHeight?: any; + /** Specifies whether or not the drop-down menu is displayed. */ + opened?: boolean; + hoverStateEnabled?: boolean; + activeStateEnabled?: boolean; + } + /** A drop-down menu widget. */ + export class dxDropDownMenu extends Widget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Opens the drop-down menu. */ + open(): void; + /** Closes the drop-down menu. */ + close(): void; + } + export interface dxActionSheetOptions extends CollectionWidgetOptions { + /** A handler for the cancelClick event. */ + onCancelClick?: any; + /** The text displayed in the button that closes the action sheet. */ + cancelText?: string; + /** Specifies whether or not to display the Cancel button in action sheet. */ + showCancelButton?: boolean; + /** A Boolean value specifying whether or not the title of the action sheet is visible. */ + showTitle?: boolean; + /** Specifies the element the action sheet popover points at. */ + target?: any; + /** The title of the action sheet. */ + title?: string; + /** Specifies whether or not to show the action sheet within a dxPopover widget. */ + usePopover?: boolean; + /** A Boolean value specifying whether or not the dxActionSheet widget is visible. */ + visible?: boolean; + } + /** A widget consisting of a set of choices related to a certain task. */ + export class dxActionSheet extends CollectionWidget { + constructor(element: JQuery, options?: dxActionSheetOptions); + constructor(element: Element, options?: dxActionSheetOptions); + /** Hides the widget. */ + hide(): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Shows or hides the widget depending on the Boolean value passed as the parameter. */ + toggle(showing: boolean): JQueryPromise; + } +} +interface JQuery { + dxTileView(): JQuery; + dxTileView(options: "instance"): DevExpress.ui.dxTileView; + dxTileView(options: string): any; + dxTileView(options: string, ...params: any[]): any; + dxTileView(options: DevExpress.ui.dxTileViewOptions): JQuery; + dxSwitch(): JQuery; + dxSwitch(options: "instance"): DevExpress.ui.dxSwitch; + dxSwitch(options: string): any; + dxSwitch(options: string, ...params: any[]): any; + dxSwitch(options: DevExpress.ui.dxSwitchOptions): JQuery; + dxSlideOut(): JQuery; + dxSlideOut(options: "instance"): DevExpress.ui.dxSlideOut; + dxSlideOut(options: string): any; + dxSlideOut(options: string, ...params: any[]): any; + dxSlideOut(options: DevExpress.ui.dxSlideOutOptions): JQuery; + dxPivot(): JQuery; + dxPivot(options: "instance"): DevExpress.ui.dxPivot; + dxPivot(options: string): any; + dxPivot(options: string, ...params: any[]): any; + dxPivot(options: DevExpress.ui.dxPivotOptions): JQuery; + dxPanorama(): JQuery; + dxPanorama(options: "instance"): DevExpress.ui.dxPanorama; + dxPanorama(options: string): any; + dxPanorama(options: string, ...params: any[]): any; + dxPanorama(options: DevExpress.ui.dxPanoramaOptions): JQuery; + dxActionSheet(): JQuery; + dxActionSheet(options: "instance"): DevExpress.ui.dxActionSheet; + dxActionSheet(options: string): any; + dxActionSheet(options: string, ...params: any[]): any; + dxActionSheet(options: DevExpress.ui.dxActionSheetOptions): JQuery; + dxDropDownMenu(): JQuery; + dxDropDownMenu(options: "instance"): DevExpress.ui.dxDropDownMenu; + dxDropDownMenu(options: string): any; + dxDropDownMenu(options: string, ...params: any[]): any; + dxDropDownMenu(options: DevExpress.ui.dxDropDownMenuOptions): JQuery; +} +declare module DevExpress.data { + export interface XmlaStoreOptions { + /** The HTTP address to an XMLA OLAP server. */ + url?: string; + /** The name of the database associated with the Store. */ + catalog?: string; + /** The cube name. */ + cube?: string; + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: Object) => void; + } + /** A Store that provides access to an OLAP cube using the XMLA standard. */ + export class XmlaStore { + constructor(options: XmlaStoreOptions); + } + export interface PivotGridField { + index?: number; + /** A boolean value specifying whether or not the field is visible in the pivot grid and the Field Chooser. */ + visible?: boolean; + /** Name of the data source field containing data for the pivot grid field. */ + dataField?: string; + /** A caption that will be displayed in the pivot grid's field chooser to identify the field. */ + caption?: string; + /** Specifies a type of field values. */ + dataType?: string; + /** Specifies how the values of the current field are combined into groups. Cannot be used for the XmlaStore store type. */ + groupInterval?: any; + /** Specifies how to aggregate field data. Cannot be used for the XmlaStore store type. */ + summaryType?: string; + /** Allows you to use a custom aggregate function to calculate the summary values. Cannot be used for the XmlaStore store type. */ + calculateCustomSummary?: (options: { + summaryProcess?: string; + value?: any; + totalValue?: any; + }) => void; + /** Specifies the function that determines how to split data from the data source into ranges for header items. Cannot be used for the XmlaStore store type. */ + selector?: (data: Object) => any; + /** Type of the area where the field is located. */ + area?: string; + /** Index among the other fields displayed within the same area. */ + areaIndex?: number; + /** The name of the folder in which the field is located. */ + displayFolder?: string; + /** The name of the group to which the field belongs. */ + groupName?: string; + /** The index of the field within a group. */ + groupIndex?: number; + /** Specifies the sort order of field values. */ + sortOrder?: string; + /** Specifies how field data should be sorted. Can be used for the XmlaStore store type only. */ + sortBy?: string; + /** Sorts the header items of this field by the summary values of another field. */ + sortBySummaryField?: string; + /** The array of field names that specify a path to column/row whose summary field is used for sorting of this field's header items. */ + sortBySummaryPath?: Array; + /** The filter values for the current field. */ + filterValues?: Array; + /** The filter type for the current field. */ + filterType?: string; + /** Indicates whether all header items of the field's header level are expanded. */ + expanded?: boolean; + /** Specifies whether the field should be treated as a Data Field. */ + isMeasure?: boolean; + /** Specifies a display format for field values. */ + format?: string; + /** Specifies a callback function that returns the text to be displayed in the cells of a field. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** Specifies a precision for formatted field values. */ + precision?: number; + /** Specifies how to sort the header items. */ + sortingMethod?: (a: Object, b: Object) => number; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies the absolute width of the field in the pivot grid. */ + width?: number; + /** Specifies the summary post-processing algorithm. */ + summaryDisplayMode?: string; + /** Specifies whether to summarize each next summary value with the previous one by rows or columns. */ + runningTotal?: string; + /** Specifies whether to allow the predefined summary post-processing functions ('absoluteVariation' and 'percentVariation') and runningTotal to take values of different groups into account. */ + allowCrossGroupCalculation?: boolean; + /** Specifies a callback function that allows you to modify summary values after they are calculated. */ + calculateSummaryValue?: (e: Object) => number; + /** Specifies whether or not to display Total values for the field. */ + showTotals?: boolean; + /** Specifies whether or not to display Grand Total values for the field. */ + showGrandTotals?: boolean; + } + export class SummaryCell { + /** Gets the parent cell in a specified direction. */ + parent(direction: string): SummaryCell; + /** Gets all children cells in a specified direction. */ + children(direction: string): Array; + /** Gets a partial Grand Total cell of a row or column. */ + grandTotal(direction: string): SummaryCell; + /** Gets the Grand Total of the entire pivot grid. */ + grandTotal(): SummaryCell; + /** Gets the cell next to the current one in a specified direction. */ + next(direction: string): SummaryCell; + /** Gets the cell next to current in a specified direction. */ + next(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the cell prior to the current one in a specified direction. */ + prev(direction: string): SummaryCell; + /** Gets the cell previous to current in a specified direction. */ + prev(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the child cell in a specified direction. */ + child(direction: string, fieldValue: any): SummaryCell; + /** Gets the cell located by the path of the source cell with one field value changed. */ + slice(field: PivotGridField, value: any): SummaryCell; + /** Gets the row or column field to which the current cell belongs. */ + field(area: string): PivotGridField; + /** Gets the value of the current cell. */ + value(): any; + /** Gets the value of the current cell. */ + value(isCalculatedValue: boolean): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField, isCalculatedValue: boolean): any; + } + export interface PivotGridDataSourceOptions { + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** Indicates whether or not the automatic field generation from data in the Store is enabled. */ + retrieveFields?: boolean; + /** Specifies data filtering conditions. Cannot be used for the XmlaStore store type. */ + filter?: Object; + /** An array of pivot grid fields. */ + fields?: Array; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Object) => void; + /** A handler for the fieldsPrepared event. */ + onFieldsPrepared?: (e?: Array) => void; + } + /** An object that provides access to data for the dxPivotGrid widget. */ + export class PivotGridDataSource implements EventsMixin { + constructor(options?: PivotGridDataSource); + /** Starts reloading data from any store and updating the data source. */ + reload(): JQueryPromise; + /** Starts updating the data source. Reloads data from the XMLA store only. */ + load(): JQueryPromise; + /** Indicates whether or not the PivotGridDataSource is currently being loaded. */ + isLoading(): boolean; + /** Gets data displayed in a PivotGrid. */ + getData(): Object; + /** Gets all fields within a specified area. */ + getAreaFields(area: string, collectGroups: boolean): Array; + /** Gets all fields from the data source. */ + fields(): Array; + /** Sets the fields option. */ + fields(fields: Array): void; + /** Gets current options of a specified field. */ + field(id: any): PivotGridField; + /** Sets one or more options of a specified field. */ + field(id: any, field: PivotGridField): void; + /** Collapses a specified header item. */ + collapseHeaderItem(area: string, path: Array): void; + /** Expands a specified header item. */ + expandHeaderItem(area: string, path: Array): void; + /** Expands all header items of a field. */ + expandAll(id: any): void; + /** Collapses all header items of a field. */ + collapseAll(id: any): void; + /** Disposes of all resources associated with this PivotGridDataSource. */ + dispose(): void; + /** Gets the current filter expression. Cannot be used for the XmlaStore store type. */ + filter(): Object; + /** Applies a new filter expression. Cannot be used for the XmlaStore store type. */ + filter(filterExpr: Object): void; + /** Provides access to a list of records (facts) that were used to calculate a specific summary. */ + createDrillDownDataSource(options: { + columnPath?: Array; + rowPath?: Array; + dataIndex?: number; + maxRowCount?: number; + customColumns?: Array; + }): DevExpress.data.DataSource; + /** Gets the current PivotGridDataSource state (fields configuration, sorting, filters, expanded headers, etc.) */ + state(): Object; + /** Sets the PivotGridDataSource state. */ + state(state: Object): void; + on(eventName: string, eventHandler: Function): PivotGridDataSource; + on(events: { [eventName: string]: Function; }): PivotGridDataSource; + off(eventName: string): PivotGridDataSource; + off(eventName: string, eventHandler: Function): PivotGridDataSource; + } +} +declare module DevExpress.ui { + export interface dxSchedulerOptions extends WidgetOptions { + /** Specifies a date displayed on the current scheduler view by default. */ + currentDate?: any; + /** The earliest date the widget allows you to select. */ + min?: Date; + /** The latest date the widget allows you to select. */ + max?: Date; + /** Specifies the view used in the scheduler by default. */ + currentView?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** The template to be used for rendering appointments. */ + appointmentTemplate?: any; + /** The template to be used for rendering an appointment tooltip. */ + appointmentTooltipTemplate?: any; + /** Lists the views to be available within the scheduler's View Selector. */ + views?: Array; + /** Specifies the resource kinds by which the scheduler's appointments are grouped in a timetable. */ + groups?: Array; + /** Specifies a start hour in the scheduler view's time interval. */ + startDayHour?: number; + /** Specifies an end hour in the scheduler view's time interval. */ + endDayHour?: number; + /** Specifies whether or not the "All-day" panel is visible. */ + showAllDayPanel?: boolean; + /** Specifies cell duration in minutes. */ + cellDuration?: number; + /** Specifies the edit mode for recurring appointments. */ + recurrenceEditMode?: string; + /** Specifies which editing operations an end-user can perform on appointments. */ + editing?: { + /** Specifies whether or not an end-user can add appointments. */ + allowAdding?: boolean; + /** Specifies whether or not an end-user can change appointment options. */ + allowUpdating?: boolean; + /** Specifies whether or not an end-user can delete appointments. */ + allowDeleting?: boolean; + /** Specifies whether or not an end-user can change an appointment duration. */ + allowResizing?: boolean; + /** Specifies whether or not an end-user can drag appointments. */ + allowDragging?: boolean; + } + /** Specifies an array of resources available in the scheduler. */ + resources?: Array<{ + /** Indicates whether or not several resources of this kind can be assigned to an appointment. */ + allowMultiple?: boolean; + /** + * Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. + * @deprecated Use the useColorAsDefault option instead. + */ + mainColor?: boolean; + /** Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. */ + useColorAsDefault?: boolean; + /** A data source used to fetch resources to be available in the scheduler. */ + dataSource?: any; + /** Specifies the resource object field whose value is displayed by the Resource editor in the Appointment popup window. */ + displayExpr?: any; + /** Specifies the resource object field that is used as a value of the Resource editor in the Appointment popup window. */ + valueExpr?: any; + /** The name of the appointment object field that specifies a resource of this kind. */ + field?: string; + /** Specifies the label of the Appointment popup window field that allows end users to assign a resource of this kind. */ + label?: string; + }>; + /** A handler for the AppointmentAdding event. */ + onAppointmentAdding?: Function; + /** A handler for the appointmentAdded event. */ + onAppointmentAdded?: Function; + /** A handler for the AppointmentUpdating event. */ + onAppointmentUpdating?: Function; + /** A handler for the appointmentUpdated event. */ + onAppointmentUpdated?: Function; + /** A handler for the AppointmentDeleting event. */ + onAppointmentDeleting?: Function; + /** A handler for the appointmentDeleted event. */ + onAppointmentDeleted?: Function; + /** A handler for the appointmentRendered event. */ + onAppointmentRendered?: Function; + /** A handler for the appointmentClick event. */ + onAppointmentClick?: any; + /** A handler for the appointmentDblClick event. */ + onAppointmentDblClick?: any; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the appointmentFormCreated event. */ + onAppointmentFormCreated?: Function; + /** Specifies whether or not an end-user can scroll the view horizontally. */ + horizontalScrollingEnabled?: boolean; + /** Specifies whether a user can switch views using tabs or a drop-down menu. */ + useDropDownViewSwitcher?: boolean; + /** Specifies the name of the data source item field that defines the start of an appointment. */ + startDateExpr?: string; + /** Specifies the name of the data source item field that defines the ending of an appointment. */ + endDateExpr?: string; + /** Specifies the name of the data source item field that holds the subject of an appointment. */ + textExpr?: string; + /** Specifies the name of the data source item field whose value holds the description of the corresponding appointment. */ + descriptionExpr?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding appointment is an all-day appointment. */ + allDayExpr?: string; + /** Specifies the name of the data source item field that defines a recurrence rule for generating recurring appointments. */ + recurrenceRuleExpr?: string; + /** Specifies the name of the data source item field that defines exceptions for the current recurring appointment. */ + recurrenceExceptionExpr?: string; + /** Specifies whether filtering is performed on the server or client side. */ + remoteFiltering?: boolean; + } + /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ + export class dxScheduler extends Widget { + constructor(element: JQuery, options?: dxSchedulerOptions); + constructor(element: Element, options?: dxSchedulerOptions); + /** Add the appointment defined by the object passed as a parameter to the data associated with the widget. */ + addAppointment(appointment: Object): void; + /** Updates the appointment specified by the first method parameter by the appointment object specified by the second method parameter in the the data associated with the widget. */ + updateAppointment(target: Object, appointment: Object): void; + /** Deletes the appointment defined by the parameter from the the data associated with the widget. */ + deleteAppointment(appointment: Object): void; + /** Scrolls the scheduler work space to the specified time of the specified day. */ + scrollToTime(hours: number, minutes: number, date: Date): void; + /** Displayes the Appointment Details popup. */ + showAppointmentPopup(appointmentData: Object, createNewAppointment?: boolean, currentAppointmentData?: Object): void; + } + export interface dxColorBoxOptions extends dxDropDownEditorOptions { + /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ + applyButtonText?: string; + applyValueMode?: string; + /** Specifies the text displayed on the button that cancels changes and closes the drop-down editor. */ + cancelButtonText?: string; + /** Specifies whether or not the widget value includes the alpha channel component. */ + editAlphaChannel?: boolean; + /** Specifies the size of a step by which a handle is moved using a keyboard shortcut. */ + keyStep?: number; + } + /** A widget used to specify a color value. */ + export class dxColorBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxColorBoxOptions); + constructor(element: Element, options?: dxColorBoxOptions); + } + export interface HierarchicalCollectionWidgetOptions extends CollectionWidgetOptions { + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of the data source item field used as a key. */ + keyExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is selected. */ + selectedExpr?: any; + /** Specifies the name of the data source item field that contains an array of nested items. */ + itemsExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is disabled. */ + disabledExpr?: any; + /** Specifies the name of the data source item field that holds the key of the parent item. */ + parentIdExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is expanded. */ + expandedExpr?: any; + hoverStateEnabled?: boolean; + focusStateEnabled?: boolean; + } + export class HierarchicalCollectionWidget extends CollectionWidget { + } + export interface dxTreeViewOptions extends HierarchicalCollectionWidgetOptions { + /** Specifies whether or not to animate item collapsing and expanding. */ + animationEnabled?: boolean; + /** Specifies whether a nested or plain array is used as a data source. */ + dataStructure?: string; + /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ + expandAllEnabled?: boolean; + /** + * Specifies whether or not a check box is displayed at each tree view item. + * @deprecated Use the showCheckBoxesMode options instead. + */ + showCheckBoxes?: boolean; + /** Specifies the current check boxes display mode. */ + showCheckBoxesMode?: string; + /** Specifies whether or not to select nodes recursively. */ + selectNodesRecursive?: boolean; + /** Specifies whether or not all parent nodes of an initially expanded node are displayed expanded. */ + expandNodesRecursive?: boolean; + /** + * Specifies whether the "Select All" check box is displayed over the tree view. + * @deprecated Use the showCheckBoxesMode options instead. + */ + selectAllEnabled?: boolean; + /** Specifies the text displayed at the "Select All" check box. */ + selectAllText?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node includes child nodes. */ + hasItemsExpr?: any; + /** Specifies if the virtual mode is enabled. */ + virtualModeEnabled?: boolean; + /** Specifies the parent ID value of the root item. */ + rootValue?: any; + /** Specifies the current value used to filter tree view items. */ + searchValue?: string; + /** A string value specifying available scrolling directions. */ + scrollDirection?: string; + /** A handler for the itemSelected event. */ + onItemSelected?: Function; + /** A handler for the itemExpanded event. */ + onItemExpanded?: Function; + /** A handler for the itemCollapsed event. */ + onItemCollapsed?: Function; + onItemClick?: Function; + onItemContextMenu?: Function; + onItemRendered?: Function; + onItemHold?: Function; + } + /** A widget displaying specified data items as a tree. */ + export class dxTreeView extends HierarchicalCollectionWidget { + constructor(element: JQuery, options?: dxTreeViewOptions); + constructor(element: Element, options?: dxTreeViewOptions); + /** Updates the tree view scrollbars according to the current size of the widget content. */ + updateDimensions(): JQueryPromise; + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + /** Expands the specified item. */ + expandItem(itemElement: any): void; + /** Collapses the specified item. */ + collapseItem(itemElement: any): void; + /** Returns all nodes of the tree view. */ + getNodes(): Array; + /** Selects all widget items. */ + selectAll(): void; + /** Unselects all widget items. */ + unselectAll(): void; + } + export interface dxMenuBaseOptions extends HierarchicalCollectionWidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the name of the CSS class associated with the menu. */ + cssClass?: string; + /** Holds an array of menu items. */ + items?: Array; + /** Specifies whether or not an item becomes selected if an end-user clicks it. */ + selectionByClick?: boolean; + /** Specifies the selection mode supported by the menu. */ + selectionMode?: string; + /** Specifies options of submenu showing and hiding. */ + showSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay of submenu show and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + } + export class dxMenuBase extends HierarchicalCollectionWidget { + constructor(element: JQuery, options?: dxMenuBaseOptions); + constructor(element: Element, options?: dxMenuBaseOptions); + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + } + export interface dxMenuOptions extends dxMenuBaseOptions { + /** Specifies whether or not the submenu is hidden when the mouse pointer leaves it. */ + hideSubmenuOnMouseLeave?: boolean; + /** Specifies whether the menu has horizontal or vertical orientation. */ + orientation?: string; + /** Specifies options for showing and hiding the first level submenu. */ + showFirstSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay in submenu showing and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + /** Specifies the direction at which the submenus are displayed. */ + submenuDirection?: string; + /** A handler for the submenuHidden event. */ + onSubmenuHidden?: Function; + /** A handler for the submenuHiding event. */ + onSubmenuHiding?: Function; + /** A handler for the submenuShowing event. */ + onSubmenuShowing?: Function; + /** A handler for the submenuShown event. */ + onSubmenuShown?: Function; + } + /** A menu widget. */ + export class dxMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxMenuOptions); + constructor(element: Element, options?: dxMenuOptions); + } + export interface dxContextMenuOptions extends dxMenuBaseOptions { + /** Holds an object that specifies options of alternative menu invocation. */ + alternativeInvocationMode?: { + /** Specifies whether or not the standard context menu invocation (on a right mouse click or on a long tap) is disabled. */ + enabled?: Boolean; + /** Specifies the element used to invoke the context menu. */ + invokingElement?: any; + }; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** A handler for the positioning event. */ + onPositioning?: Function; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the direction at which submenus are displayed. */ + submenuDirection?: string; + /** The target element associated with a popover. */ + target?: any; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + } + /** A context menu widget. */ + export class dxContextMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxContextMenuOptions); + constructor(element: Element, options?: dxContextMenuOptions); + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Hides the widget. */ + hide(): JQueryPromise; + } + export interface dxRemoteOperations { + /** Specifies whether or not filtering must be performed on the server side. */ + filtering?: boolean; + /** Specifies whether or not paging must be performed on the server side. */ + paging?: boolean; + /** Specifies whether or not sorting must be performed on the server side. */ + sorting?: boolean; + /** Specifies whether or not grouping must be performed on the server side. */ + grouping?: boolean; + /** Specifies whether or not summaries calculation must be performed on the server side. */ + summary?: boolean; + } + export interface dxDataGridRow { + /** The data object represented by the row. */ + data: Object; + /** The key of the data object represented by the row. */ + key: any; + /** The visible index of the row. */ + rowIndex: number; + /** The type of the row. */ + rowType: string; + /** The group index of the row. Available when the rowType is "group". */ + groupIndex: number; + /** Indicates whether the row is expanded or collapsed. Available if rowType is "data", "detail" or "group". */ + isExpanded: boolean; + /** Indicates whether the row is selected. Available if rowType is "data". */ + isSelected: boolean; + /** Values of the row as they exist in the data source. */ + values: Array; + } + export interface dxDataGridColumn { + /** Specifies the content alignment within column cells. */ + alignment?: string; + /** Specifies whether the values in a column can be edited at runtime. Setting this option makes sense only when editing is enabled for a grid. */ + allowEditing?: boolean; + /** Specifies whether or not a column can be used for filtering grid records. Setting this option makes sense only when the filter row and column header filtering are visible. */ + allowFiltering?: boolean; + /** Specifies whether or not to allow filtering by this column using its header. */ + allowHeaderFiltering?: boolean; + /** Specifies whether or not the column can be anchored to a grid edge by end users. Setting this option makes sense only when the columnFixing | enabled option is set to true. */ + allowFixing?: boolean; + /** Specifies if a column can be used for searching grid records. Setting this option makes sense only when the search panel is visible. */ + allowSearch?: boolean; + /** Specifies whether a column can be used for grouping grid records at runtime. Setting this option makes sense only when the group panel is visible. */ + allowGrouping?: boolean; + /** Specifies whether or not a column can be hidden by a user. Setting this option makes sense only when the column chooser is visible. */ + allowHiding?: boolean; + /** Specifies whether or not a particular column can be used in column reordering. Setting this option makes sense only when the allowColumnReordering option is set to true. */ + allowReordering?: boolean; + /** Specifies whether or not a particular column can be resized by a user. Setting this option makes sense only when the allowColumnResizing option is true. */ + allowResizing?: boolean; + /** Specifies whether grid records can be sorted by a specific column at runtime. Setting this option makes sense only when the sorting mode differs from none. */ + allowSorting?: boolean; + /** Specifies whether groups appear expanded or not when records are grouped by a specific column. Setting this option makes sense only when grouping is allowed for this column. */ + autoExpandGroup?: boolean; + /** Specifies a callback function that returns a value to be displayed in a column cell. */ + calculateCellValue?: (rowData: Object) => string; + /** Specifies a callback function to be invoked after the cell value is edited by an end-user and before the new value is saved to the data source. */ + setCellValue?: (rowData: Object, value: any) => void; + /** Specifies a callback function that defines filters for customary calculated grid cells. */ + calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string, target: string) => Array; + /** Specifies a caption for a column. */ + caption?: string; + /** Specifies a custom template for grid column cells. */ + cellTemplate?: any; + /** Specifies a CSS class to be applied to a column. */ + cssClass?: string; + /** Specifies how to get a value to be displayed in a cell when it is not in an editing state. */ + calculateDisplayValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for grouping column cells. */ + calculateGroupValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for sorting column cells. */ + calculateSortValue?: any; + /** Specifies a callback function that returns the text to be displayed in the cells of a column. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** Specifies the field of a data source that provides data for a column. */ + dataField?: string; + /** Specifies the required type of column values. */ + dataType?: string; + /** Specifies a custom template for the cell of a grid column when it is in an editing state. */ + editCellTemplate?: any; + /** Specifies configuration options for the editor widget of the current column. */ + editorOptions?: Object; + /** Specifies whether HTML tags are displayed as plain text or applied to the values of the column. */ + encodeHtml?: boolean; + /** In a boolean column, replaces all false items with a specified text. */ + falseText?: string; + /** Specifies the set of available filter operations. */ + filterOperations?: Array; + /** Specifies a filter value for a column. */ + filterValue?: any; + /** Specifies initial filter values for the column's header filter. */ + filterValues?: Array; + /** Specifies whether to include or exclude the records with the values selected in the column's header filter. */ + filterType?: string; + /** Indicates whether the column takes part in horizontal grid scrolling or is anchored to a grid edge. */ + fixed?: boolean; + /** Specifies the grid edge to which the column is anchored. */ + fixedPosition?: string; + /** Specifies a format for the values displayed in a column. */ + format?: string; + /** Specifies a custom template for the group cell of a grid column. */ + groupCellTemplate?: any; + /** Specifies the index of a column when grid records are grouped by the values of this column. */ + groupIndex?: number; + /** Specifies a custom template for the header of a grid column. */ + headerCellTemplate?: any; + /** Specifies options of a lookup column. */ + lookup?: { + /** Specifies whether or not a user can nullify values of a lookup column. */ + allowClearing?: boolean; + /** Specifies the data source providing data for a lookup column. */ + dataSource?: any; + /** Specifies the expression defining the data source field whose values must be displayed. */ + displayExpr?: any; + /** Specifies the expression defining the data source field whose values must be replaced. */ + valueExpr?: string; + }; + /** Specifies column-level options for filtering using a column header filter. */ + headerFilter?: { + /** Specifies the data source to be used for the header filter. */ + dataSource?: any; + /** Specifies how header filter values should be combined into groups. */ + groupInterval?: any; + }; + /** Specifies a precision for formatted values displayed in a column. */ + precision?: number; + /** Specifies the default filter operation of a column. */ + selectedFilterOperation?: string; + /** Specifies whether or not the column displays its values by using editors. */ + showEditorAlways?: boolean; + /** Specifies whether or not to display the column when grid records are grouped by it. */ + showWhenGrouped?: boolean; + /** Specifies the index of a column when grid records are sorted by the values of this column. */ + sortIndex?: number; + /** Specifies the initial sort order of column values. */ + sortOrder?: string; + /** In a boolean column, replaces all true items with a specified text. */ + trueText?: string; + /** Specifies whether a column is visible or not. */ + visible?: boolean; + /** Specifies the sequence number of the column in the grid. */ + visibleIndex?: number; + /** Specifies a column width in pixels or percentages. */ + width?: any; + /** Specifies an array of validation rules to be checked when updating column cell values. */ + validationRules?: Array; + /** Specifies whether or not to display the header of a hidden column in the column chooser. */ + showInColumnChooser?: boolean; + /** Specifies the identifier of the column. */ + name?: string; + /** The form item configuration object. Used only when the editing mode is "form". */ + formItem?: DevExpress.ui.dxFormItem; + } + export interface dxDataGridOptions extends WidgetOptions { + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** Indicates whether to show the error row for the grid. */ + errorRowEnabled?: boolean; + /** A handler for the rowValidating event. */ + onRowValidating?: (e: Object) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** A handler for the initNewRow event. */ + onInitNewRow?: (e: { data: Object }) => void; + /** A handler for the rowInserted event. */ + onRowInserted?: (e: { data: Object; key: any }) => void; + /** A handler for the rowInserting event. */ + onRowInserting?: (e: { data: Object; cancel: any }) => void; + /** A handler for the rowRemoved event. */ + onRowRemoved?: (e: { data: Object; key: any }) => void; + /** A handler for the rowRemoving event. */ + onRowRemoving?: (e: { data: Object; key: any; cancel: any }) => void; + /** A handler for the rowUpdated event. */ + onRowUpdated?: (e: { data: Object; key: any }) => void; + /** A handler for the rowUpdating event. */ + onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: any }) => void; + /** Enables a hint that appears when a user hovers the mouse pointer over a cell with truncated content. */ + cellHintEnabled?: boolean; + /** Specifies whether or not grid columns can be reordered by a user. */ + allowColumnReordering?: boolean; + /** Specifies whether or not grid columns can be resized by a user. */ + allowColumnResizing?: boolean; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the cellHoverChanged event. */ + onCellHoverChanged?: (e: Object) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: Object) => void; + /** Specifies whether or not the width of grid columns depends on column content. */ + columnAutoWidth?: boolean; + /** Specifies the options of a column chooser. */ + columnChooser?: { + /** Specifies text displayed by the column chooser panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether a user can invoke the column chooser or not. */ + enabled?: boolean; + /** Specifies the height of the column chooser panel. */ + height?: number; + /** Specifies text displayed in the title of the column chooser panel. */ + title?: string; + /** Specifies the width of the column chooser panel. */ + width?: number; + }; + /** Specifies options for column fixing. */ + columnFixing?: { + /** Indicates if column fixing is enabled. */ + enabled?: boolean; + /** Contains options that specify texts for column-fixing related commands in the column header's context menu. */ + texts?: { + /** Specifies text for a context menu item that fixes the column for which the context menu is invoked. */ + fix?: string; + /** Specifies text for a context menu item that unfixes the column for which the context menu is invoked. */ + unfix?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the left grid edge. */ + leftPosition?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the right grid edge. */ + rightPosition?: string; + }; + }; + /** Specifies options for filtering using a column header filter. */ + headerFilter?: { + /** Indicates whether or not the column header filter button is visible. */ + visible?: boolean; + /** Specifies the height of the dropdown menu invoked when using a column header filter. */ + height?: number; + /** Specifies the width of the dropdown menu invoked when using a column header filter. */ + width?: number; + /** Contains options that specify texts for the dropdown menu invoked when you use a column header filter. */ + texts?: { + /** Specifies text for the item specifying an empty value in the column header filter's dropdown menu. */ + emptyValue?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu and applies specified filtering. */ + ok?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu without applying performed selection. */ + cancel?: string; + } + }; + /** An array of grid columns. */ + columns?: Array; + onContentReady?: Function; + /** Specifies a function that customizes grid columns after they are created. */ + customizeColumns?: (columns: Array) => void; + /** Customizes grid columns and data before exporting. */ + customizeExportData?: (columns: Array, rows: Array) => void; + /** Specifies a data source for the grid. */ + dataSource?: any; + /** Specifies whether or not to enable data caching. */ + cacheEnabled?: boolean; + /** A handler for the editingStart event. */ + onEditingStart?: (e: { + data: Object; + key: any; + cancel: boolean; + column: dxDataGridColumn + }) => void; + /** A handler for the editorPrepared event. */ + onEditorPrepared?: (e: Object) => void; + /** A handler for the editorPreparing event. */ + onEditorPreparing?: (e: Object) => void; + /** Contains options that specify how grid content can be changed. */ + editing?: { + editMode?: string; + editEnabled?: boolean; + insertEnabled?: boolean; + removeEnabled?: boolean; + /** Specifies how grid values can be edited manually. */ + mode?: string; + /** Specifies whether or not grid records can be edited at runtime. */ + allowUpdating?: boolean; + /** Specifies whether or not new grid records can be added at runtime. */ + allowAdding?: boolean; + /** Specifies whether or not grid records can be deleted at runtime. */ + allowDeleting?: boolean; + /** The form configuration object. Used only when the editing mode is "form". */ + form?: DevExpress.ui.dxFormOptions; + /** Contains options that specify texts for editing-related grid controls. */ + texts?: { + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Save" button. Setting this option makes sense only when the mode option is set to batch. */ + saveAllChanges?: string; + /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + cancelRowChanges?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Revert" button. Setting this option makes sense only when the mode option is set to batch. */ + cancelAllChanges?: string; + /** Specifies a message to be displayed by a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteMessage?: string; + /** Specifies text to be displayed in the title of a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteTitle?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Cancel changes" button. Setting this option makes sense only when the mode option is set to cell and the validation capabilities are enabled. */ + validationCancelChanges?: string; + /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the allowDeleting option is set to true. */ + deleteRow?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Add" button. Setting this option makes sense only when the allowAdding option is true. */ + addRow?: string; + /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + editRow?: string; + /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + saveRowChanges?: string; + /** Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the allowDeleting option is set to true. */ + undeleteRow?: string; + }; + }; + /** Specifies filter row options. */ + filterRow?: { + /** Specifies when to apply a filter. */ + applyFilter?: string; + /** Specifies text for the hint that pops up when a user hovers the mouse pointer over the "Apply Filter" button. */ + applyFilterText?: string; + /** Specifies descriptions for filter operations. */ + operationDescriptions?: { + "=": string; + "<>": string; + "<": string; + "<=": string; + ">": string; + ">=": string; + "startswith": string; + "contains": string; + "notcontains": string; + "endswith": string; + }; + /** Specifies text for the reset operation in a filter list. */ + resetOperationText?: string; + /** Specifies text for the operation of clearing the applied filter when a select box is used. */ + showAllText?: string; + /** Specifies text for the range start in the 'between' filter type. */ + betweenStartText?: string; + /** Specifies text for the range end in the 'between' filter type. */ + betweenEndText?: string; + /** Specifies whether or not an icon that allows the user to choose a filter operation is visible. */ + showOperationChooser?: boolean; + /** Specifies whether the filter row is visible or not. */ + visible?: boolean; + }; + /** Specifies the behavior of grouped grid records. */ + grouping?: { + /** Specifies whether the user can collapse grouped records in a grid or not. */ + allowCollapsing?: boolean; + /** Specifies whether groups appear expanded or not. */ + autoExpandAll?: boolean; + /** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */ + groupContinuedMessage?: string; + /** Specifies the message displayed in a group row when the corresponding group continues on the next page. */ + groupContinuesMessage?: string; + }; + /** Specifies options that configure the group panel. */ + groupPanel?: { + /** Specifies whether columns can be dragged onto or from the group panel. */ + allowColumnDragging?: boolean; + /** Specifies text displayed by the group panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether the group panel is visible or not. */ + visible?: boolean; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Specifies whether to show the load panel or not. */ + enabled?: boolean; + /** Specifies the height of the load panel in pixels. */ + height?: number; + /** Specifies a URL pointing to an image to be used as a loading indicator. */ + indicatorSrc?: string; + /** Specifies whether or not a loading indicator must be displayed on the load panel. */ + showIndicator?: boolean; + /** Specifies whether or not the pane of the load panel must be displayed. */ + showPane?: boolean; + /** Specifies text displayed by the load panel. */ + text?: string; + /** Specifies the width of the load panel in pixels. */ + width?: number; + }; + /** Specifies text displayed when a grid does not contain any records. */ + noDataText?: string; + /** Specifies the options of a grid pager. */ + pager?: { + /** Specifies the page sizes that can be selected at runtime. */ + allowedPageSizes?: any; + /** Specifies whether to show the page size selector or not. */ + showPageSizeSelector?: boolean; + /** Specifies whether to show the pager or not. */ + visible?: any; + /** Specifies the text accompanying the page navigator. */ + infoText?: string; + /** Specifies whether or not to display the text accompanying the page navigator. This text is specified by the infoText option. */ + showInfo?: boolean; + /** Specifies whether or not to display buttons that switch the grid to the previous or next page. */ + showNavigationButtons?: boolean; + }; + /** Specifies paging options. */ + paging?: { + /** Specifies whether dxDataGrid loads data page by page or all at once. */ + enabled?: boolean; + /** Specifies the grid page that should be displayed by default. */ + pageIndex?: number; + /** Specifies the size of grid pages. */ + pageSize?: number; + }; + /** Specifies whether or not grid rows must be shaded in a different way. */ + rowAlternationEnabled?: boolean; + /** Specifies whether to enable two-way data binding. */ + twoWayBindingEnabled?: boolean; + /** A handler for the rowClick event. */ + onRowClick?: any; + /** A handler for the rowPrepared event. */ + onRowPrepared?: (e: Object) => void; + /** Specifies a custom template for grid rows. */ + rowTemplate?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not a grid must preload pages adjacent to the current page when using virtual scrolling. */ + preloadEnabled?: boolean; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + /** Specifies the scrollbar display policy. */ + showScrollbar?: string; + /** Specifies whether or not the scrolling by content is enabled. */ + scrollByContent?: boolean; + /** Specifies whether or not the scrollbar thumb scrolling enabled. */ + scrollByThumb?: boolean; + }; + /** Specifies options of the search panel. */ + searchPanel?: { + /** Specifies whether or not search strings in the located grid records should be highlighted. */ + highlightSearchText?: boolean; + /** Specifies text displayed by the search panel when no search string was typed. */ + placeholder?: string; + /** Specifies whether the search panel is visible or not. */ + visible?: boolean; + /** Specifies the width of the search panel in pixels. */ + width?: number; + /** Sets a search string for the search panel. */ + text?: string; + }; + /** Specifies the operations that must be performed on the server side. */ + remoteOperations?: any; + /** Allows you to sort groups according to the values of group summary items. */ + sortByGroupSummaryInfo?: Array<{ + /** Specifies the group summary item whose values must be used to sort groups. */ + summaryItem?: string; + /** Specifies the identifier of the column that must be used in grouping so that sorting by group summary item values be applied. */ + groupColumn?: string; + /** Specifies the sort order of group summary item values. */ + sortOrder?: string; + }>; + /** Allows you to build a master-detail interface in the grid. */ + masterDetail?: { + /** Enables an end-user to expand/collapse detail sections. */ + enabled?: boolean; + /** Specifies whether detail sections appear expanded or collapsed. */ + autoExpandAll?: boolean; + /** Specifies the template for detail sections. */ + template?: any; + }; + /** Specifies options for exporting grid data. */ + export?: { + /** Indicates if the export feature is enabled in the grid. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies whether to enable Excel filtering for the exported data in the resulting XLSX file. */ + excelFilterEnabled?: boolean; + /** Specifies whether to enable word wrapping for the exported data in the resulting XLSX file. */ + excelWrapTextEnabled?: boolean; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + proxyUrl?: string; + /** Indicates whether to allow end users to export not only the data displayed in the grid, but the selected rows only. */ + allowExportSelectedData?: boolean; + /** Contains options that specify texts for the export-related commands and hints. */ + texts?: { + /** Specifies text for the Export button when this button invokes a dropdown menu so you can choose the required export format. */ + exportTo?: string; + /** Specifies text for the Export button's hint when this button exports to the XSLX format without invoking the drop-down menu. */ + exportToExcel?: string; + /** Specifies text for the item in the Export dropdown menu that exports grid data to Excel. */ + excelFormat?: string; + /** Specifies text for the option in the Export dropdown menu that allows you to choose whether to export all the grid data or the selected rows only. */ + selectedRows?: string; + } + }; + /** Specifies the keys of the records that must appear selected initially. */ + selectedRowKeys?: Array; + /** Specifies options of runtime selection. */ + selection?: { + /** Specifies the checkbox row display policy in the multiple mode. */ + showCheckBoxesMode?: string; + /** Specifies whether the user can select all grid records at once. */ + allowSelectAll?: boolean; + /** Specifies the selection mode. */ + mode?: string; + }; + /** A handler for the dataErrorOccured event. */ + onDataErrorOccurred?: (e: { error: Error }) => void; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + currentSelectedRowKeys: Array; + currentDeselectedRowKeys: Array; + selectedRowKeys: Array; + selectedRowsData: Array; + }) => void; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A handler for the keyDown event. */ + onKeyDown?: (e: Object) => void; + /** A handler for the rowExpanding event. */ + onRowExpanding?: (e: Object) => void; + /** A handler for the rowExpanded event. */ + onRowExpanded?: (e: Object) => void; + /** A handler for the rowCollapsing event. */ + onRowCollapsing?: (e: Object) => void; + /** A handler for the rowCollapsed event. */ + onRowCollapsed?: (e: Object) => void; + /** Specifies whether column headers are visible or not. */ + showColumnHeaders?: boolean; + /** Specifies whether or not vertical lines separating one grid column from another are visible. */ + showColumnLines?: boolean; + /** Specifies whether or not horizontal lines separating one grid row from another are visible. */ + showRowLines?: boolean; + /** Specifies options of runtime sorting. */ + sorting?: { + /** Specifies text for the context menu item that sets an ascending sort order in a column. */ + ascendingText?: string; + /** Specifies text for the context menu item that resets sorting settings for a column. */ + clearText?: string; + /** Specifies text for the context menu item that sets a descending sort order in a column. */ + descendingText?: string; + /** Specifies the runtime sorting mode. */ + mode?: string; + }; + /** Specifies options of state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (state: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + /** Specifies the options of the grid summary. */ + summary?: { + /** Contains options that specify text patterns for summary items. */ + texts?: { + /** Specifies a pattern for the 'sum' summary items when they are displayed in the parent column. */ + sum?: string; + /** Specifies a pattern for the 'sum' summary items displayed in a group row or in any other column rather than the parent one. */ + sumOtherColumn?: string; + /** Specifies a pattern for the 'min' summary items when they are displayed in the parent column. */ + min?: string; + /** Specifies a pattern for the 'min' summary items displayed in a group row or in any other column rather than the parent one. */ + minOtherColumn?: string; + /** Specifies a pattern for the 'max' summary items when they are displayed in the parent column. */ + max?: string; + /** Specifies a pattern for the 'max' summary items displayed in a group row or in any other column rather than the parent one. */ + maxOtherColumn?: string; + /** Specifies a pattern for the 'avg' summary items when they are displayed in the parent column. */ + avg?: string; + /** Specifies a pattern for the 'avg' summary items displayed in a group row or in any other column rather than the parent one. */ + avgOtherColumn?: string; + /** Specifies a pattern for the 'count' summary items. */ + count?: string; + }; + /** Specifies items of the group summary. */ + groupItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the column that provides data for a group summary item. */ + column?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** Specifies a precision for the summary item value of a numeric format. */ + precision?: number; + /** Specifies whether or not a summary item must be displayed in the group footer. */ + showInGroupFooter?: boolean; + /** Indicates whether to display group summary items in parentheses after the group row header or to align them by the corresponding columns within the group row. */ + alignByColumn?: boolean; + /** Specifies the column that must hold the summary item when this item is displayed in the group footer or aligned by a column in the group row. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: string; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + }>; + /** Specifies items of the total summary. */ + totalItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the alignment of a summary item. */ + alignment?: string; + /** Specifies the column that provides data for a summary item. */ + column?: string; + /** Specifies a CSS class to be applied to a summary item. */ + cssClass?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** Specifies a precision for the summary item value of a numeric format. */ + precision?: number; + /** Specifies the column that must hold the summary item. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: string; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + }>; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + /** Allows you to use a custom aggregate function to calculate the value of a summary item. */ + calculateCustomSummary?: (options: { + component: dxDataGrid; + name?: string; + value: any; + totalValue: any; + summaryProcess: string + }) => void; + }; + /** Specifies whether text that does not fit into a column should be wrapped. */ + wordWrapEnabled?: boolean; + } + /** A data grid widget. */ + export class dxDataGrid extends Widget { + constructor(element: JQuery, options?: dxDataGridOptions); + constructor(element: Element, options?: dxDataGridOptions); + /** Ungroups grid records. */ + clearGrouping(): void; + /** Clears sorting settings of all grid columns at once. */ + clearSorting(): void; + /** Allows you to obtain a cell by its row index and the data field of its column. */ + getCellElement(rowIndex: number, dataField: string): any; + /** Allows you to obtain a cell by its row index and the visible index of its column. */ + getCellElement(rowIndex: number, visibleColumnIndex: number): any; + /** Returns the current state of the grid. */ + state(): Object; + /** Sets the grid state. */ + state(state: Object): void; + /** Allows you to obtain the row index by a data key. */ + getRowIndexByKey(key: any): number; + /** Allows you to obtain the data key by a row index. */ + getKeyByRowIndex(rowIndex: number): any; + /** Adds a new column to a grid. */ + addColumn(columnOptions: dxDataGridColumn): void; + /** Removes the column from the grid. */ + deleteColumn(id: any): void; + /** Displays the load panel. */ + beginCustomLoading(messageText: string): void; + /** Discards changes made in a grid. */ + cancelEditData(): void; + /** Checks whether or not the grid contains unsaved changes. */ + hasEditData(): boolean; + /** Clears all the filters of a specific type applied to grid records. */ + clearFilter(): void; + /** Deselects all grid records. */ + clearSelection(): void; + /** Draws the cell being edited from the editing state. Use this method when the edit mode is batch. */ + closeEditCell(): void; + /** Collapses groups or master rows in a grid. */ + collapseAll(groupIndex?: number): void; + /** Returns the number of data columns in a grid. */ + columnCount(): number; + /** Returns the value of a specific column option. */ + columnOption(id: any, optionName: string): any; + /** Sets an option of a specific column. */ + columnOption(id: any, optionName: string, optionValue: any): void; + /** Returns the options of a column by an identifier. */ + columnOption(id: any): Object; + /** Sets several options of a column at once. */ + columnOption(id: any, options: Object): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, visibleColumnIndex: number): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, dataField: string): void; + /** Sets a specific row into the editing state. */ + editRow(rowIndex: number): void; + /** Gets the cell value. */ + cellValue(rowIndex: number, dataField: string): any; + /** Gets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number): any; + /** Sets the cell value. */ + cellValue(rowIndex: number, dataField: string, value: any): void; + /** Sets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number, value: any): void; + /** Hides the load panel. */ + endCustomLoading(): void; + /** Expands groups or master rows in a grid. */ + expandAll(groupIndex: number): void; + /** Allows you to find out whether a specific group or master row is expanded or collapsed. */ + isRowExpanded(key: any): boolean; + /** Allows you to expand a specific group or master row by its key. */ + expandRow(key: any): void; + /** Allows you to collapse a specific group or master row by its key. */ + collapseRow(key: any): void; + /** Applies a filter to the grid's data source. */ + filter(filterExpr?: any): void; + /** Returns a filter expression applied to the grid's data source using the filter(filterExpr) method. */ + filter(): any; + /** Returns a filter expression applied to the grid using all possible scenarious. */ + getCombinedFilter(): any; + /** Gets the keys of currently selected grid records. */ + getSelectedRowKeys(): Array; + /** Gets the data objects of currently selected grid records. */ + getSelectedRowsData(): Array; + /** Hides the column chooser panel. */ + hideColumnChooser(): void; + /** Adds a new data row to a grid. */ + addRow(): void; + /** + * Adds a new data row to a grid. + * @deprecated Use the addRow() method instead. + */ + insertRow(): void; + /** Returns the key corresponding to the passed data object. */ + keyOf(obj: Object): any; + /** Switches a grid to a specified page. */ + pageIndex(newIndex: number): void; + /** Gets the index of the current page. */ + pageIndex(): number; + /** Sets the page size. */ + pageSize(value: number): void; + /** Gets the current page size. */ + pageSize(): number; + /** Refreshes grid data. */ + refresh(): JQueryPromise; + /** Removes a specific row from a grid. */ + deleteRow(rowIndex: number): void; + /** + * Removes a specific row from a grid. + * @deprecated Use the deleteRow(rowIndex) method instead. + */ + removeRow(rowIndex: number): void; + /** Saves changes made in a grid. */ + saveEditData(): JQueryPromise; + /** Searches grid records by a search string. */ + searchByText(text: string): void; + /** Selects all grid records. */ + selectAll(): void; + /** Deselects the rows that are currently selected within the applied filter. */ + deselectAll(): void; + /** Selects specific grid records. */ + selectRows(keys: Array, preserve: boolean): void; + /** Deselects specific grid records. */ + deselectRows(keys: Array): void; + /** Selects grid rows by indexes. */ + selectRowsByIndexes(indexes: Array): void; + /** Allows you to find out whether a row is selected or not. */ + isRowSelected(key: any): boolean; + /** Invokes the column chooser panel. */ + showColumnChooser(): void; + startSelectionWithCheckboxes(): boolean; + /** Returns the number of records currently held by a grid. */ + totalCount(): number; + /** Recovers a row deleted in the batch edit mode. */ + undeleteRow(rowIndex: number): void; + /** Allows you to obtain a data object by its key. */ + byKey(key: any): JQueryPromise; + /** Gets the value of a total summary item. */ + getTotalSummaryValue(summaryItemName: string): any; + /** Exports grid data to Excel. */ + exportToExcel(selectionOnly: boolean): void; + /** Updates the grid to the size of its content. */ + updateDimensions(): void; + /** Focuses the specified cell element in the grid. */ + focus(element?: JQuery): void; + } + export interface dxPivotGridOptions extends WidgetOptions { + onContentReady?: Function; + /** Specifies a data source for the pivot grid. */ + dataSource?: any; + useNativeScrolling?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + }; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies whether to display the Total rows. */ + showRowTotals?: boolean; + /** Specifies whether to display the Grand Total row. */ + showRowGrandTotals?: boolean; + /** Specifies whether to display the Total columns. */ + showColumnTotals?: boolean; + /** Specifies whether to display the Grand Total column. */ + showColumnGrandTotals?: boolean; + /** Specifies whether or not to hide rows and columns with no data. */ + hideEmptySummaryCells?: boolean; + /** Specifies where to show the total rows or columns. */ + showTotalsPrior?: string; + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** The Field Chooser configuration options. */ + fieldChooser?: { + /** Enables or disables the field chooser. */ + enabled?: boolean; + /** Specifies the field chooser layout. */ + layout?: number; + /** Specifies the text to display as a title of the field chooser popup window. */ + title?: string; + /** Specifies the field chooser width. */ + width?: number; + /** Specifies the field chooser height. */ + height?: number; + /** Strings that can be changed or localized in the pivot grid's integrated Field Chooser. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** Strings that can be changed or localized in the dxPivotGrid widget. */ + texts?: { + /** The string to display as a header of the Grand Total row and column. */ + grandTotal?: string; + /** The string to display as a header of the Total row and column. */ + total?: string; + /** Specifies the text displayed when a pivot grid does not contain any fields. */ + noData?: string; + /** The string to display as a Show Field Chooser context menu item. */ + showFieldChooser?: string; + /** The string to display as an Expand All context menu item. */ + expandAll?: string; + /** The string to display as a Collapse All context menu item. */ + collapseAll?: string; + /** The string to display as a Sort Column by Summary Value context menu item. */ + sortColumnBySummary?: string; + /** The string to display as a Sort Row by Summary Value context menu item. */ + sortRowBySummary?: string; + /** The string to display as a Remove All Sorting context menu item. */ + removeAllSorting?: string; + /** The string to display as an Export to Excel file context menu item. */ + exportToExcel?: string; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Enables or disables the load panel. */ + enabled?: boolean; + /** Specifies the height of the load panel. */ + height?: number; + /** Specifies the URL pointing to an image that will be used as a load indicator. */ + indicatorSrc?: string; + /** Specifies whether or not to show a load indicator. */ + showIndicator?: boolean; + /** Specifies whether or not to show load panel background. */ + showPane?: boolean; + /** Specifies the text to display inside a load panel. */ + text?: string; + /** Specifies the width of the load panel. */ + width?: number; + }; + /** A handler for the cellClick event. */ + onCellClick?: (e: any) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: any) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** Specifies options for exporting pivot grid data. */ + export?: { + /** Indicates whether the export feature is enabled for the pivot grid. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + proxyUrl?: string; + }; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A configuration object specifying options related to state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (gridState: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + } + /** A data summarization widget for multi-dimensional data analysis and data mining. */ + export class dxPivotGrid extends Widget { + constructor(element: JQuery, options?: dxPivotGridOptions); + constructor(element: Element, options?: dxPivotGridOptions); + /** Gets the PivotGridDataSource instance. */ + getDataSource(): DevExpress.data.PivotGridDataSource; + /** Gets the dxPopup instance of the field chooser window. */ + getFieldChooserPopup(): DevExpress.ui.dxPopup; + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + /** Exports pivot grid data to the Excel file. */ + exportToExcel(): void; + } + export interface dxPivotGridFieldChooserOptions extends WidgetOptions { + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the field chooser layout. */ + layout?: number; + /** The data source of a dxPivotGrid widget. */ + dataSource?: DevExpress.data.PivotGridDataSource; + onContentReady?: Function; + /** Strings that can be changed or localized in the dxPivotGridFieldChooser widget. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** A complementary widget for dxPivotGrid that allows you to manage data displayed in the dxPivotGrid. */ + export class dxPivotGridFieldChooser extends Widget { + constructor(element: JQuery, options?: dxPivotGridFieldChooserOptions); + constructor(element: Element, options?: dxPivotGridFieldChooserOptions); + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + } +} +interface JQuery { + dxTreeView(): JQuery; + dxTreeView(options: "instance"): DevExpress.ui.dxTreeView; + dxTreeView(options: string): any; + dxTreeView(options: string, ...params: any[]): any; + dxTreeView(options: DevExpress.ui.dxTreeViewOptions): JQuery; + dxMenuBase(): JQuery; + dxMenuBase(options: "instance"): DevExpress.ui.dxMenuBase; + dxMenuBase(options: string): any; + dxMenuBase(options: string, ...params: any[]): any; + dxMenuBase(options: DevExpress.ui.dxMenuBaseOptions): JQuery; + dxMenu(): JQuery; + dxMenu(options: "instance"): DevExpress.ui.dxMenu; + dxMenu(options: string): any; + dxMenu(options: string, ...params: any[]): any; + dxMenu(options: DevExpress.ui.dxMenuOptions): JQuery; + dxContextMenu(): JQuery; + dxContextMenu(options: "instance"): DevExpress.ui.dxContextMenu; + dxContextMenu(options: string): any; + dxContextMenu(options: string, ...params: any[]): any; + dxContextMenu(options: DevExpress.ui.dxContextMenuOptions): JQuery; + dxColorBox(): JQuery; + dxColorBox(options: "instance"): DevExpress.ui.dxColorBox; + dxColorBox(options: string): any; + dxColorBox(options: string, ...params: any[]): any; + dxColorBox(options: DevExpress.ui.dxColorBoxOptions): JQuery; + dxDataGrid(): JQuery; + dxDataGrid(options: "instance"): DevExpress.ui.dxDataGrid; + dxDataGrid(options: string): any; + dxDataGrid(options: string, ...params: any[]): any; + dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; + dxPivotGrid(): JQuery; + dxPivotGrid(options: "instance"): DevExpress.ui.dxPivotGrid; + dxPivotGrid(options: string): any; + dxPivotGrid(options: string, ...params: any[]): any; + dxPivotGrid(options: DevExpress.ui.dxPivotGridOptions): JQuery; + dxPivotGridFieldChooser(): JQuery; + dxPivotGridFieldChooser(options: "instance"): DevExpress.ui.dxPivotGridFieldChooser; + dxPivotGridFieldChooser(options: string): any; + dxPivotGridFieldChooser(options: string, ...params: any[]): any; + dxPivotGridFieldChooser(options: DevExpress.ui.dxPivotGridFieldChooserOptions): JQuery; + dxScheduler(): JQuery; + dxScheduler(options: "instance"): DevExpress.ui.dxScheduler; + dxScheduler(options: string): any; + dxScheduler(options: string, ...params: any[]): any; + dxScheduler(options: DevExpress.ui.dxSchedulerOptions): JQuery; +} +declare module DevExpress.framework { + /** An object used to store information on the views displayed in an application. */ + export class ViewCache { + viewRemoved: JQueryCallback; + /** Removes all the viewInfo objects from the cache. */ + clear(): void; + /** Obtains a viewInfo object from the cache by the specified key. */ + getView(key: string): Object; + /** Checks whether or not a viewInfo object is contained in the view cache under the specified key. */ + hasView(key: string): boolean; + /** Removes a viewInfo object from the cache by the specified key. */ + removeView(key: string): Object; + /** Adds the specified viewInfo object to the cache under the specified key. */ + setView(key: string, viewInfo: Object): void; + } + export interface dxCommandOptions extends DOMComponentOptions { + /** Specifies an action performed when the execute() method of the command is called. */ + onExecute?: any; + /** Indicates whether or not the widget that displays this command is disabled. */ + disabled?: boolean; + /** Specifies whether the current command is rendered when a view is being rendered or after a view is shown. */ + renderStage?: string; + /** Specifies the name of the icon shown inside the widget associated with this command. */ + icon?: string; + iconSrc?: string; + /** The identifier of the command. */ + id?: string; + /** Specifies the title of the widget associated with this command. */ + title?: string; + /** Specifies the type of the button, if the command is rendered as a dxButton widget. */ + type?: string; + /** A Boolean value specifying whether or not the widget associated with this command is visible. */ + visible?: boolean; + } + /** A markup component used to define markup options for a command. */ + export class dxCommand extends DOMComponent { + constructor(element: JQuery, options: dxCommandOptions); + constructor(options: dxCommandOptions); + /** Executes the action associated with this command. */ + execute(): void; + } + /** An object responsible for routing. */ + export class Router { + /** Adds a routing rule to the list of registered rules. */ + register(pattern: string, defaults?: Object, constraints?: Object): void; + /** Decodes the specified URI to an object using the registered routing rules. */ + parse(uri: string): Object; + /** Formats an object to a URI. */ + format(obj: Object): string; + } + export interface StateManagerOptions { + /** A storage to which the state manager saves the application state. */ + storage?: Object; + } + /** An object used to store the current application state. */ + export class StateManager { + constructor(options?: StateManagerOptions); + /** Adds an object that implements an interface of a state source to the state manager's collection of state sources. */ + addStateSource(stateSource: Object): void; + /** Removes a specified state source from the state manager's collection of state sources. */ + removeStateSource(stateSource: Object): void; + /** Saves the current application state. */ + saveState(): void; + /** Restores the application state that has been saved by the saveState() method to the state storage. */ + restoreState(): void; + /** Removes the application state that has been saved by the saveState() method to the state storage. */ + clearState(): void; + } + export module html { + export var layoutSets: Array; + export var animationSets: { [animationSetName: string]: AnimationSet }; + export interface AnimationSet { + [animationName: string]: any + } + export interface HtmlApplicationOptions { + /** Specifies where the commands that are defined in the application's views must be displayed. */ + commandMapping?: Object; + /** Specifies whether or not view caching is disabled. */ + disableViewCache?: boolean; + /** An array of layout controllers that should be used to show application views in the current navigation context. */ + layoutSet?: any; + /** Specifies the animation presets that are used to animate different UI elements in the current application. */ + animationSet?: AnimationSet; + /** Specifies whether the current application must behave as a mobile or web application. */ + mode?: string; + /** Specifies the object that represents a root namespace of the application. */ + namespace?: Object; + /** Specifies application behavior when the user navigates to a root view. */ + navigateToRootViewMode?: string; + /** An array of dxCommand configuration objects used to define commands available from the application's global navigation. */ + navigation?: Array; + /** A state manager to be used in the application. */ + stateManager?: StateManager; + /** Specifies the storage to be used by the application's state manager to store the application state. */ + stateStorage?: Object; + /** Indicates whether on not to use the title of the previously displayed view as text on the Back button. */ + useViewTitleAsBackText?: boolean; + /** A custom view cache to be used in the application. */ + viewCache?: Object; + /** Specifies a limit for the views that can be cached. */ + viewCacheSize?: number; + /** Specifies the current version of application templates. */ + templatesVersion?: string; + /** Specifies options for the viewport meta tag of a mobile browser. */ + viewPort?: JQuery; + /** A custom router to be used in the application. */ + router?: Router; + } + /** An object used to manage views, as well as control the application life cycle. */ + export class HtmlApplication implements EventsMixin { + constructor(options: HtmlApplicationOptions); + afterViewSetup: JQueryCallback; + beforeViewSetup: JQueryCallback; + initialized: JQueryCallback; + navigating: JQueryCallback; + navigatingBack: JQueryCallback; + resolveLayoutController: JQueryCallback; + resolveViewCacheKey: JQueryCallback; + viewDisposed: JQueryCallback; + viewDisposing: JQueryCallback; + viewHidden: JQueryCallback; + viewRendered: JQueryCallback; + viewShowing: JQueryCallback; + viewShown: JQueryCallback; + /** Provides access to the ViewCache object. */ + viewCache: ViewCache; + /** An array of dxCommand components that are created based on the application's navigation option value. */ + navigation: Array; + /** Provides access to the StateManager object. */ + stateManager: StateManager; + /** Provides access to the Router object. */ + router: Router; + /** Navigates to the URI preceding the current one in the navigation history. */ + back(): void; + /** Returns a Boolean value indicating whether or not backwards navigation is currently possible. */ + canBack(): boolean; + /** Calls the clearState() method of the application's StateManager object. */ + clearState(): void; + /** Creates global navigation commands. */ + createNavigation(navigationConfig: Array): void; + /** Returns an HTML template of the specified view. */ + getViewTemplate(viewName: string): JQuery; + /** Returns a configuration object used to create a dxView component for a specified view. */ + getViewTemplateInfo(viewName: string): Object; + /** Adds a specified HTML template to a collection of view or layout templates. */ + loadTemplates(source: any): JQueryPromise; + /** Navigates to the specified URI. */ + navigate(uri?: any, options?: Object): void; + /** Renders navigation commands to the navigation command containers that are located in the layouts used in the application. */ + renderNavigation(): void; + /** Calls the restoreState() method of the application's StateManager object. */ + restoreState(): void; + /** Calls the saveState method of the application's StateManager object. */ + saveState(): void; + /** Provides access to the object that defines the current context to be considered when choosing an appropriate template for a view. */ + templateContext(): Object; + on(eventName: "initialized", eventHandler: () => void): HtmlApplication; + on(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + on(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + on(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + on(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: string, eventHandler: Function): HtmlApplication; + on(events: { [eventName: string]: Function; }): HtmlApplication; + off(eventName: "initialized"): HtmlApplication; + off(eventName: "afterViewSetup"): HtmlApplication; + off(eventName: "beforeViewSetup"): HtmlApplication; + off(eventName: "navigating"): HtmlApplication; + off(eventName: "navigatingBack"): HtmlApplication; + off(eventName: "resolveLayoutController"): HtmlApplication; + off(eventName: "resolveViewCacheKey"): HtmlApplication; + off(eventName: "viewDisposed"): HtmlApplication; + off(eventName: "viewDisposing"): HtmlApplication; + off(eventName: "viewHidden"): HtmlApplication; + off(eventName: "viewRendered"): HtmlApplication; + off(eventName: "viewShowing"): HtmlApplication; + off(eventName: "viewShown"): HtmlApplication; + off(eventName: string): HtmlApplication; + off(eventName: "initialized", eventHandler: () => void): HtmlApplication; + off(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + off(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + off(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + off(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: string, eventHandler: Function): HtmlApplication; + } + } +} +declare module DevExpress.viz.core { + /** + * Applies a theme for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. + */ + export function currentTheme(theme: string): void; + /** + * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. + */ + export function currentTheme(platform: string, colorScheme: string): void; + /** + * Registers a new theme based on the existing one. + * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. + */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** + * Applies a predefined or registered custom palette to all visualization widgets at once. + * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. + */ + export function currentPalette(paletteName: string): void; + /** + * Obtains the color sets of a predefined or registered palette. + * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. + */ + export function getPalette(paletteName: string): Object; + /** + * Registers a new palette. + * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. + */ + export function registerPalette(paletteName: string, palette: Object): void; + export interface Border { + /** Sets a border color for a selected series. */ + color?: string; + /** Sets border visibility for a selected series. */ + visible?: boolean; + /** Sets a border width for a selected series. */ + width?: number; + } + export interface DashedBorder extends Border { + /** Specifies a dash style for the border of a selected series point. */ + dashStyle?: string; + } + export interface DashedBorderWithOpacity extends DashedBorder { + /** Specifies the opacity of the tooltip's border. */ + opacity?: number; + } + export interface Font { + /** Specifies the font color for a strip label. */ + color?: string; + /** Specifies the font family for a strip label. */ + family?: string; + /** Specifies the font opacity for a strip label. */ + opacity?: number; + /** Specifies the font size for a strip label. */ + size?: any; + /** Specifies the font weight for the text displayed in strips. */ + weight?: number; + } + export interface Hatching { + direction?: string; + /** Specifies the opacity of hatching lines. */ + opacity?: number; + /** Specifies the distance between hatching lines in pixels. */ + step?: number; + /** Specifies the width of hatching lines in pixels. */ + width?: number; + } + export interface Margins { + /** Specifies the distance in pixels between the bottom side of the title and the surrounding widget elements. */ + bottom?: number; + /** Specifies the distance in pixels between the left side of the title and the surrounding widget elements. */ + left?: number; + /** Specifies the distance between the right side of the title and surrounding widget elements in pixels. */ + right?: number; + /** Specifies the distance between the top side of the title and surrounding widget elements in pixels. */ + top?: number; + } + export interface Size { + /** Specifies the width of the widget. */ + width?: number; + /** Specifies the height of the widget. */ + height?: number; + } + export interface Title { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies the widget title's horizontal position. */ + horizontalAlignment?: string; + /** Specifies the widget title's position in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the distance between the title and surrounding widget elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies text for the title. */ + text?: string; + /** Specifies a subtitle for the widget. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } + } + export interface Tooltip { + /** Specifies the length of the tooltip's arrow in pixels. */ + arrowLength?: number; + /** Specifies the appearance of the tooltip's border. */ + border?: viz.core.DashedBorderWithOpacity; + /** Specifies a color for the tooltip. */ + color?: string; + /** Specifies the z-index for tooltips. */ + zIndex?: number; + /** Specifies the container to draw tooltips inside of it. */ + container?: any; + /** Specifies text and appearance of a set of tooltips. */ + customizeTooltip?: (arg: Object) => { color?: string; text?: string }; + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies font options for the text displayed by the tooltip. */ + font?: Font; + /** Specifies a format for the text displayed by the tooltip. */ + format?: string; + /** Specifies the opacity of a tooltip. */ + opacity?: number; + /** Specifies a distance from the tooltip's left/right boundaries to the inner text in pixels. */ + paddingLeftRight?: number; + /** Specifies a distance from the tooltip's top/bottom boundaries to the inner text in pixels. */ + paddingTopBottom?: number; + /** Specifies a precision for formatted values displayed by the tooltip. */ + precision?: number; + /** Specifies options of the tooltip's shadow. */ + shadow?: { + /** Specifies the blur distance of the tooltip's shadow. */ + blur?: number; + /** Specifies the color of the tooltip's shadow. */ + color?: string; + /** Specifies the horizontal offset of the tooltip's shadow relative to the tooltip in pixels. */ + offsetX?: number; + /** Specifies the vertical offset of the tooltip's shadow relative to the tooltip in pixels. */ + offsetY?: number; + /** Specifies the opacity of the tooltip's shadow. */ + opacity?: number; + }; + } + export interface Animation { + /** Determines how long animation runs. */ + duration?: number; + /** Specifies the animation easing mode. */ + easing?: string; + /** Indicates whether or not animation is enabled. */ + enabled?: boolean; + } + export interface LoadingIndicator { + /** Specifies a color for the loading indicator background. */ + backgroundColor?: string; + /** Specifies font options for the loading indicator text. */ + font?: viz.core.Font; + /** Specifies whether to show the loading indicator or not. */ + show?: boolean; + /** Specifies a text to be displayed by the loading indicator. */ + text?: string; + } + export interface LegendBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies a radius for the corners of the legend border. */ + cornerRadius?: number; + } + export interface BaseLegend { + /** Specifies the color of the legend's background. */ + backgroundColor?: string; + /** Specifies legend border settings. */ + border?: viz.core.LegendBorder; + /** Specifies how many columns must be taken to arrange legend items. */ + columnCount?: number; + /** Specifies the spacing between a pair of neighboring legend columns in pixels. */ + columnItemSpacing?: number; + /** Specifies font options for legend items. */ + font?: viz.core.Font; + /** Specifies the legend's position on the map. */ + horizontalAlignment?: string; + /** Specifies the alignment of legend items. */ + itemsAlignment?: string; + /** Specifies the position of text relative to the item marker. */ + itemTextPosition?: string; + /** Specifies the distance between the legend and the container borders in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of item markers in the legend in pixels. */ + markerSize?: number; + /** Specifies whether to arrange legend items horizontally or vertically. */ + orientation?: string; + /** Specifies the spacing between the legend left/right border and legend items in pixels. */ + paddingLeftRight?: number; + /** Specifies the spacing between the legend top/bottom border and legend items in pixels. */ + paddingTopBottom?: number; + /** Specifies how many rows must be taken to arrange legend items. */ + rowCount?: number; + /** Specifies the spacing between a pair of neighboring legend rows in pixels. */ + rowItemSpacing?: number; + /** Specifies the legend's position on the map. */ + verticalAlignment?: string; + /** Specifies whether or not the legend is visible on the map. */ + visible?: boolean; + } + export interface BaseWidgetOptions extends DOMComponentOptions { + /** A handler for the drawn event. */ + onDrawn?: (e: { + component: BaseWidget; + element: Element; + }) => void; + /** A handler for the incidentOccurred event. */ + onIncidentOccurred?: ( + component: BaseWidget, + element: Element, + target: { + id: string; + type: string; + args: any; + text: string; + widget: string; + version: string; + } + ) => void; + /** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */ + pathModified?: boolean; + /** Specifies whether or not the widget supports right-to-left representation. */ + rtlEnabled?: boolean; + /** Sets the name of the theme to be used in the widget. */ + theme?: string; + } + /** This section describes options and methods that are common to all widgets. */ + export class BaseWidget extends DOMComponent { + /** Returns the widget's SVG markup. */ + svg(): string; + } +} +declare module DevExpress.viz.charts { + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface BaseSeries { + /** Provides information about the state of the series object. */ + fullState: number; + /** Returns the type of the series. */ + type: string; + /** Unselects all the selected points of the series. The points are displayed in an initial style. */ + clearSelection(): void; + /** Gets the color of a particular series. */ + getColor(): string; + /** Gets points from the series point collection based on the specified argument. */ + getPointsByArg(pointArg: any): Array; + /** Gets a point from the series point collection based on the specified point position. */ + getPointByPos(positionIndex: number): Object; + /** Selects the series. The series is displayed in a 'selected' style until another series is selected or the current series is deselected programmatically. */ + select(): void; + /** Selects the specified point. The point is displayed in a 'selected' style. */ + selectPoint(point: BasePoint): void; + /** Deselects the specified point. The point is displayed in an initial style. */ + deselectPoint(point: BasePoint): void; + /** Returns an array of all points in the series. */ + getAllPoints(): Array; + /** Returns visible series points. */ + getVisiblePoints(): Array; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): boolean; + /** Provides information about the selection state of a series. */ + isSelected(): boolean; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface BasePoint { + /** Provides information about the state of the point object. */ + fullState: number; + /** Returns the point's argument value that was set in the data source. */ + originalArgument: any; + /** Returns the point's value that was set in the data source. */ + originalValue: any; + /** Returns the tag of the point. */ + tag: string; + /** Deselects the point. */ + clearSelection(): void; + /** Gets the color of a particular point. */ + getColor(): string; + /** Hides the tooltip of the point. */ + hideTooltip(): void; + /** Provides information about the hover state of a point. */ + isHovered(): boolean; + /** Provides information about the selection state of a point. */ + isSelected(): boolean; + /** Selects the point. The point is displayed in a 'selected' style until another point is selected or the current point is deselected programmatically. */ + select(): void; + /** Shows the tooltip of the point. */ + showTooltip(): void; + /** Allows you to obtain the label of a series point. */ + getLabel(): any; + /** Returns the series object to which the point belongs. */ + series: BaseSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface ChartSeries extends BaseSeries { + /** Returns the name of the series pane. */ + pane: string; + /** Returns the name of the value axis of the series. */ + axis: string; + selectPoint(point: ChartPoint): void; + deselectPoint(point: ChartPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface ChartPoint extends BasePoint { + /** Contains the close value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalCloseValue: any; + /** Contains the high value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalHighValue: any; + /** Contains the low value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalLowValue: any; + /** Contains the first value of the point. This field is useful for points belonging to a series of the range area or range bar type only. */ + originalMinValue: any; + /** Contains the open value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalOpenValue: any; + /** Contains the size of the bubble as it was set in the data source. This field is useful for points belonging to a series of the bubble type only. */ + size: any; + /** Gets the parameters of the point's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + series: ChartSeries; + } + /** This section describes the methods that can be used in code to manipulate the Label object. */ + export interface Label { + /** Gets the parameters of the label's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + /** Hides the point label. */ + hide(): void; + /** Shows the point label. */ + show(): void; + } + export interface PieSeries extends BaseSeries { + selectPoint(point: PiePoint): void; + deselectPoint(point: PiePoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PiePoint extends BasePoint { + /** Gets the percentage value of the specific point. */ + percent: any; + /** Provides information about the visibility state of a point. */ + isVisible(): boolean; + /** Makes a specific point visible. */ + show(): void; + /** Hides a specific point. */ + hide(): void; + series: PieSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface PolarSeries extends BaseSeries { + /** Returns the name of the value axis of the series. */ + axis: string; + selectPoint(point: PolarPoint): void; + deselectPoint(point: PolarPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PolarPoint extends BasePoint { + series: PolarSeries; + } + export interface Strip { + /** Specifies a color for a strip. */ + color?: string; + /** An object that defines the label configuration options of a strip. */ + label?: { + /** Specifies the text displayed in a strip. */ + text?: string; + }; + /** Specifies a start value for a strip. */ + startValue?: any; + /** Specifies an end value for a strip. */ + endValue?: any; + } + export interface BaseSeriesConfigLabel { + /** Specifies a format for arguments displayed by point labels. */ + argumentFormat?: string; + /** Specifies a precision for formatted point arguments displayed in point labels. */ + argumentPrecision?: number; + /** Specifies a background color for point labels. */ + backgroundColor?: string; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies connector options for series point labels. */ + connector?: { + /** Specifies the color of label connectors. */ + color?: string; + /** Indicates whether or not label connectors are visible. */ + visible?: boolean; + /** Specifies the width of label connectors. */ + width?: number; + }; + /** Specifies a callback function that returns the text to be displayed by point labels. */ + customizeText?: (pointInfo: Object) => string; + /** Specifies font options for the text displayed in point labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed by point labels. */ + format?: string; + position?: string; + /** Specifies a precision for formatted point values displayed in point labels. */ + precision?: number; + /** Specifies the angle used to rotate point labels from their initial position. */ + rotationAngle?: number; + /** Specifies the visibility of point labels. */ + visible?: boolean; + } + export interface SeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies whether or not to show a label when the point has a zero value. */ + showForZeroValues?: boolean; + } + export interface ChartSeriesConfigLabel extends SeriesConfigLabel { + /** Specifies how to align point labels relative to the corresponding data points that they represent. */ + alignment?: string; + /** Specifies how to shift point labels horizontally from their initial positions. */ + horizontalOffset?: number; + /** Specifies how to shift point labels vertically from their initial positions. */ + verticalOffset?: number; + /** Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. */ + percentPrecision?: number; + } + export interface BaseCommonSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + axis?: string; + /** An object defining the label configuration options for a series in the dxChart widget. */ + label?: ChartSeriesConfigLabel; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the dash style of the series' line. */ + dashStyle?: string; + hoverMode?: string; + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /**

Sets a color for a series when it is hovered over.

*/ + color?: string; + /** Specifies the dash style for the line in a hovered series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a hovered series. */ + width?: number; + }; + /** Specifies whether a chart ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies the minimal length of a displayed bar in pixels. */ + minBarSize?: number; + /** Specifies opacity for a series. */ + opacity?: number; + /** Specifies the series elements to highlight when the series is selected. */ + selectionMode?: string; + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the dash style for the line in a selected series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a selected series. */ + width?: number; + }; + /** Specifies whether or not to show the series in the chart's legend. */ + showInLegend?: boolean; + /** Specifies the name of the stack where the values of the _stackedBar_ series must be located. */ + stack?: string; + /** Specifies the name of the data source field that provides data about a point. */ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + /** Specifies the visibility of a series. */ + visible?: boolean; + /** Specifies a line width. */ + width?: number; + /** Configures error bars. */ + valueErrorBar?: { + /** Specifies whether error bars must be displayed in full or partially. */ + displayMode?: string; + /** Specifies the data field that provides data for low error values. */ + lowValueField?: string; + /** Specifies the data field that provides data for high error values. */ + highValueField?: string; + /** Specifies how error bar values must be calculated. */ + type?: string; + /** Specifies the value to be used for generating error bars. */ + value?: number; + /** Specifies the color of error bars. */ + color?: string; + /** Specifies the opacity of error bars. */ + opacity?: number; + /** Specifies the length of the lines that indicate the error bar edges. */ + edgeLength?: number; + /** Specifies the width of the error bar line. */ + lineWidth?: number; + }; + } + export interface CommonPointOptions { + /** Specifies border options for points in the line and area series. */ + border?: viz.core.Border; + /** Specifies the points color. */ + color?: string; + /** Specifies what series points to highlight when a point is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered point. */ + hoverStyle?: { + /** An object defining the border options for a hovered point. */ + border?: viz.core.Border; + /** Sets a color for a point when it is hovered over. */ + color?: string; + /** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies what series points to highlight when a point is selected. */ + selectionMode?: string; + /** An object defining configuration options for a selected point. */ + selectionStyle?: { + /** An object defining the border options for a selected point. */ + border?: viz.core.Border; + /**

Sets a color for a point when it is selected.

*/ + color?: string; + /** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */ + size?: number; + /** Specifies a symbol for presenting points of the line and area series. */ + symbol?: string; + visible?: boolean; + } + export interface ChartCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: any; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: any; + /** Specifies the width of an image that is used as a point marker. */ + width?: any; + }; + } + export interface PolarCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: number; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: string; + /** Specifies the width of an image that is used as a point marker. */ + width?: number; + }; + } + /** An object that defines configuration options for chart series. */ + export interface CommonSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies the data source field that provides a 'close' value for a _candleStick_ or _stock_ series. */ + closeValueField?: string; + /** Specifies a radius for bar corners. */ + cornerRadius?: number; + /** Specifies the data source field that provides a 'high' value for a _candleStick_ or _stock_ series. */ + highValueField?: string; + /** Specifies the color for the body (rectangle) of a _candleStick_ series. */ + innerColor?: string; + /** Specifies the data source field that provides a 'low' value for a _candleStick_ or _stock_ series. */ + lowValueField?: string; + /** Specifies the data source field that provides an 'open' value for a _candleStick_ or _stock_ series. */ + openValueField?: string; + /** Specifies the pane that will be used to display a series. */ + pane?: string; + /** An object defining configuration options for points in line-, scatter- and area-like series. */ + point?: ChartCommonPointOptions; + /** Specifies the data source field that provides values for one end of a range series. To set the data source field for the other end of the range series, use the rangeValue2Field property. */ + rangeValue1Field?: string; + /** Specifies the data source field that provides values for the second end of a range series. To set the data source field for the other end of the range series, use the rangeValue1Field property. */ + rangeValue2Field?: string; + /** Specifies reduction options for the stock or candleStick series. */ + reduction?: { + /** Specifies a color for the points whose reduction level price is lower in comparison to the value in the previous point. */ + color?: string; + /** Specifies for which price level (open, high, low or close) to enable reduction options in the series. */ + level?: string; + }; + /** Specifies the data source field that defines the size of bubbles. */ + sizeField?: string; + } + export interface CommonSeriesSettings extends CommonSeriesConfig { + /**

An object that specifies configuration options for all series of the area type in the chart.

*/ + area?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the bubble type in the chart. */ + bubble?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _candleStick_ type in the chart. */ + candlestick?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedArea_ type in the chart. */ + fullstackedarea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Full-Stacked Spline Area type in the chart. */ + fullstackedsplinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedBar_ type in the chart. */ + fullstackedbar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedLine_ type in the chart. */ + fullstackedline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Full-Stacked Spline type in the chart. */ + fullstackedspline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _rangeArea_ type in the chart. */ + rangearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _rangeBar_ type in the chart. */ + rangebar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _spline_ type in the chart. */ + spline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _splineArea_ type in the chart. */ + splinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedArea_ type in the chart. */ + stackedarea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Stacked Spline Area type in the chart. */ + stackedsplinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedLine_ type in the chart. */ + stackedline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Stacked Spline type in the chart. */ + stackedspline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stepArea_ type in the chart. */ + steparea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stepLine_ type in the chart. */ + stepline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stock_ type in the chart. */ + stock?: CommonSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface SeriesConfig extends CommonSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + /** An object that defines configuration options for polar chart series. */ + export interface CommonPolarSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies whether or not to close the chart by joining the end point with the first point. */ + closed?: boolean; + label?: SeriesConfigLabel; + point?: PolarCommonPointOptions; + } + export interface CommonPolarSeriesSettings extends CommonPolarSeriesConfig { + /** An object that specifies configuration options for all series of the area type in the chart. */ + area?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonPolarSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface PolarSeriesConfig extends CommonPolarSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + export interface PieSeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies how to shift labels from their initial position in a radial direction in pixels. */ + radialOffset?: number; + /** Specifies a precision for the percentage values displayed in labels. */ + percentPrecision?: number; + } + /** An object that defines configuration options for chart series. */ + export interface CommonPieSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + /** Specifies the required type for series arguments. */ + argumentType?: string; + /** An object defining the series border configuration options. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the chart elements to highlight when a series is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered series. */ + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /** Sets a color for the series when it is hovered over. */ + color?: string; + /** Specifies the hatching options to be applied when a point is hovered over. */ + hatching?: viz.core.Hatching; + }; + /** + * Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. + * @deprecated Use the innerRadius option instead. + */ + innerRadius?: number; + /** An object defining the label configuration options. */ + label?: PieSeriesConfigLabel; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies a minimal size of a displayed pie segment. */ + minSegmentSize?: number; + /** + * Specifies the direction in which the dxPieChart series points are located. + * @deprecated Use the segmentsDirection option instead. + */ + segmentsDirection?: string; + /**

Specifies the chart elements to highlight when the series is selected.

*/ + selectionMode?: string; + /** An object defining configuration options for the series when it is selected. */ + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the hatching options to be applied when a point is selected. */ + hatching?: viz.core.Hatching; + }; + /** Specifies chart segment grouping options. */ + smallValuesGrouping?: { + /** Specifies the name of the grouped chart segment. This name represents the segment in the chart legend. */ + groupName?: string; + /** Specifies the segment grouping mode. */ + mode?: string; + /** Specifies a threshold for segment values. */ + threshold?: number; + /** Specifies how many segments must not be grouped. */ + topCount?: number; + }; + /** + * Specifies a start angle for a pie chart in arc degrees. + * @deprecated Use the startAngle option instead. + */ + startAngle?: number; + /**

Specifies the name of the data source field that provides data about a point.

*/ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + } + export interface CommonPieSeriesSettings extends CommonPieSeriesConfig { + /** + * Specifies the type of the pie chart series. + * @deprecated Use the type option instead. + */ + type?: string; + } + export interface PieSeriesConfig extends CommonPieSeriesConfig { + /** + * Sets the series type. + * @deprecated Use the type option instead. + */ + type?: string; + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + } + export interface SeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => SeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface PolarSeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => PolarSeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface ChartCommonConstantLineLabel { + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + /** Specifies the position of the constant line label relative to the chart plot. */ + position?: string; + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + } + export interface PolarCommonConstantLineLabel { + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + } + export interface ConstantLineStyle { + /** Specifies a color for a constant line. */ + color?: string; + /** Specifies a dash style for a constant line. */ + dashStyle?: string; + /** Specifies a constant line width in pixels. */ + width?: number; + } + export interface ChartCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartCommonConstantLineLabel; + /** Specifies the space between the constant line label and the left/right side of the constant line. */ + paddingLeftRight?: number; + /** Specifies the space between the constant line label and the top/bottom side of the constant line. */ + paddingTopBottom?: number; + } + export interface PolarCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarCommonConstantLineLabel; + } + export interface CommonAxisLabel { + /** Specifies font options for axis labels. */ + font?: viz.core.Font; + /** Specifies the spacing between an axis and its labels in pixels. */ + indentFromAxis?: number; + /** Indicates whether or not axis labels are visible. */ + visible?: boolean; + } + export interface ChartCommonAxisLabel extends CommonAxisLabel { + /** Specifies the label's position relative to the tick (grid line). */ + alignment?: string; + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: { + /** Specifies how to arrange axis labels. */ + mode?: string; + /** Specifies the angle used to rotate axis labels. */ + rotationAngle?: number; + /** Specifies the spacing that must be set between staggered rows when the 'stagger' algorithm is applied. */ + staggeringSpacing?: number; + }; + } + export interface PolarCommonAxisLabel extends CommonAxisLabel { + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: string; + } + export interface CommonAxisTitle { + /** Specifies font options for an axis title. */ + font?: viz.core.Font; + /** Specifies a margin for an axis title in pixels. */ + margin?: number; + } + export interface BaseCommonAxisSettings { + /** Specifies the color of the line that represents an axis. */ + color?: string; + /** Specifies whether ticks/grid lines of a discrete axis are located between labels or cross the labels. */ + discreteAxisDivisionMode?: string; + /** An object defining the configuration options for the grid lines of an axis in the dxPolarChart widget. */ + grid?: { + /** Specifies a color for grid lines. */ + color?: string; + /** Specifies an opacity for grid lines. */ + opacity?: number; + /** Indicates whether or not the grid lines of an axis are visible. */ + visible?: boolean; + /** Specifies the width of grid lines. */ + width?: number; + }; + /** Specifies the options of the minor grid. */ + minorGrid?: { + /** Specifies a color for the lines of the minor grid. */ + color?: string; + /** Specifies an opacity for the lines of the minor grid. */ + opacity?: number; + /** Indicates whether the minor grid is visible or not. */ + visible?: boolean; + /** Specifies a width for the lines of the minor grid. */ + width?: number; + }; + /** Indicates whether or not an axis is inverted. */ + inverted?: boolean; + /** Specifies the opacity of the line that represents an axis. */ + opacity?: number; + /** Indicates whether or not to set ticks/grid lines of a continuous axis of the 'date-time' type at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** An object defining the configuration options for axis ticks. */ + tick?: { + /** Specifies ticks color. */ + color?: string; + /** Specifies tick opacity. */ + opacity?: number; + /** Indicates whether or not ticks are visible on an axis. */ + visible?: boolean; + /** Specifies tick width. */ + width?: number; + /** Specifies tick length. */ + length?: number; + }; + /** Specifies the options of the minor ticks. */ + minorTick?: { + /** Specifies a color for the minor ticks. */ + color?: string; + /** Specifies an opacity for the minor ticks. */ + opacity?: number; + /** Indicates whether or not the minor ticks are displayed on an axis. */ + visible?: boolean; + /** Specifies minor tick width. */ + width?: number; + /** Specifies minor tick length. */ + length?: number; + }; + /** Indicates whether or not the line that represents an axis in a chart is visible. */ + visible?: boolean; + /** Specifies the width of the line that represents an axis in the chart. */ + width?: number; + } + export interface ChartCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxChart widget. */ + label?: ChartCommonAxisLabel; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + /** Specifies, in pixels, the space reserved for an axis. */ + placeholderSize?: number; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + /** Specifies the label's position on a strip. */ + horizontalAlignment?: string; + /** Specifies a label's position on a strip. */ + verticalAlignment?: string; + }; + /** Specifies the spacing, in pixels, between the left/right strip border and the strip label. */ + paddingLeftRight?: number; + /** Specifies the spacing, in pixels, between the top/bottom strip borders and the strip label. */ + paddingTopBottom?: number; + }; + /** An object defining the title configuration options that are common for all axes in the dxChart widget. */ + title?: CommonAxisTitle; + /** Indicates whether or not to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + } + export interface PolarCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: PolarCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxPolarChart widget. */ + label?: PolarCommonAxisLabel; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + }; + }; + } + export interface ChartConstantLineLabel extends ChartCommonConstantLineLabel { + /** Specifies the horizontal alignment of a constant line label. */ + horizontalAlignment?: string; + /** Specifies the vertical alignment of a constant line label. */ + verticalAlignment?: string; + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface PolarConstantLineLabel extends PolarCommonConstantLineLabel { + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface AxisLabel { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */ + customizeHint?: (argument: { value: any; valueText: string }) => string; + /** Specifies a callback function that returns the text to be displayed in value axis labels. */ + customizeText?: (argument: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed by axis labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the axis labels. */ + precision?: number; + } + export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { } + export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { } + export interface AxisTitle extends CommonAxisTitle { + /** Specifies the text for the value axis title. */ + text?: string; + } + export interface ChartConstantLineStyle extends ChartCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartConstantLineLabel; + } + export interface ChartConstantLine extends ChartConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface PolarConstantLine extends PolarCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface Axis { + /** Specifies a coefficient for dividing the value axis. */ + axisDivisionFactor?: number; + /** Specifies the order in which discrete values are arranged on the value axis. */ + categories?: Array; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic axis. */ + logarithmBase?: number; + /** Specifies an interval between axis ticks/grid lines. */ + tickInterval?: any; + /** Specifies the interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the number of minor ticks between two neighboring major ticks. */ + minorTickCount?: number; + /** Specifies the required type of the value axis. */ + type?: string; + /** Specifies the pane on which the current value axis will be displayed. */ + pane?: string; + /** Specifies options for value axis strips. */ + strips?: Array; + } + export interface ChartAxis extends ChartCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies the appearance options for the constant lines of the value axis. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** Specifies options for value axis labels. */ + label?: ChartAxisLabel; + /** Specifies the maximum value on the value axis. */ + max?: any; + /** Specifies the minimum value on the value axis. */ + min?: any; + /** Specifies the position of the value axis on a chart. */ + position?: string; + /** Specifies the title for a value axis. */ + title?: any; + } + export interface PolarAxis extends PolarCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies options for value axis labels. */ + label?: PolarAxisLabel; + } + export interface ArgumentAxis { + /** Specifies the desired type of axis values. */ + argumentType?: string; + /** Specifies the elements that will be highlighted when the argument axis is hovered over. */ + hoverMode?: string; + } + export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis { } + export interface PolarArgumentAxis extends PolarAxis, ArgumentAxis { + /** Specifies the angle in arc degrees to which the argument axis should be rotated. The positive values rotate the axis clockwise. */ + startAngle?: number; + /** Specifies whether or not to display the first point at the angle specified by the startAngle option. */ + firstPointOnStartAngle?: boolean; + /** Specifies the value to be used as the origin for the argument axis. */ + originValue?: number; + /** Specifies the period of the argument values in the data source. */ + period?: number; + } + export interface ValueAxis { + /** Specifies the name of the value axis. */ + name?: string; + /** Specifies whether or not to indicate a zero value on the value axis. */ + showZero?: boolean; + /** Specifies the desired type of axis values. */ + valueType?: string; + } + export interface ChartValueAxis extends ChartAxis, ValueAxis { + /** Specifies the spacing, in pixels, between multiple value axes in a chart. */ + multipleAxesSpacing?: number; + /** Specifies the value by which the chart's value axes are synchronized. */ + synchronizedValue?: number; + } + export interface PolarValueAxis extends PolarAxis, ValueAxis { + /** Indicates whether to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + tick?: { + visible?: boolean; + } + } + export interface CommonPane { + /** Specifies a background color in a pane. */ + backgroundColor?: string; + /** Specifies the border options of a chart's pane. */ + border?: PaneBorder; + } + export interface Pane extends CommonPane { + /** Specifies the name of a pane. */ + name?: string; + } + export interface PaneBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies the bottom border's visibility state in a pane. */ + bottom?: boolean; + /** Specifies the left border's visibility state in a pane. */ + left?: boolean; + /** Specifies the right border's visibility state in a pane. */ + right?: boolean; + /** Specifies the top border's visibility state in a pane. */ + top?: boolean; + } + export interface ChartAnimation extends viz.core.Animation { + /** Specifies the maximum series point count in the chart that the animation supports. */ + maxPointCountSupported?: number; + } + export interface BaseChartTooltip extends viz.core.Tooltip { + /** Specifies a format for arguments of the chart's series points. */ + argumentFormat?: string; + /** Specifies a precision for formatted arguments displayed in tooltips. */ + argumentPrecision?: number; + /** Specifies a precision for a percent value displayed in tooltips for stacked series and dxPieChart series. */ + percentPrecision?: number; + } + export interface BaseChartOptions extends viz.core.BaseWidgetOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies the width of the widget that is small enough for the layout to begin adapting. */ + width?: number; + /** Specifies the height of the widget that is small enough for the layout to begin adapting. */ + height?: number; + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies animation options. */ + animation?: ChartAnimation; + /** Specifies a callback function that returns an object with options for a specific point label. */ + customizeLabel?: (labelInfo: Object) => Object; + /** Specifies a callback function that returns an object with options for a specific point. */ + customizePoint?: (pointInfo: Object) => Object; + /** Specifies a data source for the chart. */ + dataSource?: any; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies options of a dxChart's (dxPieChart's) legend. */ + legend?: core.BaseLegend; + /** Specifies the blank space between the chart's extreme elements and the boundaries of the area provided for the widget (see size) in pixels. */ + margin?: viz.core.Margins; + /** Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** A handler for the done event. */ + onDone?: (e: { + component: BaseChart; + element: Element; + }) => void; + /** A handler for the pointClick event. */ + onPointClick?: any; + /** A handler for the pointHoverChanged event. */ + onPointHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + /** A handler for the pointSelectionChanged event. */ + onPointSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + /** Specifies whether a single point or multiple points can be selected in the chart. */ + pointSelectionMode?: string; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies options for the dxChart and dxPieChart widget series. */ + series?: any; + /** Specifies the size of the widget in pixels. */ + size?: viz.core.Size; + /** Specifies a title for the chart. */ + title?: viz.core.Title; + /** Specifies tooltip options. */ + tooltip?: BaseChartTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + } + /** A base class for all chart widgets included in the ChartJS library. */ + export class BaseChart extends viz.core.BaseWidget { + /** Deselects the chart's selected series. The series is displayed in an initial style. */ + clearSelection(): void; + /** Gets the current size of the widget. */ + getSize(): { width: number; height: number }; + /** Returns an array of all series in the chart. */ + getAllSeries(): Array; + /** Gets a series within the chart's series collection by the specified name (see the name option). */ + getSeriesByName(seriesName: string): BaseSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): BaseSeries; + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Hides all widget tooltips. */ + hideTooltip(): void; + /** Redraws a widget. */ + render(renderOptions?: { + force?: boolean; + animate?: boolean; + asyncSeriesRendering?: boolean; + }): void; + } + export interface AdvancedLegend extends core.BaseLegend { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /**

Specifies a callback function that returns the text to be displayed by legend items.

*/ + customizeText?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /** Specifies what series elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + } + export interface AdvancedOptions extends BaseChartOptions { + /** A handler for the argumentAxisClick event. */ + onArgumentAxisClick?: any; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate the values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort the series points. */ + sortingMethod?: any; + }; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** A handler for the seriesClick event. */ + onSeriesClick?: any; + /** A handler for the seriesHoverChanged event. */ + onSeriesHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** A handler for the seriesSelectionChanged event. */ + onSeriesSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** Specifies whether a single series or multiple series can be selected in the chart. */ + seriesSelectionMode?: string; + /** Specifies how the chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + /** Specifies whether or not all bars in a series must have the same angle, or may have different angles if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; + /** Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ + negativesAsZeroes?: boolean; + } + export interface Legend extends AdvancedLegend { + /** Specifies whether the legend is located outside or inside the chart's plot. */ + position?: string; + } + export interface ChartTooltip extends BaseChartTooltip { + /** Specifies whether the tooltip must be located in the center of a bar or on its edge. Applies to the Bar and Bubble series. */ + location?: string; + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxChartOptions extends AdvancedOptions { + adaptiveLayout?: { + keepLabels?: boolean; + }; + /** Indicates whether or not to synchronize value axes when they are displayed on a single pane. */ + synchronizeMultiAxes?: boolean; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Indicates whether or not to adjust a value axis to the current minimum and maximum values of a zoomed chart. */ + adjustOnZoom?: boolean; + /** Specifies argument axis options for the dxChart widget. */ + argumentAxis?: ChartArgumentAxis; + /** An object defining the configuration options that are common for all axes of the dxChart widget. */ + commonAxisSettings?: ChartCommonAxisSettings; + /** An object defining the configuration options that are common for all panes in the dxChart widget. */ + commonPaneSettings?: CommonPane; + /** An object defining the configuration options that are common for all series of the dxChart widget. */ + commonSeriesSettings?: CommonSeriesSettings; + /** An object that specifies the appearance options of the chart crosshair. */ + crosshair?: { + /** Specifies a color for the crosshair lines. */ + color?: string; + /** Specifies a dash style for the crosshair lines. */ + dashStyle?: string; + /** Specifies whether to enable the crosshair or not. */ + enabled?: boolean; + /** Specifies the opacity of the crosshair lines. */ + opacity?: number; + /** Specifies the width of the crosshair lines. */ + width?: number; + /** Specifies the appearance of the horizontal crosshair line. */ + horizontalLine?: CrosshaierWithLabel; + /** Specifies the appearance of the vertical crosshair line. */ + verticalLine?: CrosshaierWithLabel; + /** Specifies the options of the crosshair labels. */ + label?: { + /** Specifies a color for the background of the crosshair labels. */ + backgroundColor?: string; + /** Specifies whether the crosshair labels are visible or not. */ + visible?: boolean; + /** Specifies font options for the text of the crosshair labels. */ + font?: viz.core.Font; + /** Specifies the format of the values displayed by crosshair labels. */ + format?: string; + /** Specifies a precision for formatted values. */ + precision?: number; + /** Customizes the text displayed by the crosshair labels. */ + customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; + } + }; + /** Specifies a default pane for the chart series. */ + defaultPane?: string; + /** Specifies a coefficient determining the diameter of the largest bubble. */ + maxBubbleSize?: number; + /** Specifies the diameter of the smallest bubble measured in pixels. */ + minBubbleSize?: number; + /** Defines the dxChart widget's pane(s). */ + panes?: Array; + /** Swaps the axes round so that the value axis becomes horizontal and the argument axes becomes vertical. */ + rotated?: boolean; + /** Specifies the options of a chart's legend. */ + legend?: Legend; + /** Specifies options for dxChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: SeriesTemplate; + /** Specifies tooltip options. */ + tooltip?: ChartTooltip; + /** Specifies value axis options for the dxChart widget. */ + valueAxis?: Array; + /** Enables scrolling in your chart. */ + scrollingMode?: string; + /** Enables zooming in your chart. */ + zoomingMode?: string; + /** Specifies the settings of the scroll bar. */ + scrollBar?: { + /** Specifies whether the scroll bar is visible or not. */ + visible?: boolean; + /** Specifies the spacing between the scroll bar and the chart's plot in pixels. */ + offset?: number; + /** Specifies the color of the scroll bar. */ + color?: string; + /** Specifies the width of the scroll bar in pixels. */ + width?: number; + /** Specifies the opacity of the scroll bar. */ + opacity?: number; + /** Specifies the position of the scroll bar in the chart. */ + position?: string; + }; + } + /** A widget used to embed charts into web applications. */ + export class dxChart extends BaseChart { + constructor(element: JQuery, options?: dxChartOptions); + constructor(element: Element, options?: dxChartOptions); + /** Sets the specified start and end values for the chart's argument axis. */ + zoomArgument(startValue: any, endValue: any): void; + } + interface CrosshaierWithLabel extends viz.core.DashedBorderWithOpacity { + /** Configures the label that belongs to the horizontal crosshair line. */ + label?: { + /** Specifies a color for the background of the label that belongs to the horizontal crosshair line. */ + backgroundColor?: string; + /** Specifies whether the label of the horizontal crosshair line is visible or not. */ + visible?: boolean; + /** Specifies font options for the text of the label that belongs to the horizontal crosshair line. */ + font?: viz.core.Font; + /** Specifies the format of the values displayed by crosshair labels. */ + format?: string; + /** Specifies a precision for formatted values. */ + precision?: number; + /** Customizes the text displayed by the crosshair label that accompany the horizontal line. */ + customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; + } + } + export interface PolarChartTooltip extends BaseChartTooltip { + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxPolarChartOptions extends AdvancedOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + width?: number; + height?: number; + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Indicates whether or not to display a "spider web". */ + useSpiderWeb?: boolean; + /** Specifies argument axis options for the dxPolarChart widget. */ + argumentAxis?: PolarArgumentAxis; + /** An object defining the configuration options that are common for all axes of the dxPolarChart widget. */ + commonAxisSettings?: PolarCommonAxisSettings; + /** An object defining the configuration options that are common for all series of the dxPolarChart widget. */ + commonSeriesSettings?: CommonPolarSeriesSettings; + /** Specifies the options of a chart's legend. */ + legend?: AdvancedLegend; + /** Specifies options for dxPolarChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: PolarSeriesTemplate; + /** Specifies tooltip options. */ + tooltip?: PolarChartTooltip; + /** Specifies value axis options for the dxPolarChart widget. */ + valueAxis?: PolarValueAxis; + } + /** A chart widget displaying data in a polar coordinate system. */ + export class dxPolarChart extends BaseChart { + constructor(element: JQuery, options?: dxPolarChartOptions); + constructor(element: Element, options?: dxPolarChartOptions); + } + export interface PieLegend extends core.BaseLegend { + /** Specifies what chart elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + /** Specifies a callback function that returns the text to be displayed by a legend item. */ + customizeText?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + } + export interface dxPieChartOptions extends BaseChartOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies dxPieChart legend options. */ + legend?: PieLegend; + /** Specifies options for the series of the dxPieChart widget. */ + series?: Array; + /** Specifies the diameter of the pie. */ + diameter?: number; + /** Specifies the direction that the pie chart segments will occupy. */ + segmentsDirection?: string; + /** Specifies the angle in arc degrees from which the first segment of a pie chart should start. */ + startAngle?: number; + /** Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. The value should be between 0 and 1. */ + innerRadius?: number; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** Specifies how a chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + /** An object defining the configuration options that are common for all series of the dxPieChart widget. */ + commonSeriesSettings?: CommonPieSeriesSettings; + /** Specifies the type of the pie chart series. */ + type?: string; + } + /** A circular chart widget for web applications. */ + export class dxPieChart extends BaseChart { + constructor(element: JQuery, options?: dxPieChartOptions); + constructor(element: Element, options?: dxPieChartOptions); + /** + * Provides access to the dxPieChart series. + * @deprecated Use the getAllSeries() method instead. + */ + getSeries(): PieSeries; + } +} +interface JQuery { + dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; + dxChart(methodName: string, ...params: any[]): any; + dxChart(methodName: "instance"): DevExpress.viz.charts.dxChart; + dxPieChart(options?: DevExpress.viz.charts.dxPieChartOptions): JQuery; + dxPieChart(methodName: string, ...params: any[]): any; + dxPieChart(methodName: "instance"): DevExpress.viz.charts.dxPieChart; + dxPolarChart(options?: DevExpress.viz.charts.dxPolarChartOptions): JQuery; + dxPolarChart(methodName: string, ...params: any[]): any; + dxPolarChart(methodName: "instance"): DevExpress.viz.charts.dxPolarChart; +} +declare module DevExpress.viz.gauges { + export interface BaseRangeContainer { + /** Specifies a range container's background color. */ + backgroundColor?: string; + /** Specifies the offset of the range container from an invisible scale line in pixels. */ + offset?: number; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** An array of objects representing ranges contained in the range container. */ + ranges?: Array<{ startValue: number; endValue: number; color: string }>; + /** Specifies a color of a range. */ + color?: string; + /** Specifies an end value of a range. */ + endValue?: number; + /** Specifies a start value of a range. */ + startValue?: number; + } + export interface ScaleTick { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** + * Specifies an array of custom minor ticks. + * @deprecated Use the scale | customMinorTicks option instead. + */ + customTickValues?: Array; + /** Specifies the length of the scale's minor ticks. */ + length?: number; + /** + * Indicates whether automatically calculated minor ticks are visible or not. + * @deprecated This feature is no longer available. + */ + showCalculatedTicks?: boolean; + /** + * Specifies an interval between minor ticks. + * @deprecated Use the scale | minorTickInterval option instead. + */ + tickInterval?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + } + export interface ScaleMajorTick extends ScaleTick { + /** + * Specifies whether or not to expand the current major tick interval if labels overlap each other. + * @deprecated Use the overlappingBehavior | useAutoArrangement option instead. + */ + useTicksAutoArrangement?: boolean; + } + export interface ScaleMinorTick extends ScaleTick { + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + } + export interface BaseScaleLabel { + /** Specifies whether or not scale labels should be colored similarly to their corresponding ranges in the range container. */ + useRangeColors?: boolean; + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: number; valueText: string }) => string; + /** Specifies the overlap resolving options to be applied to scale labels. */ + overlappingBehavior?: { + /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + useAutoArrangement?: boolean; + /** Specifies what label to hide in case of overlapping. */ + hideFirstOrLast?: string; + }; + /** Specifies font options for the text displayed in the scale labels of the gauge. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the scale labels. */ + precision?: number; + /** Specifies whether or not scale labels are visible on the gauge. */ + visible?: boolean; + } + export interface BaseScale { + /** Specifies the end value for the scale of the gauge. */ + endValue?: number; + /** + * Specifies whether or not to hide the first scale label. + * @deprecated This feature is no longer available. + */ + hideFirstLabel?: boolean; + /** + * Specifies whether or not to hide the first major tick on the scale. + * @deprecated This feature is no longer available. + */ + hideFirstTick?: boolean; + /** + * Specifies whether or not to hide the last scale label. + * @deprecated This feature is no longer available. + */ + hideLastLabel?: boolean; + /** + * Specifies whether or not to hide the last major tick on the scale. + * @deprecated This feature is no longer available. + */ + hideLastTick?: boolean; + /** Specifies an interval between major ticks. */ + tickInterval?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: number; + /** Specifies an array of custom major ticks. */ + customTicks?: Array; + /** Specifies an array of custom minor ticks. */ + customMinorTicks?: Array; + /** Specifies common options for scale labels. */ + label?: BaseScaleLabel; + /** + * Specifies options of the gauge's major ticks. + * @deprecated Use the tick option instead. + */ + majorTick?: ScaleMajorTick; + /** Specifies options of the gauge's major ticks. */ + tick?: { + /** Specifies the color of the scale's major ticks. */ + color?: string; + /** Specifies the length of the scale's major ticks. */ + length?: number; + /** Indicates whether scale major ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's major ticks. */ + width?: number; + /** Specifies the opacity of the scale's major ticks. */ + opacity?: number; + }; + /** Specifies options of the gauge's minor ticks. */ + minorTick?: ScaleMinorTick; + /** Specifies the start value for the scale of the gauge. */ + startValue?: number; + } + export interface BaseValueIndicator { + /** Specifies the type of subvalue indicators. */ + type?: string; + /** Specifies the background color for the indicator of the rangeBar type. */ + backgroundColor?: string; + /** Specifies the base value for the indicator of the rangeBar type. */ + baseValue?: number; + /** Specifies a color of the indicator. */ + color?: string; + /** Specifies the range bar size for an indicator of the rangeBar type. */ + size?: number; + text?: { + /** Specifies a callback function that returns the text to be displayed in an indicator. */ + customizeText?: (indicatedValue: { value: number; valueText: string }) => string; + font?: viz.core.Font; + /** Specifies a format for the text displayed in an indicator. */ + format?: string; + /** Specifies the range bar's label indent in pixels. */ + indent?: number; + /** Specifies a precision for the formatted value displayed by an indicator. */ + precision?: number; + }; + offset?: number; + length?: number; + width?: number; + /** Specifies the length of an arrow for the indicator of the textCloud type in pixels. */ + arrowLength?: number; + /** Sets the array of colors to be used for coloring subvalue indicators. */ + palette?: Array; + /** Specifies the distance between the needle and the center of a gauge for the indicator of a needle-like type. */ + indentFromCenter?: number; + /** Specifies the second color for the indicator of the twoColorNeedle type. */ + secondColor?: string; + /** Specifies the length of a twoNeedleColor type indicator tip as a percentage. */ + secondFraction?: number; + /** Specifies the spindle's diameter in pixels for the indicator of a needle-like type. */ + spindleSize?: number; + /** Specifies the inner diameter in pixels, so that the spindle has the shape of a ring. */ + spindleGapSize?: number; + /** Specifies the orientation of the rangeBar indicator on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of the rangeBar indicator on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface SharedGaugeOptions { + /** Specifies animation options. */ + animation?: viz.core.Animation; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies the size of the widget in pixels. */ + size?: viz.core.Size; + /** + * Specifies a subtitle for the widget. + * @deprecated Use the title | subtitle option instead. + */ + subtitle?: { + /** + * Specifies font options for the subtitle. + * @deprecated Use the title | subtitle | font option instead. + */ + font?: viz.core.Font; + /** + * Specifies a text for the subtitle. + * @deprecated Use the title | subtitle | text option instead. + */ + text?: string; + }; + /** Specifies a title for a gauge. */ + title?: { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** + * Specifies a title's position on the gauge. + * @deprecated Use the horizontalAlignment and verticalAlignment options instead. + */ + position?: string; + /** Specifies the distance between the title and surrounding gauge elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies the gauge title's position in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the gauge title's horizontal position. */ + horizontalAlignment?: string; + /** Specifies text for the title. */ + text?: string; + /** Specifies a subtitle for the widget. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } + }; + /** Specifies options for gauge tooltips. */ + tooltip?: viz.core.Tooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + } + export interface BaseGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies the blank space in pixels between the widget's extreme elements and the boundaries of the area provided for the widget (see the size option). */ + margin?: viz.core.Margins; + /** Specifies options of the gauge's range container. */ + rangeContainer?: BaseRangeContainer; + /** Specifies a gauge's scale options. */ + scale?: BaseScale; + /** Specifies the appearance options of subvalue indicators. */ + subvalueIndicator?: BaseValueIndicator; + /** Specifies a set of subvalues to be designated by the subvalue indicators. */ + subvalues?: Array; + /** Specifies the main value on a gauge. */ + value?: number; + /** Specifies the appearance options of the value indicator. */ + valueIndicator?: BaseValueIndicator; + } + /** A gauge widget. */ + export class dxBaseGauge extends viz.core.BaseWidget { + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(): void; + /** Returns the main gauge value. */ + value(): number; + /** Updates a gauge value. */ + value(value: number): void; + /** Returns an array of gauge subvalues. */ + subvalues(): Array; + /** Updates gauge subvalues. */ + subvalues(subvalues: Array): void; + } + export interface LinearRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of a range container on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + /** Specifies the width of the range container's start and end boundaries in the dxLinearGauge widget. */ + width?: any; + /** Specifies an end width of a range container. */ + end?: number; + /** Specifies a start width of a range container. */ + start?: number; + } + export interface LinearScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface LinearScale extends BaseScale { + /** Specifies the orientation of scale ticks on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + label?: LinearScaleLabel; + /** Specifies the orientation of scale ticks on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface dxLinearGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxLinearGauge widget. */ + geometry?: { + /** Indicates whether to display the dxLinearGauge widget vertically or horizontally. */ + orientation?: string; + }; + /** Specifies gauge range container options. */ + rangeContainer?: LinearRangeContainer; + scale?: LinearScale; + } + /** A widget that represents a gauge with a linear scale. */ + export class dxLinearGauge extends dxBaseGauge { + constructor(element: JQuery, options?: dxLinearGaugeOptions); + constructor(element: Element, options?: dxLinearGaugeOptions); + } + export interface CircularRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container in the dxCircularGauge widget. */ + orientation?: string; + /** Specifies the range container's width in pixels. */ + width?: number; + } + export interface CircularScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface CircularScale extends BaseScale { + label?: CircularScaleLabel; + /** Specifies the orientation of scale ticks. */ + orientation?: string; + } + export interface dxCircularGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxCircularGauge widget. */ + geometry?: { + /** Specifies the end angle of the circular gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the circular gauge's arc. */ + startAngle?: number; + }; + /** Specifies gauge range container options. */ + rangeContainer?: CircularRangeContainer; + scale?: CircularScale; + } + /** A widget that represents a gauge with a circular scale. */ + export class dxCircularGauge extends dxBaseGauge { + constructor(element: JQuery, options?: dxCircularGaugeOptions); + constructor(element: Element, options?: dxCircularGaugeOptions); + } + export interface dxBarGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies a color for the remaining segment of the bar's track. */ + backgroundColor?: string; + /** Specifies a distance between bars in pixels. */ + barSpacing?: number; + /** Specifies a base value for bars. */ + baseValue?: number; + /** Specifies an end value for the gauge's invisible scale. */ + endValue?: number; + /** Defines the shape of the gauge's arc. */ + geometry?: { + /** Specifies the end angle of the bar gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the bar gauge's arc. */ + startAngle?: number; + }; + /** Specifies the options of the labels that accompany gauge bars. */ + label?: { + /** Specifies a color for the label connector text. */ + connectorColor?: string; + /** Specifies the width of the label connector in pixels. */ + connectorWidth?: number; + /** Specifies a callback function that returns a text for labels. */ + customizeText?: (barValue: { value: number; valueText: string }) => string; + /** Specifies font options for bar labels. */ + font?: viz.core.Font; + /** Specifies a format for bar labels. */ + format?: string; + /** Specifies the distance between the upper bar and bar labels in pixels. */ + indent?: number; + /** Specifies a precision for the formatted value displayed by labels. */ + precision?: number; + /** Specifies whether bar labels appear on a gauge or not. */ + visible?: boolean; + }; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** Defines the radius of the bar that is closest to the center relatively to the radius of the topmost bar. */ + relativeInnerRadius?: number; + /** Specifies a start value for the gauge's invisible scale. */ + startValue?: number; + /** Specifies the array of values to be indicated on a bar gauge. */ + values?: Array; + } + /** A circular bar widget. */ + export class dxBarGauge extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxBarGaugeOptions); + constructor(element: Element, options?: dxBarGaugeOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws the widget. */ + render(): void; + /** Returns an array of gauge values. */ + values(): Array; + /** Updates the values displayed by a gauge. */ + values(values: Array): void; + } +} +interface JQuery { + dxLinearGauge(options?: DevExpress.viz.gauges.dxLinearGaugeOptions): JQuery; + dxLinearGauge(methodName: string, ...params: any[]): any; + dxLinearGauge(methodName: "instance"): DevExpress.viz.gauges.dxLinearGauge; + dxCircularGauge(options?: DevExpress.viz.gauges.dxCircularGaugeOptions): JQuery; + dxCircularGauge(methodName: string, ...params: any[]): any; + dxCircularGauge(methodName: "instance"): DevExpress.viz.gauges.dxCircularGauge; + dxBarGauge(options?: DevExpress.viz.gauges.dxBarGaugeOptions): JQuery; + dxBarGauge(methodName: string, ...params: any[]): any; + dxBarGauge(methodName: "instance"): DevExpress.viz.gauges.dxBarGauge; +} +declare module DevExpress.viz.rangeSelector { + export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions { + /** Specifies the options for the range selector's background. */ + background?: { + /** Specifies the background color for the dxRangeSelector. */ + color?: string; + /** Specifies image options. */ + image?: { + /** Specifies a location for the image in the background of a range selector. */ + location?: string; + /** Specifies the image's URL. */ + url?: string; + }; + /** Indicates whether or not the background (background color and/or image) is visible. */ + visible?: boolean; + }; + /** Specifies a title for the range selector. */ + title?: viz.core.Title; + /** Specifies the dxRangeSelector's behavior options. */ + behavior?: { + /** Indicates whether or not you can swap sliders. */ + allowSlidersSwap?: boolean; + /** Indicates whether or not animation is enabled. */ + animationEnabled?: boolean; + /** Specifies when to call the onSelectedRangeChanged function. */ + callSelectedRangeChanged?: string; + /** Indicates whether or not an end user can specify the range using a mouse, without the use of sliders. */ + manualRangeSelectionEnabled?: boolean; + /** Indicates whether or not an end user can shift the selected range to the required location on a scale by clicking. */ + moveSelectedRangeByClick?: boolean; + /** Indicates whether to snap a slider to ticks. */ + snapToTicks?: boolean; + }; + /** Specifies the options required to display a chart as the range selector's background. */ + chart?: { + /** Specifies a coefficient for determining an indent from the bottom background boundary to the lowest chart point. */ + bottomIndent?: number; + /** An object defining the common configuration options for the chart’s series. */ + commonSeriesSettings?: viz.charts.CommonSeriesSettings; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort series points. */ + sortingMethod?: any; + }; + /** Specifies whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; + /** Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ + negativesAsZeroes?: boolean; + /** Sets the name of the palette to be used in the range selector's chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** An object defining the chart’s series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: viz.charts.SeriesTemplate; + /** Specifies a coefficient for determining an indent from the background's top boundary to the topmost chart point. */ + topIndent?: number; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Specifies options for the chart's value axis. */ + valueAxis?: { + /** Indicates whether or not the chart's value axis must be inverted. */ + inverted?: boolean; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic value axis. */ + logarithmBase?: number; + /** Specifies the maximum value of the chart's value axis. */ + max?: number; + /** Specifies the minimum value of the chart's value axis. */ + min?: number; + /** Specifies the type of the value axis. */ + type?: string; + /** Specifies the desired type of axis values. */ + valueType?: string; + }; + }; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies a data source for the scale values and for the chart at the background. */ + dataSource?: any; + /** Specifies the data source field that provides data for the scale. */ + dataSourceField?: string; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies the blank space in pixels between the dxRangeSelector widget's extreme elements and the boundaries of the area provided for the widget (see size). */ + margin?: viz.core.Margins; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies options of the range selector's scale. */ + scale?: { + /** Specifies the scale's end value. */ + endValue?: any; + /** Specifies common options for scale labels. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: any; valueText: string; }) => string; + /** Specifies font options for the text displayed in the range selector's scale labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the scale labels. */ + precision?: number; + /** Specifies a spacing between scale labels and the background bottom edge. */ + topIndent?: number; + /** Specifies whether or not the scale's labels are visible. */ + visible?: boolean; + }; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic scale. */ + logarithmBase?: number; + /** + * Specifies an interval between major ticks. + * @deprecated Use the tickInterval option instead. + */ + majorTickInterval?: any; + /** Specifies an interval between axis ticks. */ + tickInterval?: any; + /** Specifies options for the date-time scale's markers. */ + marker?: { + /** Defines the options that can be set for the text that is displayed by the scale markers. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale markers. */ + customizeText?: (markerValue: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed in scale markers. */ + format?: string; + }; + /** Specifies the height of the marker's separator. */ + separatorHeight?: number; + /** Specifies the space between the marker label and the marker separator. */ + textLeftIndent?: number; + /** Specifies the space between the marker's label and the top edge of the marker's separator. */ + textTopIndent?: number; + /** Specified the indent between the marker and the scale lables. */ + topIndent?: number; + /** Indicates whether scale markers are visible. */ + visible?: boolean; + }; + /** Specifies the maximum range that can be selected. */ + maxRange?: any; + /** Specifies the number of minor ticks between neighboring major ticks. */ + minorTickCount?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the minimum range that can be selected. */ + minRange?: any; + /** Specifies the height of the space reserved for the scale in pixels. */ + placeholderHeight?: number; + /** Indicates whether or not to set ticks of a date-time scale at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** Specifies whether or not to show ticks for the boundary scale values, when neither major ticks nor minor ticks are created for these values. */ + showCustomBoundaryTicks?: boolean; + /** + * Indicates whether or not to show minor ticks on the scale. + * @deprecated Use the minorTick | visible option instead. + */ + showMinorTicks?: boolean; + /** Specifies the scale's start value. */ + startValue?: any; + /** Specifies options defining the appearance of scale ticks. */ + tick?: { + /** Specifies the color of scale ticks (both major and minor ticks). */ + color?: string; + /** Specifies the opacity of scale ticks (both major and minor ticks). */ + opacity?: number; + /** Specifies the width of the scale's ticks (both major and minor ticks). */ + width?: number; + }; + /** Specifies options of the range selector's minor ticks. */ + minorTick?: { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + }; + /** Specifies the type of the scale. */ + type?: string; + /** Specifies whether or not to expand the current tick interval if labels overlap each other. */ + useTicksAutoArrangement?: boolean; + /** Specifies the type of values on the scale. */ + valueType?: string; + /** Specifies the order of arguments on a discrete scale. */ + categories?: Array; + }; + /** Specifies the range to be selected when displaying the dxRangeSelector. */ + selectedRange?: { + /** Specifies the start value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + startValue?: any; + /** Specifies the end value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + endValue?: any; + }; + /** Specifies the color of the selected range. */ + selectedRangeColor?: string; + /** Range selector's indent options. */ + indent?: { + /** Specifies range selector's left indent. */ + left?: number; + /** Specifies range selector's right indent. */ + right?: number; + }; + /** A handler for the selectedRangeChanged event. */ + onSelectedRangeChanged?: (e: { + startValue: any; + endValue: any; + component: dxRangeSelector; + element: Element; + }) => void; + /** Specifies range selector shutter options. */ + shutter?: { + /** Specifies shutter color. */ + color?: string; + /** Specifies the opacity of the color of shutters. */ + opacity?: number; + }; + /** Specifies in pixels the size of the dxRangeSelector widget. */ + size?: viz.core.Size; + /** Specifies the appearance of the range selector's slider handles. */ + sliderHandle?: { + /** Specifies the color of the slider handles. */ + color?: string; + /** Specifies the opacity of the slider handles. */ + opacity?: number; + /** Specifies the width of the slider handles. */ + width?: number; + }; + /** Defines the options of the range selector slider markers. */ + sliderMarker?: { + /** Specifies the color of the slider markers. */ + color?: string; + /** Specifies a callback function that returns the text to be displayed by slider markers. */ + customizeText?: (scaleValue: { value: any; valueText: any; }) => string; + /** Specifies font options for the text displayed by the range selector slider markers. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in slider markers. */ + format?: string; + /** Specifies the color used for the slider marker text when the currently selected range does not match the minRange and maxRange values. */ + invalidRangeColor?: string; + /** + * Specifies the empty space between the marker's border and the marker’s text. + * @deprecated Use the paddingTopBottom and paddingLeftRight options instead. + */ + padding?: number; + /** Specifies the empty space between the marker's top and bottom borders and the marker's text. */ + paddingTopBottom?: number; + /** Specifies the empty space between the marker's left and right borders and the marker's text. */ + paddingLeftRight?: number; + /** Specifies the placeholder height of the slider marker. */ + placeholderHeight?: number; + /** + * Specifies in pixels the height and width of the space reserved for the range selector slider markers. + * @deprecated Use the placeholderHeight and indent options instead. + */ + placeholderSize?: { + /** Specifies the height of the placeholder for the left and right slider markers. */ + height?: number; + /** Specifies the width of the placeholder for the left and right slider markers. */ + width?: { + /** Specifies the width of the left slider marker's placeholder. */ + left?: number; + /** Specifies the width of the right slider marker's placeholder. */ + right?: number; + }; + }; + /** Specifies a precision for the formatted value displayed in slider markers. */ + precision?: number; + /** Indicates whether or not the slider markers are visible. */ + visible?: boolean; + }; + } + /** A widget that allows end users to select a range of values on a scale. */ + export class dxRangeSelector extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxRangeSelectorOptions); + constructor(element: Element, options?: dxRangeSelectorOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(skipChartAnimation?: boolean): void; + /** Returns the currently selected range. */ + getSelectedRange(): { startValue: any; endValue: any; }; + /** Sets a specified range. */ + setSelectedRange(selectedRange: { startValue: any; endValue: any; }): void; + } +} +interface JQuery { + dxRangeSelector(options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; + dxRangeSelector(methodName: string, ...params: any[]): any; + dxRangeSelector(methodName: "instance"): DevExpress.viz.rangeSelector.dxRangeSelector; +} +declare module DevExpress.viz.map { + /** This section describes the fields and methods that can be used in code to manipulate the Layer object. */ + export interface MapLayer { + /** The name of the layer. */ + name: string; + /** The layer index in the layers array. */ + index: number; + /** The layer type. Can be "area", "line" or "marker". */ + type: string; + /** The type of the layer elements. */ + elementType: string; + /** Gets all layer elements. */ + getElements(): Array; + /** Deselects all layer elements. */ + clearSelection(): void; + } + /** This section describes the fields and methods that can be used in code to manipulate the Layer Element object. */ + export interface MapLayerElement { + /** The parent layer of the layer element. */ + layer: MapLayer; + /** Gets the layer element coordinates. */ + coordinates(): Object; + /** Sets the value of an attribute. */ + attribute(name: string, value: any): void; + /** Gets the value of an attribute. */ + attribute(name: string): any; + /** Gets the selection state of the layer element. */ + selected(): boolean; + /** Sets the selection state of the layer element. */ + selected(state: boolean): void; + /** Applies the layer element settings and updates element appearance. */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Area object. + * @deprecated Use the Layer Element instead. + */ + export interface Area { + /** + * Contains the element type. + * @deprecated Use the Layer | type instead. + */ + type: string; + /** + * Return the value of an attribute. + * @deprecated Use the Layer Element | attribute(name, value) method instead. + */ + attribute(name: string): any; + /** + * Provides information about the selection state of an area. + * @deprecated Use the Layer Element | selected() method instead. + */ + selected(): boolean; + /** + * Sets a new selection state for an area. + * @deprecated Use the Layer Element | selected(state) method instead. + */ + selected(state: boolean): void; + /** + * Applies the area settings specified as a parameter and updates the area appearance. + * @deprecated Use the Layer Element | applySettings(settings) method instead. + */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Markers object. + * @deprecated Use the Layer Element instead. + */ + export interface Marker { + /** + * Contains the descriptive text accompanying the map marker. + * @deprecated Get the text using the Layer Element | attribute(name) method. The name parameter value for text is set at the dataField option. + */ + text: string; + /** + * Contains the type of the element. + * @deprecated Use the Layer | type instead. + */ + type: string; + /** + * Contains the URL of an image map marker. + * @deprecated Get the image URL using the Layer Element | attribute(name) method. The name parameter value for the image URL is set at the dataField option. + */ + url: string; + /** + * Contains the value of a bubble map marker. + * @deprecated Get the bubble value using the Layer Element | attribute(name) method. The name parameter for the bubble value is set at the dataField option. + */ + value: number; + /** + * Contains the values of a pie map marker. + * @deprecated Get the pie values using the Layer Element | attribute(name) method. The name parameter for pie values is set at the dataField option. + */ + values: Array; + /** + * Returns the value of an attribute. + * @deprecated Use the Layer Element | attribute(name, value) method instead. + */ + attribute(name: string): any; + /** + * Returns the coordinates of a specific marker. + * @deprecated Use the Layer Element | coordinates() method instead. + */ + coordinates(): Array; + /** + * Provides information about the selection state of a marker. + * @deprecated Use the Layer Element | selected() method instead. + */ + selected(): boolean; + /** + * Sets a new selection state for a marker. + * @deprecated Use the Layer Element | selected(state) method instead. + */ + selected(state: boolean): void; + /** + * Applies the marker settings specified as a parameter and updates marker appearance. + * @deprecated Use the Layer Element | applySettings(settings) method instead. + */ + applySettings(settings: any): void; + } + export interface MapLayerSettings { + /** Specifies the layer name. */ + name?: string; + /** Specifies layer type. */ + type?: string; + /** Specifies the type of a marker element. Setting this option makes sense only if the layer type is "marker". */ + elementType?: string; + /** Specifies a data source for the layer. */ + dataSource?: any; + /** Specifies the line width (for layers of a line type) or width of the layer elements border in pixels. */ + borderWidth?: number; + /** Specifies a color for the border of the layer elements. */ + borderColor?: string; + /** Specifies a color for layer elements. */ + color?: string; + /** Specifies a color for the border of the layer element when it is hovered over. */ + hoveredBorderColor?: string; + /** Specifies the pixel-measured line width (for layers of a line type) or width for the border of the layer element when it is hovered over. */ + hoveredBorderWidth?: number; + /** Specifies a color for a layer element when it is hovered over. */ + hoveredColor?: string; + /** Specifies a pixel-measured line width (for layers of a line type) or width for the border of the layer element when it is selected. */ + selectedBorderWidth?: number; + /** Specifies a color for the border of the layer element when it is selected. */ + selectedBorderColor?: string; + /** Specifies a color for the layer element when it is selected. */ + selectedColor?: string; + /** Specifies the layer opacity (from 0 to 1). */ + opacity?: number; + /** Specifies the size of markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "dot", "pie" or "image". */ + size?: number; + /** Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if the layer type is "marker". */ + minSize?: number; + /** Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if the layer type is "marker". */ + maxSize?: number; + /** Specifies whether or not to change the appearance of a layer element when it is hovered over. */ + hoverEnabled?: boolean; + /** Specifies whether single or multiple map elements can be selected on a vector map. */ + selectionMode?: string; + /** Specifies the name of the palette or a custom range of colors to be used for coloring a layer. */ + palette?: any; + /** Specifies the number of colors in a palette. */ + paletteSize?: number; + /** Allows you to paint layer elements with similar attributes in the same color. */ + colorGroups?: Array; + /** Specifies the field that provides data to be used for coloring of layer elements. */ + colorGroupingField?: string; + /** Allows you to display bubbles with similar attributes in the same size. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroups?: Array; + /** Specifies the field that provides data to be used for sizing bubble markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroupingField?: string; + /** Specifies the name of the attribute containing marker data. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble", "pie" or "image". */ + dataField?: string; + /** Specifies the function that customizes each layer element individually. */ + customize?: (eleemnts: Array) => void; + /** Specifies marker label options. */ + label?: { + /** The name of the dataSource attribute containing marker texts. */ + dataField?: string; + /** Enables marker labels. */ + enabled?: boolean; + /** Specifies font options for marker labels. */ + font?: viz.core.Font; + }; + } + export interface AreaSettings { + /** + * Specifies the width of the area border in pixels. + * @deprecated Use the layers | borderWidth option instead. + */ + borderWidth?: number; + /** + * Specifies a color for the area border. + * @deprecated Use the layers | borderColor option instead. + */ + borderColor?: string; + /** + * Specifies a color for an area. + * @deprecated Use the layers | color option instead. + */ + color?: string; + /** + * Specifies the function that customizes each area individually. + * @deprecated Use the layers | customize option instead. + */ + customize?: (areaInfo: Area) => AreaSettings; + /** + * Specifies a color for the area border when the area is hovered over. + * @deprecated Use the layers | hoveredBorderColor option instead. + */ + hoveredBorderColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is hovered over. + * @deprecated Use the layers | hoveredBorderWidth option instead. + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for an area when this area is hovered over. + * @deprecated Use the layers | hoveredColor option instead. + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of an area when it is hovered over. + * @deprecated Use the layers | hoverEnabled option instead. + */ + hoverEnabled?: boolean; + /** + * Configures area labels. + * @deprecated Use the layers | label option instead. + */ + label?: { + /** + * Specifies the data field that provides data for area labels. + * @deprecated Use the layers | label | dataField option instead. + */ + dataField?: string; + /** + * Enables area labels. + * @deprecated Use the layers | label | enabled option instead. + */ + enabled?: boolean; + /** + * Specifies font options for area labels. + * @deprecated Use the layers | label | font option instead. + */ + font?: viz.core.Font; + }; + /** + * Specifies the name of the palette or a custom range of colors to be used for coloring a map. + * @deprecated Use the layers | palette option instead. + */ + palette?: any; + /** + * Specifies the number of colors in a palette. + * @deprecated Use the layers | paletteSize option instead. + */ + paletteSize?: number; + /** + * Allows you to paint areas with similar attributes in the same color. + * @deprecated Use the layers | colorGroups option instead. + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring areas. + * @deprecated Use the layers | colorGroupingField option instead. + */ + colorGroupingField?: string; + /** + * Specifies a color for the area border when the area is selected. + * @deprecated Use the layers | selectedBorderColor option instead. + */ + selectedBorderColor?: string; + /** + * Specifies a color for an area when this area is selected. + * @deprecated Use the layers | selectedColor option instead. + */ + selectedColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is selected. + * @deprecated Use the layers | selectedBorderWidth option instead. + */ + selectedBorderWidth?: number; + /** + * Specifies whether single or multiple areas can be selected on a vector map. + * @deprecated Use the layers | selectionMode option instead. + */ + selectionMode?: string; + } + export interface MarkerSettings { + /** + * Specifies a color for the marker border. + * @deprecated Use the layers | borderColor option instead. + */ + borderColor?: string; + /** + * Specifies the width of the marker border in pixels. + * @deprecated Use the layers | borderWidth option instead. + */ + borderWidth?: number; + /** + * Specifies a color for a marker of the dot or bubble type. + * @deprecated Use the layers | color option instead. + */ + color?: string; + /** + * Specifies the function that customizes each marker individually. + * @deprecated Use the layers | customize option instead. + */ + customize?: (markerInfo: Marker) => MarkerSettings; + /** + * Specifies the pixel-measured width of the marker border when the marker is hovered over. + * @deprecated Use the layers | hoveredBorderWidth option instead. + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is hovered over. + * @deprecated Use the layers | hoveredBorderColor option instead. + */ + hoveredBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is hovered over. + * @deprecated Use the layers | hoveredColor option instead. + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of a marker when it is hovered over. + * @deprecated Use the layers | hoverEnabled option instead. + */ + hoverEnabled?: boolean; + /** + * Specifies marker label options. + * @deprecated Use the layers | label option instead. + */ + label?: { + /** + * Enables marker labels. + * @deprecated Use the layers | label | enabled option instead. + */ + enabled?: boolean; + /** + * Specifies font options for marker labels. + * @deprecated Use the layers | label | font option instead. + */ + font?: viz.core.Font; + }; + /** + * Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | maxSize option instead. + */ + maxSize?: number; + /** + * Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | minSize option instead. + */ + minSize?: number; + /** + * Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | opacity option instead. + */ + opacity?: number; + /** + * Specifies the pixel-measured width of the marker border when the marker is selected. + * @deprecated Use the layers | selectedBorderWidth option instead. + */ + selectedBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is selected. + * @deprecated Use the layers | selectedBorderColor option instead. + */ + selectedBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is selected. + * @deprecated Use the layers | selectedColor option instead. + */ + selectedColor?: string; + /** + * Specifies whether a single or multiple markers can be selected on a vector map. + * @deprecated Use the layers | selectionMode option instead. + */ + selectionMode?: string; + /** + * Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. + * @deprecated Use the layers | size option instead. + */ + size?: number; + /** + * Specifies the type of markers to be used on the map. + * @deprecated Use the layers | elementType option instead. + */ + type?: string; + /** + * Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. + * @deprecated Use the layers | palette option instead. + */ + palette?: any; + /** + * Allows you to paint markers with similar attributes in the same color. + * @deprecated Use the layers | colorGroups option instead. + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring markers. + * @deprecated Use the layers | colorGroupingField option instead. + */ + colorGroupingField?: string; + /** + * Allows you to display bubbles with similar attributes in the same size. + * @deprecated Use the layers | sizeGroups option instead. + */ + sizeGroups?: Array; + /** + * Specifies the field that provides data to be used for sizing bubble markers. + * @deprecated Use the layers | sizeGroupingField option instead. + */ + sizeGroupingField?: string; + } + export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions { + /** + * An object specifying options for the map areas. + * @deprecated Use the "area" type element of the layers array. + */ + areaSettings?: AreaSettings; + /** Specifies the options for the map background. */ + background?: { + /** Specifies a color for the background border. */ + borderColor?: string; + /** Specifies a color for the background. */ + color?: string; + }; + /** Specifies options for dxVectorMap widget layers. */ + layers?: Array; + /** Specifies the map projection. */ + projection?: Object; + /** Specifies the positioning of a map in geographical coordinates. */ + bounds?: Array; + /** Specifies the options of the control bar. */ + controlBar?: { + /** Specifies a color for the outline of the control bar elements. */ + borderColor?: string; + /** Specifies a color for the inner area of the control bar elements. */ + color?: string; + /** Specifies whether or not to display the control bar. */ + enabled?: boolean; + /** Specifies the margin of the control bar in pixels. */ + margin?: number; + /** Specifies the position of the control bar. */ + horizontalAlignment?: string; + /** Specifies the position of the control bar. */ + verticalAlignment?: string; + /** Specifies the opacity of the control bar. */ + opacity?: number; + }; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** + * Specifies a data source for the map area. + * @deprecated Use the layers | dataSource option instead. + */ + mapData?: any; + /** + * Specifies a data source for the map markers. + * @deprecated Use the layers | dataSource option instead. + */ + markers?: any; + /** + * An object specifying options for the map markers. + * @deprecated Use the "marker" type element of the layers array. + */ + markerSettings?: MarkerSettings; + /** Specifies the size of the dxVectorMap widget. */ + size?: viz.core.Size; + /** Specifies a title for the vector map. */ + title?: viz.core.Title; + /** Specifies tooltip options. */ + tooltip?: viz.core.Tooltip; + /** Configures map legends. */ + legends?: Array; + /** Specifies whether or not the map should respond when a user rolls the mouse wheel. */ + wheelEnabled?: boolean; + /** Specifies whether the map should respond to touch gestures. */ + touchEnabled?: boolean; + /** Disables the zooming capability. */ + zoomingEnabled?: boolean; + /** Specifies the geographical coordinates of the center for a map. */ + center?: Array; + /** A handler for the centerChanged event. */ + onCenterChanged?: (e: { + center: Array; + component: dxVectorMap; + element: Element; + }) => void; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** Specifies a number that is used to zoom a map initially. */ + zoomFactor?: number; + /** Specifies a map's maximum zoom factor. */ + maxZoomFactor?: number; + /** A handler for the zoomFactorChanged event. */ + onZoomFactorChanged?: (e: { + component: dxVectorMap; + element: Element; + zoomFactor: number; + }) => void; + /** A handler for the click event. */ + onClick?: any; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + component: dxVectorMap; + element: Element; + target: MapLayerElement; + }) => void; + /** + * A handler for the areaClick event. + * @deprecated Use the onClick option instead. + */ + onAreaClick?: any; + /** + * A handler for the areaSelectionChanged event. + * @deprecated Use the onSelectionChanged option instead. + */ + onAreaSelectionChanged?: (e: { + target: Area; + component: dxVectorMap; + element: Element; + }) => void; + /** + * A handler for the markerClick event. + * @deprecated Use the onClick option instead. + */ + onMarkerClick?: any; + /** + * A handler for the markerSelectionChanged event. + * @deprecated Use the onSelecitonChanged option instead. + */ + onMarkerSelectionChanged?: (e: { + target: Marker; + component: dxVectorMap; + element: Element; + }) => void; + /** Disables the panning capability. */ + panningEnabled?: boolean; + } + export interface Legend extends viz.core.BaseLegend { + /** Specifies the color of item markers in the legend. The specified color applied only when the legend uses 'size' source. */ + markerColor?: string; + /** Specifies text for legend items. */ + customizeText?: (itemInfo: { start: number; end: number; index: number; color: string; size: number; }) => string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item. */ + customizeHint?: (itemInfo: { start: number; end: number; index: number; color: string; size: number }) => string; + /** Specifies the source of data for the legend. */ + source?: { + /** Specifies a layer to which the legend belongs. */ + layer?: string; + /** Specifies the type of the legend grouping. */ + grouping?: string; + } + } + /** A vector map widget. */ + export class dxVectorMap extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxVectorMapOptions); + constructor(element: Element, options?: dxVectorMapOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(): void; + /** Gets the current coordinates of the map center. */ + center(): Array; + /** Sets the coordinates of the map center. */ + center(centerCoordinates: Array): void; + /** + * Deselects all the selected areas on a map. The areas are displayed in their initial style after. + * @deprecated Use the layer's clearSelection() method instead. + */ + clearAreaSelection(): void; + /** + * Deselects all the selected markers on a map. The markers are displayed in their initial style after. + * @deprecated Use the layer's clearSelection() method instead. + */ + clearMarkerSelection(): void; + /** Deselects all the selected area and markers on a map at once. The areas and markers are displayed in their initial style after. */ + clearSelection(): void; + /** Converts client area coordinates into map coordinates. */ + convertCoordinates(x: number, y: number): Array; + /** Gets all map layers. */ + getLayers(): Array; + /** Gets the layer by its index. */ + getLayerByIndex(index: number): MapLayer; + /** Gets the layer by its name. */ + getLayerByName(name: string): MapLayer; + /** + * Returns an array with all the map areas. + * @deprecated Use the layer's getElements() method instead. + */ + getAreas(): Array; + /** + * Returns an array with all the map markers. + * @deprecated Use the layer's getElements() method instead. + */ + getMarkers(): Array; + /** Gets the current coordinates of the map viewport. */ + viewport(): Array; + /** Sets the coordinates of the map viewport. */ + viewport(viewportCoordinates: Array): void; + /** Gets the current value of the map zoom factor. */ + zoomFactor(): number; + /** Sets the value of the map zoom factor. */ + zoomFactor(zoomFactor: number): void; + } + export var projection: ProjectionCreator; + export interface ProjectionCreator { + /** Creates a new projection. */ + (data: { + to?: (coordinates: Array) => Array; + from?: (coordinates: Array) => Array; + aspectRatio?: number; + }): Object; + /** Gets the default or custom projection from the projection storage. */ + get(name: string): Object; + /** Adds a new projection to the internal projections storage. */ + add(name: string, projection: Object): void; + } +} +interface JQuery { + dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; + dxVectorMap(methodName: string, ...params: any[]): any; + dxVectorMap(methodName: "instance"): DevExpress.viz.map.dxVectorMap; +} +declare module DevExpress.viz.sparklines { + export interface SparklineTooltip extends viz.core.Tooltip { + /** + * Specifies how a tooltip is horizontally aligned relative to the graph. + * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. + */ + horizontalAlignment?: string; + /** + * Specifies how a tooltip is vertically aligned relative to the graph. + * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. + */ + verticalAlignment?: string; + } + export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions { + /** Specifies the blank space between the widget's extreme elements and the boundaries of the area provided for the widget in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of the widget. */ + size?: viz.core.Size; + /** Specifies tooltip options. */ + tooltip?: SparklineTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + } + /** Overridden by descriptions for particular widgets. */ + export class BaseSparkline extends viz.core.BaseWidget { + /** Redraws a widget. */ + render(): void; + } + export interface dxBulletOptions extends BaseSparklineOptions { + /** Specifies a color for the bullet bar. */ + color?: string; + /** Specifies an end value for the invisible scale. */ + endScaleValue?: number; + /** Specifies whether or not to show the target line. */ + showTarget?: boolean; + /** Specifies whether or not to show the line indicating zero on the invisible scale. */ + showZeroLevel?: boolean; + /** Specifies a start value for the invisible scale. */ + startScaleValue?: number; + /** Specifies the value indicated by the target line. */ + target?: number; + /** Specifies a color for both the target and zero level lines. */ + targetColor?: string; + /** Specifies the width of the target line. */ + targetWidth?: number; + /** Specifies the primary value indicated by the bullet bar. */ + value?: number; + } + /** A bullet graph widget. */ + export class dxBullet extends BaseSparkline { + constructor(element: JQuery, options?: dxBulletOptions); + constructor(element: Element, options?: dxBulletOptions); + } + export interface dxSparklineOptions extends BaseSparklineOptions { + /** Specifies the data source field that provides arguments for a sparkline. */ + argumentField?: string; + /** Sets a color for the bars indicating negative values. Available for a sparkline of the bar type only. */ + barNegativeColor?: string; + /** Sets a color for the bars indicating positive values. Available for a sparkline of the bar type only. */ + barPositiveColor?: string; + /** Specifies a data source for the sparkline. */ + dataSource?: any; + /** Sets a color for the boundary of both the first and last points on a sparkline. */ + firstLastColor?: string; + /** Specifies whether a sparkline ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Sets a color for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineColor?: string; + /** Specifies a width for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineWidth?: number; + /** Sets a color for the bars indicating the values that are less than the winloss threshold. Available for a sparkline of the winloss type only. */ + lossColor?: string; + /** Sets a color for the boundary of the maximum point on a sparkline. */ + maxColor?: string; + /** Sets a color for the boundary of the minimum point on a sparkline. */ + minColor?: string; + /** Sets a color for points on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointColor?: string; + /** Specifies the diameter of sparkline points in pixels. Available for the sparklines of line- and area-like types. */ + pointSize?: number; + /** Specifies a symbol to use as a point marker on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointSymbol?: string; + /** Specifies whether or not to indicate both the first and last values on a sparkline. */ + showFirstLast?: boolean; + /** Specifies whether or not to indicate both the minimum and maximum values on a sparkline. */ + showMinMax?: boolean; + /** Determines the type of a sparkline. */ + type?: string; + /** Specifies the data source field that provides values for a sparkline. */ + valueField?: string; + /** Sets a color for the bars indicating the values greater than a winloss threshold. Available for a sparkline of the winloss type only. */ + winColor?: string; + /** Specifies a value that serves as a threshold for the sparkline of the winloss type. */ + winlossThreshold?: number; + /** Specifies the minimum value of the sparkline value axis. */ + minValue?: number; + /** Specifies the maximum value of the sparkline's value axis. */ + maxValue?: number; + } + /** A sparkline widget. */ + export class dxSparkline extends BaseSparkline { + constructor(element: JQuery, options?: dxSparklineOptions); + constructor(element: Element, options?: dxSparklineOptions); + } +} +interface JQuery { + dxBullet(options?: DevExpress.viz.sparklines.dxBulletOptions): JQuery; + dxBullet(methodName: string, ...params: any[]): any; + dxBullet(methodName: "instance"): DevExpress.viz.sparklines.dxBullet; + dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery; + dxSparkline(methodName: string, ...params: any[]): any; + dxSparkline(methodName: "instance"): DevExpress.viz.sparklines.dxSparkline; +} diff --git a/devextreme/devextreme-15.2.13.d.ts b/devextreme/devextreme-15.2.13.d.ts new file mode 100644 index 0000000000..cb1ca8697b --- /dev/null +++ b/devextreme/devextreme-15.2.13.d.ts @@ -0,0 +1,7531 @@ +// Type definitions for DevExtreme 15.2.13 +// Project: http://js.devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module DevExpress { + /** A mixin that provides a capability to fire and subscribe to events. */ + export interface EventsMixin { + /** Subscribes to a specified event. */ + on(eventName: string, eventHandler: Function): T; + /** Subscribes to the specified events. */ + on(events: { [eventName: string]: Function; }): T; + /** Detaches all event handlers from the specified event. */ + off(eventName: string): Object; + /** Detaches a particular event handler from the specified event. */ + off(eventName: string, eventHandler: Function): T; + } + /** An object that serves as a namespace for the methods required to perform validation. */ + export module validationEngine { + export interface IValidator { + validate(): ValidatorValidationResult; + reset(): void; + } + export interface ValidatorValidationResult { + isValid: boolean; + name?: string; + value: any; + brokenRule: any; + validationRules: any[]; + } + export interface ValidationGroupValidationResult { + isValid: boolean; + brokenRules: any[]; + validators: IValidator[]; + } + export interface GroupConfig extends EventsMixin { + group: any; + validators: IValidator[]; + validate(): ValidationGroupValidationResult; + reset(): void; + } + /** Provides access to the object that represents the specified validation group. */ + export function getGroupConfig(group: any): GroupConfig + /** Provides access to the object that represents the default validation group. */ + export function getGroupConfig(): GroupConfig + /** Validates rules of the validators that belong to the specified validation group. */ + export function validateGroup(group: any): ValidationGroupValidationResult; + /** Validates rules of the validators that belong to the default validation group. */ + export function validateGroup(): ValidationGroupValidationResult; + /** Resets the values and validation result of the editors that belong to the specified validation group. */ + export function resetGroup(group: any): void; + /** Resets the values and validation result of the editors that belong to the default validation group. */ + export function resetGroup(): void; + /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ + export function validateModel(model: Object): ValidationGroupValidationResult; + /** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */ + export function registerModelForValidation(model: Object) : void; + } + export var hardwareBackButton: JQueryCallback; + /** Processes the hardware back button click. */ + export function processHardwareBackButton(): void; + /** Hides the last displayed overlay widget. */ + export function hideTopOverlay(): boolean; + /** Specifies whether or not the entire application/site supports right-to-left representation. */ + export var rtlEnabled: boolean; + /** Registers a new component in the DevExpress.ui namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, componentClass: Object): void; + /** Registers a new component in the specified namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, namespace: Object, componentClass: Object): void; + export function requestAnimationFrame(callback: Function): number; + export function cancelAnimationFrame(requestID: number): void; + /** Custom Knockout binding that links an HTML element with a specific action. */ + export class Action { } + /** Used to get URLs that vary in a locally running application and the application running on production. */ + export class EndpointSelector { + constructor(options: { + [key: string]: { + local?: string; + production?: string; + } + }); + /** Returns a local or a productional URL depending on how the application is currently running. */ + urlFor(key: string): string; + } + /** An object that serves as a namespace for the methods that are used to animate UI elements. */ + export module fx { + /** Defines animation options. */ + export interface AnimationOptions { + /** A function called after animation is completed. */ + complete?: (element: JQuery, config: AnimationOptions) => void; + /** A number specifying wait time before animation execution. */ + delay?: number; + /** A number specifying the time period to wait before the animation of the next stagger item starts. */ + staggerDelay?: number; + /** A number specifying the time in milliseconds spent on animation. */ + duration?: number; + /** A string specifying the type of an easing function used for animation. */ + easing?: string; + /** Specifies the initial animation state. */ + from?: any; + /** A function called before animation is started. */ + start?: (element: JQuery, config: AnimationOptions) => void; + /** Specifies a final animation state. */ + to?: any; + /** A string value specifying the animation type. */ + type?: string; + /** Specifies the animation direction for the "slideIn" and "slideOut" animation types. */ + direction?: string; + } + /** Animates the specified element. */ + export function animate(element: HTMLElement, config: AnimationOptions): Object; + /** Returns a value indicating whether the specified element is being animated. */ + export function isAnimating(element: HTMLElement): boolean; + /** Stops the animation. */ + export function stop(element: HTMLElement, jumpToEnd: boolean): void; + } + /** The manager that performs several specified animations at a time. */ + export class TransitionExecutor { + /** Deletes all the animations registered in the Transition Executor by using the enter(elements, animation) and leave(elements, animation) methods. */ + reset(): void; + /** Registers a set of elements that should be animated as "entering" using the specified animation configuration. */ + enter(elements: JQuery, animation: any): void; + /** Registers a set of elements that should be animated as "leaving" using the specified animation configuration. */ + leave(elements: JQuery, animation: any): void; + /** Starts all the animations registered using the enter(elements, animation) and leave(elements, animation) methods beforehand. */ + start(config: Object): JQueryPromise; + /** Stops all started animations. */ + stop(): void; + } + export class AnimationPresetCollection { + /** Resets all the changes made in the animation repository. */ + resetToDefaults(): void; + /** Deletes the specified animation or clears all the animation repository, if an animation name is not passed. */ + clear(name: string): void; + /** Adds the specified animation preset to the animation repository by the specified name. */ + registerPreset(name: string, config: any): void; + /** Applies the changes made in the animation repository. */ + applyChanges(): void; + /** Returns the configuration of the animation found in the animation repository by the specified name for the current device. */ + getPreset(name: string): void; + /** Registers predefined animations in the animation repository. */ + registerDefaultPresets(): void; + } + /** A repository of animations. */ + export var animationPresets: AnimationPresetCollection; + /** The device object defines the device on which the application is running. */ + export interface Device { + /** Indicates whether or not the device platform is Android. */ + android?: boolean; + /** Specifies the type of the device on which the application is running. */ + deviceType?: string; + /** Indicates whether or not the device platform is generic, which means that the application will look and behave according to a generic "light" or "dark" theme. */ + generic?: boolean; + /** Indicates whether or not the device platform is iOS. */ + ios?: boolean; + /** Indicates whether or not the device type is 'phone'. */ + phone?: boolean; + /** Specifies the platform of the device on which the application is running. */ + platform?: string; + /** Indicates whether or not the device type is 'tablet'. */ + tablet?: boolean; + /** Specifies an array with the major and minor versions of the device platform. */ + version?: Array; + /** Indicates whether or not the device platform is Windows. */ + win?: boolean; + /** Specifies a performance grade of the current device. */ + grade?: string; + } + export class Devices implements EventsMixin { + constructor(options: { window: Window }); + /** Overrides actual device information to force the application to operate as if it was running on the specified device. */ + current(deviceName: any): void; + /** Returns information about the current device. */ + current(): Device; + orientationChanged: JQueryCallback; + /** Returns the current device orientation. */ + orientation(): string; + /** Returns real information about the current device regardless of the value passed to the devices.current(deviceName) method. */ + real(): Device; + on(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + on(eventName: string, eventHandler: Function): Devices; + on(events: { [eventName: string]: Function; }): Devices; + off(eventName: "orientationChanged"): Devices; + off(eventName: string): Devices; + off(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + off(eventName: string, eventHandler: Function): Devices; + } + /** An object that serves as a namespace for the methods and events specifying information on the current device. */ + export var devices: Devices; + /** The position object specifies the widget positioning options. */ + export interface PositionOptions { + /** The target element position that the widget is positioned against. */ + at?: any; + /** The element within which the widget is positioned. */ + boundary?: Object; + /** Specifies the horizontal and vertical offset from the window's boundaries. */ + boundaryOffset?: any; + /** Specifies how to move the widget if it overflows the screen. */ + collision?: any; + /** The position of the widget to align against the target element. */ + my?: any; + /** The target element that the widget is positioned against. */ + of?: Object; + /** Specifies horizontal and vertical offset in pixels. */ + offset?: any; + } + export interface ComponentOptions { + /** A handler for the initialized event. */ + onInitialized?: Function; + /** A handler for the optionChanged event. */ + onOptionChanged?: Function; + /** A handler for the disposing event. */ + onDisposing?: Function; + } + /** A base class for all components and widgets. */ + export class Component { + constructor(options?: ComponentOptions) + /** Prevents the component from refreshing until the endUpdate method is called. */ + beginUpdate(): void; + /** Enables the component to refresh after the beginUpdate method call. */ + endUpdate(): void; + /** Returns an instance of this component class. */ + instance(): Component; + /** Returns the configuration options of this component. */ + option(): { + [optionKey: string]: any; + }; + /** Sets one or more options of this component. */ + option(options: { + [optionKey: string]: any; + }): void; + /** Gets the value of the specified configuration option of this component. */ + option(optionName: string): any; + /** Sets a value to the specified configuration option of this component. */ + option(optionName: string, optionValue: any): void; + } + export interface DOMComponentOptions extends ComponentOptions { + /** Specifies whether or not the current component supports a right-to-left representation. */ + rtlEnabled?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the width of the widget. */ + width?: any; + /** A bag for holding any options that require two-way binding (Angular approach specific) */ + bindingOptions?: { [key: string]: any; }; + } + /** A base class for all components. */ + export class DOMComponent extends Component { + constructor(element: JQuery, options?: DOMComponentOptions); + constructor(element: HTMLElement, options?: DOMComponentOptions); + /** Returns the root HTML element of the widget. */ + element(): JQuery; + /** Specifies the device-dependent default configuration options for this component. */ + static defaultOptions(rule: { + device?: any; + options?: any; + }): void; + } + export module data { + export interface ODataError extends Error { + httpStatus?: number; + errorDetails?: any; + } + export interface StoreOptions { + /** A handler for the modified event. */ + onModified?: () => void; + /** A handler for the modifying event. */ + onModifying?: () => void; + /** A handler for the removed event. */ + onRemoved?: (key: any) => void; + /** A handler for the removing event. */ + onRemoving?: (key: any) => void; + /** A handler for the updated event. */ + onUpdated?: (key: any, values: Object) => void; + /** A handler for the updating event. */ + onUpdating?: (key: any, values: Object) => void; + /** A handler for the loaded event. */ + onLoaded?: (result: Array) => void; + /** A handler for the loading event. */ + onLoading?: (loadOptions: LoadOptions) => void; + /** A handler for the inserted event. */ + onInserted?: (values: Object, key: any) => void; + /** A handler for the inserting event. */ + onInserting?: (values: Object) => void; + /** Specifies the function called when the Store causes an error. */ + errorHandler?: (e: Error) => void; + /** Specifies the key properties within the data associated with the Store. */ + key?: any; + } + export interface LoadOptions { + filter?: Object; + sort?: Object; + select?: Object; + expand?: Object; + group?: Object; + skip?: number; + take?: number; + userData?: Object; + requireTotalCount?: boolean; + } + /** The base class for all Stores. */ + export class Store implements EventsMixin { + constructor(options?: StoreOptions); + /** Returns the data item specified by the key. */ + byKey(key: any): JQueryPromise; + /** Adds an item to the data associated with this Store. */ + insert(values: Object): JQueryPromise; + /** Returns the key expression specified via the key configuration option. */ + key(): any; + /** Returns the key of the Store item that matches the specified object. */ + keyOf(obj: Object): any; + /** Starts loading data. */ + load(obj?: LoadOptions): JQueryPromise; + /** Removes the data item specified by the key. */ + remove(key: any): JQueryPromise; + /** Obtains the total count of items that will be returned by the load() function. */ + totalCount(options?: { + filter?: Object; + group?: Object; + }): JQueryPromise; + /** Updates the data item specified by the key. */ + update(key: any, values: Object): JQueryPromise; + on(eventName: "removing", eventHandler: (key: any) => void): Store; + on(eventName: "removed", eventHandler: (key: any) => void): Store; + on(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "inserting", eventHandler: (values: Object) => void): Store; + on(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + on(eventName: "modifying", eventHandler: () => void): Store; + on(eventName: "modified", eventHandler: () => void): Store; + on(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + on(eventName: "loaded", eventHandler: (result: Array) => void): Store; + on(eventName: string, eventHandler: Function): Store; + on(events: { [eventName: string]: Function; }): Store; + off(eventName: "removing"): Store; + off(eventName: "removed"): Store; + off(eventName: "updating"): Store; + off(eventName: "updated"): Store; + off(eventName: "inserting"): Store; + off(eventName: "inserted"): Store; + off(eventName: "modifying"): Store; + off(eventName: "modified"): Store; + off(eventName: "loading"): Store; + off(eventName: "loaded"): Store; + off(eventName: string): Store; + off(eventName: "removing", eventHandler: (key: any) => void): Store; + off(eventName: "removed", eventHandler: (key: any) => void): Store; + off(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "inserting", eventHandler: (values: Object) => void): Store; + off(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + off(eventName: "modifying", eventHandler: () => void): Store; + off(eventName: "modified", eventHandler: () => void): Store; + off(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + off(eventName: "loaded", eventHandler: (result: Array) => void): Store; + off(eventName: string, eventHandler: Function): Store; + } + export interface ArrayStoreOptions extends StoreOptions { + /** Specifies the array associated with this Store. */ + data?: Array; + } + /** A Store accessing an in-memory array. */ + export class ArrayStore extends Store { + constructor(options?: ArrayStoreOptions); + /** Clears all data associated with the current ArrayStore. */ + clear(): void; + /** Creates the Query object for the underlying array. */ + createQuery(): Query; + } + interface Promise { + then(doneFn?: Function, failFn?: Function, progressFn?: Function): Promise; + } + export interface CustomStoreOptions extends StoreOptions { + /** Specifies whether or not the store combines the search expression with the filter expression. */ + useDefaultSearch?: boolean; + /** The user implementation of the byKey(key, extraOptions) method. */ + byKey?: (key: any) => Promise; + /** The user implementation of the insert(values) method. */ + insert?: (values: Object) => Promise; + /** The user implementation of the load(options) method. */ + load?: (options?: LoadOptions) => Promise; + /** The user implementation of the remove(key) method. */ + remove?: (key: any) => Promise; + /** The user implementation of the totalCount(options) method. */ + totalCount?: (options?: { + filter?: Object; + group?: Object; + }) => Promise; + /** The user implementation of the update(key, values) method. */ + update?: (key: any, values: Object) => Promise; + } + /** A Store object that enables you to implement your own data access logic. */ + export class CustomStore extends Store { + constructor(options: CustomStoreOptions); + } + export interface DataSourceOptions { + /** Specifies data filtering conditions. */ + filter?: Object; + /** Specifies data grouping conditions. */ + group?: Object; + /** The item mapping function. */ + map?: (record: any) => any; + /** Specifies the maximum number of items the page can contain. */ + pageSize?: number; + /** Specifies whether a DataSource loads data by pages, or all items at once. */ + paginate?: boolean; + /** The data post processing function. */ + postProcess?: (data: any[]) => any[]; + /** Specifies a value by which the required items are searched. */ + searchExpr?: Object; + /** Specifies the comparison operation used to search for the required items. */ + searchOperation?: string; + /** Specifies the value to which the search expression is compared. */ + searchValue?: Object; + /** Specifies the initial select option value. */ + select?: Object; + /** An array of the strings that represent the names of the navigation properties to be loaded simultaneously with the OData store's entity. */ + expand?: Object; + /** The bag of custom parameters passed to the query executed when the DataSource load operation is invoked. */ + customQueryParams?: Object; + /** Specifies whether or not the DataSource instance requests the total count of items available in the storage. */ + requireTotalCount?: boolean; + /** Specifies the initial sort option value. */ + sort?: Object; + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Error) => void; + } + export interface OperationPromise extends JQueryPromise { + operationId: number; + } + /** An object that provides access to a data web service or local data storage for collection container widgets. */ + export class DataSource implements EventsMixin { + constructor(url: string); + constructor(data: Array); + constructor(options: CustomStoreOptions); + constructor(options: DataSourceOptions); + /** Disposes all resources associated with this DataSource. */ + dispose(): void; + /** Returns the current filter option value. */ + filter(): Object; + /** Sets the filter option value. */ + filter(filterExpr: Object): void; + /** Returns the current group option value. */ + group(): Object; + /** Sets the group option value. */ + group(groupExpr: Object): void; + /** Indicates whether or not the current page contains fewer items than the number of items specified by the pageSize configuration option. */ + isLastPage(): boolean; + /** Indicates whether or not at least one load() method execution has successfully finished. */ + isLoaded(): boolean; + /** Indicates whether or not the DataSource is currently being loaded. */ + isLoading(): boolean; + /** Returns the array of items currently operated by the DataSource. */ + items(): Array; + /** Returns the key expression. */ + key(): any; + /** Starts loading data. */ + load(): OperationPromise>; + /** Clears currently loaded DataSource items and calls the load() method. */ + reload(): OperationPromise>; + /** Returns an object that would be passed to the load() method of the underlying Store according to the current data shaping option values of the current DataSource instance. */ + loadOptions(): Object; + /** Returns the current pageSize option value. */ + pageSize(): number; + /** Sets the pageSize option value. */ + pageSize(value: number): void; + /** Specifies the index of the currently loaded page. */ + pageIndex(): number; + /** Specifies the index of the page to be loaded during the next load() method execution. */ + pageIndex(newIndex: number): void; + /** Returns the current paginate option value. */ + paginate(): boolean; + /** Sets the paginate option value. */ + paginate(value: boolean): void; + /** Returns the searchExpr option value. */ + searchExpr(): Object; + /** Sets the searchExpr option value. */ + searchExpr(...expr: Object[]): void; + /** Returns the currently specified search operation. */ + searchOperation(): string; + /** Sets the current search operation. */ + searchOperation(op: string): void; + /** Returns the searchValue option value. */ + searchValue(): Object; + /** Sets the searchValue option value. */ + searchValue(value: Object): void; + /** Returns the current select option value. */ + select(): Object; + /** Sets the select option value. */ + select(expr: Object): void; + /** Returns the current requireTotalCount option value. */ + requireTotalCount(): boolean; + /** Sets the requireTotalCount option value. */ + requireTotalCount(value: boolean): void; + /** Returns the current sort option value. */ + sort(): Object; + /** Sets the sort option value. */ + sort(sortExpr: Object): void; + /** Returns the underlying Store instance. */ + store(): Store; + /** Returns the number of data items available in an underlying Store after the last load() operation without paging. */ + totalCount(): number; + /** Cancels the load operation associated with the specified identifier. */ + cancel(operationId: number): boolean; + on(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + on(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + on(eventName: "changed", eventHandler: () => void): DataSource; + on(eventName: string, eventHandler: Function): DataSource; + on(events: { [eventName: string]: Function; }): DataSource; + off(eventName: "loadingChanged"): DataSource; + off(eventName: "loadError"): DataSource; + off(eventName: "changed"): DataSource; + off(eventName: string): DataSource; + off(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + off(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + off(eventName: "changed", eventHandler: () => void): DataSource; + off(eventName: string, eventHandler: Function): DataSource; + } + /** An object used to work with primitive data types not supported by JavaScript when accessing an OData web service. */ + export class EdmLiteral { + /** Creates an EdmLiteral instance and assigns the specified value to it. */ + constructor(value: string); + /** Returns a string representation of the value associated with this EdmLiteral object. */ + valueOf(): string; + } + /** An object used to generate and hold the GUID. */ + export class Guid { + /** Creates a new Guid instance that holds the specified GUID. */ + constructor(value: string); + /** Creates a new Guid instance holding the generated GUID. */ + constructor(); + /** Returns a string representation of the Guid instance. */ + toString(): string; + /** Returns a string representation of the Guid instance. */ + valueOf(): string; + } + export interface LocalStoreOptions extends ArrayStoreOptions { + /** Specifies the time (in miliseconds) after the change operation, before the data is flushed. */ + flushInterval?: number; + /** Specifies whether the data is flushed immediatelly after each change operation, or after the delay specified via the flushInterval option. */ + immediate?: boolean; + /** The unique identifier used to distinguish the data within the HTML5 Web Storage. */ + name?: string; + } + /** A Store providing access to the HTML5 Web Storage. */ + export class LocalStore extends ArrayStore { + constructor(options?: LocalStoreOptions); + /** Removes all data associated with this Store. */ + clear(): void; + } + export interface ODataContextOptions extends ODataStoreOptions { + /** Specifies the list of entities to be accessed via the ODataContext. */ + entities?: Object; + /** Specifies the function called if the ODataContext causes an error. */ + errorHandler?: (e: Error) => void; + } + /** Provides access to the entire OData service. */ + export class ODataContext { + constructor(options?: ODataContextOptions); + /** Initiates the specified WebGet service operation that returns a value. For the information on service operations, refer to the OData documentation. */ + get(operationName: string, params: Object): JQueryPromise; + /** Initiates the specified WebGet service operation that returns nothing. For the information on service operations, refer to the OData documentation. */ + invoke(operationName: string, params: Object, httpMethod: Object): JQueryPromise; + /** Return a special proxy object to describe the entity link. */ + objectLink(entityAlias: string, key: any): Object; + } + export interface ODataStoreOptions extends StoreOptions { + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: { + url: string; + async: boolean; + method: string; + timeout: number; + params: Object; + payload: Object; + headers: Object; + }) => void; + /** Specifies whether the ODataStore uses the JSONP approach to access non-CORS-compatible remote services. */ + jsonp?: boolean; + /** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, and Guid. */ + keyType?: any; + /** Specifies whether or not dates found in the response are deserialized. */ + deserializeDates?: boolean; + /** Specifies the URL of the data service being accessed via the current ODataContext. */ + url?: string; + /** Specifies the version of the OData protocol used to interact with the data service. */ + version?: number; + /** Specifies the value of the withCredentials field of the underlying jqXHR object. */ + withCredentials?: boolean; + } + /** A Store providing access to a separate OData web service entity. */ + export class ODataStore extends Store { + constructor(options?: ODataStoreOptions); + /** Creates the Query object for the OData endpoint. */ + createQuery(loadOptions: Object): Object; + /** Returns the data item specified by the key. */ + byKey(key: any, extraOptions?: { expand?: Object }): JQueryPromise; + } + /** An universal chainable data query interface object. */ + export interface Query { + /** Calculates a custom summary for the items in the current Query. */ + aggregate(step: (accumulator: any, value: any) => any): JQueryPromise; + /** Calculates a custom summary for the items in the current Query. */ + aggregate(seed: any, step: (accumulator: any, value: any) => any, finalize: (result: any) => any): JQueryPromise; + /** Calculates the average item value for the current Query. */ + avg(getter: Object): JQueryPromise; + /** Finds the item with the maximum getter value. */ + max(getter: Object): JQueryPromise; + /** Finds the item with the maximum value in the Query. */ + max(): JQueryPromise; + /** Finds the item with the minimum value in the Query. */ + min(): JQueryPromise; + /** Finds the item with the minimum getter value. */ + min(getter: Object): JQueryPromise; + /** Calculates the average item value for the current Query, if each Query item has a numeric type. */ + avg(): JQueryPromise; + /** Returns the total count of items in the current Query. */ + count(): JQueryPromise; + /** Executes the Query. */ + enumerate(): JQueryPromise; + /** Filters the current Query data. */ + filter(criteria: Array): Query; + /** Filters the current Query data. */ + filter(predicate: (item: any) => boolean): Query; + /** Groups the current Query data. */ + groupBy(getter: Object): Query; + /** Applies the specified transformation to each item. */ + select(getter: Object): Query; + /** Limits the data item count. */ + slice(skip: number, take?: number): Query; + /** Sorts current Query data. */ + sortBy(getter: Object, desc: boolean): Query; + /** Sorts current Query data. */ + sortBy(getter: Object): Query; + /** Calculates the sum of item getter values in the current Query. */ + sum(getter: Object): JQueryPromise; + /** Calculates the sum of item values in the current Query. */ + sum(): JQueryPromise; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object): Query; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object, desc: boolean): Query; + /** Returns the array of current Query items. */ + toArray(): Array; + } + /** The global data layer error handler. */ + export var errorHandler: (e: Error) => void; + /** Encodes the specified string or array of bytes to base64 encoding. */ + export function base64_encode(input: any): string; + /** Creates a Query instance. */ + export function query(array: Array): Query; + /** Creates a Query instance for accessing the remote service specified by a URL. */ + export function query(url: string, queryOptions: Object): Query; + /** This section describes the utility objects provided by the DevExtreme data layer. */ + export var utils: { + /** Compiles a getter function from the getter expression. */ + compileGetter(expr: any): Function; + /** Compiles a setter function from the setter expression. */ + compileSetter(expr: any): Function; + odata: { + /** Holds key value converters for OData. */ + keyConverters: { + String(value: any): string; + Int32(value: any): number; + Int64(value: any): EdmLiteral; + Guid(value: any): Guid; + Boolean(value: any): boolean; + Single(value: any): EdmLiteral; + Decimal(value: any): EdmLiteral; + }; + } + } + } + /** An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications. */ + export module ui { + export interface WidgetOptions extends DOMComponentOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + /** Specifies whether or not the widget can be focused. */ + focusStateEnabled?: boolean; + /** Specifies a shortcut key that sets focus on the widget element. */ + accessKey?: string; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** Specifies the widget tab index. */ + tabIndex?: number; + /** Specifies the text of the hint displayed for the widget. */ + hint?: string; + } + /** The base class for widgets. */ + export class Widget extends DOMComponent { + constructor(options?: WidgetOptions); + /** Redraws the widget. */ + repaint(): void; + /** Sets focus on the widget. */ + focus(): void; + /** Registers a handler when a specified key is pressed. */ + registerKeyHandler(key: string, handler: Function): void; + } + export interface CollectionWidgetOptions extends WidgetOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** The time period in milliseconds before the onItemHold event is raised. */ + itemHoldTimeout?: number; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + loopItemFocus?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + onContentReady?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemContextMenu event. */ + onItemContextMenu?: Function; + /** A handler for the itemHold event. */ + onItemHold?: Function; + /** A handler for the itemRendered event. */ + onItemRendered?: Function; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** The index of the currently selected widget item. */ + selectedIndex?: number; + /** The selected item object. */ + selectedItem?: Object; + /** An array of currently selected item objects. */ + selectedItems?: Array; + /** A handler for the itemDeleting event. */ + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + } + /** The base class for widgets containing an item collection. */ + export class CollectionWidget extends Widget { + constructor(element: JQuery, options?: CollectionWidgetOptions); + constructor(element: HTMLElement, options?: CollectionWidgetOptions); + selectItem(itemElement: any): void; + unselectItem(itemElement: any): void; + deleteItem(itemElement: any): JQueryPromise; + isItemSelected(itemElement: any): boolean; + reorderItem(itemElement: any, toItemElement: any): JQueryPromise; + } + export interface DataExpressionMixinOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of a data source item field whose value is held in the value configuration option. */ + valueExpr?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** The currently selected value in the widget. */ + value?: Object; + } + export interface EditorOptions extends WidgetOptions { + /** The currently specified value. */ + value?: Object; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** A Boolean value specifying whether or not the widget is read-only. */ + readOnly?: boolean; + /** Holds the object that defines the error that occurred during validation. */ + validationError?: Object; + /** Specifies whether the editor's value is valid. */ + isValid?: boolean; + /** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ + validationMessageMode?: string; + } + /** A base class for editors. */ + export class Editor extends Widget { + /** Resets the editor's value to undefined. */ + reset(): void; + } + /** An object that serves as a namespace for methods displaying a message in an application/site. */ + export var dialog: { + /** Creates an alert dialog message containing a single "OK" button. */ + alert(message: string, title: string): JQueryPromise; + /** Creates a confirm dialog that contains "Yes" and "No" buttons. */ + confirm(message: string, title: string): JQueryPromise; + /** Creates a custom dialog using the options specified by the passed configuration object. */ + custom(options: { title?: string; message?: string; buttons?: Array; }): { + show(): JQueryPromise; + hide(): void; + hide(value: any): void; + }; + }; + /** Creates a toast message. */ + export function notify(message: any, type: string, displayTime: number): void; + /** Creates a toast message. */ + export function notify(options: Object): void; + /** An object that serves as a namespace for the methods that work with DevExtreme CSS Themes. */ + export var themes: { + /** Returns the name of the currently applied theme. */ + current(): string; + /** Changes the current theme to the specified one. */ + current(themeName: string): void; + }; + /** Sets a specified template engine. */ + export function setTemplateEngine(name: string): void; + /** Sets a custom template engine defined via custom compile and render functions. */ + export function setTemplateEngine(options: Object): void; + } + /** An object that serves as a namespace for utility methods that can be helpful when working with the DevExtreme framework and UI widgets. */ + export var utils: { + /** Sets parameters for the viewport meta tag. */ + initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + /** Requests that the browser call a specified function to update animation before the next repaint. */ + requestAnimationFrame(callback: Function): number; + /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ + cancelAnimationFrame(requestID: number): void; + }; + /** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */ + export module viz { + /** Applies a theme for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(theme: string): void; + /** Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(platform: string, colorScheme: string): void; + /** Registers a new theme based on the existing one. */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** Applies a predefined or registered custom palette to all visualization widgets at once. */ + export function currentPalette(paletteName: string): void; + /** Obtains the color sets of a predefined or registered palette. */ + export function getPalette(paletteName: string): Object; + /** Registers a new palette. */ + export function registerPalette(paletteName: string, palette: Object): void; + } +} +declare module DevExpress.ui { + export interface dxValidatorOptions extends DOMComponentOptions { + /** An array of validation rules to be checked for the editor with which the dxValidator object is associated. */ + validationRules?: Array; + /** Specifies the editor name to be used in the validation default messages. */ + name?: string; + /** An object that specifies what and when to validate, and how to apply the validation result. */ + adapter?: Object; + /** Specifies the validation group the editor will be related to. */ + validationGroup?: string; + /** A handler for the validated event. */ + onValidated?: (params: validationEngine.ValidatorValidationResult) => void; + } + /** A widget that is used to validate the associated DevExtreme editors against the defined validation rules. */ + export class dxValidator extends DOMComponent implements validationEngine.IValidator { + constructor(element: JQuery, options?: dxValidatorOptions); + constructor(element: Element, options?: dxValidatorOptions); + /** Validates the value of the editor that is controlled by the current dxValidator object against the list of the specified validation rules. */ + validate(): validationEngine.ValidatorValidationResult; + /** Resets the value and validation result of the editor associated with the current dxValidator object. */ + reset(): void; + } + /** The widget that is used in the Knockout and Angular approaches to combine the editors to be validated. */ + export class dxValidationGroup extends DOMComponent { + constructor(element: JQuery); + constructor(element: Element); + /** Validates rules of the validators that belong to the current validation group. */ + validate(): validationEngine.ValidationGroupValidationResult; + /** Resets the value and validation result of the editors that are included to the current validation group. */ + reset(): void; + } + export interface dxValidationSummaryOptions extends CollectionWidgetOptions { + /** Specifies the validation group for which summary should be generated. */ + validationGroup?: string; + } + /** A widget for displaying the result of checking validation rules for editors. */ + export class dxValidationSummary extends CollectionWidget { + constructor(element: JQuery, options?: dxValidationSummaryOptions); + constructor(element: Element, options?: dxValidationSummaryOptions); + } + export interface dxResizableOptions extends DOMComponentOptions { + /** Specifies which borders of the widget element are used as a handle. */ + handles?: string; + /** Specifies the lower width boundary for resizing. */ + minWidth?: number; + /** Specifies the upper width boundary for resizing. */ + maxWidth?: number; + /** Specifies the lower height boundary for resizing. */ + minHeight?: number; + /** Specifies the upper height boundary for resizing. */ + maxHeight?: number; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + } + /** A widget that displays required content in a resizable element. */ + export class dxResizable extends DOMComponent { + constructor(element: JQuery, options?: dxResizableOptions); + constructor(element: Element, options?: dxResizableOptions); + } + export interface dxTooltipOptions extends dxPopoverOptions { + } + /** A tooltip widget. */ + export class dxTooltip extends dxPopover { + constructor(element: JQuery, options?: dxTooltipOptions); + constructor(element: Element, options?: dxTooltipOptions); + } + export interface dxDropDownListOptions extends dxDropDownEditorOptions, DataExpressionMixinOptions { + /** Returns the value currently displayed by the widget. */ + displayValue?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies whether or not the widget displays unfiltered values until a user types a number of characters exceeding the minSearchLength option value. */ + showDataBeforeSearch?: boolean; + /** Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */ + searchExpr?: any; + /** Specifies the binary operation used to filter data. */ + searchMode?: string; + /** Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed. */ + searchTimeout?: number; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget supports searching. */ + searchEnabled?: boolean; + /** + * Specifies whether or not the widget displays items by pages. + * @deprecated Use the DataSource paging opportunities instead. + */ + pagingEnabled?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** A handler for the itemClick event. */ + onItemClick?: Function; + onContentReady?: Function; + } + /** A base class for drop-down list widgets. */ + export class dxDropDownList extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDropDownListOptions); + constructor(element: Element, options?: dxDropDownListOptions); + } + export interface dxToolbarOptions extends CollectionWidgetOptions { + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** Informs the widget about its location in a view HTML markup. */ + renderAs?: string; + } + /** A toolbar widget. */ + export class dxToolbar extends CollectionWidget { + constructor(element: JQuery, options?: dxToolbarOptions); + constructor(element: Element, options?: dxToolbarOptions); + } + export interface dxToastOptions extends dxOverlayOptions { + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** The time span in milliseconds during which the dxToast widget is visible. */ + displayTime?: number; + height?: any; + /** The dxToast message text. */ + message?: string; + position?: PositionOptions; + shading?: boolean; + /** Specifies the dxToast widget type. */ + type?: string; + width?: any; + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user swipes it out of the screen boundaries. */ + closeOnSwipe?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user clicks it. */ + closeOnClick?: boolean; + } + /** The toast message widget. */ + export class dxToast extends dxOverlay { + constructor(element: JQuery, options?: dxToastOptions); + constructor(element: Element, options?: dxToastOptions); + } + export interface dxTextEditorOptions extends EditorOptions { + /** A handler for the change event. */ + onChange?: Function; + /** A handler for the copy event. */ + onCopy?: Function; + /** A handler for the cut event. */ + onCut?: Function; + /** A handler for the enterKey event. */ + onEnterKey?: Function; + /** A handler for the focusIn event. */ + onFocusIn?: Function; + /** A handler for the focusOut event. */ + onFocusOut?: Function; + /** A handler for the input event. */ + onInput?: Function; + /** A handler for the keyDown event. */ + onKeyDown?: Function; + /** A handler for the keyPress event. */ + onKeyPress?: Function; + /** A handler for the keyUp event. */ + onKeyUp?: Function; + /** A handler for the paste event. */ + onPaste?: Function; + /** The text displayed by the widget when the widget value is empty. */ + placeholder?: string; + /** Specifies whether to display the Clear button in the widget. */ + showClearButton?: boolean; + /** Specifies the current value displayed by the widget. */ + value?: any; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + /** Specifies HTML attributes applied to the inner input element of the widget. */ + attr?: Object; + /** The read-only option that holds the text displayed by the widget input element. */ + text?: string; + focusStateEnabled?: boolean; + hoverStateEnabled?: boolean; + /** The editor mask that specifies the format of the entered string. */ + mask?: string; + /** Specifies a mask placeholder character. */ + maskChar?: string; + /** Specifies custom mask rules. */ + maskRules?: Object; + /** A message displayed when the entered text does not match the specified pattern. */ + maskInvalidMessage?: string; + /** Specifies whether the value option holds only characters entered by a user or prompt characters as well. */ + useMaskedValue?: boolean; + } + /** A base class for text editing widgets. */ + export class dxTextEditor extends Editor { + constructor(element: JQuery, options?: dxTextEditorOptions); + constructor(element: Element, options?: dxTextEditorOptions); + /** Removes focus from the input element. */ + blur(): void; + /** Sets focus to the input element representing the widget. */ + focus(): void; + } + export interface dxTextBoxOptions extends dxTextEditorOptions { + /** Specifies the maximum number of characters you can enter into the textbox. */ + maxLength?: any; + /** The "mode" attribute value of the actual HTML input element representing the text box. */ + mode?: string; + } + /** A single-line text box widget. */ + export class dxTextBox extends dxTextEditor { + constructor(element: JQuery, options?: dxTextBoxOptions); + constructor(element: Element, options?: dxTextBoxOptions); + } + export interface dxTextAreaOptions extends dxTextBoxOptions { + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + } + /** A widget used to display and edit multi-line text. */ + export class dxTextArea extends dxTextBox { + constructor(element: JQuery, options?: dxTextAreaOptions); + constructor(element: Element, options?: dxTextAreaOptions); + } + export interface dxTabsOptions extends CollectionWidgetOptions { + /** Specifies whether the widget enables an end-user to select only a single item or multiple items. */ + selectionMode?: string; + /** Specifies whether or not an end-user can scroll tabs by swiping. */ + scrollByContent?: boolean; + /** Specifies whether or not an end-user can scroll tabs. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A tab strip used to switch between pages. */ + export class dxTabs extends CollectionWidget { + constructor(element: JQuery, options?: dxTabsOptions); + constructor(element: Element, options?: dxTabsOptions); + } + export interface dxTabPanelOptions extends dxMultiViewOptions { + /** A handler for the titleClick event. */ + onTitleClick?: any; + /** A handler for the titleHold event. */ + onTitleHold?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** A Boolean value specifying if tabs in the title are scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value that indicates whether or not to add scrolling support for tabs in the title. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A widget used to display a view and to switch between several views by clicking the appropriate tabs. */ + export class dxTabPanel extends dxMultiView { + constructor(element: JQuery, options?: dxTabPanelOptions); + constructor(element: Element, options?: dxTabPanelOptions); + } + export interface dxSelectBoxOptions extends dxDropDownListOptions { + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + /** The text that is provided as a hint in the select box editor. */ + placeholder?: string; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + } + /** A widget that allows you to select an item in a dropdown list. */ + export class dxSelectBox extends dxDropDownList { + constructor(element: JQuery, options?: dxSelectBoxOptions); + constructor(element: Element, options?: dxSelectBoxOptions); + } + export interface dxTagBoxOptions extends dxSelectBoxOptions { + /** Holds the list of selected values. */ + values?: Array; + /** A read-only option that holds the last selected value. */ + value?: Object; + } + /** A widget that allows you to select multiple items from a dropdown list. */ + export class dxTagBox extends dxSelectBox { + constructor(element: JQuery, options?: dxTagBoxOptions); + constructor(element: Element, options?: dxTagBoxOptions); + } + export interface dxScrollViewOptions extends dxScrollableOptions { + /** A handler for the pullDown event. */ + onPullDown?: Function; + /** Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the reachBottom event. */ + onReachBottom?: Function; + /** Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom. */ + reachBottomText?: string; + /** Specifies the text shown in the pullDown panel displayed when the content is being refreshed. */ + refreshingText?: string; + } + /** A widget used to display scrollable content. */ + export class dxScrollView extends dxScrollable { + constructor(element: JQuery, options?: dxScrollViewOptions); + constructor(element: Element, options?: dxScrollViewOptions); + /** Returns a value indicating if the scrollView content is larger then the widget container. */ + isFull(): boolean; + /** Locks the widget until the release(preventScrollBottom) method is called and executes the function passed to the onPullDown option and the handler assigned to the pullDown event. */ + refresh(): void; + /** Notifies the scroll view that data loading is finished. */ + release(preventScrollBottom: boolean): JQueryPromise; + /** Toggles the loading state of the widget. */ + toggleLoading(showOrHide: boolean): void; + } + export interface dxScrollableLocation { + top?: number; + left?: number; + } + export interface dxScrollableOptions extends DOMComponentOptions { + /** A string value specifying the available scrolling directions. */ + direction?: string; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A handler for the scroll event. */ + onScroll?: Function; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** A handler for the update event. */ + onUpdated?: Function; + /** Indicates whether to use native or simulated scrolling. */ + useNative?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content swiping it up or down. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content using the scrollbar. */ + scrollByThumb?: boolean; + } + /** A widget used to display scrollable content. */ + export class dxScrollable extends DOMComponent { + constructor(element: JQuery, options?: dxScrollableOptions); + constructor(element: Element, options?: dxScrollableOptions); + /** Returns the height of the scrollable widget in pixels. */ + clientHeight(): number; + /** Returns the width of the scrollable widget in pixels. */ + clientWidth(): number; + /** Returns an HTML element of the widget. */ + content(): JQuery; + /** Scrolls the widget content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Scrolls widget content by the specified number of pixels in horizontal and vertical directions. */ + scrollBy(distanceObject: dxScrollableLocation): void; + /** Returns the height of the scrollable content in pixels. */ + scrollHeight(): number; + /** Returns the current scroll position against the leftmost position. */ + scrollLeft(): number; + /** Returns how far the scrollable content is scrolled from the top and from the left. */ + scrollOffset(): dxScrollableLocation; + /** Scrolls widget content to the specified position. */ + scrollTo(targetLocation: number): void; + /** Scrolls widget content to a specified position. */ + scrollTo(targetLocation: dxScrollableLocation): void; + /** Scrolls widget content to the specified element. */ + scrollToElement(element: Element): void; + /** Returns the current scroll position against the topmost position. */ + scrollTop(): number; + /** Returns the width of the scrollable content in pixels. */ + scrollWidth(): number; + /** Updates the dimensions of the scrollable contents. */ + update(): void; + } + export interface dxRadioGroupOptions extends EditorOptions, DataExpressionMixinOptions { + activeStateEnabled?: boolean; + /** Specifies the radio group layout. */ + layout?: string; + } + /** A widget that enables a user to select one item within a list of items represented by radio buttons. */ + export class dxRadioGroup extends CollectionWidget { + constructor(element: JQuery, options?: dxRadioGroupOptions); + constructor(element: Element, options?: dxRadioGroupOptions); + } + export interface dxPopupButtonOptions { + /** Specifies whether or not a toolbar item must be displayed disabled. */ + disabled?: boolean; + /** Specifies html code inserted into the toolbar item element. */ + html?: string; + /** Specifies a location for the item on the toolbar. */ + location?: string; + /** Specifies a configuration object for the widget that presents a toolbar item. */ + options?: Object; + /** Specifies an item template that should be used to render this item only. */ + template?: any; + /** Specifies text displayed for the toolbar item. */ + text?: string; + /** Specifies whether the item is displayed on a top or bottom toolbar. */ + toolbar?: string; + /** Specifies whether or not a widget item must be displayed. */ + visible?: boolean; + /** A widget that presents a toolbar item. */ + widget?: string; + } + export interface dxPopupOptions extends dxOverlayOptions { + /** Specifies whether or not to allow a user to drag the popup window. */ + dragEnabled?: boolean; + /** A Boolean value specifying whether or not to display the widget in full-screen mode. */ + fullScreen?: boolean; + position?: PositionOptions; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showTitle?: boolean; + /** The title in the overlay window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + width?: any; + /** Specifies items displayed on the top or bottom toolbar of the popup window. */ + buttons?: Array; + /** Specifies whether or not the widget displays the Close button. */ + showCloseButton?: boolean; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + } + /** A widget that displays required content in a popup window. */ + export class dxPopup extends dxOverlay { + constructor(element: JQuery, options?: dxPopupOptions); + constructor(element: Element, options?: dxPopupOptions); + } + export interface dxPopoverOptions extends dxPopupOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** Specifies the height of the widget. */ + height?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + shading?: boolean; + /** A Boolean value specifying whether or not to display the title in the overlay window. */ + showTitle?: boolean; + /** The target element associated with a popover. */ + target?: any; + /** Specifies the width of the widget. */ + width?: any; + } + /** A widget that displays the required content in a popup window. */ + export class dxPopover extends dxPopup { + constructor(element: JQuery, options?: dxPopoverOptions); + constructor(element: Element, options?: dxPopoverOptions); + /** Displays the widget for the specified target element. */ + show(target?: any): JQueryPromise; + } + export interface dxOverlayOptions extends WidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** A Boolean value specifying whether or not the widget is closed if a user presses the Back hardware button. */ + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlapping window. */ + closeOnOutsideClick?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + /** Specifies whether or not an end-user can drag the widget. */ + dragEnabled?: boolean; + /** Specifies whether or not an end user can resize the widget. */ + resizeEnabled?: boolean; + /** The height of the widget in pixels. */ + height?: any; + /** Specifies the maximum height the widget can reach while resizing. */ + maxHeight?: any; + /** Specifies the maximum width the widget can reach while resizing. */ + maxWidth?: any; + /** Specifies the minimum height the widget can reach while resizing. */ + minHeight?: any; + /** Specifies the minimum width the widget can reach while resizing. */ + minWidth?: any; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** A Boolean value specifying whether or not the main screen is inactive while the widget is active. */ + shading?: boolean; + /** Specifies the shading color. */ + shadingColor?: string; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + onContentReady?: Function; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** The widget width in pixels. */ + width?: any; + } + /** A widget displaying the required content in an overlay window. */ + export class dxOverlay extends Widget { + constructor(element: JQuery, options?: dxOverlayOptions); + constructor(element: Element, options?: dxOverlayOptions); + /** An HTML element of the widget. */ + content(): JQuery; + /** Hides the widget. */ + hide(): JQueryPromise; + /** Recalculates the overlay's size and position. */ + repaint(): void; + /** Shows the widget. */ + show(): JQueryPromise; + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** A static method that specifies the base z-index for all overlay widgets. */ + static baseZIndex(zIndex: number): void; + } + export interface dxNumberBoxOptions extends dxTextEditorOptions { + /** The maximum value accepted by the number box. */ + max?: number; + /** The minimum value accepted by the number box. */ + min?: number; + /** Specifies whether or not to show spin buttons. */ + showSpinButtons?: boolean; + useTouchSpinButtons?: boolean; + /** Specifies by which value the widget value changes when a spin button is clicked. */ + step?: number; + /** The current number box value. */ + value?: number; + /** The "mode" attribute value of the actual HTML input element representing the widget. */ + mode?: string; + } + /** A textbox widget that enables a user to enter numeric values. */ + export class dxNumberBox extends dxTextEditor { + constructor(element: JQuery, options?: dxNumberBoxOptions); + constructor(element: Element, options?: dxNumberBoxOptions); + } + export interface dxNavBarOptions extends dxTabsOptions { + scrollingEnabled?: boolean; + } + /** A widget that contains items used to navigate through application views. */ + export class dxNavBar extends dxTabs { + constructor(element: JQuery, options?: dxNavBarOptions); + constructor(element: Element, options?: dxNavBarOptions); + } + export interface dxMultiViewOptions extends CollectionWidgetOptions { + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently displayed item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to change the selected index by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget used to display a view and to switch between several views. */ + export class dxMultiView extends CollectionWidget { + constructor(element: JQuery, options?: dxMultiViewOptions); + constructor(element: Element, options?: dxMultiViewOptions); + } + export interface dxMapOptions extends WidgetOptions { + /** Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route, or when creating a widget if it initially contains markers or routes. */ + autoAdjust?: boolean; + center?: { + /** The latitude location displayed in the center of the widget. */ + lat?: number; + /** The longitude location displayed in the center of the widget. */ + lng?: number; + }; + /** A handler for the click event. */ + onClick?: any; + /** Specifies whether or not map widget controls are available. */ + controls?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** A key used to authenticate the application within the required map provider. */ + key?: { + /** A key used to authenticate the application within the "Bing" map provider. */ + bing?: string; + /** A key used to authenticate the application within the "Google" map provider. */ + google?: string; + /** A key used to authenticate the application within the "Google Static" map provider. */ + googleStatic?: string; + } + /** A handler for the markerAdded event. */ + onMarkerAdded?: Function; + /** A URL pointing to the custom icon to be used for map markers. */ + markerIconSrc?: string; + /** A handler for the markerRemoved event. */ + onMarkerRemoved?: Function; + /** An array of markers displayed on a map. */ + markers?: Array; + /** The name of the current map data provider. */ + provider?: string; + /** A handler for the ready event. */ + onReady?: Function; + /** A handler for the routeAdded event. */ + onRouteAdded?: Function; + /** A handler for the routeRemoved event. */ + onRouteRemoved?: Function; + /** An array of routes shown on the map. */ + routes?: Array; + /** The type of a map to display. */ + type?: string; + /** Specifies the width of the widget. */ + width?: any; + /** The zoom level of the map. */ + zoom?: number; + } + /** An interactive map widget. */ + export class dxMap extends Widget { + constructor(element: JQuery, options?: dxMapOptions); + constructor(element: Element, options?: dxMapOptions); + /** Adds a marker to the map. */ + addMarker(markerOptions: Object): JQueryPromise; + /** Adds a route to the map. */ + addRoute(routeOptions: Object): JQueryPromise; + /** Removes a marker from the map. */ + removeMarker(marker: Object): JQueryPromise; + /** Removes a route from the map. */ + removeRoute(route: any): JQueryPromise; + } + export interface dxLookupOptions extends dxDropDownListOptions { + applyValueMode?: string; + /** An object that defines widget animation options. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + /** The text displayed on the Clear button. */ + clearButtonText?: string; + /** Specifies whether or not the widget cleans the search box when the popup window is displayed. */ + cleanSearchOnOpening?: boolean; + /** A Boolean value specifying whether or not a widget is closed if a user clicks outside of the overlaying window. */ + closeOnOutsideClick?: any; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** A Boolean value specifying whether or not to display the lookup in full-screen mode. */ + fullScreen?: boolean; + focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not to group widget items. */ + grouped?: boolean; + /** The name of the template used to display a group header. */ + groupTemplate?: any; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies the text shown in the pullDown panel, which is displayed when the widget is scrolled to the bottom. */ + pageLoadingText?: string; + /** The text displayed by the widget when nothing is selected. */ + placeholder?: string; + /** The height of the widget popup element. */ + popupHeight?: any; + /** The width of the widget popup element. */ + popupWidth?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the text displayed in the pullDown panel when the widget is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the widget is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + /** A Boolean value specifying whether or not the search bar is visible. */ + searchEnabled?: boolean; + /** The text that is provided as a hint in the lookup's search bar. */ + searchPlaceholder?: string; + /** A Boolean value specifying whether or not the main screen is inactive while the lookup is active. */ + shading?: boolean; + /** Specifies whether to display the Cancel button in the lookup window. */ + showCancelButton?: boolean; + /** + * A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. + * @deprecated Use the pageLoadMode option instead. + */ + showNextButton?: boolean; + /** The title of the lookup window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** Specifies whether or not to show lookup contents in a dxPopover widget. */ + usePopover?: boolean; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showPopupTitle?: boolean; + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + } + /** A widget that allows a user to select predefined values from a lookup window. */ + export class dxLookup extends dxDropDownList { + constructor(element: JQuery, options?: dxLookupOptions); + constructor(element: Element, options?: dxLookupOptions); + } + export interface dxLoadPanelOptions extends dxOverlayOptions { + /** An object defining the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** The delay in milliseconds after which the load panel is displayed. */ + delay?: number; + /** The height of the widget. */ + height?: number; + /** A URL pointing to an image to be used as a load indicator. */ + indicatorSrc?: string; + /** The text displayed in the load panel. */ + message?: string; + /** A Boolean value specifying whether or not to show a load indicator. */ + showIndicator?: boolean; + /** A Boolean value specifying whether or not to show the pane behind the load indicator. */ + showPane?: boolean; + /** The width of the widget. */ + width?: number; + } + /** A widget used to indicate whether or not an element is loading. */ + export class dxLoadPanel extends dxOverlay { + constructor(element: JQuery, options?: dxLoadPanelOptions); + constructor(element: Element, options?: dxLoadPanelOptions); + } + export interface dxLoadIndicatorOptions extends WidgetOptions { + /** Specifies the path to an image used as the indicator. */ + indicatorSrc?: string; + } + /** The widget used to indicate the loading process. */ + export class dxLoadIndicator extends Widget { + constructor(element: JQuery, options?: dxLoadIndicatorOptions); + constructor(element: Element, options?: dxLoadIndicatorOptions); + } + /** An object containing items for a context menu called for a list item. */ + export interface ListOptionsMenuItem { + /** Specifies the menu item text. */ + text?: string; + /** Specifies the function called when the menu item is clicked. */ + action?: (itemElement: Element, itemData: any) => void; + } + export interface dxListOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not to display a grouped list. */ + grouped?: boolean; + /** The template to be used for rendering item groups. */ + groupTemplate?: any; + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the groupRendered event. */ + onGroupRendered?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemSwipe event. */ + onItemSwipe?: Function; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies the text shown in the pullDown panel, which is displayed when the list is scrolled to the bottom. */ + pageLoadingText?: string; + /** Specifies the text displayed in the pullDown panel when the list is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the list is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + /** A Boolean value specifying whether to enable or disable list scrolling. */ + scrollingEnabled?: boolean; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying if the list is scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value specifying if the list is scrolled using the scrollbar. */ + scrollByThumb?: boolean; + onItemContextMenu?: Function; + onItemHold?: Function; + /** Specifies whether or not an end-user can collapse groups. */ + collapsibleGroups?: boolean; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies whether or not to display controls used to select list items. */ + showSelectionControls?: boolean; + /** Specifies item selection mode. */ + selectionMode?: string; + selectAllText?: string; + onSelectAllChanged?: Function; + /** Specifies the array of items for a context menu called for a list item. */ + menuItems?: Array; + /** Specifies whether an item context menu is shown when a user holds or swipes an item. */ + menuMode?: string; + /** Specifies whether or not an end user can delete list items. */ + allowItemDeleting?: boolean; + /** Specifies the way a user can delete items from the list. */ + itemDeleteMode?: string; + /** Specifies whether or not an end user can reorder list items. */ + allowItemReordering?: boolean; + /** Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ + indicateLoading?: boolean; + activeStateEnabled?: boolean; + } + /** A list widget. */ + export class dxList extends CollectionWidget { + constructor(element: JQuery, options?: dxListOptions); + constructor(element: Element, options?: dxListOptions); + /** Returns the height of the widget in pixels. */ + clientHeight(): number; + /** Removes the specified item from the list. */ + deleteItem(itemIndex: any): JQueryPromise; + /** Removes the specified item from the list. */ + deleteItem(itemElement: Element): JQueryPromise; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemIndex: any): boolean; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemElement: Element): boolean; + /** Reloads list data. */ + reload(): void; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemElement: Element, toItemElement: Element): JQueryPromise; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemIndex: any, toItemIndex: any): JQueryPromise; + /** Scrolls the list content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Returns the height of the list content in pixels. */ + scrollHeight(): number; + /** Scrolls list content to the specified position. */ + scrollTo(location: number): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemElement: Element): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemIndex: any): void; + /** Returns how far the list content is scrolled from the top. */ + scrollTop(): number; + /** Selects the specified item from the list. */ + selectItem(itemElement: Element): void; + /** Selects the specified item from the list. */ + selectItem(itemIndex: any): void; + /** Deselects the specified item from the list. */ + unselectItem(itemElement: Element): void; + /** Unselects the specified item from the list. */ + unselectItem(itemIndex: any): void; + /** Updates the widget scrollbar according to widget content size. */ + updateDimensions(): JQueryPromise; + /** Expands the specified group. */ + expandGroup(groupIndex: number): JQueryPromise; + /** Collapses the specified group. */ + collapseGroup(groupIndex: number): JQueryPromise; + } + export interface dxGalleryOptions extends CollectionWidgetOptions { + /** The time, in milliseconds, spent on slide animation. */ + animationDuration?: number; + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to allow users to switch between items by clicking an indicator. */ + indicatorEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently active gallery item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to display an indicator that points to the selected gallery item. */ + showIndicator?: boolean; + /** A Boolean value that specifies the availability of the "Forward" and "Back" navigation buttons. */ + showNavButtons?: boolean; + /** The time interval in milliseconds, after which the gallery switches to the next item. */ + slideshowDelay?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether or not to display parts of previous and next images along the sides of the current image. */ + wrapAround?: boolean; + /** Specifies if the widget stretches images to fit the total gallery width. */ + stretchImages?: boolean; + /** Specifies the width of an area used to display a single image. */ + initialItemWidth?: number; + } + /** An image gallery widget. */ + export class dxGallery extends CollectionWidget { + constructor(element: JQuery, options?: dxGalleryOptions); + constructor(element: Element, options?: dxGalleryOptions); + /** Shows the specified gallery item. */ + goToItem(itemIndex: number, animation: boolean): JQueryPromise; + /** Shows the next gallery item. */ + nextItem(animation: boolean): JQueryPromise; + /** Shows the previous gallery item. */ + prevItem(animation: boolean): JQueryPromise; + } + export interface dxDropDownEditorOptions extends dxTextBoxOptions { + /** Specifies the current value displayed by the widget. */ + value?: Object; + /** A handler for the closed event. */ + onClosed?: Function; + /** A handler for the opened event. */ + onOpened?: Function; + /** Specifies whether or not the drop-down editor is displayed. */ + opened?: boolean; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + /** Specifies the way an end-user applies the selected value. */ + applyValueMode?: string; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + activeStateEnabled?: boolean; + } + /** A drop-down editor widget. */ + export class dxDropDownEditor extends dxTextBox { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Closes the drop-down editor. */ + close(): void; + /** Opens the drop-down editor. */ + open(): void; + /** Resets the widget's value to null. */ + reset(): void; + /** Returns an <input> element of the widget. */ + field(): JQuery; + /** Returns an HTML element of the popup window content. */ + content(): JQuery; + } + export interface dxDateBoxOptions extends dxTextEditorOptions { + /** A format used to display date/time information. */ + format?: string; + /** A Globalize format string specifying the date display format. */ + formatString?: string; + /** The last date that can be selected within the widget. */ + max?: any; + /** The minimum date that can be selected within the widget. */ + min?: any; + /** The text displayed by the widget when the widget value is not yet specified. This text is also used as a title of the date picker. */ + placeholder?: string; + /** + * Specifies whether or not a user can pick out a date using the drop-down calendar. + * @deprecated Use the pickerType option instead. + */ + useCalendar?: boolean; + /** An object or a value, specifying the date and time currently selected using the date box. */ + value?: any; + /** + * Specifies whether or not the widget uses the native HTML input element. + * @deprecated Use the pickerType option instead. + */ + useNative?: boolean; + /** Specifies the interval between neighboring values in the popup list in minutes. */ + interval?: number; + /** Specifies the maximum zoom level of a calendar, which is used to pick the date. */ + maxZoomLevel?: string; + /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ + minZoomLevel?: string; + /** Specifies the type of date/time picker. */ + pickerType?: string; + /** Specifies the message displayed if the typed value is not a valid date or time. */ + invalidDateMessage?: string; + /** Specifies the message displayed if the specified date is later than the max value or earlier than the min value. */ + dateOutOfRangeMessage?: string; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + } + /** A date box widget. */ + export class dxDateBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDateBoxOptions); + constructor(element: Element, options?: dxDateBoxOptions); + } + export interface dxCheckBoxOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Specifies the widget state. */ + value?: boolean; + /** Specifies the text displayed by the check box. */ + text?: string; + } + /** A check box widget. */ + export class dxCheckBox extends Editor { + constructor(element: JQuery, options?: dxCheckBoxOptions); + constructor(element: Element, options?: dxCheckBoxOptions); + } + export interface dxCalendarOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Specifies a date displayed on the current calendar page. */ + currentDate?: Date; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** An object or a value, specifying the date and time currently selected in the calendar. */ + value?: any; + /** The latest date the widget allows to select. */ + max?: any; + /** The earliest date the widget allows to select. */ + min?: any; + /** Specifies whether or not the widget displays a button that selects the current date. */ + showTodayButton?: boolean; + /** Specifies the current calendar zoom level. */ + zoomLevel?: string; + /** Specifies the maximum zoom level of the calendar. */ + maxZoomLevel?: string; + /** Specifies the minimum zoom level of the calendar. */ + minZoomLevel?: string; + /** The template to be used for rendering calendar cells. */ + cellTemplate?: any; + } + /** A calendar widget. */ + export class dxCalendar extends Editor { + constructor(element: JQuery, options?: dxCalendarOptions); + constructor(element: Element, options?: dxCalendarOptions); + } + export interface dxButtonOptions extends WidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A handler for the click event. */ + onClick?: any; + /** Specifies the icon to be displayed on the button. */ + icon?: string; + iconSrc?: string; + /** A template to be used for rendering the dxButton widget. */ + template?: any; + /** The text displayed on the button. */ + text?: string; + /** Specifies the button type. */ + type?: string; + /** Specifies the name of the validation group to be accessed in the click event handler. */ + validationGroup?: string; + } + /** A button widget. */ + export class dxButton extends Widget { + constructor(element: JQuery, options?: dxButtonOptions); + constructor(element: Element, options?: dxButtonOptions); + } + export interface dxBoxOptions extends CollectionWidgetOptions { + /** Specifies how widget items are aligned along the main direction. */ + align?: string; + /** Specifies the direction of item positioning in the widget. */ + direction?: string; + /** Specifies how widget items are aligned cross-wise. */ + crossAlign?: string; + } + /** A container widget used to arrange inner elements. */ + export class dxBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxResponsiveBoxOptions extends CollectionWidgetOptions { + /** Specifies the collection of rows for the grid used to position layout elements. */ + rows?: Array; + /** Specifies the collection of columns for the grid used to position layout elements. */ + cols?: Array; + /** Specifies the function returning the screen factor depending on the screen width. */ + screenByWidth?: (width: number) => string; + /** Specifies the screen factor with which all elements are located in a single column. */ + singleColumnScreen?: string; + } + /** A widget used to build an adaptive markup that is dependent on screen resolution. */ + export class dxResponsiveBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxAutocompleteOptions extends dxDropDownListOptions { + /** Specifies the current value displayed by the widget. */ + value?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies the maximum count of items displayed by the widget. */ + maxItemCount?: number; + /** Gets the currently selected item. */ + selectedItem?: Object; + } + /** A textbox widget that supports autocompletion. */ + export class dxAutocomplete extends dxDropDownList { + constructor(element: JQuery, options?: dxAutocompleteOptions); + constructor(element: Element, options?: dxAutocompleteOptions); + /** Opens the drop-down editor. */ + open(): void; + /** Closes the drop-down editor. */ + close(): void; + } + export interface dxAccordionOptions extends CollectionWidgetOptions { + /** A number specifying the time in milliseconds spent on the animation of the expanding or collapsing of a panel. */ + animationDuration?: number; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies whether all items can be collapsed or whether at least one item must always be expanded. */ + collapsible?: boolean; + /** Specifies whether the widget can expand several items or only a single item at once. */ + multiple?: boolean; + /** The template to be used for rendering dxAccordion items. */ + itemTemplate?: any; + /** A handler for the itemTitleClick event. */ + onItemTitleClick?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** The index number of the currently selected item. */ + selectedIndex?: number; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget that displays data source items on collapsible panels. */ + export class dxAccordion extends CollectionWidget { + constructor(element: JQuery, options?: dxAccordionOptions); + constructor(element: Element, options?: dxAccordionOptions); + /** Collapses the specified item. */ + collapseItem(index: number): JQueryPromise; + /** Expands the specified item. */ + expandItem(index: number): JQueryPromise; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + } + export interface dxFileUploaderOptions extends EditorOptions { + /** A read-only option that holds a File instance representing the selected file. */ + value?: File; + /** Holds the File instances representing files selected in the widget. */ + values?: Array; + buttonText?: string; + /** The text displayed on the button that opens the file browser. */ + selectButtonText?: string; + /** The text displayed on the button that starts uploading. */ + uploadButtonText?: string; + /** Specifies the text displayed on the area to which an end-user can drop a file. */ + labelText?: string; + /** Specifies the value passed to the name attribute of the underlying input element. */ + name?: string; + /** Specifies whether the widget enables an end-user to select a single file or multiple files. */ + multiple?: boolean; + /** Specifies a file type or several types accepted by the widget. */ + accept?: string; + /** Specifies a target Url for the upload request. */ + uploadUrl?: string; + /** Specifies if an end user can remove a file from the selection and interrupt uploading. */ + allowCanceling?: boolean; + /** Specifies whether or not the widget displays the list of selected files. */ + showFileList?: boolean; + /** Gets the current progress in percentages. */ + progress?: number; + /** The message displayed by the widget when it is ready to upload the specified files. */ + readyToUploadMessage?: string; + /** The message displayed by the widget when uploading is finished. */ + uploadedMessage?: string; + /** The message displayed by the widget on uploading failure. */ + uploadFailedMessage?: string; + /** Specifies how the widget uploads files. */ + uploadMode?: string; + /** A handler for the uploaded event. */ + onUploaded?: Function; + /** A handler for the uploaded event. */ + onProgress?: Function; + /** A handler for the uploadError event. */ + onUploadError?: Function; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + } + /** A widget used to select and upload a file or multiple files. */ + export class dxFileUploader extends Editor { + constructor(element: JQuery, options?: dxFileUploaderOptions); + constructor(element: Element, options?: dxFileUploaderOptions); + } + export interface dxTrackBarOptions extends EditorOptions { + /** The minimum value the widget can accept. */ + min?: number; + /** The maximum value the widget can accept. */ + max?: number; + /** The current widget value. */ + value?: number; + } + /** A base class for track bar widgets. */ + export class dxTrackBar extends Editor { + constructor(element: JQuery, options?: dxTrackBarOptions); + constructor(element: Element, options?: dxTrackBarOptions); + } + export interface dxProgressBarOptions extends dxTrackBarOptions { + /** Specifies a format for the progress status. */ + statusFormat?: any; + /** Specifies whether or not the widget displays a progress status. */ + showStatus?: boolean; + /** A handler for the complete event. */ + onComplete?: Function; + } + /** A widget used to indicate progress. */ + export class dxProgressBar extends dxTrackBar { + constructor(element: JQuery, options?: dxProgressBarOptions); + constructor(element: Element, options?: dxProgressBarOptions); + } + export interface dxSliderOptions extends dxTrackBarOptions { + activeStateEnabled?: boolean; + /** The slider step size. */ + step?: number; + /** The current slider value. */ + value?: number; + /** Specifies whether or not to highlight a range selected within the widget. */ + showRange?: boolean; + /** Specifies the size of a step by which a slider handle is moved when a user uses the Page up or Page down keyboard shortcuts. */ + keyStep?: number; + /** Specifies options for the slider tooltip. */ + tooltip?: { + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies format for the tooltip. */ + format?: any; + /** Specifies whether the tooltip is located over or under the slider. */ + position?: string; + /** Specifies whether the widget always shows a tooltip or only when a pointer is over the slider. */ + showMode?: string; + }; + /** Specifies options for labels displayed at the min and max values. */ + label?: { + /** Specifies whether or not slider labels are visible. */ + visible?: boolean; + /** Specifies whether labels are located over or under the scale. */ + position?: string; + /** Specifies a format for labels. */ + format?: any; + }; + } + /** A widget that allows a user to select a numeric value within a given range. */ + export class dxSlider extends dxTrackBar { + constructor(element: JQuery, options?: dxSliderOptions); + constructor(element: Element, options?: dxSliderOptions); + } + export interface dxRangeSliderOptions extends dxSliderOptions { + /** The left edge of the interval currently selected using the range slider. */ + start?: number; + /** The right edge of the interval currently selected using the range slider. */ + end?: number; + } + /** A widget that enables a user to select a range of numeric values. */ + export class dxRangeSlider extends dxSlider { + constructor(element: JQuery, options?: dxRangeSliderOptions); + constructor(element: Element, options?: dxRangeSliderOptions); + } + export interface dxFormItemLabel { + /** Specifies the label text. */ + text?: string; + /** Specifies whether or not the label is visible. */ + visible?: boolean; + /** Specifies whether or not a colon is displayed at the end of the current label. */ + showColon?: boolean; + /** Specifies the location of a label against the editor. */ + location?: string; + /** Specifies the label horizontal alignment. */ + alignment?: string; + } + export interface dxFormItem { + /** Specifies the type of the current item. */ + itemType?: string; + /** Specifies whether or not the current form item is visible. */ + visible?: boolean; + /** Specifies the sequence number of the item in a form, group or tab. */ + visibleIndex?: number; + /** Specifies a CSS class to be applied to the form item. */ + cssClass?: string; + /** Specifies the number of columns spanned by the item. */ + colSpan?: number; + } + export interface dxFormEmptyItem extends dxFormItem { + /** Specifies the form item name. */ + name?: string; + } + export interface dxFormSimpleItem extends dxFormItem { + /** Specifies the path to the formData object field bound to the current form item. */ + dataField?: string; + /** Specifies the form item name. */ + name?: string; + /** Specifies which editor widget is used to display and edit the form item value. */ + editorType?: string; + /** Specifies configuration options for the editor widget of the current form item. */ + editorOptions?: Object; + /** A template to be used for rendering the form item. */ + template?: any; + /** Specifies the help text displayed for the current form item. */ + helpText?: string; + /** Specifies whether the current form item is required. */ + isRequired?: boolean; + /** Specifies options for the form item label. */ + label?: dxFormItemLabel; + /** An array of validation rules to be checked for the form item editor. */ + validationRules?: Array; + } + export interface dxFormGroupItem extends dxFormItem { + /** Specifies the group caption. */ + caption?: string; + /** A template to be used for rendering the group item. */ + template?: any; + /** The count of columns in the group layout. */ + colCount?: number; + /** Specifies whether or not all group item labels are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the group. */ + items?: Array; + } + export interface dxFormTab { + /** Specifies the tab title. */ + title?: string; + /** The count of columns in the tab layout. */ + colCount?: number; + /** Specifies whether or not labels of items displayed within the current tab are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the tab. */ + items?: Array; + /** Specifies a badge text for the tab. */ + badge?: string; + /** A Boolean value specifying whether or not the tab can respond to user interaction. */ + disabled?: boolean; + /** Specifies the icon to be displayed on the tab. */ + icon?: string; + /** The template to be used for rendering the tab. */ + tabTemplate?: any; + /** The template to be used for rendering the tab content. */ + template?: any; + } + export interface dxFormTabbedItem extends dxFormItem { + /** Holds a configuration object for the dxTabPanel widget used to display the current form item. */ + tabPanelOptions?: Object; + /** An array of tab configuration objects. */ + tabs?: Array; + } + export interface dxFormOptions extends WidgetOptions { + /** An object providing data for the form. */ + formData?: Object; + /** The count of columns in the form layout. */ + colCount?: any; + /** Specifies the location of a label against the editor. */ + labelLocation?: string; + /** Specifies whether or not all editors on the form are read-only. */ + readOnly?: boolean; + /** A handler for the fieldDataChanged event. */ + onFieldDataChanged?: (e: Object) => void; + /** A handler for the editorEnterKey event. */ + onEditorEnterKey?: (e: Object) => void; + /** Specifies a function that customizes a form item after it has been created. */ + customizeItem?: Function; + /** The minimum column width used for calculating column count in the form layout. */ + minColWidth?: number; + /** Specifies whether or not all root item labels are aligned. */ + alignItemLabels?: boolean; + /** Specifies whether or not item labels in all groups are aligned. */ + alignItemLabelsInAllGroups?: boolean; + /** Specifies whether or not a colon is displayed at the end of form labels. */ + showColonAfterLabel?: boolean; + /** Specifies whether or not the required mark is displayed for required fields. */ + showRequiredMark?: boolean; + /** Specifies whether or not the optional mark is displayed for optional fields. */ + showOptionalMark?: boolean; + /** The text displayed for required fields. */ + requiredMark?: string; + /** The text displayed for optional fields. */ + optionalMark?: string; + /** Specifies the message that is shown for end-users if a required field value is not specified. */ + requiredMessage?: string; + /** Specifies whether or not the total validation summary is displayed on the form. */ + showValidationSummary?: boolean; + /** Holds an array of form items. */ + items?: Array; + /** A Boolean value specifying whether to enable or disable form scrolling. */ + scrollingEnabled?: boolean; + onContentReady?: Function; + } + /** A form widget used to display and edit values of object fields. */ + export class dxForm extends Widget { + constructor(element: JQuery, options?: dxFormOptions); + constructor(element: Element, options?: dxFormOptions); + /** Updates the specified field of the formData object and the corresponding editor on the form. */ + updateData(dataField: string, value: any): void; + /** Updates the specified fields of the formData object and the corresponding editors on the form. */ + updateData(data: Object): void; + /** Updates the value of a form item option. */ + itemOption(field: string, option: string, value: any): void; + /** Updates the values of form item options. */ + itemOption(field: string, options: Object): void; + /** Returns an editor instance associated with the specified formData field or name of the form item. */ + getEditor(field: string): Object; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + /** Validates the values of all editors on the form against the list of the validation rules specified for each form item. */ + validate(): Object; + /** Resets the editor's value to undefined. */ + resetValues(): void; + } + export interface dxDeferRenderingOptions extends WidgetOptions { + /** Indicates if a load indicator should be shown until the widget's content is rendered. */ + showLoadIndicator?: boolean; + /** Specifies a jQuery.Promise or a boolean value, which upon resolving forces widget content to render. */ + renderWhen?: any; + /** Specifies the animation to be used to show the rendered content. */ + animation?: fx.AnimationOptions; + /** Specifies a jQuery selector of items that should be rendered using a staggered animation. */ + staggerItemSelector?: string; + /** Specifies a callback function that is called when the widget's content has finished rendering but is not yet shown. */ + onRendered?: Function; + /** Specifies a callback function that is called when widget content is shown and animation has completed. */ + onShown?: Function; + } + /** A container for elements that must be rendered at a specified moment. */ + export class dxDeferRendering extends Widget { + constructor(element: JQuery, options?: dxDeferRenderingOptions); + constructor(element: Element, options?: dxDeferRenderingOptions); + } +} +interface JQuery { + dxProgressBar(): JQuery; + dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; + dxProgressBar(options: string): any; + dxProgressBar(options: string, ...params: any[]): any; + dxProgressBar(options: DevExpress.ui.dxProgressBarOptions): JQuery; + dxSlider(): JQuery; + dxSlider(options: "instance"): DevExpress.ui.dxSlider; + dxSlider(options: string): any; + dxSlider(options: string, ...params: any[]): any; + dxSlider(options: DevExpress.ui.dxSliderOptions): JQuery; + dxRangeSlider(): JQuery; + dxRangeSlider(options: "instance"): DevExpress.ui.dxRangeSlider; + dxRangeSlider(options: string): any; + dxRangeSlider(options: string, ...params: any[]): any; + dxRangeSlider(options: DevExpress.ui.dxRangeSliderOptions): JQuery; + dxFileUploader(): JQuery; + dxFileUploader(options: "instance"): DevExpress.ui.dxFileUploader; + dxFileUploader(options: string): any; + dxFileUploader(options: string, ...params: any[]): any; + dxFileUploader(options: DevExpress.ui.dxFileUploaderOptions): JQuery; + dxValidator(): JQuery; + dxValidator(options: "instance"): DevExpress.ui.dxValidator; + dxValidator(options: string): any; + dxValidator(options: string, ...params: any[]): any; + dxValidator(options: DevExpress.ui.dxValidatorOptions): JQuery; + dxValidationGroup(): JQuery; + dxValidationGroup(options: "instance"): DevExpress.ui.dxValidationGroup; + dxValidationGroup(options: string): any; + dxValidationGroup(options: string, ...params: any[]): any; + dxValidationSummary(): JQuery; + dxValidationSummary(options: "instance"): DevExpress.ui.dxValidationSummary; + dxValidationSummary(options: string): any; + dxValidationSummary(options: string, ...params: any[]): any; + dxValidationSummary(options: DevExpress.ui.dxValidationSummaryOptions): JQuery; + dxTooltip(): JQuery; + dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; + dxTooltip(options: string): any; + dxTooltip(options: string, ...params: any[]): any; + dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; + dxResizable(): JQuery; + dxResizable(options: "instance"): DevExpress.ui.dxResizable; + dxResizable(options: string): any; + dxResizable(options: string, ...params: any[]): any; + dxResizable(options: DevExpress.ui.dxResizableOptions): JQuery; + dxDropDownList(): JQuery; + dxDropDownList(options: "instance"): DevExpress.ui.dxDropDownList; + dxDropDownList(options: string): any; + dxDropDownList(options: string, ...params: any[]): any; + dxDropDownList(options: DevExpress.ui.dxDropDownListOptions): JQuery; + dxToolbar(): JQuery; + dxToolbar(options: "instance"): DevExpress.ui.dxToolbar; + dxToolbar(options: string): any; + dxToolbar(options: string, ...params: any[]): any; + dxToolbar(options: DevExpress.ui.dxToolbarOptions): JQuery; + dxToast(): JQuery; + dxToast(options: "instance"): DevExpress.ui.dxToast; + dxToast(options: string): any; + dxToast(options: string, ...params: any[]): any; + dxToast(options: DevExpress.ui.dxToastOptions): JQuery; + dxTextEditor(): JQuery; + dxTextEditor(options: "instance"): DevExpress.ui.dxTextEditor; + dxTextEditor(options: string): any; + dxTextEditor(options: string, ...params: any[]): any; + dxTextEditor(options: DevExpress.ui.dxTextEditorOptions): JQuery; + dxTextBox(): JQuery; + dxTextBox(options: "instance"): DevExpress.ui.dxTextBox; + dxTextBox(options: string): any; + dxTextBox(options: string, ...params: any[]): any; + dxTextBox(options: DevExpress.ui.dxTextBoxOptions): JQuery; + dxTextArea(): JQuery; + dxTextArea(options: "instance"): DevExpress.ui.dxTextArea; + dxTextArea(options: string): any; + dxTextArea(options: string, ...params: any[]): any; + dxTextArea(options: DevExpress.ui.dxTextAreaOptions): JQuery; + dxTabs(): JQuery; + dxTabs(options: "instance"): DevExpress.ui.dxTabs; + dxTabs(options: string): any; + dxTabs(options: string, ...params: any[]): any; + dxTabs(options: DevExpress.ui.dxTabsOptions): JQuery; + dxTabPanel(): JQuery; + dxTabPanel(options: "instance"): DevExpress.ui.dxTabPanel; + dxTabPanel(options: string): any; + dxTabPanel(options: string, ...params: any[]): any; + dxTabPanel(options: DevExpress.ui.dxTabPanelOptions): JQuery; + dxSelectBox(): JQuery; + dxSelectBox(options: "instance"): DevExpress.ui.dxSelectBox; + dxSelectBox(options: string): any; + dxSelectBox(options: string, ...params: any[]): any; + dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery; + dxTagBox(): JQuery; + dxTagBox(options: "instance"): DevExpress.ui.dxTagBox; + dxTagBox(options: string): any; + dxTagBox(options: string, ...params: any[]): any; + dxTagBox(options: DevExpress.ui.dxTagBoxOptions): JQuery; + dxScrollView(): JQuery; + dxScrollView(options: "instance"): DevExpress.ui.dxScrollView; + dxScrollView(options: string): any; + dxScrollView(options: string, ...params: any[]): any; + dxScrollView(options: DevExpress.ui.dxScrollViewOptions): JQuery; + dxScrollable(): JQuery; + dxScrollable(options: "instance"): DevExpress.ui.dxScrollable; + dxScrollable(options: string): any; + dxScrollable(options: string, ...params: any[]): any; + dxScrollable(options: DevExpress.ui.dxScrollableOptions): JQuery; + dxRadioGroup(): JQuery; + dxRadioGroup(options: "instance"): DevExpress.ui.dxRadioGroup; + dxRadioGroup(options: string): any; + dxRadioGroup(options: string, ...params: any[]): any; + dxRadioGroup(options: DevExpress.ui.dxRadioGroupOptions): JQuery; + dxPopup(): JQuery; + dxPopup(options: "instance"): DevExpress.ui.dxPopup; + dxPopup(options: string): any; + dxPopup(options: string, ...params: any[]): any; + dxPopup(options: DevExpress.ui.dxPopupOptions): JQuery; + dxPopover(): JQuery; + dxPopover(options: "instance"): DevExpress.ui.dxPopover; + dxPopover(options: string): any; + dxPopover(options: string, ...params: any[]): any; + dxPopover(options: DevExpress.ui.dxPopoverOptions): JQuery; + dxOverlay(): JQuery; + dxOverlay(options: "instance"): DevExpress.ui.dxOverlay; + dxOverlay(options: string): any; + dxOverlay(options: string, ...params: any[]): any; + dxOverlay(options: DevExpress.ui.dxOverlayOptions): JQuery; + dxNumberBox(): JQuery; + dxNumberBox(options: "instance"): DevExpress.ui.dxNumberBox; + dxNumberBox(options: string): any; + dxNumberBox(options: string, ...params: any[]): any; + dxNumberBox(options: DevExpress.ui.dxNumberBoxOptions): JQuery; + dxNavBar(): JQuery; + dxNavBar(options: "instance"): DevExpress.ui.dxNavBar; + dxNavBar(options: string): any; + dxNavBar(options: string, ...params: any[]): any; + dxNavBar(options: DevExpress.ui.dxNavBarOptions): JQuery; + dxMultiView(): JQuery; + dxMultiView(options: "instance"): DevExpress.ui.dxMultiView; + dxMultiView(options: string): any; + dxMultiView(options: string, ...params: any[]): any; + dxMultiView(options: DevExpress.ui.dxMultiViewOptions): JQuery; + dxMap(): JQuery; + dxMap(options: "instance"): DevExpress.ui.dxMap; + dxMap(options: string): any; + dxMap(options: string, ...params: any[]): any; + dxMap(options: DevExpress.ui.dxMapOptions): JQuery; + dxLookup(): JQuery; + dxLookup(options: "instance"): DevExpress.ui.dxLookup; + dxLookup(options: string): any; + dxLookup(options: string, ...params: any[]): any; + dxLookup(options: DevExpress.ui.dxLookupOptions): JQuery; + dxLoadPanel(): JQuery; + dxLoadPanel(options: "instance"): DevExpress.ui.dxLoadPanel; + dxLoadPanel(options: string): any; + dxLoadPanel(options: string, ...params: any[]): any; + dxLoadPanel(options: DevExpress.ui.dxLoadPanelOptions): JQuery; + dxLoadIndicator(): JQuery; + dxLoadIndicator(options: "instance"): DevExpress.ui.dxLoadIndicator; + dxLoadIndicator(options: string): any; + dxLoadIndicator(options: string, ...params: any[]): any; + dxLoadIndicator(options: DevExpress.ui.dxLoadIndicatorOptions): JQuery; + dxList(): JQuery; + dxList(options: "instance"): DevExpress.ui.dxList; + dxList(options: string): any; + dxList(options: string, ...params: any[]): any; + dxList(options: DevExpress.ui.dxListOptions): JQuery; + dxGallery(): JQuery; + dxGallery(options: "instance"): DevExpress.ui.dxGallery; + dxGallery(options: string): any; + dxGallery(options: string, ...params: any[]): any; + dxGallery(options: DevExpress.ui.dxGalleryOptions): JQuery; + dxDropDownEditor(): JQuery; + dxDropDownEditor(options: "instance"): DevExpress.ui.dxDropDownEditor; + dxDropDownEditor(options: string): any; + dxDropDownEditor(options: string, ...params: any[]): any; + dxDropDownEditor(options: DevExpress.ui.dxDropDownEditorOptions): JQuery; + dxDateBox(): JQuery; + dxDateBox(options: "instance"): DevExpress.ui.dxDateBox; + dxDateBox(options: string): any; + dxDateBox(options: string, ...params: any[]): any; + dxDateBox(options: DevExpress.ui.dxDateBoxOptions): JQuery; + dxCheckBox(): JQuery; + dxCheckBox(options: "instance"): DevExpress.ui.dxCheckBox; + dxCheckBox(options: string): any; + dxCheckBox(options: string, ...params: any[]): any; + dxCheckBox(options: DevExpress.ui.dxCheckBoxOptions): JQuery; + dxBox(): JQuery; + dxBox(options: "instance"): DevExpress.ui.dxBox; + dxBox(options: string): any; + dxBox(options: string, ...params: any[]): any; + dxBox(options: DevExpress.ui.dxBoxOptions): JQuery; + dxButton(): JQuery; + dxButton(options: "instance"): DevExpress.ui.dxButton; + dxButton(options: string): any; + dxButton(options: string, ...params: any[]): any; + dxButton(options: DevExpress.ui.dxButtonOptions): JQuery; + dxCalendar(): JQuery; + dxCalendar(options: "instance"): DevExpress.ui.dxCalendar; + dxCalendar(options: string): any; + dxCalendar(options: string, ...params: any[]): any; + dxCalendar(options: DevExpress.ui.dxCalendarOptions): JQuery; + dxAccordion(): JQuery; + dxAccordion(options: "instance"): DevExpress.ui.dxAccordion; + dxAccordion(options: string): any; + dxAccordion(options: string, ...params: any[]): any; + dxAccordion(options: DevExpress.ui.dxAccordionOptions): JQuery; + dxResponsiveBox(): JQuery; + dxResponsiveBox(options: "instance"): DevExpress.ui.dxResponsiveBox; + dxResponsiveBox(options: string): any; + dxResponsiveBox(options: string, ...params: any[]): any; + dxResponsiveBox(options: DevExpress.ui.dxResponsiveBoxOptions): JQuery; + dxAutocomplete(): JQuery; + dxAutocomplete(options: "instance"): DevExpress.ui.dxAutocomplete; + dxAutocomplete(options: string): any; + dxAutocomplete(options: string, ...params: any[]): any; + dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; + dxForm(): JQuery; + dxForm(options: "instance"): DevExpress.ui.dxForm; + dxForm(options: string): any; + dxForm(options: string, ...params: any[]): any; + dxForm(options: DevExpress.ui.dxFormOptions): JQuery; +} + +declare module DevExpress.ui { + export interface dxTileViewOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the height of the base tile view item. */ + baseItemHeight?: number; + /** Specifies the width of the base tile view item. */ + baseItemWidth?: number; + /** Specifies whether tiles are placed horizontally or vertically. */ + direction?: string; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the distance in pixels between adjacent tiles. */ + itemMargin?: number; + /** A Boolean value specifying whether or not to display a scrollbar. */ + showScrollbar?: boolean; + } + /** A widget displaying several blocks of data as tiles. */ + export class dxTileView extends CollectionWidget { + constructor(element: JQuery, options?: dxTileViewOptions); + constructor(element: Element, options?: dxTileViewOptions); + /** Returns the current scroll position of the widget content. */ + scrollPosition(): number; + } + export interface dxSwitchOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Text displayed when the widget is in a disabled state. */ + offText?: string; + /** Text displayed when the widget is in an enabled state. */ + onText?: string; + /** A Boolean value specifying whether the current switch state is "On" or "Off". */ + value?: boolean; + } + /** A switch widget. */ + export class dxSwitch extends Editor { + constructor(element: JQuery, options?: dxSwitchOptions); + constructor(element: Element, options?: dxSwitchOptions); + } + export interface dxSlideOutViewOptions extends WidgetOptions { + /** Specifies the current menu position. */ + menuPosition?: string; + /** Specifies whether or not the menu panel is visible. */ + menuVisible?: boolean; + /** Specifies whether or not the menu is shown when a user swipes the widget content. */ + swipeEnabled?: boolean; + /** A template to be used for rendering menu panel content. */ + menuTemplate?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal a custom menu. */ + export class dxSlideOutView extends Widget { + constructor(element: JQuery, options?: dxSlideOutViewOptions); + constructor(element: Element, options?: dxSlideOutViewOptions); + /** Returns an HTML element of the widget menu block. */ + menuContent(): JQuery; + /** Returns an HTML element of the widget content block. */ + content(): JQuery; + /** Displays the widget's menu block. */ + showMenu(): JQueryPromise; + /** Hides the widget's menu block. */ + hideMenu(): JQueryPromise; + /** Toggles the visibility of the widget's menu block. */ + toggleMenuVisibility(): JQueryPromise; + } + export interface dxSlideOutOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not to display a grouped menu. */ + menuGrouped?: boolean; + /** Specifies the current menu position. */ + menuPosition?: string; + /** The name of the template used to display a group header. */ + menuGroupTemplate?: any; + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** A handler for the menuGroupRendered event. */ + onMenuGroupRendered?: Function; + /** A handler for the menuItemRendered event. */ + onMenuItemRendered?: Function; + /** Specifies whether or not the slide-out menu is displayed. */ + menuVisible?: boolean; + /** Indicates whether the menu can be shown/hidden by swiping the widget's main panel. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal an item list. */ + export class dxSlideOut extends CollectionWidget { + constructor(element: JQuery, options?: dxSlideOutOptions); + constructor(element: Element, options?: dxSlideOutOptions); + /** Hides the widget's slide-out menu. */ + hideMenu(): JQueryPromise; + /** Displays the widget's slide-out menu. */ + showMenu(): JQueryPromise; + /** Toggles the visibility of the widget's slide-out menu. */ + toggleMenuVisibility(showing: boolean): JQueryPromise; + } + export interface dxPivotOptions extends CollectionWidgetOptions { + /** The index of the currently active pivot item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + } + /** A widget that is similar to a traditional tab control, but optimized for the phone with simplified end-user interaction. */ + export class dxPivot extends CollectionWidget { + constructor(element: JQuery, options?: dxPivotOptions); + constructor(element: Element, options?: dxPivotOptions); + } + export interface dxPanoramaOptions extends CollectionWidgetOptions { + /** An object exposing options for setting a background image for the panorama. */ + backgroundImage?: { + /** Specifies the height of the panorama's background image. */ + height?: number; + /** Specifies the URL of the image that is used as the panorama's background image. */ + url?: string; + /** Specifies the width of the panorama's background image. */ + width?: number; + }; + /** The index of the currently active panorama item. */ + selectedIndex?: number; + /** Specifies the widget content title. */ + title?: string; + } + /** A widget displaying the required content in a long horizontal canvas that extends beyond the frames of the screen. */ + export class dxPanorama extends CollectionWidget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + } + export interface dxDropDownMenuOptions extends WidgetOptions { + /** A handler for the buttonClick event. */ + onButtonClick?: any; + /** The name of the icon to be displayed by the DropDownMenu button. */ + buttonIcon?: string; + /** The text displayed in the DropDownMenu button. */ + buttonText?: string; + buttonIconSrc?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** Specifies whether or not to show the drop down menu within a dxPopover widget. */ + usePopover?: boolean; + /** The width of the menu popup in pixels. */ + popupWidth?: any; + /** The height of the menu popup in pixels. */ + popupHeight?: any; + /** Specifies whether or not the drop-down menu is displayed. */ + opened?: boolean; + hoverStateEnabled?: boolean; + activeStateEnabled?: boolean; + } + /** A drop-down menu widget. */ + export class dxDropDownMenu extends Widget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Opens the drop-down menu. */ + open(): void; + /** Closes the drop-down menu. */ + close(): void; + } + export interface dxActionSheetOptions extends CollectionWidgetOptions { + /** A handler for the cancelClick event. */ + onCancelClick?: any; + /** The text displayed in the button that closes the action sheet. */ + cancelText?: string; + /** Specifies whether or not to display the Cancel button in action sheet. */ + showCancelButton?: boolean; + /** A Boolean value specifying whether or not the title of the action sheet is visible. */ + showTitle?: boolean; + /** Specifies the element the action sheet popover points at. */ + target?: any; + /** The title of the action sheet. */ + title?: string; + /** Specifies whether or not to show the action sheet within a dxPopover widget. */ + usePopover?: boolean; + /** A Boolean value specifying whether or not the dxActionSheet widget is visible. */ + visible?: boolean; + } + /** A widget consisting of a set of choices related to a certain task. */ + export class dxActionSheet extends CollectionWidget { + constructor(element: JQuery, options?: dxActionSheetOptions); + constructor(element: Element, options?: dxActionSheetOptions); + /** Hides the widget. */ + hide(): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Shows or hides the widget depending on the Boolean value passed as the parameter. */ + toggle(showing: boolean): JQueryPromise; + } +} +interface JQuery { + dxTileView(): JQuery; + dxTileView(options: "instance"): DevExpress.ui.dxTileView; + dxTileView(options: string): any; + dxTileView(options: string, ...params: any[]): any; + dxTileView(options: DevExpress.ui.dxTileViewOptions): JQuery; + dxSwitch(): JQuery; + dxSwitch(options: "instance"): DevExpress.ui.dxSwitch; + dxSwitch(options: string): any; + dxSwitch(options: string, ...params: any[]): any; + dxSwitch(options: DevExpress.ui.dxSwitchOptions): JQuery; + dxSlideOut(): JQuery; + dxSlideOut(options: "instance"): DevExpress.ui.dxSlideOut; + dxSlideOut(options: string): any; + dxSlideOut(options: string, ...params: any[]): any; + dxSlideOut(options: DevExpress.ui.dxSlideOutOptions): JQuery; + dxPivot(): JQuery; + dxPivot(options: "instance"): DevExpress.ui.dxPivot; + dxPivot(options: string): any; + dxPivot(options: string, ...params: any[]): any; + dxPivot(options: DevExpress.ui.dxPivotOptions): JQuery; + dxPanorama(): JQuery; + dxPanorama(options: "instance"): DevExpress.ui.dxPanorama; + dxPanorama(options: string): any; + dxPanorama(options: string, ...params: any[]): any; + dxPanorama(options: DevExpress.ui.dxPanoramaOptions): JQuery; + dxActionSheet(): JQuery; + dxActionSheet(options: "instance"): DevExpress.ui.dxActionSheet; + dxActionSheet(options: string): any; + dxActionSheet(options: string, ...params: any[]): any; + dxActionSheet(options: DevExpress.ui.dxActionSheetOptions): JQuery; + dxDropDownMenu(): JQuery; + dxDropDownMenu(options: "instance"): DevExpress.ui.dxDropDownMenu; + dxDropDownMenu(options: string): any; + dxDropDownMenu(options: string, ...params: any[]): any; + dxDropDownMenu(options: DevExpress.ui.dxDropDownMenuOptions): JQuery; +} +declare module DevExpress.data { + export interface XmlaStoreOptions { + /** The HTTP address to an XMLA OLAP server. */ + url?: string; + /** The name of the database associated with the Store. */ + catalog?: string; + /** The cube name. */ + cube?: string; + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: Object) => void; + } + /** A Store that provides access to an OLAP cube using the XMLA standard. */ + export class XmlaStore { + constructor(options: XmlaStoreOptions); + } + export interface PivotGridField { + index?: number; + /** A boolean value specifying whether or not the field is visible in the pivot grid and the Field Chooser. */ + visible?: boolean; + /** Name of the data source field containing data for the pivot grid field. */ + dataField?: string; + /** A caption that will be displayed in the pivot grid's field chooser to identify the field. */ + caption?: string; + /** Specifies a type of field values. */ + dataType?: string; + /** Specifies how the values of the current field are combined into groups. Cannot be used for the XmlaStore store type. */ + groupInterval?: any; + /** Specifies how to aggregate field data. Cannot be used for the XmlaStore store type. */ + summaryType?: string; + /** Allows you to use a custom aggregate function to calculate the summary values. Cannot be used for the XmlaStore store type. */ + calculateCustomSummary?: (options: { + summaryProcess?: string; + value?: any; + totalValue?: any; + }) => void; + /** Specifies the function that determines how to split data from the data source into ranges for header items. Cannot be used for the XmlaStore store type. */ + selector?: (data: Object) => any; + /** Type of the area where the field is located. */ + area?: string; + /** Index among the other fields displayed within the same area. */ + areaIndex?: number; + /** The name of the folder in which the field is located. */ + displayFolder?: string; + /** The name of the group to which the field belongs. */ + groupName?: string; + /** The index of the field within a group. */ + groupIndex?: number; + /** Specifies the sort order of field values. */ + sortOrder?: string; + /** Specifies how field data should be sorted. Can be used for the XmlaStore store type only. */ + sortBy?: string; + /** Sorts the header items of this field by the summary values of another field. */ + sortBySummaryField?: string; + /** The array of field names that specify a path to column/row whose summary field is used for sorting of this field's header items. */ + sortBySummaryPath?: Array; + /** The filter values for the current field. */ + filterValues?: Array; + /** The filter type for the current field. */ + filterType?: string; + /** Indicates whether all header items of the field's header level are expanded. */ + expanded?: boolean; + /** Specifies whether the field should be treated as a Data Field. */ + isMeasure?: boolean; + /** Specifies a display format for field values. */ + format?: string; + /** Specifies a callback function that returns the text to be displayed in the cells of a field. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** Specifies a precision for formatted field values. */ + precision?: number; + /** Specifies how to sort the header items. */ + sortingMethod?: (a: Object, b: Object) => number; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies the absolute width of the field in the pivot grid. */ + width?: number; + /** Specifies the summary post-processing algorithm. */ + summaryDisplayMode?: string; + /** Specifies whether to summarize each next summary value with the previous one by rows or columns. */ + runningTotal?: string; + /** Specifies whether to allow the predefined summary post-processing functions ('absoluteVariation' and 'percentVariation') and runningTotal to take values of different groups into account. */ + allowCrossGroupCalculation?: boolean; + /** Specifies a callback function that allows you to modify summary values after they are calculated. */ + calculateSummaryValue?: (e: Object) => number; + /** Specifies whether or not to display Total values for the field. */ + showTotals?: boolean; + /** Specifies whether or not to display Grand Total values for the field. */ + showGrandTotals?: boolean; + } + export class SummaryCell { + /** Gets the parent cell in a specified direction. */ + parent(direction: string): SummaryCell; + /** Gets all children cells in a specified direction. */ + children(direction: string): Array; + /** Gets a partial Grand Total cell of a row or column. */ + grandTotal(direction: string): SummaryCell; + /** Gets the Grand Total of the entire pivot grid. */ + grandTotal(): SummaryCell; + /** Gets the cell next to the current one in a specified direction. */ + next(direction: string): SummaryCell; + /** Gets the cell next to current in a specified direction. */ + next(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the cell prior to the current one in a specified direction. */ + prev(direction: string): SummaryCell; + /** Gets the cell previous to current in a specified direction. */ + prev(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the child cell in a specified direction. */ + child(direction: string, fieldValue: any): SummaryCell; + /** Gets the cell located by the path of the source cell with one field value changed. */ + slice(field: PivotGridField, value: any): SummaryCell; + /** Gets the row or column field to which the current cell belongs. */ + field(area: string): PivotGridField; + /** Gets the value of the current cell. */ + value(): any; + /** Gets the value of the current cell. */ + value(isCalculatedValue: boolean): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField, isCalculatedValue: boolean): any; + } + export interface PivotGridDataSourceOptions { + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** Indicates whether or not the automatic field generation from data in the Store is enabled. */ + retrieveFields?: boolean; + /** Specifies data filtering conditions. Cannot be used for the XmlaStore store type. */ + filter?: Object; + /** An array of pivot grid fields. */ + fields?: Array; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Object) => void; + /** A handler for the fieldsPrepared event. */ + onFieldsPrepared?: (e?: Array) => void; + } + /** An object that provides access to data for the dxPivotGrid widget. */ + export class PivotGridDataSource implements EventsMixin { + constructor(options?: PivotGridDataSource); + /** Starts reloading data from any store and updating the data source. */ + reload(): JQueryPromise; + /** Starts updating the data source. Reloads data from the XMLA store only. */ + load(): JQueryPromise; + /** Indicates whether or not the PivotGridDataSource is currently being loaded. */ + isLoading(): boolean; + /** Gets data displayed in a PivotGrid. */ + getData(): Object; + /** Gets all fields within a specified area. */ + getAreaFields(area: string, collectGroups: boolean): Array; + /** Gets all fields from the data source. */ + fields(): Array; + /** Sets the fields option. */ + fields(fields: Array): void; + /** Gets current options of a specified field. */ + field(id: any): PivotGridField; + /** Sets one or more options of a specified field. */ + field(id: any, field: PivotGridField): void; + /** Collapses a specified header item. */ + collapseHeaderItem(area: string, path: Array): void; + /** Expands a specified header item. */ + expandHeaderItem(area: string, path: Array): void; + /** Expands all header items of a field. */ + expandAll(id: any): void; + /** Collapses all header items of a field. */ + collapseAll(id: any): void; + /** Disposes of all resources associated with this PivotGridDataSource. */ + dispose(): void; + /** Gets the current filter expression. Cannot be used for the XmlaStore store type. */ + filter(): Object; + /** Applies a new filter expression. Cannot be used for the XmlaStore store type. */ + filter(filterExpr: Object): void; + /** Provides access to a list of records (facts) that were used to calculate a specific summary. */ + createDrillDownDataSource(options: { + columnPath?: Array; + rowPath?: Array; + dataIndex?: number; + maxRowCount?: number; + customColumns?: Array; + }): DevExpress.data.DataSource; + /** Gets the current PivotGridDataSource state (fields configuration, sorting, filters, expanded headers, etc.) */ + state(): Object; + /** Sets the PivotGridDataSource state. */ + state(state: Object): void; + on(eventName: string, eventHandler: Function): PivotGridDataSource; + on(events: { [eventName: string]: Function; }): PivotGridDataSource; + off(eventName: string): PivotGridDataSource; + off(eventName: string, eventHandler: Function): PivotGridDataSource; + } +} +declare module DevExpress.ui { + export interface dxSchedulerOptions extends WidgetOptions { + /** Specifies a date displayed on the current scheduler view by default. */ + currentDate?: any; + /** The earliest date the widget allows you to select. */ + min?: Date; + /** The latest date the widget allows you to select. */ + max?: Date; + /** Specifies the view used in the scheduler by default. */ + currentView?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** The template to be used for rendering appointments. */ + appointmentTemplate?: any; + /** The template to be used for rendering an appointment tooltip. */ + appointmentTooltipTemplate?: any; + /** Lists the views to be available within the scheduler's View Selector. */ + views?: Array; + /** Specifies the resource kinds by which the scheduler's appointments are grouped in a timetable. */ + groups?: Array; + /** Specifies a start hour in the scheduler view's time interval. */ + startDayHour?: number; + /** Specifies an end hour in the scheduler view's time interval. */ + endDayHour?: number; + /** Specifies whether or not the "All-day" panel is visible. */ + showAllDayPanel?: boolean; + /** Specifies cell duration in minutes. */ + cellDuration?: number; + /** Specifies the edit mode for recurring appointments. */ + recurrenceEditMode?: string; + /** Specifies which editing operations an end-user can perform on appointments. */ + editing?: { + /** Specifies whether or not an end-user can add appointments. */ + allowAdding?: boolean; + /** Specifies whether or not an end-user can change appointment options. */ + allowUpdating?: boolean; + /** Specifies whether or not an end-user can delete appointments. */ + allowDeleting?: boolean; + /** Specifies whether or not an end-user can change an appointment duration. */ + allowResizing?: boolean; + /** Specifies whether or not an end-user can drag appointments. */ + allowDragging?: boolean; + } + /** Specifies an array of resources available in the scheduler. */ + resources?: Array<{ + /** Indicates whether or not several resources of this kind can be assigned to an appointment. */ + allowMultiple?: boolean; + /** + * Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. + * @deprecated Use the useColorAsDefault option instead. + */ + mainColor?: boolean; + /** Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. */ + useColorAsDefault?: boolean; + /** A data source used to fetch resources to be available in the scheduler. */ + dataSource?: any; + /** Specifies the resource object field whose value is displayed by the Resource editor in the Appointment popup window. */ + displayExpr?: any; + /** Specifies the resource object field that is used as a value of the Resource editor in the Appointment popup window. */ + valueExpr?: any; + /** The name of the appointment object field that specifies a resource of this kind. */ + field?: string; + /** Specifies the label of the Appointment popup window field that allows end users to assign a resource of this kind. */ + label?: string; + }>; + /** A handler for the AppointmentAdding event. */ + onAppointmentAdding?: Function; + /** A handler for the appointmentAdded event. */ + onAppointmentAdded?: Function; + /** A handler for the AppointmentUpdating event. */ + onAppointmentUpdating?: Function; + /** A handler for the appointmentUpdated event. */ + onAppointmentUpdated?: Function; + /** A handler for the AppointmentDeleting event. */ + onAppointmentDeleting?: Function; + /** A handler for the appointmentDeleted event. */ + onAppointmentDeleted?: Function; + /** A handler for the appointmentRendered event. */ + onAppointmentRendered?: Function; + /** A handler for the appointmentClick event. */ + onAppointmentClick?: any; + /** A handler for the appointmentDblClick event. */ + onAppointmentDblClick?: any; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the appointmentFormCreated event. */ + onAppointmentFormCreated?: Function; + /** Specifies whether or not an end-user can scroll the view horizontally. */ + horizontalScrollingEnabled?: boolean; + /** Specifies whether a user can switch views using tabs or a drop-down menu. */ + useDropDownViewSwitcher?: boolean; + /** Specifies the name of the data source item field that defines the start of an appointment. */ + startDateExpr?: string; + /** Specifies the name of the data source item field that defines the ending of an appointment. */ + endDateExpr?: string; + /** Specifies the name of the data source item field that holds the subject of an appointment. */ + textExpr?: string; + /** Specifies the name of the data source item field whose value holds the description of the corresponding appointment. */ + descriptionExpr?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding appointment is an all-day appointment. */ + allDayExpr?: string; + /** Specifies the name of the data source item field that defines a recurrence rule for generating recurring appointments. */ + recurrenceRuleExpr?: string; + /** Specifies the name of the data source item field that defines exceptions for the current recurring appointment. */ + recurrenceExceptionExpr?: string; + /** Specifies whether filtering is performed on the server or client side. */ + remoteFiltering?: boolean; + } + /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ + export class dxScheduler extends Widget { + constructor(element: JQuery, options?: dxSchedulerOptions); + constructor(element: Element, options?: dxSchedulerOptions); + /** Add the appointment defined by the object passed as a parameter to the data associated with the widget. */ + addAppointment(appointment: Object): void; + /** Updates the appointment specified by the first method parameter by the appointment object specified by the second method parameter in the the data associated with the widget. */ + updateAppointment(target: Object, appointment: Object): void; + /** Deletes the appointment defined by the parameter from the the data associated with the widget. */ + deleteAppointment(appointment: Object): void; + /** Scrolls the scheduler work space to the specified time of the specified day. */ + scrollToTime(hours: number, minutes: number, date: Date): void; + /** Displayes the Appointment Details popup. */ + showAppointmentPopup(appointmentData: Object, createNewAppointment?: boolean, currentAppointmentData?: Object): void; + } + export interface dxColorBoxOptions extends dxDropDownEditorOptions { + /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ + applyButtonText?: string; + applyValueMode?: string; + /** Specifies the text displayed on the button that cancels changes and closes the drop-down editor. */ + cancelButtonText?: string; + /** Specifies whether or not the widget value includes the alpha channel component. */ + editAlphaChannel?: boolean; + /** Specifies the size of a step by which a handle is moved using a keyboard shortcut. */ + keyStep?: number; + } + /** A widget used to specify a color value. */ + export class dxColorBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxColorBoxOptions); + constructor(element: Element, options?: dxColorBoxOptions); + } + export interface HierarchicalCollectionWidgetOptions extends CollectionWidgetOptions { + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of the data source item field used as a key. */ + keyExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is selected. */ + selectedExpr?: any; + /** Specifies the name of the data source item field that contains an array of nested items. */ + itemsExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is disabled. */ + disabledExpr?: any; + /** Specifies the name of the data source item field that holds the key of the parent item. */ + parentIdExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is expanded. */ + expandedExpr?: any; + hoverStateEnabled?: boolean; + focusStateEnabled?: boolean; + } + export class HierarchicalCollectionWidget extends CollectionWidget { + } + export interface dxTreeViewOptions extends HierarchicalCollectionWidgetOptions { + /** Specifies whether or not to animate item collapsing and expanding. */ + animationEnabled?: boolean; + /** Specifies whether a nested or plain array is used as a data source. */ + dataStructure?: string; + /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ + expandAllEnabled?: boolean; + /** + * Specifies whether or not a check box is displayed at each tree view item. + * @deprecated Use the showCheckBoxesMode options instead. + */ + showCheckBoxes?: boolean; + /** Specifies the current check boxes display mode. */ + showCheckBoxesMode?: string; + /** Specifies whether or not to select nodes recursively. */ + selectNodesRecursive?: boolean; + /** Specifies whether or not all parent nodes of an initially expanded node are displayed expanded. */ + expandNodesRecursive?: boolean; + /** + * Specifies whether the "Select All" check box is displayed over the tree view. + * @deprecated Use the showCheckBoxesMode options instead. + */ + selectAllEnabled?: boolean; + /** Specifies the text displayed at the "Select All" check box. */ + selectAllText?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node includes child nodes. */ + hasItemsExpr?: any; + /** Specifies if the virtual mode is enabled. */ + virtualModeEnabled?: boolean; + /** Specifies the parent ID value of the root item. */ + rootValue?: any; + /** Specifies the current value used to filter tree view items. */ + searchValue?: string; + /** A string value specifying available scrolling directions. */ + scrollDirection?: string; + /** A handler for the itemSelected event. */ + onItemSelected?: Function; + /** A handler for the itemExpanded event. */ + onItemExpanded?: Function; + /** A handler for the itemCollapsed event. */ + onItemCollapsed?: Function; + onItemClick?: Function; + onItemContextMenu?: Function; + onItemRendered?: Function; + onItemHold?: Function; + } + /** A widget displaying specified data items as a tree. */ + export class dxTreeView extends HierarchicalCollectionWidget { + constructor(element: JQuery, options?: dxTreeViewOptions); + constructor(element: Element, options?: dxTreeViewOptions); + /** Updates the tree view scrollbars according to the current size of the widget content. */ + updateDimensions(): JQueryPromise; + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + /** Expands the specified item. */ + expandItem(itemElement: any): void; + /** Collapses the specified item. */ + collapseItem(itemElement: any): void; + /** Returns all nodes of the tree view. */ + getNodes(): Array; + /** Selects all widget items. */ + selectAll(): void; + /** Unselects all widget items. */ + unselectAll(): void; + } + export interface dxMenuBaseOptions extends HierarchicalCollectionWidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the name of the CSS class associated with the menu. */ + cssClass?: string; + /** Holds an array of menu items. */ + items?: Array; + /** Specifies whether or not an item becomes selected if an end-user clicks it. */ + selectionByClick?: boolean; + /** Specifies the selection mode supported by the menu. */ + selectionMode?: string; + /** Specifies options of submenu showing and hiding. */ + showSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay of submenu show and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + } + export class dxMenuBase extends HierarchicalCollectionWidget { + constructor(element: JQuery, options?: dxMenuBaseOptions); + constructor(element: Element, options?: dxMenuBaseOptions); + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + } + export interface dxMenuOptions extends dxMenuBaseOptions { + /** Specifies whether or not the submenu is hidden when the mouse pointer leaves it. */ + hideSubmenuOnMouseLeave?: boolean; + /** Specifies whether the menu has horizontal or vertical orientation. */ + orientation?: string; + /** Specifies options for showing and hiding the first level submenu. */ + showFirstSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay in submenu showing and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + /** Specifies the direction at which the submenus are displayed. */ + submenuDirection?: string; + /** A handler for the submenuHidden event. */ + onSubmenuHidden?: Function; + /** A handler for the submenuHiding event. */ + onSubmenuHiding?: Function; + /** A handler for the submenuShowing event. */ + onSubmenuShowing?: Function; + /** A handler for the submenuShown event. */ + onSubmenuShown?: Function; + } + /** A menu widget. */ + export class dxMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxMenuOptions); + constructor(element: Element, options?: dxMenuOptions); + } + export interface dxContextMenuOptions extends dxMenuBaseOptions { + /** Holds an object that specifies options of alternative menu invocation. */ + alternativeInvocationMode?: { + /** Specifies whether or not an alternative invocation mode is enabled. */ + enabled?: Boolean; + /** Specifies the element used to invoke the context menu. */ + invokingElement?: any; + }; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** A handler for the positioning event. */ + onPositioning?: Function; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the direction at which submenus are displayed. */ + submenuDirection?: string; + /** The target element associated with a popover. */ + target?: any; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + } + /** A context menu widget. */ + export class dxContextMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxContextMenuOptions); + constructor(element: Element, options?: dxContextMenuOptions); + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Hides the widget. */ + hide(): JQueryPromise; + } + export interface dxRemoteOperations { + /** Specifies whether or not filtering must be performed on the server side. */ + filtering?: boolean; + /** Specifies whether or not paging must be performed on the server side. */ + paging?: boolean; + /** Specifies whether or not sorting must be performed on the server side. */ + sorting?: boolean; + /** Specifies whether or not grouping must be performed on the server side. */ + grouping?: boolean; + /** Specifies whether or not summaries calculation must be performed on the server side. */ + summary?: boolean; + } + export interface dxDataGridRow { + /** The data object represented by the row. */ + data: Object; + /** The key of the data object represented by the row. */ + key: any; + /** The visible index of the row. */ + rowIndex: number; + /** The type of the row. */ + rowType: string; + /** The group index of the row. Available when the rowType is "group". */ + groupIndex: number; + /** Indicates whether the row is expanded or collapsed. Available if rowType is "data", "detail" or "group". */ + isExpanded: boolean; + /** Indicates whether the row is selected. Available if rowType is "data". */ + isSelected: boolean; + /** Values of the row as they exist in the data source. */ + values: Array; + } + export interface dxDataGridColumn { + /** Specifies the content alignment within column cells. */ + alignment?: string; + /** Specifies whether the values in a column can be edited at runtime. Setting this option makes sense only when editing is enabled for a grid. */ + allowEditing?: boolean; + /** Specifies whether or not a column can be used for filtering grid records. Setting this option makes sense only when the filter row and column header filtering are visible. */ + allowFiltering?: boolean; + /** Specifies whether or not to allow filtering by this column using its header. */ + allowHeaderFiltering?: boolean; + /** Specifies whether or not the column can be anchored to a grid edge by end users. Setting this option makes sense only when the columnFixing | enabled option is set to true. */ + allowFixing?: boolean; + /** Specifies if a column can be used for searching grid records. Setting this option makes sense only when the search panel is visible. */ + allowSearch?: boolean; + /** Specifies whether a column can be used for grouping grid records at runtime. Setting this option makes sense only when the group panel is visible. */ + allowGrouping?: boolean; + /** Specifies whether or not a column can be hidden by a user. Setting this option makes sense only when the column chooser is visible. */ + allowHiding?: boolean; + /** Specifies whether or not a particular column can be used in column reordering. Setting this option makes sense only when the allowColumnReordering option is set to true. */ + allowReordering?: boolean; + /** Specifies whether or not a particular column can be resized by a user. Setting this option makes sense only when the allowColumnResizing option is true. */ + allowResizing?: boolean; + /** Specifies whether grid records can be sorted by a specific column at runtime. Setting this option makes sense only when the sorting mode differs from none. */ + allowSorting?: boolean; + /** Specifies whether groups appear expanded or not when records are grouped by a specific column. Setting this option makes sense only when grouping is allowed for this column. */ + autoExpandGroup?: boolean; + /** Specifies a callback function that returns a value to be displayed in a column cell. */ + calculateCellValue?: (rowData: Object) => string; + /** Specifies a callback function to be invoked after the cell value is edited by an end-user and before the new value is saved to the data source. */ + setCellValue?: (rowData: Object, value: any) => void; + /** Specifies a callback function that defines filters for customary calculated grid cells. */ + calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string, target: string) => Array; + /** Specifies a caption for a column. */ + caption?: string; + /** Specifies a custom template for grid column cells. */ + cellTemplate?: any; + /** Specifies a CSS class to be applied to a column. */ + cssClass?: string; + /** Specifies how to get a value to be displayed in a cell when it is not in an editing state. */ + calculateDisplayValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for grouping column cells. */ + calculateGroupValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for sorting column cells. */ + calculateSortValue?: any; + /** Specifies a callback function that returns the text to be displayed in the cells of a column. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** Specifies the field of a data source that provides data for a column. */ + dataField?: string; + /** Specifies the required type of column values. */ + dataType?: string; + /** Specifies a custom template for the cell of a grid column when it is in an editing state. */ + editCellTemplate?: any; + /** Specifies configuration options for the editor widget of the current column. */ + editorOptions?: Object; + /** Specifies whether HTML tags are displayed as plain text or applied to the values of the column. */ + encodeHtml?: boolean; + /** In a boolean column, replaces all false items with a specified text. */ + falseText?: string; + /** Specifies the set of available filter operations. */ + filterOperations?: Array; + /** Specifies a filter value for a column. */ + filterValue?: any; + /** Specifies initial filter values for the column's header filter. */ + filterValues?: Array; + /** Specifies whether to include or exclude the records with the values selected in the column's header filter. */ + filterType?: string; + /** Indicates whether the column takes part in horizontal grid scrolling or is anchored to a grid edge. */ + fixed?: boolean; + /** Specifies the grid edge to which the column is anchored. */ + fixedPosition?: string; + /** Specifies a format for the values displayed in a column. */ + format?: string; + /** Specifies a custom template for the group cell of a grid column. */ + groupCellTemplate?: any; + /** Specifies the index of a column when grid records are grouped by the values of this column. */ + groupIndex?: number; + /** Specifies a custom template for the header of a grid column. */ + headerCellTemplate?: any; + /** Specifies options of a lookup column. */ + lookup?: { + /** Specifies whether or not a user can nullify values of a lookup column. */ + allowClearing?: boolean; + /** Specifies the data source providing data for a lookup column. */ + dataSource?: any; + /** Specifies the expression defining the data source field whose values must be displayed. */ + displayExpr?: any; + /** Specifies the expression defining the data source field whose values must be replaced. */ + valueExpr?: string; + }; + /** Specifies column-level options for filtering using a column header filter. */ + headerFilter?: { + /** Specifies the data source to be used for the header filter. */ + dataSource?: any; + /** Specifies how header filter values should be combined into groups. */ + groupInterval?: any; + }; + /** Specifies a precision for formatted values displayed in a column. */ + precision?: number; + /** Specifies the default filter operation of a column. */ + selectedFilterOperation?: string; + /** Specifies whether or not the column displays its values by using editors. */ + showEditorAlways?: boolean; + /** Specifies whether or not to display the column when grid records are grouped by it. */ + showWhenGrouped?: boolean; + /** Specifies the index of a column when grid records are sorted by the values of this column. */ + sortIndex?: number; + /** Specifies the initial sort order of column values. */ + sortOrder?: string; + /** In a boolean column, replaces all true items with a specified text. */ + trueText?: string; + /** Specifies whether a column is visible or not. */ + visible?: boolean; + /** Specifies the sequence number of the column in the grid. */ + visibleIndex?: number; + /** Specifies a column width in pixels or percentages. */ + width?: any; + /** Specifies an array of validation rules to be checked when updating column cell values. */ + validationRules?: Array; + /** Specifies whether or not to display the header of a hidden column in the column chooser. */ + showInColumnChooser?: boolean; + /** Specifies the identifier of the column. */ + name?: string; + /** The form item configuration object. Used only when the editing mode is "form". */ + formItem?: DevExpress.ui.dxFormItem; + } + export interface dxDataGridOptions extends WidgetOptions { + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** Indicates whether to show the error row for the grid. */ + errorRowEnabled?: boolean; + /** A handler for the rowValidating event. */ + onRowValidating?: (e: Object) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** A handler for the initNewRow event. */ + onInitNewRow?: (e: { data: Object }) => void; + /** A handler for the rowInserted event. */ + onRowInserted?: (e: { data: Object; key: any }) => void; + /** A handler for the rowInserting event. */ + onRowInserting?: (e: { data: Object; cancel: any }) => void; + /** A handler for the rowRemoved event. */ + onRowRemoved?: (e: { data: Object; key: any }) => void; + /** A handler for the rowRemoving event. */ + onRowRemoving?: (e: { data: Object; key: any; cancel: any }) => void; + /** A handler for the rowUpdated event. */ + onRowUpdated?: (e: { data: Object; key: any }) => void; + /** A handler for the rowUpdating event. */ + onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: any }) => void; + /** Enables a hint that appears when a user hovers the mouse pointer over a cell with truncated content. */ + cellHintEnabled?: boolean; + /** Specifies whether or not grid columns can be reordered by a user. */ + allowColumnReordering?: boolean; + /** Specifies whether or not grid columns can be resized by a user. */ + allowColumnResizing?: boolean; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the cellHoverChanged event. */ + onCellHoverChanged?: (e: Object) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: Object) => void; + /** Specifies whether or not the width of grid columns depends on column content. */ + columnAutoWidth?: boolean; + /** Specifies the options of a column chooser. */ + columnChooser?: { + /** Specifies text displayed by the column chooser panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether a user can invoke the column chooser or not. */ + enabled?: boolean; + /** Specifies the height of the column chooser panel. */ + height?: number; + /** Specifies text displayed in the title of the column chooser panel. */ + title?: string; + /** Specifies the width of the column chooser panel. */ + width?: number; + }; + /** Specifies options for column fixing. */ + columnFixing?: { + /** Indicates if column fixing is enabled. */ + enabled?: boolean; + /** Contains options that specify texts for column-fixing related commands in the column header's context menu. */ + texts?: { + /** Specifies text for a context menu item that fixes the column for which the context menu is invoked. */ + fix?: string; + /** Specifies text for a context menu item that unfixes the column for which the context menu is invoked. */ + unfix?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the left grid edge. */ + leftPosition?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the right grid edge. */ + rightPosition?: string; + }; + }; + /** Specifies options for filtering using a column header filter. */ + headerFilter?: { + /** Indicates whether or not the column header filter button is visible. */ + visible?: boolean; + /** Specifies the height of the dropdown menu invoked when using a column header filter. */ + height?: number; + /** Specifies the width of the dropdown menu invoked when using a column header filter. */ + width?: number; + /** Contains options that specify texts for the dropdown menu invoked when you use a column header filter. */ + texts?: { + /** Specifies text for the item specifying an empty value in the column header filter's dropdown menu. */ + emptyValue?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu and applies specified filtering. */ + ok?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu without applying performed selection. */ + cancel?: string; + } + }; + /** An array of grid columns. */ + columns?: Array; + onContentReady?: Function; + /** Specifies a function that customizes grid columns after they are created. */ + customizeColumns?: (columns: Array) => void; + /** Customizes grid columns and data before exporting. */ + customizeExportData?: (columns: Array, rows: Array) => void; + /** Specifies a data source for the grid. */ + dataSource?: any; + /** Specifies whether or not to enable data caching. */ + cacheEnabled?: boolean; + /** A handler for the editingStart event. */ + onEditingStart?: (e: { + data: Object; + key: any; + cancel: boolean; + column: dxDataGridColumn + }) => void; + /** A handler for the editorPrepared event. */ + onEditorPrepared?: (e: Object) => void; + /** A handler for the editorPreparing event. */ + onEditorPreparing?: (e: Object) => void; + /** Contains options that specify how grid content can be changed. */ + editing?: { + editMode?: string; + editEnabled?: boolean; + insertEnabled?: boolean; + removeEnabled?: boolean; + /** Specifies how grid values can be edited manually. */ + mode?: string; + /** Specifies whether or not grid records can be edited at runtime. */ + allowUpdating?: boolean; + /** Specifies whether or not new grid records can be added at runtime. */ + allowAdding?: boolean; + /** Specifies whether or not grid records can be deleted at runtime. */ + allowDeleting?: boolean; + /** The form configuration object. Used only when the editing mode is "form". */ + form?: DevExpress.ui.dxFormOptions; + /** Contains options that specify texts for editing-related grid controls. */ + texts?: { + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Save" button. Setting this option makes sense only when the mode option is set to batch. */ + saveAllChanges?: string; + /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + cancelRowChanges?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Revert" button. Setting this option makes sense only when the mode option is set to batch. */ + cancelAllChanges?: string; + /** Specifies a message to be displayed by a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteMessage?: string; + /** Specifies text to be displayed in the title of a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteTitle?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Cancel changes" button. Setting this option makes sense only when the mode option is set to cell and the validation capabilities are enabled. */ + validationCancelChanges?: string; + /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the allowDeleting option is set to true. */ + deleteRow?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Add" button. Setting this option makes sense only when the allowAdding option is true. */ + addRow?: string; + /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + editRow?: string; + /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + saveRowChanges?: string; + /** Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the allowDeleting option is set to true. */ + undeleteRow?: string; + }; + }; + /** Specifies filter row options. */ + filterRow?: { + /** Specifies when to apply a filter. */ + applyFilter?: string; + /** Specifies text for the hint that pops up when a user hovers the mouse pointer over the "Apply Filter" button. */ + applyFilterText?: string; + /** Specifies descriptions for filter operations. */ + operationDescriptions?: { + "=": string; + "<>": string; + "<": string; + "<=": string; + ">": string; + ">=": string; + "startswith": string; + "contains": string; + "notcontains": string; + "endswith": string; + }; + /** Specifies text for the reset operation in a filter list. */ + resetOperationText?: string; + /** Specifies text for the operation of clearing the applied filter when a select box is used. */ + showAllText?: string; + /** Specifies text for the range start in the 'between' filter type. */ + betweenStartText?: string; + /** Specifies text for the range end in the 'between' filter type. */ + betweenEndText?: string; + /** Specifies whether or not an icon that allows the user to choose a filter operation is visible. */ + showOperationChooser?: boolean; + /** Specifies whether the filter row is visible or not. */ + visible?: boolean; + }; + /** Specifies the behavior of grouped grid records. */ + grouping?: { + /** Specifies whether the user can collapse grouped records in a grid or not. */ + allowCollapsing?: boolean; + /** Specifies whether groups appear expanded or not. */ + autoExpandAll?: boolean; + /** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */ + groupContinuedMessage?: string; + /** Specifies the message displayed in a group row when the corresponding group continues on the next page. */ + groupContinuesMessage?: string; + }; + /** Specifies options that configure the group panel. */ + groupPanel?: { + /** Specifies whether columns can be dragged onto or from the group panel. */ + allowColumnDragging?: boolean; + /** Specifies text displayed by the group panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether the group panel is visible or not. */ + visible?: boolean; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Specifies whether to show the load panel or not. */ + enabled?: boolean; + /** Specifies the height of the load panel in pixels. */ + height?: number; + /** Specifies a URL pointing to an image to be used as a loading indicator. */ + indicatorSrc?: string; + /** Specifies whether or not a loading indicator must be displayed on the load panel. */ + showIndicator?: boolean; + /** Specifies whether or not the pane of the load panel must be displayed. */ + showPane?: boolean; + /** Specifies text displayed by the load panel. */ + text?: string; + /** Specifies the width of the load panel in pixels. */ + width?: number; + }; + /** Specifies text displayed when a grid does not contain any records. */ + noDataText?: string; + /** Specifies the options of a grid pager. */ + pager?: { + /** Specifies the page sizes that can be selected at runtime. */ + allowedPageSizes?: any; + /** Specifies whether to show the page size selector or not. */ + showPageSizeSelector?: boolean; + /** Specifies whether to show the pager or not. */ + visible?: any; + /** Specifies the text accompanying the page navigator. */ + infoText?: string; + /** Specifies whether or not to display the text accompanying the page navigator. This text is specified by the infoText option. */ + showInfo?: boolean; + /** Specifies whether or not to display buttons that switch the grid to the previous or next page. */ + showNavigationButtons?: boolean; + }; + /** Specifies paging options. */ + paging?: { + /** Specifies whether dxDataGrid loads data page by page or all at once. */ + enabled?: boolean; + /** Specifies the grid page that should be displayed by default. */ + pageIndex?: number; + /** Specifies the size of grid pages. */ + pageSize?: number; + }; + /** Specifies whether or not grid rows must be shaded in a different way. */ + rowAlternationEnabled?: boolean; + /** Specifies whether to enable two-way data binding. */ + twoWayBindingEnabled?: boolean; + /** A handler for the rowClick event. */ + onRowClick?: any; + /** A handler for the rowPrepared event. */ + onRowPrepared?: (e: Object) => void; + /** Specifies a custom template for grid rows. */ + rowTemplate?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not a grid must preload pages adjacent to the current page when using virtual scrolling. */ + preloadEnabled?: boolean; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + /** Specifies the scrollbar display policy. */ + showScrollbar?: string; + /** Specifies whether or not the scrolling by content is enabled. */ + scrollByContent?: boolean; + /** Specifies whether or not the scrollbar thumb scrolling enabled. */ + scrollByThumb?: boolean; + }; + /** Specifies options of the search panel. */ + searchPanel?: { + /** Specifies whether or not search strings in the located grid records should be highlighted. */ + highlightSearchText?: boolean; + /** Specifies text displayed by the search panel when no search string was typed. */ + placeholder?: string; + /** Specifies whether the search panel is visible or not. */ + visible?: boolean; + /** Specifies the width of the search panel in pixels. */ + width?: number; + /** Sets a search string for the search panel. */ + text?: string; + }; + /** Specifies the operations that must be performed on the server side. */ + remoteOperations?: any; + /** Allows you to sort groups according to the values of group summary items. */ + sortByGroupSummaryInfo?: Array<{ + /** Specifies the group summary item whose values must be used to sort groups. */ + summaryItem?: string; + /** Specifies the identifier of the column that must be used in grouping so that sorting by group summary item values be applied. */ + groupColumn?: string; + /** Specifies the sort order of group summary item values. */ + sortOrder?: string; + }>; + /** Allows you to build a master-detail interface in the grid. */ + masterDetail?: { + /** Enables an end-user to expand/collapse detail sections. */ + enabled?: boolean; + /** Specifies whether detail sections appear expanded or collapsed. */ + autoExpandAll?: boolean; + /** Specifies the template for detail sections. */ + template?: any; + }; + /** Specifies options for exporting grid data. */ + export?: { + /** Indicates if the export feature is enabled in the grid. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies whether to enable Excel filtering for the exported data in the resulting XLSX file. */ + excelFilterEnabled?: boolean; + /** Specifies whether to enable word wrapping for the exported data in the resulting XLSX file. */ + excelWrapTextEnabled?: boolean; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + proxyUrl?: string; + /** Indicates whether to allow end users to export not only the data displayed in the grid, but the selected rows only. */ + allowExportSelectedData?: boolean; + /** Contains options that specify texts for the export-related commands and hints. */ + texts?: { + /** Specifies text for the Export button when this button invokes a dropdown menu so you can choose the required export format. */ + exportTo?: string; + /** Specifies text for the Export button's hint when this button exports to the XSLX format without invoking the drop-down menu. */ + exportToExcel?: string; + /** Specifies text for the item in the Export dropdown menu that exports grid data to Excel. */ + excelFormat?: string; + /** Specifies text for the option in the Export dropdown menu that allows you to choose whether to export all the grid data or the selected rows only. */ + selectedRows?: string; + } + }; + /** Specifies the keys of the records that must appear selected initially. */ + selectedRowKeys?: Array; + /** Specifies options of runtime selection. */ + selection?: { + /** Specifies the checkbox row display policy in the multiple mode. */ + showCheckBoxesMode?: string; + /** Specifies whether the user can select all grid records at once. */ + allowSelectAll?: boolean; + /** Specifies the selection mode. */ + mode?: string; + }; + /** A handler for the dataErrorOccured event. */ + onDataErrorOccurred?: (e: { error: Error }) => void; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + currentSelectedRowKeys: Array; + currentDeselectedRowKeys: Array; + selectedRowKeys: Array; + selectedRowsData: Array; + }) => void; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A handler for the keyDown event. */ + onKeyDown?: (e: Object) => void; + /** A handler for the rowExpanding event. */ + onRowExpanding?: (e: Object) => void; + /** A handler for the rowExpanded event. */ + onRowExpanded?: (e: Object) => void; + /** A handler for the rowCollapsing event. */ + onRowCollapsing?: (e: Object) => void; + /** A handler for the rowCollapsed event. */ + onRowCollapsed?: (e: Object) => void; + /** Specifies whether column headers are visible or not. */ + showColumnHeaders?: boolean; + /** Specifies whether or not vertical lines separating one grid column from another are visible. */ + showColumnLines?: boolean; + /** Specifies whether or not horizontal lines separating one grid row from another are visible. */ + showRowLines?: boolean; + /** Specifies options of runtime sorting. */ + sorting?: { + /** Specifies text for the context menu item that sets an ascending sort order in a column. */ + ascendingText?: string; + /** Specifies text for the context menu item that resets sorting settings for a column. */ + clearText?: string; + /** Specifies text for the context menu item that sets a descending sort order in a column. */ + descendingText?: string; + /** Specifies the runtime sorting mode. */ + mode?: string; + }; + /** Specifies options of state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (state: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + /** Specifies the options of the grid summary. */ + summary?: { + /** Contains options that specify text patterns for summary items. */ + texts?: { + /** Specifies a pattern for the 'sum' summary items when they are displayed in the parent column. */ + sum?: string; + /** Specifies a pattern for the 'sum' summary items displayed in a group row or in any other column rather than the parent one. */ + sumOtherColumn?: string; + /** Specifies a pattern for the 'min' summary items when they are displayed in the parent column. */ + min?: string; + /** Specifies a pattern for the 'min' summary items displayed in a group row or in any other column rather than the parent one. */ + minOtherColumn?: string; + /** Specifies a pattern for the 'max' summary items when they are displayed in the parent column. */ + max?: string; + /** Specifies a pattern for the 'max' summary items displayed in a group row or in any other column rather than the parent one. */ + maxOtherColumn?: string; + /** Specifies a pattern for the 'avg' summary items when they are displayed in the parent column. */ + avg?: string; + /** Specifies a pattern for the 'avg' summary items displayed in a group row or in any other column rather than the parent one. */ + avgOtherColumn?: string; + /** Specifies a pattern for the 'count' summary items. */ + count?: string; + }; + /** Specifies items of the group summary. */ + groupItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the column that provides data for a group summary item. */ + column?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** Specifies a precision for the summary item value of a numeric format. */ + precision?: number; + /** Specifies whether or not a summary item must be displayed in the group footer. */ + showInGroupFooter?: boolean; + /** Indicates whether to display group summary items in parentheses after the group row header or to align them by the corresponding columns within the group row. */ + alignByColumn?: boolean; + /** Specifies the column that must hold the summary item when this item is displayed in the group footer or aligned by a column in the group row. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: string; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + }>; + /** Specifies items of the total summary. */ + totalItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the alignment of a summary item. */ + alignment?: string; + /** Specifies the column that provides data for a summary item. */ + column?: string; + /** Specifies a CSS class to be applied to a summary item. */ + cssClass?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** Specifies a precision for the summary item value of a numeric format. */ + precision?: number; + /** Specifies the column that must hold the summary item. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: string; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + }>; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + /** Allows you to use a custom aggregate function to calculate the value of a summary item. */ + calculateCustomSummary?: (options: { + component: dxDataGrid; + name?: string; + value: any; + totalValue: any; + summaryProcess: string + }) => void; + }; + /** Specifies whether text that does not fit into a column should be wrapped. */ + wordWrapEnabled?: boolean; + } + /** A data grid widget. */ + export class dxDataGrid extends Widget { + constructor(element: JQuery, options?: dxDataGridOptions); + constructor(element: Element, options?: dxDataGridOptions); + /** Ungroups grid records. */ + clearGrouping(): void; + /** Clears sorting settings of all grid columns at once. */ + clearSorting(): void; + /** Allows you to obtain a cell by its row index and the data field of its column. */ + getCellElement(rowIndex: number, dataField: string): any; + /** Allows you to obtain a cell by its row index and the visible index of its column. */ + getCellElement(rowIndex: number, visibleColumnIndex: number): any; + /** Returns the current state of the grid. */ + state(): Object; + /** Sets the grid state. */ + state(state: Object): void; + /** Allows you to obtain the row index by a data key. */ + getRowIndexByKey(key: any): number; + /** Allows you to obtain the data key by a row index. */ + getKeyByRowIndex(rowIndex: number): any; + /** Adds a new column to a grid. */ + addColumn(columnOptions: dxDataGridColumn): void; + /** Removes the column from the grid. */ + deleteColumn(id: any): void; + /** Displays the load panel. */ + beginCustomLoading(messageText: string): void; + /** Discards changes made in a grid. */ + cancelEditData(): void; + /** Checks whether or not the grid contains unsaved changes. */ + hasEditData(): boolean; + /** Clears all the filters of a specific type applied to grid records. */ + clearFilter(): void; + /** Deselects all grid records. */ + clearSelection(): void; + /** Draws the cell being edited from the editing state. Use this method when the edit mode is batch. */ + closeEditCell(): void; + /** Collapses groups or master rows in a grid. */ + collapseAll(groupIndex?: number): void; + /** Returns the number of data columns in a grid. */ + columnCount(): number; + /** Returns the value of a specific column option. */ + columnOption(id: any, optionName: string): any; + /** Sets an option of a specific column. */ + columnOption(id: any, optionName: string, optionValue: any): void; + /** Returns the options of a column by an identifier. */ + columnOption(id: any): Object; + /** Sets several options of a column at once. */ + columnOption(id: any, options: Object): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, visibleColumnIndex: number): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, dataField: string): void; + /** Sets a specific row into the editing state. */ + editRow(rowIndex: number): void; + /** Gets the cell value. */ + cellValue(rowIndex: number, dataField: string): any; + /** Gets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number): any; + /** Sets the cell value. */ + cellValue(rowIndex: number, dataField: string, value: any): void; + /** Sets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number, value: any): void; + /** Hides the load panel. */ + endCustomLoading(): void; + /** Expands groups or master rows in a grid. */ + expandAll(groupIndex: number): void; + /** Allows you to find out whether a specific group or master row is expanded or collapsed. */ + isRowExpanded(key: any): boolean; + /** Allows you to expand a specific group or master row by its key. */ + expandRow(key: any): void; + /** Allows you to collapse a specific group or master row by its key. */ + collapseRow(key: any): void; + /** Applies a filter to the grid's data source. */ + filter(filterExpr?: any): void; + /** Returns a filter expression applied to the grid's data source using the filter(filterExpr) method. */ + filter(): any; + /** Returns a filter expression applied to the grid using all possible scenarious. */ + getCombinedFilter(): any; + /** Gets the keys of currently selected grid records. */ + getSelectedRowKeys(): Array; + /** Gets the data objects of currently selected grid records. */ + getSelectedRowsData(): Array; + /** Hides the column chooser panel. */ + hideColumnChooser(): void; + /** Adds a new data row to a grid. */ + addRow(): void; + /** + * Adds a new data row to a grid. + * @deprecated Use the addRow() method instead. + */ + insertRow(): void; + /** Returns the key corresponding to the passed data object. */ + keyOf(obj: Object): any; + /** Switches a grid to a specified page. */ + pageIndex(newIndex: number): void; + /** Gets the index of the current page. */ + pageIndex(): number; + /** Sets the page size. */ + pageSize(value: number): void; + /** Gets the current page size. */ + pageSize(): number; + /** Refreshes grid data. */ + refresh(): JQueryPromise; + /** Removes a specific row from a grid. */ + deleteRow(rowIndex: number): void; + /** + * Removes a specific row from a grid. + * @deprecated Use the deleteRow(rowIndex) method instead. + */ + removeRow(rowIndex: number): void; + /** Saves changes made in a grid. */ + saveEditData(): JQueryPromise; + /** Searches grid records by a search string. */ + searchByText(text: string): void; + /** Selects all grid records. */ + selectAll(): void; + /** Deselects the rows that are currently selected within the applied filter. */ + deselectAll(): void; + /** Selects specific grid records. */ + selectRows(keys: Array, preserve: boolean): void; + /** Deselects specific grid records. */ + deselectRows(keys: Array): void; + /** Selects grid rows by indexes. */ + selectRowsByIndexes(indexes: Array): void; + /** Allows you to find out whether a row is selected or not. */ + isRowSelected(key: any): boolean; + /** Invokes the column chooser panel. */ + showColumnChooser(): void; + startSelectionWithCheckboxes(): boolean; + /** Returns the number of records currently held by a grid. */ + totalCount(): number; + /** Recovers a row deleted in the batch edit mode. */ + undeleteRow(rowIndex: number): void; + /** Allows you to obtain a data object by its key. */ + byKey(key: any): JQueryPromise; + /** Gets the value of a total summary item. */ + getTotalSummaryValue(summaryItemName: string): any; + /** Exports grid data to Excel. */ + exportToExcel(selectionOnly: boolean): void; + /** Updates the grid to the size of its content. */ + updateDimensions(): void; + /** Focuses the specified cell element in the grid. */ + focus(element?: JQuery): void; + } + export interface dxPivotGridOptions extends WidgetOptions { + onContentReady?: Function; + /** Specifies a data source for the pivot grid. */ + dataSource?: any; + useNativeScrolling?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + }; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies whether to display the Total rows. */ + showRowTotals?: boolean; + /** Specifies whether to display the Grand Total row. */ + showRowGrandTotals?: boolean; + /** Specifies whether to display the Total columns. */ + showColumnTotals?: boolean; + /** Specifies whether to display the Grand Total column. */ + showColumnGrandTotals?: boolean; + /** Specifies whether or not to hide rows and columns with no data. */ + hideEmptySummaryCells?: boolean; + /** Specifies where to show the total rows or columns. */ + showTotalsPrior?: string; + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** The Field Chooser configuration options. */ + fieldChooser?: { + /** Enables or disables the field chooser. */ + enabled?: boolean; + /** Specifies the field chooser layout. */ + layout?: number; + /** Specifies the text to display as a title of the field chooser popup window. */ + title?: string; + /** Specifies the field chooser width. */ + width?: number; + /** Specifies the field chooser height. */ + height?: number; + /** Strings that can be changed or localized in the pivot grid's integrated Field Chooser. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** Strings that can be changed or localized in the dxPivotGrid widget. */ + texts?: { + /** The string to display as a header of the Grand Total row and column. */ + grandTotal?: string; + /** The string to display as a header of the Total row and column. */ + total?: string; + /** Specifies the text displayed when a pivot grid does not contain any fields. */ + noData?: string; + /** The string to display as a Show Field Chooser context menu item. */ + showFieldChooser?: string; + /** The string to display as an Expand All context menu item. */ + expandAll?: string; + /** The string to display as a Collapse All context menu item. */ + collapseAll?: string; + /** The string to display as a Sort Column by Summary Value context menu item. */ + sortColumnBySummary?: string; + /** The string to display as a Sort Row by Summary Value context menu item. */ + sortRowBySummary?: string; + /** The string to display as a Remove All Sorting context menu item. */ + removeAllSorting?: string; + /** The string to display as an Export to Excel file context menu item. */ + exportToExcel?: string; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Enables or disables the load panel. */ + enabled?: boolean; + /** Specifies the height of the load panel. */ + height?: number; + /** Specifies the URL pointing to an image that will be used as a load indicator. */ + indicatorSrc?: string; + /** Specifies whether or not to show a load indicator. */ + showIndicator?: boolean; + /** Specifies whether or not to show load panel background. */ + showPane?: boolean; + /** Specifies the text to display inside a load panel. */ + text?: string; + /** Specifies the width of the load panel. */ + width?: number; + }; + /** A handler for the cellClick event. */ + onCellClick?: (e: any) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: any) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** Specifies options for exporting pivot grid data. */ + export?: { + /** Indicates whether the export feature is enabled for the pivot grid. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + proxyUrl?: string; + }; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A configuration object specifying options related to state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (gridState: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + } + /** A data summarization widget for multi-dimensional data analysis and data mining. */ + export class dxPivotGrid extends Widget { + constructor(element: JQuery, options?: dxPivotGridOptions); + constructor(element: Element, options?: dxPivotGridOptions); + /** Gets the PivotGridDataSource instance. */ + getDataSource(): DevExpress.data.PivotGridDataSource; + /** Gets the dxPopup instance of the field chooser window. */ + getFieldChooserPopup(): DevExpress.ui.dxPopup; + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + /** Exports pivot grid data to the Excel file. */ + exportToExcel(): void; + } + export interface dxPivotGridFieldChooserOptions extends WidgetOptions { + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the field chooser layout. */ + layout?: number; + /** The data source of a dxPivotGrid widget. */ + dataSource?: DevExpress.data.PivotGridDataSource; + onContentReady?: Function; + /** Strings that can be changed or localized in the dxPivotGridFieldChooser widget. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** A complementary widget for dxPivotGrid that allows you to manage data displayed in the dxPivotGrid. */ + export class dxPivotGridFieldChooser extends Widget { + constructor(element: JQuery, options?: dxPivotGridFieldChooserOptions); + constructor(element: Element, options?: dxPivotGridFieldChooserOptions); + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + } +} +interface JQuery { + dxTreeView(): JQuery; + dxTreeView(options: "instance"): DevExpress.ui.dxTreeView; + dxTreeView(options: string): any; + dxTreeView(options: string, ...params: any[]): any; + dxTreeView(options: DevExpress.ui.dxTreeViewOptions): JQuery; + dxMenuBase(): JQuery; + dxMenuBase(options: "instance"): DevExpress.ui.dxMenuBase; + dxMenuBase(options: string): any; + dxMenuBase(options: string, ...params: any[]): any; + dxMenuBase(options: DevExpress.ui.dxMenuBaseOptions): JQuery; + dxMenu(): JQuery; + dxMenu(options: "instance"): DevExpress.ui.dxMenu; + dxMenu(options: string): any; + dxMenu(options: string, ...params: any[]): any; + dxMenu(options: DevExpress.ui.dxMenuOptions): JQuery; + dxContextMenu(): JQuery; + dxContextMenu(options: "instance"): DevExpress.ui.dxContextMenu; + dxContextMenu(options: string): any; + dxContextMenu(options: string, ...params: any[]): any; + dxContextMenu(options: DevExpress.ui.dxContextMenuOptions): JQuery; + dxColorBox(): JQuery; + dxColorBox(options: "instance"): DevExpress.ui.dxColorBox; + dxColorBox(options: string): any; + dxColorBox(options: string, ...params: any[]): any; + dxColorBox(options: DevExpress.ui.dxColorBoxOptions): JQuery; + dxDataGrid(): JQuery; + dxDataGrid(options: "instance"): DevExpress.ui.dxDataGrid; + dxDataGrid(options: string): any; + dxDataGrid(options: string, ...params: any[]): any; + dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; + dxPivotGrid(): JQuery; + dxPivotGrid(options: "instance"): DevExpress.ui.dxPivotGrid; + dxPivotGrid(options: string): any; + dxPivotGrid(options: string, ...params: any[]): any; + dxPivotGrid(options: DevExpress.ui.dxPivotGridOptions): JQuery; + dxPivotGridFieldChooser(): JQuery; + dxPivotGridFieldChooser(options: "instance"): DevExpress.ui.dxPivotGridFieldChooser; + dxPivotGridFieldChooser(options: string): any; + dxPivotGridFieldChooser(options: string, ...params: any[]): any; + dxPivotGridFieldChooser(options: DevExpress.ui.dxPivotGridFieldChooserOptions): JQuery; + dxScheduler(): JQuery; + dxScheduler(options: "instance"): DevExpress.ui.dxScheduler; + dxScheduler(options: string): any; + dxScheduler(options: string, ...params: any[]): any; + dxScheduler(options: DevExpress.ui.dxSchedulerOptions): JQuery; +} +declare module DevExpress.framework { + /** An object used to store information on the views displayed in an application. */ + export class ViewCache { + viewRemoved: JQueryCallback; + /** Removes all the viewInfo objects from the cache. */ + clear(): void; + /** Obtains a viewInfo object from the cache by the specified key. */ + getView(key: string): Object; + /** Checks whether or not a viewInfo object is contained in the view cache under the specified key. */ + hasView(key: string): boolean; + /** Removes a viewInfo object from the cache by the specified key. */ + removeView(key: string): Object; + /** Adds the specified viewInfo object to the cache under the specified key. */ + setView(key: string, viewInfo: Object): void; + } + export interface dxCommandOptions extends DOMComponentOptions { + /** Specifies an action performed when the execute() method of the command is called. */ + onExecute?: any; + /** Indicates whether or not the widget that displays this command is disabled. */ + disabled?: boolean; + /** Specifies whether the current command is rendered when a view is being rendered or after a view is shown. */ + renderStage?: string; + /** Specifies the name of the icon shown inside the widget associated with this command. */ + icon?: string; + iconSrc?: string; + /** The identifier of the command. */ + id?: string; + /** Specifies the title of the widget associated with this command. */ + title?: string; + /** Specifies the type of the button, if the command is rendered as a dxButton widget. */ + type?: string; + /** A Boolean value specifying whether or not the widget associated with this command is visible. */ + visible?: boolean; + } + /** A markup component used to define markup options for a command. */ + export class dxCommand extends DOMComponent { + constructor(element: JQuery, options: dxCommandOptions); + constructor(options: dxCommandOptions); + /** Executes the action associated with this command. */ + execute(): void; + } + /** An object responsible for routing. */ + export class Router { + /** Adds a routing rule to the list of registered rules. */ + register(pattern: string, defaults?: Object, constraints?: Object): void; + /** Decodes the specified URI to an object using the registered routing rules. */ + parse(uri: string): Object; + /** Formats an object to a URI. */ + format(obj: Object): string; + } + export interface StateManagerOptions { + /** A storage to which the state manager saves the application state. */ + storage?: Object; + } + /** An object used to store the current application state. */ + export class StateManager { + constructor(options?: StateManagerOptions); + /** Adds an object that implements an interface of a state source to the state manager's collection of state sources. */ + addStateSource(stateSource: Object): void; + /** Removes a specified state source from the state manager's collection of state sources. */ + removeStateSource(stateSource: Object): void; + /** Saves the current application state. */ + saveState(): void; + /** Restores the application state that has been saved by the saveState() method to the state storage. */ + restoreState(): void; + /** Removes the application state that has been saved by the saveState() method to the state storage. */ + clearState(): void; + } + export module html { + export var layoutSets: Array; + export var animationSets: { [animationSetName: string]: AnimationSet }; + export interface AnimationSet { + [animationName: string]: any + } + export interface HtmlApplicationOptions { + /** Specifies where the commands that are defined in the application's views must be displayed. */ + commandMapping?: Object; + /** Specifies whether or not view caching is disabled. */ + disableViewCache?: boolean; + /** An array of layout controllers that should be used to show application views in the current navigation context. */ + layoutSet?: any; + /** Specifies the animation presets that are used to animate different UI elements in the current application. */ + animationSet?: AnimationSet; + /** Specifies whether the current application must behave as a mobile or web application. */ + mode?: string; + /** Specifies the object that represents a root namespace of the application. */ + namespace?: Object; + /** Specifies application behavior when the user navigates to a root view. */ + navigateToRootViewMode?: string; + /** An array of dxCommand configuration objects used to define commands available from the application's global navigation. */ + navigation?: Array; + /** A state manager to be used in the application. */ + stateManager?: StateManager; + /** Specifies the storage to be used by the application's state manager to store the application state. */ + stateStorage?: Object; + /** Indicates whether on not to use the title of the previously displayed view as text on the Back button. */ + useViewTitleAsBackText?: boolean; + /** A custom view cache to be used in the application. */ + viewCache?: Object; + /** Specifies a limit for the views that can be cached. */ + viewCacheSize?: number; + /** Specifies the current version of application templates. */ + templatesVersion?: string; + /** Specifies options for the viewport meta tag of a mobile browser. */ + viewPort?: JQuery; + /** A custom router to be used in the application. */ + router?: Router; + } + /** An object used to manage views, as well as control the application life cycle. */ + export class HtmlApplication implements EventsMixin { + constructor(options: HtmlApplicationOptions); + afterViewSetup: JQueryCallback; + beforeViewSetup: JQueryCallback; + initialized: JQueryCallback; + navigating: JQueryCallback; + navigatingBack: JQueryCallback; + resolveLayoutController: JQueryCallback; + resolveViewCacheKey: JQueryCallback; + viewDisposed: JQueryCallback; + viewDisposing: JQueryCallback; + viewHidden: JQueryCallback; + viewRendered: JQueryCallback; + viewShowing: JQueryCallback; + viewShown: JQueryCallback; + /** Provides access to the ViewCache object. */ + viewCache: ViewCache; + /** An array of dxCommand components that are created based on the application's navigation option value. */ + navigation: Array; + /** Provides access to the StateManager object. */ + stateManager: StateManager; + /** Provides access to the Router object. */ + router: Router; + /** Navigates to the URI preceding the current one in the navigation history. */ + back(): void; + /** Returns a Boolean value indicating whether or not backwards navigation is currently possible. */ + canBack(): boolean; + /** Calls the clearState() method of the application's StateManager object. */ + clearState(): void; + /** Creates global navigation commands. */ + createNavigation(navigationConfig: Array): void; + /** Returns an HTML template of the specified view. */ + getViewTemplate(viewName: string): JQuery; + /** Returns a configuration object used to create a dxView component for a specified view. */ + getViewTemplateInfo(viewName: string): Object; + /** Adds a specified HTML template to a collection of view or layout templates. */ + loadTemplates(source: any): JQueryPromise; + /** Navigates to the specified URI. */ + navigate(uri?: any, options?: Object): void; + /** Renders navigation commands to the navigation command containers that are located in the layouts used in the application. */ + renderNavigation(): void; + /** Calls the restoreState() method of the application's StateManager object. */ + restoreState(): void; + /** Calls the saveState method of the application's StateManager object. */ + saveState(): void; + /** Provides access to the object that defines the current context to be considered when choosing an appropriate template for a view. */ + templateContext(): Object; + on(eventName: "initialized", eventHandler: () => void): HtmlApplication; + on(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + on(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + on(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + on(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: string, eventHandler: Function): HtmlApplication; + on(events: { [eventName: string]: Function; }): HtmlApplication; + off(eventName: "initialized"): HtmlApplication; + off(eventName: "afterViewSetup"): HtmlApplication; + off(eventName: "beforeViewSetup"): HtmlApplication; + off(eventName: "navigating"): HtmlApplication; + off(eventName: "navigatingBack"): HtmlApplication; + off(eventName: "resolveLayoutController"): HtmlApplication; + off(eventName: "resolveViewCacheKey"): HtmlApplication; + off(eventName: "viewDisposed"): HtmlApplication; + off(eventName: "viewDisposing"): HtmlApplication; + off(eventName: "viewHidden"): HtmlApplication; + off(eventName: "viewRendered"): HtmlApplication; + off(eventName: "viewShowing"): HtmlApplication; + off(eventName: "viewShown"): HtmlApplication; + off(eventName: string): HtmlApplication; + off(eventName: "initialized", eventHandler: () => void): HtmlApplication; + off(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + off(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + off(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + off(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: string, eventHandler: Function): HtmlApplication; + } + } +} +declare module DevExpress.viz.core { + /** + * Applies a theme for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. + */ + export function currentTheme(theme: string): void; + /** + * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. + */ + export function currentTheme(platform: string, colorScheme: string): void; + /** + * Registers a new theme based on the existing one. + * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. + */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** + * Applies a predefined or registered custom palette to all visualization widgets at once. + * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. + */ + export function currentPalette(paletteName: string): void; + /** + * Obtains the color sets of a predefined or registered palette. + * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. + */ + export function getPalette(paletteName: string): Object; + /** + * Registers a new palette. + * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. + */ + export function registerPalette(paletteName: string, palette: Object): void; + export interface Border { + /** Sets a border color for a selected series. */ + color?: string; + /** Sets border visibility for a selected series. */ + visible?: boolean; + /** Sets a border width for a selected series. */ + width?: number; + } + export interface DashedBorder extends Border { + /** Specifies a dash style for the border of a selected series point. */ + dashStyle?: string; + } + export interface DashedBorderWithOpacity extends DashedBorder { + /** Specifies the opacity of the tooltip's border. */ + opacity?: number; + } + export interface Font { + /** Specifies the font color for a strip label. */ + color?: string; + /** Specifies the font family for a strip label. */ + family?: string; + /** Specifies the font opacity for a strip label. */ + opacity?: number; + /** Specifies the font size for a strip label. */ + size?: any; + /** Specifies the font weight for the text displayed in strips. */ + weight?: number; + } + export interface Hatching { + direction?: string; + /** Specifies the opacity of hatching lines. */ + opacity?: number; + /** Specifies the distance between hatching lines in pixels. */ + step?: number; + /** Specifies the width of hatching lines in pixels. */ + width?: number; + } + export interface Margins { + /** Specifies the distance in pixels between the bottom side of the title and the surrounding widget elements. */ + bottom?: number; + /** Specifies the distance in pixels between the left side of the title and the surrounding widget elements. */ + left?: number; + /** Specifies the distance between the right side of the title and surrounding widget elements in pixels. */ + right?: number; + /** Specifies the distance between the top side of the title and surrounding widget elements in pixels. */ + top?: number; + } + export interface Size { + /** Specifies the width of the widget. */ + width?: number; + /** Specifies the height of the widget. */ + height?: number; + } + export interface Title { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies the widget title's horizontal position. */ + horizontalAlignment?: string; + /** Specifies the widget title's position in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the distance between the title and surrounding widget elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies text for the title. */ + text?: string; + /** Specifies a subtitle for the widget. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } + } + export interface Tooltip { + /** Specifies the length of the tooltip's arrow in pixels. */ + arrowLength?: number; + /** Specifies the appearance of the tooltip's border. */ + border?: viz.core.DashedBorderWithOpacity; + /** Specifies a color for the tooltip. */ + color?: string; + /** Specifies the z-index for tooltips. */ + zIndex?: number; + /** Specifies the container to draw tooltips inside of it. */ + container?: any; + /** Specifies text and appearance of a set of tooltips. */ + customizeTooltip?: (arg: Object) => { color?: string; text?: string }; + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies font options for the text displayed by the tooltip. */ + font?: Font; + /** Specifies a format for the text displayed by the tooltip. */ + format?: string; + /** Specifies the opacity of a tooltip. */ + opacity?: number; + /** Specifies a distance from the tooltip's left/right boundaries to the inner text in pixels. */ + paddingLeftRight?: number; + /** Specifies a distance from the tooltip's top/bottom boundaries to the inner text in pixels. */ + paddingTopBottom?: number; + /** Specifies a precision for formatted values displayed by the tooltip. */ + precision?: number; + /** Specifies options of the tooltip's shadow. */ + shadow?: { + /** Specifies the blur distance of the tooltip's shadow. */ + blur?: number; + /** Specifies the color of the tooltip's shadow. */ + color?: string; + /** Specifies the horizontal offset of the tooltip's shadow relative to the tooltip in pixels. */ + offsetX?: number; + /** Specifies the vertical offset of the tooltip's shadow relative to the tooltip in pixels. */ + offsetY?: number; + /** Specifies the opacity of the tooltip's shadow. */ + opacity?: number; + }; + } + export interface Animation { + /** Determines how long animation runs. */ + duration?: number; + /** Specifies the animation easing mode. */ + easing?: string; + /** Indicates whether or not animation is enabled. */ + enabled?: boolean; + } + export interface LoadingIndicator { + /** Specifies a color for the loading indicator background. */ + backgroundColor?: string; + /** Specifies font options for the loading indicator text. */ + font?: viz.core.Font; + /** Specifies whether to show the loading indicator or not. */ + show?: boolean; + /** Specifies a text to be displayed by the loading indicator. */ + text?: string; + } + export interface LegendBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies a radius for the corners of the legend border. */ + cornerRadius?: number; + } + export interface BaseLegend { + /** Specifies the color of the legend's background. */ + backgroundColor?: string; + /** Specifies legend border settings. */ + border?: viz.core.LegendBorder; + /** Specifies how many columns must be taken to arrange legend items. */ + columnCount?: number; + /** Specifies the spacing between a pair of neighboring legend columns in pixels. */ + columnItemSpacing?: number; + /** Specifies font options for legend items. */ + font?: viz.core.Font; + /** Specifies the legend's position on the map. */ + horizontalAlignment?: string; + /** Specifies the alignment of legend items. */ + itemsAlignment?: string; + /** Specifies the position of text relative to the item marker. */ + itemTextPosition?: string; + /** Specifies the distance between the legend and the container borders in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of item markers in the legend in pixels. */ + markerSize?: number; + /** Specifies whether to arrange legend items horizontally or vertically. */ + orientation?: string; + /** Specifies the spacing between the legend left/right border and legend items in pixels. */ + paddingLeftRight?: number; + /** Specifies the spacing between the legend top/bottom border and legend items in pixels. */ + paddingTopBottom?: number; + /** Specifies how many rows must be taken to arrange legend items. */ + rowCount?: number; + /** Specifies the spacing between a pair of neighboring legend rows in pixels. */ + rowItemSpacing?: number; + /** Specifies the legend's position on the map. */ + verticalAlignment?: string; + /** Specifies whether or not the legend is visible on the map. */ + visible?: boolean; + } + export interface BaseWidgetOptions extends DOMComponentOptions { + /** A handler for the drawn event. */ + onDrawn?: (e: { + component: BaseWidget; + element: Element; + }) => void; + /** A handler for the incidentOccurred event. */ + onIncidentOccurred?: ( + component: BaseWidget, + element: Element, + target: { + id: string; + type: string; + args: any; + text: string; + widget: string; + version: string; + } + ) => void; + /** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */ + pathModified?: boolean; + /** Specifies whether or not the widget supports right-to-left representation. */ + rtlEnabled?: boolean; + /** Sets the name of the theme to be used in the widget. */ + theme?: string; + } + /** This section describes options and methods that are common to all widgets. */ + export class BaseWidget extends DOMComponent { + /** Returns the widget's SVG markup. */ + svg(): string; + } +} +declare module DevExpress.viz.charts { + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface BaseSeries { + /** Provides information about the state of the series object. */ + fullState: number; + /** Returns the type of the series. */ + type: string; + /** Unselects all the selected points of the series. The points are displayed in an initial style. */ + clearSelection(): void; + /** Gets the color of a particular series. */ + getColor(): string; + /** Gets points from the series point collection based on the specified argument. */ + getPointsByArg(pointArg: any): Array; + /** Gets a point from the series point collection based on the specified point position. */ + getPointByPos(positionIndex: number): Object; + /** Selects the series. The series is displayed in a 'selected' style until another series is selected or the current series is deselected programmatically. */ + select(): void; + /** Selects the specified point. The point is displayed in a 'selected' style. */ + selectPoint(point: BasePoint): void; + /** Deselects the specified point. The point is displayed in an initial style. */ + deselectPoint(point: BasePoint): void; + /** Returns an array of all points in the series. */ + getAllPoints(): Array; + /** Returns visible series points. */ + getVisiblePoints(): Array; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): boolean; + /** Provides information about the selection state of a series. */ + isSelected(): boolean; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface BasePoint { + /** Provides information about the state of the point object. */ + fullState: number; + /** Returns the point's argument value that was set in the data source. */ + originalArgument: any; + /** Returns the point's value that was set in the data source. */ + originalValue: any; + /** Returns the tag of the point. */ + tag: string; + /** Deselects the point. */ + clearSelection(): void; + /** Gets the color of a particular point. */ + getColor(): string; + /** Hides the tooltip of the point. */ + hideTooltip(): void; + /** Provides information about the hover state of a point. */ + isHovered(): boolean; + /** Provides information about the selection state of a point. */ + isSelected(): boolean; + /** Selects the point. The point is displayed in a 'selected' style until another point is selected or the current point is deselected programmatically. */ + select(): void; + /** Shows the tooltip of the point. */ + showTooltip(): void; + /** Allows you to obtain the label(s) of the series point. */ + getLabel(): any; + /** Returns the series object to which the point belongs. */ + series: BaseSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface ChartSeries extends BaseSeries { + /** Returns the name of the series pane. */ + pane: string; + /** Returns the name of the value axis of the series. */ + axis: string; + selectPoint(point: ChartPoint): void; + deselectPoint(point: ChartPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface ChartPoint extends BasePoint { + /** Contains the close value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalCloseValue: any; + /** Contains the high value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalHighValue: any; + /** Contains the low value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalLowValue: any; + /** Contains the first value of the point. This field is useful for points belonging to a series of the range area or range bar type only. */ + originalMinValue: any; + /** Contains the open value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalOpenValue: any; + /** Contains the size of the bubble as it was set in the data source. This field is useful for points belonging to a series of the bubble type only. */ + size: any; + /** Gets the parameters of the point's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + series: ChartSeries; + } + /** This section describes the methods that can be used in code to manipulate the Label object. */ + export interface Label { + /** Gets the parameters of the label's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + /** Hides the point label. */ + hide(): void; + /** Shows the point label. */ + show(): void; + } + export interface PieSeries extends BaseSeries { + selectPoint(point: PiePoint): void; + deselectPoint(point: PiePoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PiePoint extends BasePoint { + /** Gets the percentage value of the specific point. */ + percent: any; + /** Provides information about the visibility state of a point. */ + isVisible(): boolean; + /** Makes a specific point visible. */ + show(): void; + /** Hides a specific point. */ + hide(): void; + series: PieSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface PolarSeries extends BaseSeries { + /** Returns the name of the value axis of the series. */ + axis: string; + selectPoint(point: PolarPoint): void; + deselectPoint(point: PolarPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PolarPoint extends BasePoint { + series: PolarSeries; + } + export interface Strip { + /** Specifies a color for a strip. */ + color?: string; + /** An object that defines the label configuration options of a strip. */ + label?: { + /** Specifies the text displayed in a strip. */ + text?: string; + }; + /** Specifies a start value for a strip. */ + startValue?: any; + /** Specifies an end value for a strip. */ + endValue?: any; + } + export interface BaseSeriesConfigLabel { + /** Specifies a format for arguments displayed by point labels. */ + argumentFormat?: string; + /** Specifies a precision for formatted point arguments displayed in point labels. */ + argumentPrecision?: number; + /** Specifies a background color for point labels. */ + backgroundColor?: string; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies connector options for series point labels. */ + connector?: { + /** Specifies the color of label connectors. */ + color?: string; + /** Indicates whether or not label connectors are visible. */ + visible?: boolean; + /** Specifies the width of label connectors. */ + width?: number; + }; + /** Specifies a callback function that returns the text to be displayed by point labels. */ + customizeText?: (pointInfo: Object) => string; + /** Specifies font options for the text displayed in point labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed by point labels. */ + format?: string; + position?: string; + /** Specifies a precision for formatted point values displayed in point labels. */ + precision?: number; + /** Specifies the angle used to rotate point labels from their initial position. */ + rotationAngle?: number; + /** Specifies the visibility of point labels. */ + visible?: boolean; + } + export interface SeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies whether or not to show a label when the point has a zero value. */ + showForZeroValues?: boolean; + } + export interface ChartSeriesConfigLabel extends SeriesConfigLabel { + /** Specifies how to align point labels relative to the corresponding data points that they represent. */ + alignment?: string; + /** Specifies how to shift point labels horizontally from their initial positions. */ + horizontalOffset?: number; + /** Specifies how to shift point labels vertically from their initial positions. */ + verticalOffset?: number; + /** Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. */ + percentPrecision?: number; + } + export interface BaseCommonSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + axis?: string; + /** An object defining the label configuration options for a series in the dxChart widget. */ + label?: ChartSeriesConfigLabel; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the dash style of the series' line. */ + dashStyle?: string; + hoverMode?: string; + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /**

Sets a color for a series when it is hovered over.

*/ + color?: string; + /** Specifies the dash style for the line in a hovered series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a hovered series. */ + width?: number; + }; + /** Specifies whether a chart ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies the minimal length of a displayed bar in pixels. */ + minBarSize?: number; + /** Specifies opacity for a series. */ + opacity?: number; + /** Specifies the series elements to highlight when the series is selected. */ + selectionMode?: string; + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the dash style for the line in a selected series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a selected series. */ + width?: number; + }; + /** Specifies whether or not to show the series in the chart's legend. */ + showInLegend?: boolean; + /** Specifies the name of the stack where the values of the _stackedBar_ series must be located. */ + stack?: string; + /** Specifies the name of the data source field that provides data about a point. */ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + /** Specifies the visibility of a series. */ + visible?: boolean; + /** Specifies a line width. */ + width?: number; + /** Configures error bars. */ + valueErrorBar?: { + /** Specifies whether error bars must be displayed in full or partially. */ + displayMode?: string; + /** Specifies the data field that provides data for low error values. */ + lowValueField?: string; + /** Specifies the data field that provides data for high error values. */ + highValueField?: string; + /** Specifies how error bar values must be calculated. */ + type?: string; + /** Specifies the value to be used for generating error bars. */ + value?: number; + /** Specifies the color of error bars. */ + color?: string; + /** Specifies the opacity of error bars. */ + opacity?: number; + /** Specifies the length of the lines that indicate the error bar edges. */ + edgeLength?: number; + /** Specifies the width of the error bar line. */ + lineWidth?: number; + }; + } + export interface CommonPointOptions { + /** Specifies border options for points in the line and area series. */ + border?: viz.core.Border; + /** Specifies the points color. */ + color?: string; + /** Specifies what series points to highlight when a point is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered point. */ + hoverStyle?: { + /** An object defining the border options for a hovered point. */ + border?: viz.core.Border; + /** Sets a color for a point when it is hovered over. */ + color?: string; + /** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies what series points to highlight when a point is selected. */ + selectionMode?: string; + /** An object defining configuration options for a selected point. */ + selectionStyle?: { + /** An object defining the border options for a selected point. */ + border?: viz.core.Border; + /**

Sets a color for a point when it is selected.

*/ + color?: string; + /** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */ + size?: number; + /** Specifies a symbol for presenting points of the line and area series. */ + symbol?: string; + visible?: boolean; + } + export interface ChartCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: any; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: any; + /** Specifies the width of an image that is used as a point marker. */ + width?: any; + }; + } + export interface PolarCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: number; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: string; + /** Specifies the width of an image that is used as a point marker. */ + width?: number; + }; + } + /** An object that defines configuration options for chart series. */ + export interface CommonSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies the data source field that provides a 'close' value for a _candleStick_ or _stock_ series. */ + closeValueField?: string; + /** Specifies a radius for bar corners. */ + cornerRadius?: number; + /** Specifies the data source field that provides a 'high' value for a _candleStick_ or _stock_ series. */ + highValueField?: string; + /** Specifies the color for the body (rectangle) of a _candleStick_ series. */ + innerColor?: string; + /** Specifies the data source field that provides a 'low' value for a _candleStick_ or _stock_ series. */ + lowValueField?: string; + /** Specifies the data source field that provides an 'open' value for a _candleStick_ or _stock_ series. */ + openValueField?: string; + /** Specifies the pane that will be used to display a series. */ + pane?: string; + /** An object defining configuration options for points in line-, scatter- and area-like series. */ + point?: ChartCommonPointOptions; + /** Specifies the data source field that provides values for one end of a range series. To set the data source field for the other end of the range series, use the rangeValue2Field property. */ + rangeValue1Field?: string; + /** Specifies the data source field that provides values for the second end of a range series. To set the data source field for the other end of the range series, use the rangeValue1Field property. */ + rangeValue2Field?: string; + /** Specifies reduction options for the stock or candleStick series. */ + reduction?: { + /** Specifies a color for the points whose reduction level price is lower in comparison to the value in the previous point. */ + color?: string; + /** Specifies for which price level (open, high, low or close) to enable reduction options in the series. */ + level?: string; + }; + /** Specifies the data source field that defines the size of bubbles. */ + sizeField?: string; + } + export interface CommonSeriesSettings extends CommonSeriesConfig { + /**

An object that specifies configuration options for all series of the area type in the chart.

*/ + area?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the bubble type in the chart. */ + bubble?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _candleStick_ type in the chart. */ + candlestick?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedArea_ type in the chart. */ + fullstackedarea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Full-Stacked Spline Area type in the chart. */ + fullstackedsplinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedBar_ type in the chart. */ + fullstackedbar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedLine_ type in the chart. */ + fullstackedline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Full-Stacked Spline type in the chart. */ + fullstackedspline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _rangeArea_ type in the chart. */ + rangearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _rangeBar_ type in the chart. */ + rangebar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _spline_ type in the chart. */ + spline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _splineArea_ type in the chart. */ + splinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedArea_ type in the chart. */ + stackedarea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Stacked Spline Area type in the chart. */ + stackedsplinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedLine_ type in the chart. */ + stackedline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Stacked Spline type in the chart. */ + stackedspline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stepArea_ type in the chart. */ + steparea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stepLine_ type in the chart. */ + stepline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stock_ type in the chart. */ + stock?: CommonSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface SeriesConfig extends CommonSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + /** An object that defines configuration options for polar chart series. */ + export interface CommonPolarSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies whether or not to close the chart by joining the end point with the first point. */ + closed?: boolean; + label?: SeriesConfigLabel; + point?: PolarCommonPointOptions; + } + export interface CommonPolarSeriesSettings extends CommonPolarSeriesConfig { + /** An object that specifies configuration options for all series of the area type in the chart. */ + area?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonPolarSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface PolarSeriesConfig extends CommonPolarSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + export interface PieSeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies how to shift labels from their initial position in a radial direction in pixels. */ + radialOffset?: number; + /** Specifies a precision for the percentage values displayed in labels. */ + percentPrecision?: number; + } + /** An object that defines configuration options for chart series. */ + export interface CommonPieSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + /** Specifies the required type for series arguments. */ + argumentType?: string; + /** An object defining the series border configuration options. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the chart elements to highlight when a series is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered series. */ + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /** Sets a color for the series when it is hovered over. */ + color?: string; + /** Specifies the hatching options to be applied when a point is hovered over. */ + hatching?: viz.core.Hatching; + }; + /** + * Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. + * @deprecated Use the innerRadius option instead. + */ + innerRadius?: number; + /** An object defining the label configuration options. */ + label?: PieSeriesConfigLabel; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies a minimal size of a displayed pie segment. */ + minSegmentSize?: number; + /** + * Specifies the direction in which the dxPieChart series points are located. + * @deprecated Use the segmentsDirection option instead. + */ + segmentsDirection?: string; + /**

Specifies the chart elements to highlight when the series is selected.

*/ + selectionMode?: string; + /** An object defining configuration options for the series when it is selected. */ + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the hatching options to be applied when a point is selected. */ + hatching?: viz.core.Hatching; + }; + /** Specifies chart segment grouping options. */ + smallValuesGrouping?: { + /** Specifies the name of the grouped chart segment. This name represents the segment in the chart legend. */ + groupName?: string; + /** Specifies the segment grouping mode. */ + mode?: string; + /** Specifies a threshold for segment values. */ + threshold?: number; + /** Specifies how many segments must not be grouped. */ + topCount?: number; + }; + /** + * Specifies a start angle for a pie chart in arc degrees. + * @deprecated Use the startAngle option instead. + */ + startAngle?: number; + /**

Specifies the name of the data source field that provides data about a point.

*/ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + } + export interface CommonPieSeriesSettings extends CommonPieSeriesConfig { + /** + * Specifies the type of the pie chart series. + * @deprecated Use the type option instead. + */ + type?: string; + } + export interface PieSeriesConfig extends CommonPieSeriesConfig { + /** + * Sets the series type. + * @deprecated Use the type option instead. + */ + type?: string; + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + } + export interface SeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => SeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface PolarSeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => PolarSeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface ChartCommonConstantLineLabel { + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + /** Specifies the position of the constant line label relative to the chart plot. */ + position?: string; + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + } + export interface PolarCommonConstantLineLabel { + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + } + export interface ConstantLineStyle { + /** Specifies a color for a constant line. */ + color?: string; + /** Specifies a dash style for a constant line. */ + dashStyle?: string; + /** Specifies a constant line width in pixels. */ + width?: number; + } + export interface ChartCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartCommonConstantLineLabel; + /** Specifies the space between the constant line label and the left/right side of the constant line. */ + paddingLeftRight?: number; + /** Specifies the space between the constant line label and the top/bottom side of the constant line. */ + paddingTopBottom?: number; + } + export interface PolarCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarCommonConstantLineLabel; + } + export interface CommonAxisLabel { + /** Specifies font options for axis labels. */ + font?: viz.core.Font; + /** Specifies the spacing between an axis and its labels in pixels. */ + indentFromAxis?: number; + /** Indicates whether or not axis labels are visible. */ + visible?: boolean; + } + export interface ChartCommonAxisLabel extends CommonAxisLabel { + /** Specifies the label's position relative to the tick (grid line). */ + alignment?: string; + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: { + /** Specifies how to arrange axis labels. */ + mode?: string; + /** Specifies the angle used to rotate axis labels. */ + rotationAngle?: number; + /** Specifies the spacing that must be set between staggered rows when the 'stagger' algorithm is applied. */ + staggeringSpacing?: number; + }; + } + export interface PolarCommonAxisLabel extends CommonAxisLabel { + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: string; + } + export interface CommonAxisTitle { + /** Specifies font options for an axis title. */ + font?: viz.core.Font; + /** Specifies a margin for an axis title in pixels. */ + margin?: number; + } + export interface BaseCommonAxisSettings { + /** Specifies the color of the line that represents an axis. */ + color?: string; + /** Specifies whether ticks/grid lines of a discrete axis are located between labels or cross the labels. */ + discreteAxisDivisionMode?: string; + /** An object defining the configuration options for the grid lines of an axis in the dxPolarChart widget. */ + grid?: { + /** Specifies a color for grid lines. */ + color?: string; + /** Specifies an opacity for grid lines. */ + opacity?: number; + /** Indicates whether or not the grid lines of an axis are visible. */ + visible?: boolean; + /** Specifies the width of grid lines. */ + width?: number; + }; + /** Specifies the options of the minor grid. */ + minorGrid?: { + /** Specifies a color for the lines of the minor grid. */ + color?: string; + /** Specifies an opacity for the lines of the minor grid. */ + opacity?: number; + /** Indicates whether the minor grid is visible or not. */ + visible?: boolean; + /** Specifies a width for the lines of the minor grid. */ + width?: number; + }; + /** Indicates whether or not an axis is inverted. */ + inverted?: boolean; + /** Specifies the opacity of the line that represents an axis. */ + opacity?: number; + /** Indicates whether or not to set ticks/grid lines of a continuous axis of the 'date-time' type at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** An object defining the configuration options for axis ticks. */ + tick?: { + /** Specifies ticks color. */ + color?: string; + /** Specifies tick opacity. */ + opacity?: number; + /** Indicates whether or not ticks are visible on an axis. */ + visible?: boolean; + /** Specifies tick width. */ + width?: number; + /** Specifies tick length. */ + length?: number; + }; + /** Specifies the options of the minor ticks. */ + minorTick?: { + /** Specifies a color for the minor ticks. */ + color?: string; + /** Specifies an opacity for the minor ticks. */ + opacity?: number; + /** Indicates whether or not the minor ticks are displayed on an axis. */ + visible?: boolean; + /** Specifies minor tick width. */ + width?: number; + /** Specifies minor tick length. */ + length?: number; + }; + /** Indicates whether or not the line that represents an axis in a chart is visible. */ + visible?: boolean; + /** Specifies the width of the line that represents an axis in the chart. */ + width?: number; + } + export interface ChartCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxChart widget. */ + label?: ChartCommonAxisLabel; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + /** Specifies, in pixels, the space reserved for an axis. */ + placeholderSize?: number; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + /** Specifies the label's position on a strip. */ + horizontalAlignment?: string; + /** Specifies a label's position on a strip. */ + verticalAlignment?: string; + }; + /** Specifies the spacing, in pixels, between the left/right strip border and the strip label. */ + paddingLeftRight?: number; + /** Specifies the spacing, in pixels, between the top/bottom strip borders and the strip label. */ + paddingTopBottom?: number; + }; + /** An object defining the title configuration options that are common for all axes in the dxChart widget. */ + title?: CommonAxisTitle; + /** Indicates whether or not to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + } + export interface PolarCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: PolarCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxPolarChart widget. */ + label?: PolarCommonAxisLabel; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + }; + }; + } + export interface ChartConstantLineLabel extends ChartCommonConstantLineLabel { + /** Specifies the horizontal alignment of a constant line label. */ + horizontalAlignment?: string; + /** Specifies the vertical alignment of a constant line label. */ + verticalAlignment?: string; + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface PolarConstantLineLabel extends PolarCommonConstantLineLabel { + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface AxisLabel { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */ + customizeHint?: (argument: { value: any; valueText: string }) => string; + /** Specifies a callback function that returns the text to be displayed in value axis labels. */ + customizeText?: (argument: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed by axis labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the axis labels. */ + precision?: number; + } + export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { } + export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { } + export interface AxisTitle extends CommonAxisTitle { + /** Specifies the text for the value axis title. */ + text?: string; + } + export interface ChartConstantLineStyle extends ChartCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartConstantLineLabel; + } + export interface ChartConstantLine extends ChartConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface PolarConstantLine extends PolarCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface Axis { + /** Specifies a coefficient for dividing the value axis. */ + axisDivisionFactor?: number; + /** Specifies the order in which discrete values are arranged on the value axis. */ + categories?: Array; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic axis. */ + logarithmBase?: number; + /** Specifies an interval between axis ticks/grid lines. */ + tickInterval?: any; + /** Specifies the interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the number of minor ticks between two neighboring major ticks. */ + minorTickCount?: number; + /** Specifies the required type of the value axis. */ + type?: string; + /** Specifies the pane on which the current value axis will be displayed. */ + pane?: string; + /** Specifies options for value axis strips. */ + strips?: Array; + } + export interface ChartAxis extends ChartCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies the appearance options for the constant lines of the value axis. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** Specifies options for value axis labels. */ + label?: ChartAxisLabel; + /** Specifies the maximum value on the value axis. */ + max?: any; + /** Specifies the minimum value on the value axis. */ + min?: any; + /** Specifies the position of the value axis on a chart. */ + position?: string; + /** Specifies the title for a value axis. */ + title?: any; + } + export interface PolarAxis extends PolarCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies options for value axis labels. */ + label?: PolarAxisLabel; + } + export interface ArgumentAxis { + /** Specifies the desired type of axis values. */ + argumentType?: string; + /** Specifies the elements that will be highlighted when the argument axis is hovered over. */ + hoverMode?: string; + } + export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis { } + export interface PolarArgumentAxis extends PolarAxis, ArgumentAxis { + /** Specifies the angle in arc degrees to which the argument axis should be rotated. The positive values rotate the axis clockwise. */ + startAngle?: number; + /** Specifies whether or not to display the first point at the angle specified by the startAngle option. */ + firstPointOnStartAngle?: boolean; + /** Specifies the value to be used as the origin for the argument axis. */ + originValue?: number; + /** Specifies the period of the argument values in the data source. */ + period?: number; + } + export interface ValueAxis { + /** Specifies the name of the value axis. */ + name?: string; + /** Specifies whether or not to indicate a zero value on the value axis. */ + showZero?: boolean; + /** Specifies the desired type of axis values. */ + valueType?: string; + } + export interface ChartValueAxis extends ChartAxis, ValueAxis { + /** Specifies the spacing, in pixels, between multiple value axes in a chart. */ + multipleAxesSpacing?: number; + /** Specifies the value by which the chart's value axes are synchronized. */ + synchronizedValue?: number; + } + export interface PolarValueAxis extends PolarAxis, ValueAxis { + /** Indicates whether to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + tick?: { + visible?: boolean; + } + } + export interface CommonPane { + /** Specifies a background color in a pane. */ + backgroundColor?: string; + /** Specifies the border options of a chart's pane. */ + border?: PaneBorder; + } + export interface Pane extends CommonPane { + /** Specifies the name of a pane. */ + name?: string; + } + export interface PaneBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies the bottom border's visibility state in a pane. */ + bottom?: boolean; + /** Specifies the left border's visibility state in a pane. */ + left?: boolean; + /** Specifies the right border's visibility state in a pane. */ + right?: boolean; + /** Specifies the top border's visibility state in a pane. */ + top?: boolean; + } + export interface ChartAnimation extends viz.core.Animation { + /** Specifies the maximum series point count in the chart that the animation supports. */ + maxPointCountSupported?: number; + } + export interface BaseChartTooltip extends viz.core.Tooltip { + /** Specifies a format for arguments of the chart's series points. */ + argumentFormat?: string; + /** Specifies a precision for formatted arguments displayed in tooltips. */ + argumentPrecision?: number; + /** Specifies a precision for a percent value displayed in tooltips for stacked series and dxPieChart series. */ + percentPrecision?: number; + } + export interface BaseChartOptions extends viz.core.BaseWidgetOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies the width of the widget that is small enough for the layout to begin adapting. */ + width?: number; + /** Specifies the height of the widget that is small enough for the layout to begin adapting. */ + height?: number; + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies animation options. */ + animation?: ChartAnimation; + /** Specifies a callback function that returns an object with options for a specific point label. */ + customizeLabel?: (labelInfo: Object) => Object; + /** Specifies a callback function that returns an object with options for a specific point. */ + customizePoint?: (pointInfo: Object) => Object; + /** Specifies a data source for the chart. */ + dataSource?: any; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies options of a dxChart's (dxPieChart's) legend. */ + legend?: core.BaseLegend; + /** Specifies the blank space between the chart's extreme elements and the boundaries of the area provided for the widget (see size) in pixels. */ + margin?: viz.core.Margins; + /** Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** A handler for the done event. */ + onDone?: (e: { + component: BaseChart; + element: Element; + }) => void; + /** A handler for the pointClick event. */ + onPointClick?: any; + /** A handler for the pointHoverChanged event. */ + onPointHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + /** A handler for the pointSelectionChanged event. */ + onPointSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + /** Specifies whether a single point or multiple points can be selected in the chart. */ + pointSelectionMode?: string; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies options for the dxChart and dxPieChart widget series. */ + series?: any; + /** Specifies the size of the widget in pixels. */ + size?: viz.core.Size; + /** Specifies a title for the chart. */ + title?: viz.core.Title; + /** Specifies tooltip options. */ + tooltip?: BaseChartTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + } + /** A base class for all chart widgets included in the ChartJS library. */ + export class BaseChart extends viz.core.BaseWidget { + /** Deselects the chart's selected series. The series is displayed in an initial style. */ + clearSelection(): void; + /** Gets the current size of the widget. */ + getSize(): { width: number; height: number }; + /** Returns an array of all series in the chart. */ + getAllSeries(): Array; + /** Gets a series within the chart's series collection by the specified name (see the name option). */ + getSeriesByName(seriesName: string): BaseSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): BaseSeries; + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Hides all widget tooltips. */ + hideTooltip(): void; + /** Redraws a widget. */ + render(renderOptions?: { + force?: boolean; + animate?: boolean; + asyncSeriesRendering?: boolean; + }): void; + } + export interface AdvancedLegend extends core.BaseLegend { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /**

Specifies a callback function that returns the text to be displayed by legend items.

*/ + customizeText?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /** Specifies what series elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + } + export interface AdvancedOptions extends BaseChartOptions { + /** A handler for the argumentAxisClick event. */ + onArgumentAxisClick?: any; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate the values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort the series points. */ + sortingMethod?: any; + }; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** A handler for the seriesClick event. */ + onSeriesClick?: any; + /** A handler for the seriesHoverChanged event. */ + onSeriesHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** A handler for the seriesSelectionChanged event. */ + onSeriesSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** Specifies whether a single series or multiple series can be selected in the chart. */ + seriesSelectionMode?: string; + /** Specifies how the chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + /** Specifies whether or not all bars in a series must have the same angle, or may have different angles if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; + /** Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ + negativesAsZeroes?: boolean; + } + export interface Legend extends AdvancedLegend { + /** Specifies whether the legend is located outside or inside the chart's plot. */ + position?: string; + } + export interface ChartTooltip extends BaseChartTooltip { + /** Specifies whether the tooltip must be located in the center of a bar or on its edge. Applies to the Bar and Bubble series. */ + location?: string; + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxChartOptions extends AdvancedOptions { + adaptiveLayout?: { + keepLabels?: boolean; + }; + /** Indicates whether or not to synchronize value axes when they are displayed on a single pane. */ + synchronizeMultiAxes?: boolean; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Indicates whether or not to adjust a value axis to the current minimum and maximum values of a zoomed chart. */ + adjustOnZoom?: boolean; + /** Specifies argument axis options for the dxChart widget. */ + argumentAxis?: ChartArgumentAxis; + /** An object defining the configuration options that are common for all axes of the dxChart widget. */ + commonAxisSettings?: ChartCommonAxisSettings; + /** An object defining the configuration options that are common for all panes in the dxChart widget. */ + commonPaneSettings?: CommonPane; + /** An object defining the configuration options that are common for all series of the dxChart widget. */ + commonSeriesSettings?: CommonSeriesSettings; + /** An object that specifies the appearance options of the chart crosshair. */ + crosshair?: { + /** Specifies a color for the crosshair lines. */ + color?: string; + /** Specifies a dash style for the crosshair lines. */ + dashStyle?: string; + /** Specifies whether to enable the crosshair or not. */ + enabled?: boolean; + /** Specifies the opacity of the crosshair lines. */ + opacity?: number; + /** Specifies the width of the crosshair lines. */ + width?: number; + /** Specifies the appearance of the horizontal crosshair line. */ + horizontalLine?: CrosshaierWithLabel; + /** Specifies the appearance of the vertical crosshair line. */ + verticalLine?: CrosshaierWithLabel; + /** Specifies the options of the crosshair labels. */ + label?: { + /** Specifies a color for the background of the crosshair labels. */ + backgroundColor?: string; + /** Specifies whether the crosshair labels are visible or not. */ + visible?: boolean; + /** Specifies font options for the text of the crosshair labels. */ + font?: viz.core.Font; + /** Specifies the format of the values displayed by crosshair labels. */ + format?: string; + /** Specifies a precision for formatted values. */ + precision?: number; + /** Customizes the text displayed by the crosshair labels. */ + customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; + } + }; + /** Specifies a default pane for the chart series. */ + defaultPane?: string; + /** Specifies a coefficient determining the diameter of the largest bubble. */ + maxBubbleSize?: number; + /** Specifies the diameter of the smallest bubble measured in pixels. */ + minBubbleSize?: number; + /** Defines the dxChart widget's pane(s). */ + panes?: Array; + /** Swaps the axes round so that the value axis becomes horizontal and the argument axes becomes vertical. */ + rotated?: boolean; + /** Specifies the options of a chart's legend. */ + legend?: Legend; + /** Specifies options for dxChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: SeriesTemplate; + /** Specifies tooltip options. */ + tooltip?: ChartTooltip; + /** Specifies value axis options for the dxChart widget. */ + valueAxis?: Array; + /** Enables scrolling in your chart. */ + scrollingMode?: string; + /** Enables zooming in your chart. */ + zoomingMode?: string; + /** Specifies the settings of the scroll bar. */ + scrollBar?: { + /** Specifies whether the scroll bar is visible or not. */ + visible?: boolean; + /** Specifies the spacing between the scroll bar and the chart's plot in pixels. */ + offset?: number; + /** Specifies the color of the scroll bar. */ + color?: string; + /** Specifies the width of the scroll bar in pixels. */ + width?: number; + /** Specifies the opacity of the scroll bar. */ + opacity?: number; + /** Specifies the position of the scroll bar in the chart. */ + position?: string; + }; + } + /** A widget used to embed charts into web applications. */ + export class dxChart extends BaseChart { + constructor(element: JQuery, options?: dxChartOptions); + constructor(element: Element, options?: dxChartOptions); + /** Sets the specified start and end values for the chart's argument axis. */ + zoomArgument(startValue: any, endValue: any): void; + } + interface CrosshaierWithLabel extends viz.core.DashedBorderWithOpacity { + /** Configures the label that belongs to the horizontal crosshair line. */ + label?: { + /** Specifies a color for the background of the label that belongs to the horizontal crosshair line. */ + backgroundColor?: string; + /** Specifies whether the label of the horizontal crosshair line is visible or not. */ + visible?: boolean; + /** Specifies font options for the text of the label that belongs to the horizontal crosshair line. */ + font?: viz.core.Font; + /** Specifies the format of the values displayed by crosshair labels. */ + format?: string; + /** Specifies a precision for formatted values. */ + precision?: number; + /** Customizes the text displayed by the crosshair label that accompany the horizontal line. */ + customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; + } + } + export interface PolarChartTooltip extends BaseChartTooltip { + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxPolarChartOptions extends AdvancedOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + width?: number; + height?: number; + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Indicates whether or not to display a "spider web". */ + useSpiderWeb?: boolean; + /** Specifies argument axis options for the dxPolarChart widget. */ + argumentAxis?: PolarArgumentAxis; + /** An object defining the configuration options that are common for all axes of the dxPolarChart widget. */ + commonAxisSettings?: PolarCommonAxisSettings; + /** An object defining the configuration options that are common for all series of the dxPolarChart widget. */ + commonSeriesSettings?: CommonPolarSeriesSettings; + /** Specifies the options of a chart's legend. */ + legend?: AdvancedLegend; + /** Specifies options for dxPolarChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: PolarSeriesTemplate; + /** Specifies tooltip options. */ + tooltip?: PolarChartTooltip; + /** Specifies value axis options for the dxPolarChart widget. */ + valueAxis?: PolarValueAxis; + } + /** A chart widget displaying data in a polar coordinate system. */ + export class dxPolarChart extends BaseChart { + constructor(element: JQuery, options?: dxPolarChartOptions); + constructor(element: Element, options?: dxPolarChartOptions); + } + export interface PieLegend extends core.BaseLegend { + /** Specifies what chart elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + /** Specifies a callback function that returns the text to be displayed by a legend item. */ + customizeText?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + } + export interface dxPieChartOptions extends BaseChartOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies dxPieChart legend options. */ + legend?: PieLegend; + /** Specifies options for the series of the dxPieChart widget. */ + series?: Array; + /** Specifies the diameter of the pie. */ + diameter?: number; + /** Specifies the direction that the pie chart segments will occupy. */ + segmentsDirection?: string; + /** Specifies the angle in arc degrees from which the first segment of a pie chart should start. */ + startAngle?: number; + /** Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. The value should be between 0 and 1. */ + innerRadius?: number; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** Specifies how a chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + /** An object defining the configuration options that are common for all series of the dxPieChart widget. */ + commonSeriesSettings?: CommonPieSeriesSettings; + /** Specifies the type of the pie chart series. */ + type?: string; + } + /** A circular chart widget for web applications. */ + export class dxPieChart extends BaseChart { + constructor(element: JQuery, options?: dxPieChartOptions); + constructor(element: Element, options?: dxPieChartOptions); + /** + * Provides access to the dxPieChart series. + * @deprecated Use the getAllSeries() method instead. + */ + getSeries(): PieSeries; + } +} +interface JQuery { + dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; + dxChart(methodName: string, ...params: any[]): any; + dxChart(methodName: "instance"): DevExpress.viz.charts.dxChart; + dxPieChart(options?: DevExpress.viz.charts.dxPieChartOptions): JQuery; + dxPieChart(methodName: string, ...params: any[]): any; + dxPieChart(methodName: "instance"): DevExpress.viz.charts.dxPieChart; + dxPolarChart(options?: DevExpress.viz.charts.dxPolarChartOptions): JQuery; + dxPolarChart(methodName: string, ...params: any[]): any; + dxPolarChart(methodName: "instance"): DevExpress.viz.charts.dxPolarChart; +} +declare module DevExpress.viz.gauges { + export interface BaseRangeContainer { + /** Specifies a range container's background color. */ + backgroundColor?: string; + /** Specifies the offset of the range container from an invisible scale line in pixels. */ + offset?: number; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** An array of objects representing ranges contained in the range container. */ + ranges?: Array<{ startValue: number; endValue: number; color: string }>; + /** Specifies a color of a range. */ + color?: string; + /** Specifies an end value of a range. */ + endValue?: number; + /** Specifies a start value of a range. */ + startValue?: number; + } + export interface ScaleTick { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** + * Specifies an array of custom minor ticks. + * @deprecated Use the scale | customMinorTicks option instead. + */ + customTickValues?: Array; + /** Specifies the length of the scale's minor ticks. */ + length?: number; + /** + * Indicates whether automatically calculated minor ticks are visible or not. + * @deprecated This feature is no longer available. + */ + showCalculatedTicks?: boolean; + /** + * Specifies an interval between minor ticks. + * @deprecated Use the scale | minorTickInterval option instead. + */ + tickInterval?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + } + export interface ScaleMajorTick extends ScaleTick { + /** + * Specifies whether or not to expand the current major tick interval if labels overlap each other. + * @deprecated Use the overlappingBehavior | useAutoArrangement option instead. + */ + useTicksAutoArrangement?: boolean; + } + export interface ScaleMinorTick extends ScaleTick { + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + } + export interface BaseScaleLabel { + /** Specifies whether or not scale labels should be colored similarly to their corresponding ranges in the range container. */ + useRangeColors?: boolean; + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: number; valueText: string }) => string; + /** Specifies the overlap resolving options to be applied to scale labels. */ + overlappingBehavior?: { + /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + useAutoArrangement?: boolean; + /** Specifies what label to hide in case of overlapping. */ + hideFirstOrLast?: string; + }; + /** Specifies font options for the text displayed in the scale labels of the gauge. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the scale labels. */ + precision?: number; + /** Specifies whether or not scale labels are visible on the gauge. */ + visible?: boolean; + } + export interface BaseScale { + /** Specifies the end value for the scale of the gauge. */ + endValue?: number; + /** + * Specifies whether or not to hide the first scale label. + * @deprecated This feature is no longer available. + */ + hideFirstLabel?: boolean; + /** + * Specifies whether or not to hide the first major tick on the scale. + * @deprecated This feature is no longer available. + */ + hideFirstTick?: boolean; + /** + * Specifies whether or not to hide the last scale label. + * @deprecated This feature is no longer available. + */ + hideLastLabel?: boolean; + /** + * Specifies whether or not to hide the last major tick on the scale. + * @deprecated This feature is no longer available. + */ + hideLastTick?: boolean; + /** Specifies an interval between major ticks. */ + tickInterval?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: number; + /** Specifies an array of custom major ticks. */ + customTicks?: Array; + /** Specifies an array of custom minor ticks. */ + customMinorTicks?: Array; + /** Specifies common options for scale labels. */ + label?: BaseScaleLabel; + /** + * Specifies options of the gauge's major ticks. + * @deprecated Use the tick option instead. + */ + majorTick?: ScaleMajorTick; + /** Specifies options of the gauge's major ticks. */ + tick?: { + /** Specifies the color of the scale's major ticks. */ + color?: string; + /** Specifies the length of the scale's major ticks. */ + length?: number; + /** Indicates whether scale major ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's major ticks. */ + width?: number; + /** Specifies the opacity of the scale's major ticks. */ + opacity?: number; + }; + /** Specifies options of the gauge's minor ticks. */ + minorTick?: ScaleMinorTick; + /** Specifies the start value for the scale of the gauge. */ + startValue?: number; + } + export interface BaseValueIndicator { + /** Specifies the type of subvalue indicators. */ + type?: string; + /** Specifies the background color for the indicator of the rangeBar type. */ + backgroundColor?: string; + /** Specifies the base value for the indicator of the rangeBar type. */ + baseValue?: number; + /** Specifies a color of the indicator. */ + color?: string; + /** Specifies the range bar size for an indicator of the rangeBar type. */ + size?: number; + text?: { + /** Specifies a callback function that returns the text to be displayed in an indicator. */ + customizeText?: (indicatedValue: { value: number; valueText: string }) => string; + font?: viz.core.Font; + /** Specifies a format for the text displayed in an indicator. */ + format?: string; + /** Specifies the range bar's label indent in pixels. */ + indent?: number; + /** Specifies a precision for the formatted value displayed by an indicator. */ + precision?: number; + }; + offset?: number; + length?: number; + width?: number; + /** Specifies the length of an arrow for the indicator of the textCloud type in pixels. */ + arrowLength?: number; + /** Sets the array of colors to be used for coloring subvalue indicators. */ + palette?: Array; + /** Specifies the distance between the needle and the center of a gauge for the indicator of a needle-like type. */ + indentFromCenter?: number; + /** Specifies the second color for the indicator of the twoColorNeedle type. */ + secondColor?: string; + /** Specifies the length of a twoNeedleColor type indicator tip as a percentage. */ + secondFraction?: number; + /** Specifies the spindle's diameter in pixels for the indicator of a needle-like type. */ + spindleSize?: number; + /** Specifies the inner diameter in pixels, so that the spindle has the shape of a ring. */ + spindleGapSize?: number; + /** Specifies the orientation of the rangeBar indicator on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of the rangeBar indicator on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface SharedGaugeOptions { + /** Specifies animation options. */ + animation?: viz.core.Animation; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies the size of the widget in pixels. */ + size?: viz.core.Size; + /** + * Specifies a subtitle for the widget. + * @deprecated Use the title | subtitle option instead. + */ + subtitle?: { + /** + * Specifies font options for the subtitle. + * @deprecated Use the title | subtitle | font option instead. + */ + font?: viz.core.Font; + /** + * Specifies a text for the subtitle. + * @deprecated Use the title | subtitle | text option instead. + */ + text?: string; + }; + /** Specifies a title for a gauge. */ + title?: { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** + * Specifies a title's position on the gauge. + * @deprecated Use the horizontalAlignment and verticalAlignment options instead. + */ + position?: string; + /** Specifies the distance between the title and surrounding gauge elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies the gauge title's position in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the gauge title's horizontal position. */ + horizontalAlignment?: string; + /** Specifies text for the title. */ + text?: string; + /** Specifies a subtitle for the widget. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } + }; + /** Specifies options for gauge tooltips. */ + tooltip?: viz.core.Tooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + } + export interface BaseGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies the blank space in pixels between the widget's extreme elements and the boundaries of the area provided for the widget (see the size option). */ + margin?: viz.core.Margins; + /** Specifies options of the gauge's range container. */ + rangeContainer?: BaseRangeContainer; + /** Specifies a gauge's scale options. */ + scale?: BaseScale; + /** Specifies the appearance options of subvalue indicators. */ + subvalueIndicator?: BaseValueIndicator; + /** Specifies a set of subvalues to be designated by the subvalue indicators. */ + subvalues?: Array; + /** Specifies the main value on a gauge. */ + value?: number; + /** Specifies the appearance options of the value indicator. */ + valueIndicator?: BaseValueIndicator; + } + /** A gauge widget. */ + export class dxBaseGauge extends viz.core.BaseWidget { + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(): void; + /** Returns the main gauge value. */ + value(): number; + /** Updates a gauge value. */ + value(value: number): void; + /** Returns an array of gauge subvalues. */ + subvalues(): Array; + /** Updates gauge subvalues. */ + subvalues(subvalues: Array): void; + } + export interface LinearRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of a range container on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + /** Specifies the width of the range container's start and end boundaries in the dxLinearGauge widget. */ + width?: any; + /** Specifies an end width of a range container. */ + end?: number; + /** Specifies a start width of a range container. */ + start?: number; + } + export interface LinearScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface LinearScale extends BaseScale { + /** Specifies the orientation of scale ticks on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + label?: LinearScaleLabel; + /** Specifies the orientation of scale ticks on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface dxLinearGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxLinearGauge widget. */ + geometry?: { + /** Indicates whether to display the dxLinearGauge widget vertically or horizontally. */ + orientation?: string; + }; + /** Specifies gauge range container options. */ + rangeContainer?: LinearRangeContainer; + scale?: LinearScale; + } + /** A widget that represents a gauge with a linear scale. */ + export class dxLinearGauge extends dxBaseGauge { + constructor(element: JQuery, options?: dxLinearGaugeOptions); + constructor(element: Element, options?: dxLinearGaugeOptions); + } + export interface CircularRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container in the dxCircularGauge widget. */ + orientation?: string; + /** Specifies the range container's width in pixels. */ + width?: number; + } + export interface CircularScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface CircularScale extends BaseScale { + label?: CircularScaleLabel; + /** Specifies the orientation of scale ticks. */ + orientation?: string; + } + export interface dxCircularGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxCircularGauge widget. */ + geometry?: { + /** Specifies the end angle of the circular gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the circular gauge's arc. */ + startAngle?: number; + }; + /** Specifies gauge range container options. */ + rangeContainer?: CircularRangeContainer; + scale?: CircularScale; + } + /** A widget that represents a gauge with a circular scale. */ + export class dxCircularGauge extends dxBaseGauge { + constructor(element: JQuery, options?: dxCircularGaugeOptions); + constructor(element: Element, options?: dxCircularGaugeOptions); + } + export interface dxBarGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies a color for the remaining segment of the bar's track. */ + backgroundColor?: string; + /** Specifies a distance between bars in pixels. */ + barSpacing?: number; + /** Specifies a base value for bars. */ + baseValue?: number; + /** Specifies an end value for the gauge's invisible scale. */ + endValue?: number; + /** Defines the shape of the gauge's arc. */ + geometry?: { + /** Specifies the end angle of the bar gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the bar gauge's arc. */ + startAngle?: number; + }; + /** Specifies the options of the labels that accompany gauge bars. */ + label?: { + /** Specifies a color for the label connector text. */ + connectorColor?: string; + /** Specifies the width of the label connector in pixels. */ + connectorWidth?: number; + /** Specifies a callback function that returns a text for labels. */ + customizeText?: (barValue: { value: number; valueText: string }) => string; + /** Specifies font options for bar labels. */ + font?: viz.core.Font; + /** Specifies a format for bar labels. */ + format?: string; + /** Specifies the distance between the upper bar and bar labels in pixels. */ + indent?: number; + /** Specifies a precision for the formatted value displayed by labels. */ + precision?: number; + /** Specifies whether bar labels appear on a gauge or not. */ + visible?: boolean; + }; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** Defines the radius of the bar that is closest to the center relatively to the radius of the topmost bar. */ + relativeInnerRadius?: number; + /** Specifies a start value for the gauge's invisible scale. */ + startValue?: number; + /** Specifies the array of values to be indicated on a bar gauge. */ + values?: Array; + } + /** A circular bar widget. */ + export class dxBarGauge extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxBarGaugeOptions); + constructor(element: Element, options?: dxBarGaugeOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws the widget. */ + render(): void; + /** Returns an array of gauge values. */ + values(): Array; + /** Updates the values displayed by a gauge. */ + values(values: Array): void; + } +} +interface JQuery { + dxLinearGauge(options?: DevExpress.viz.gauges.dxLinearGaugeOptions): JQuery; + dxLinearGauge(methodName: string, ...params: any[]): any; + dxLinearGauge(methodName: "instance"): DevExpress.viz.gauges.dxLinearGauge; + dxCircularGauge(options?: DevExpress.viz.gauges.dxCircularGaugeOptions): JQuery; + dxCircularGauge(methodName: string, ...params: any[]): any; + dxCircularGauge(methodName: "instance"): DevExpress.viz.gauges.dxCircularGauge; + dxBarGauge(options?: DevExpress.viz.gauges.dxBarGaugeOptions): JQuery; + dxBarGauge(methodName: string, ...params: any[]): any; + dxBarGauge(methodName: "instance"): DevExpress.viz.gauges.dxBarGauge; +} +declare module DevExpress.viz.rangeSelector { + export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions { + /** Specifies the options for the range selector's background. */ + background?: { + /** Specifies the background color for the dxRangeSelector. */ + color?: string; + /** Specifies image options. */ + image?: { + /** Specifies a location for the image in the background of a range selector. */ + location?: string; + /** Specifies the image's URL. */ + url?: string; + }; + /** Indicates whether or not the background (background color and/or image) is visible. */ + visible?: boolean; + }; + /** Specifies a title for the range selector. */ + title?: viz.core.Title; + /** Specifies the dxRangeSelector's behavior options. */ + behavior?: { + /** Indicates whether or not you can swap sliders. */ + allowSlidersSwap?: boolean; + /** Indicates whether or not animation is enabled. */ + animationEnabled?: boolean; + /** Specifies when to call the onSelectedRangeChanged function. */ + callSelectedRangeChanged?: string; + /** Indicates whether or not an end user can specify the range using a mouse, without the use of sliders. */ + manualRangeSelectionEnabled?: boolean; + /** Indicates whether or not an end user can shift the selected range to the required location on a scale by clicking. */ + moveSelectedRangeByClick?: boolean; + /** Indicates whether to snap a slider to ticks. */ + snapToTicks?: boolean; + }; + /** Specifies the options required to display a chart as the range selector's background. */ + chart?: { + /** Specifies a coefficient for determining an indent from the bottom background boundary to the lowest chart point. */ + bottomIndent?: number; + /** An object defining the common configuration options for the chart’s series. */ + commonSeriesSettings?: viz.charts.CommonSeriesSettings; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort series points. */ + sortingMethod?: any; + }; + /** Specifies whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; + /** Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ + negativesAsZeroes?: boolean; + /** Sets the name of the palette to be used in the range selector's chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** An object defining the chart’s series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: viz.charts.SeriesTemplate; + /** Specifies a coefficient for determining an indent from the background's top boundary to the topmost chart point. */ + topIndent?: number; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Specifies options for the chart's value axis. */ + valueAxis?: { + /** Indicates whether or not the chart's value axis must be inverted. */ + inverted?: boolean; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic value axis. */ + logarithmBase?: number; + /** Specifies the maximum value of the chart's value axis. */ + max?: number; + /** Specifies the minimum value of the chart's value axis. */ + min?: number; + /** Specifies the type of the value axis. */ + type?: string; + /** Specifies the desired type of axis values. */ + valueType?: string; + }; + }; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies a data source for the scale values and for the chart at the background. */ + dataSource?: any; + /** Specifies the data source field that provides data for the scale. */ + dataSourceField?: string; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies the blank space in pixels between the dxRangeSelector widget's extreme elements and the boundaries of the area provided for the widget (see size). */ + margin?: viz.core.Margins; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies options of the range selector's scale. */ + scale?: { + /** Specifies the scale's end value. */ + endValue?: any; + /** Specifies common options for scale labels. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: any; valueText: string; }) => string; + /** Specifies font options for the text displayed in the range selector's scale labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the scale labels. */ + precision?: number; + /** Specifies a spacing between scale labels and the background bottom edge. */ + topIndent?: number; + /** Specifies whether or not the scale's labels are visible. */ + visible?: boolean; + }; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic scale. */ + logarithmBase?: number; + /** + * Specifies an interval between major ticks. + * @deprecated Use the tickInterval option instead. + */ + majorTickInterval?: any; + /** Specifies an interval between axis ticks. */ + tickInterval?: any; + /** Specifies options for the date-time scale's markers. */ + marker?: { + /** Defines the options that can be set for the text that is displayed by the scale markers. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale markers. */ + customizeText?: (markerValue: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed in scale markers. */ + format?: string; + }; + /** Specifies the height of the marker's separator. */ + separatorHeight?: number; + /** Specifies the space between the marker label and the marker separator. */ + textLeftIndent?: number; + /** Specifies the space between the marker's label and the top edge of the marker's separator. */ + textTopIndent?: number; + /** Specified the indent between the marker and the scale lables. */ + topIndent?: number; + /** Indicates whether scale markers are visible. */ + visible?: boolean; + }; + /** Specifies the maximum range that can be selected. */ + maxRange?: any; + /** Specifies the number of minor ticks between neighboring major ticks. */ + minorTickCount?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the minimum range that can be selected. */ + minRange?: any; + /** Specifies the height of the space reserved for the scale in pixels. */ + placeholderHeight?: number; + /** Indicates whether or not to set ticks of a date-time scale at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** Specifies whether or not to show ticks for the boundary scale values, when neither major ticks nor minor ticks are created for these values. */ + showCustomBoundaryTicks?: boolean; + /** + * Indicates whether or not to show minor ticks on the scale. + * @deprecated Use the minorTick | visible option instead. + */ + showMinorTicks?: boolean; + /** Specifies the scale's start value. */ + startValue?: any; + /** Specifies options defining the appearance of scale ticks. */ + tick?: { + /** Specifies the color of scale ticks (both major and minor ticks). */ + color?: string; + /** Specifies the opacity of scale ticks (both major and minor ticks). */ + opacity?: number; + /** Specifies the width of the scale's ticks (both major and minor ticks). */ + width?: number; + }; + /** Specifies options of the range selector's minor ticks. */ + minorTick?: { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + }; + /** Specifies the type of the scale. */ + type?: string; + /** Specifies whether or not to expand the current tick interval if labels overlap each other. */ + useTicksAutoArrangement?: boolean; + /** Specifies the type of values on the scale. */ + valueType?: string; + /** Specifies the order of arguments on a discrete scale. */ + categories?: Array; + }; + /** Specifies the range to be selected when displaying the dxRangeSelector. */ + selectedRange?: { + /** Specifies the start value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + startValue?: any; + /** Specifies the end value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + endValue?: any; + }; + /** Specifies the color of the selected range. */ + selectedRangeColor?: string; + /** Range selector's indent options. */ + indent?: { + /** Specifies range selector's left indent. */ + left?: number; + /** Specifies range selector's right indent. */ + right?: number; + }; + /** A handler for the selectedRangeChanged event. */ + onSelectedRangeChanged?: (e: { + startValue: any; + endValue: any; + component: dxRangeSelector; + element: Element; + }) => void; + /** Specifies range selector shutter options. */ + shutter?: { + /** Specifies shutter color. */ + color?: string; + /** Specifies the opacity of the color of shutters. */ + opacity?: number; + }; + /** Specifies in pixels the size of the dxRangeSelector widget. */ + size?: viz.core.Size; + /** Specifies the appearance of the range selector's slider handles. */ + sliderHandle?: { + /** Specifies the color of the slider handles. */ + color?: string; + /** Specifies the opacity of the slider handles. */ + opacity?: number; + /** Specifies the width of the slider handles. */ + width?: number; + }; + /** Defines the options of the range selector slider markers. */ + sliderMarker?: { + /** Specifies the color of the slider markers. */ + color?: string; + /** Specifies a callback function that returns the text to be displayed by slider markers. */ + customizeText?: (scaleValue: { value: any; valueText: any; }) => string; + /** Specifies font options for the text displayed by the range selector slider markers. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in slider markers. */ + format?: string; + /** Specifies the color used for the slider marker text when the currently selected range does not match the minRange and maxRange values. */ + invalidRangeColor?: string; + /** + * Specifies the empty space between the marker's border and the marker’s text. + * @deprecated Use the paddingTopBottom and paddingLeftRight options instead. + */ + padding?: number; + /** Specifies the empty space between the marker's top and bottom borders and the marker's text. */ + paddingTopBottom?: number; + /** Specifies the empty space between the marker's left and right borders and the marker's text. */ + paddingLeftRight?: number; + /** Specifies the placeholder height of the slider marker. */ + placeholderHeight?: number; + /** + * Specifies in pixels the height and width of the space reserved for the range selector slider markers. + * @deprecated Use the placeholderHeight and indent options instead. + */ + placeholderSize?: { + /** Specifies the height of the placeholder for the left and right slider markers. */ + height?: number; + /** Specifies the width of the placeholder for the left and right slider markers. */ + width?: { + /** Specifies the width of the left slider marker's placeholder. */ + left?: number; + /** Specifies the width of the right slider marker's placeholder. */ + right?: number; + }; + }; + /** Specifies a precision for the formatted value displayed in slider markers. */ + precision?: number; + /** Indicates whether or not the slider markers are visible. */ + visible?: boolean; + }; + } + /** A widget that allows end users to select a range of values on a scale. */ + export class dxRangeSelector extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxRangeSelectorOptions); + constructor(element: Element, options?: dxRangeSelectorOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(skipChartAnimation?: boolean): void; + /** Returns the currently selected range. */ + getSelectedRange(): { startValue: any; endValue: any; }; + /** Sets a specified range. */ + setSelectedRange(selectedRange: { startValue: any; endValue: any; }): void; + } +} +interface JQuery { + dxRangeSelector(options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; + dxRangeSelector(methodName: string, ...params: any[]): any; + dxRangeSelector(methodName: "instance"): DevExpress.viz.rangeSelector.dxRangeSelector; +} +declare module DevExpress.viz.map { + /** This section describes the fields and methods that can be used in code to manipulate the Layer object. */ + export interface MapLayer { + /** The name of the layer. */ + name: string; + /** The layer index in the layers array. */ + index: number; + /** The layer type. Can be "area", "line" or "marker". */ + type: string; + /** The type of the layer elements. */ + elementType: string; + /** Gets all layer elements. */ + getElements(): Array; + /** Deselects all layer elements. */ + clearSelection(): void; + } + /** This section describes the fields and methods that can be used in code to manipulate the Layer Element object. */ + export interface MapLayerElement { + /** The parent layer of the layer element. */ + layer: MapLayer; + /** Gets the layer element coordinates. */ + coordinates(): Object; + /** Sets the value of an attribute. */ + attribute(name: string, value: any): void; + /** Gets the value of an attribute. */ + attribute(name: string): any; + /** Gets the selection state of the layer element. */ + selected(): boolean; + /** Sets the selection state of the layer element. */ + selected(state: boolean): void; + /** Applies the layer element settings and updates element appearance. */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Area object. + * @deprecated Use the Layer Element instead. + */ + export interface Area { + /** + * Contains the element type. + * @deprecated Use the Layer | type instead. + */ + type: string; + /** + * Return the value of an attribute. + * @deprecated Use the Layer Element | attribute(name, value) method instead. + */ + attribute(name: string): any; + /** + * Provides information about the selection state of an area. + * @deprecated Use the Layer Element | selected() method instead. + */ + selected(): boolean; + /** + * Sets a new selection state for an area. + * @deprecated Use the Layer Element | selected(state) method instead. + */ + selected(state: boolean): void; + /** + * Applies the area settings specified as a parameter and updates the area appearance. + * @deprecated Use the Layer Element | applySettings(settings) method instead. + */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Markers object. + * @deprecated Use the Layer Element instead. + */ + export interface Marker { + /** + * Contains the descriptive text accompanying the map marker. + * @deprecated Get the text using the Layer Element | attribute(name) method. The name parameter value for text is set at the dataField option. + */ + text: string; + /** + * Contains the type of the element. + * @deprecated Use the Layer | type instead. + */ + type: string; + /** + * Contains the URL of an image map marker. + * @deprecated Get the image URL using the Layer Element | attribute(name) method. The name parameter value for the image URL is set at the dataField option. + */ + url: string; + /** + * Contains the value of a bubble map marker. + * @deprecated Get the bubble value using the Layer Element | attribute(name) method. The name parameter for the bubble value is set at the dataField option. + */ + value: number; + /** + * Contains the values of a pie map marker. + * @deprecated Get the pie values using the Layer Element | attribute(name) method. The name parameter for pie values is set at the dataField option. + */ + values: Array; + /** + * Returns the value of an attribute. + * @deprecated Use the Layer Element | attribute(name, value) method instead. + */ + attribute(name: string): any; + /** + * Returns the coordinates of a specific marker. + * @deprecated Use the Layer Element | coordinates() method instead. + */ + coordinates(): Array; + /** + * Provides information about the selection state of a marker. + * @deprecated Use the Layer Element | selected() method instead. + */ + selected(): boolean; + /** + * Sets a new selection state for a marker. + * @deprecated Use the Layer Element | selected(state) method instead. + */ + selected(state: boolean): void; + /** + * Applies the marker settings specified as a parameter and updates marker appearance. + * @deprecated Use the Layer Element | applySettings(settings) method instead. + */ + applySettings(settings: any): void; + } + export interface MapLayerSettings { + /** Specifies the layer name. */ + name?: string; + /** Specifies layer type. */ + type?: string; + /** Specifies the type of a marker element. Setting this option makes sense only if the layer type is "marker". */ + elementType?: string; + /** Specifies a data source for the layer. */ + dataSource?: any; + /** Specifies the line width (for layers of a line type) or width of the layer elements border in pixels. */ + borderWidth?: number; + /** Specifies a color for the border of the layer elements. */ + borderColor?: string; + /** Specifies a color for layer elements. */ + color?: string; + /** Specifies a color for the border of the layer element when it is hovered over. */ + hoveredBorderColor?: string; + /** Specifies the pixel-measured line width (for layers of a line type) or width for the border of the layer element when it is hovered over. */ + hoveredBorderWidth?: number; + /** Specifies a color for a layer element when it is hovered over. */ + hoveredColor?: string; + /** Specifies a pixel-measured line width (for layers of a line type) or width for the border of the layer element when it is selected. */ + selectedBorderWidth?: number; + /** Specifies a color for the border of the layer element when it is selected. */ + selectedBorderColor?: string; + /** Specifies a color for the layer element when it is selected. */ + selectedColor?: string; + /** Specifies the layer opacity (from 0 to 1). */ + opacity?: number; + /** Specifies the size of markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "dot", "pie" or "image". */ + size?: number; + /** Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if the layer type is "marker". */ + minSize?: number; + /** Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if the layer type is "marker". */ + maxSize?: number; + /** Specifies whether or not to change the appearance of a layer element when it is hovered over. */ + hoverEnabled?: boolean; + /** Specifies whether single or multiple map elements can be selected on a vector map. */ + selectionMode?: string; + /** Specifies the name of the palette or a custom range of colors to be used for coloring a layer. */ + palette?: any; + /** Specifies the number of colors in a palette. */ + paletteSize?: number; + /** Allows you to paint layer elements with similar attributes in the same color. */ + colorGroups?: Array; + /** Specifies the field that provides data to be used for coloring of layer elements. */ + colorGroupingField?: string; + /** Allows you to display bubbles with similar attributes in the same size. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroups?: Array; + /** Specifies the field that provides data to be used for sizing bubble markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroupingField?: string; + /** Specifies the name of the attribute containing marker data. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble", "pie" or "image". */ + dataField?: string; + /** Specifies the function that customizes each layer element individually. */ + customize?: (eleemnts: Array) => void; + /** Specifies marker label options. */ + label?: { + /** The name of the dataSource attribute containing marker texts. */ + dataField?: string; + /** Enables marker labels. */ + enabled?: boolean; + /** Specifies font options for marker labels. */ + font?: viz.core.Font; + }; + } + export interface AreaSettings { + /** + * Specifies the width of the area border in pixels. + * @deprecated Use the layers | borderWidth option instead. + */ + borderWidth?: number; + /** + * Specifies a color for the area border. + * @deprecated Use the layers | borderColor option instead. + */ + borderColor?: string; + /** + * Specifies a color for an area. + * @deprecated Use the layers | color option instead. + */ + color?: string; + /** + * Specifies the function that customizes each area individually. + * @deprecated Use the layers | customize option instead. + */ + customize?: (areaInfo: Area) => AreaSettings; + /** + * Specifies a color for the area border when the area is hovered over. + * @deprecated Use the layers | hoveredBorderColor option instead. + */ + hoveredBorderColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is hovered over. + * @deprecated Use the layers | hoveredBorderWidth option instead. + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for an area when this area is hovered over. + * @deprecated Use the layers | hoveredColor option instead. + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of an area when it is hovered over. + * @deprecated Use the layers | hoverEnabled option instead. + */ + hoverEnabled?: boolean; + /** + * Configures area labels. + * @deprecated Use the layers | label option instead. + */ + label?: { + /** + * Specifies the data field that provides data for area labels. + * @deprecated Use the layers | label | dataField option instead. + */ + dataField?: string; + /** + * Enables area labels. + * @deprecated Use the layers | label | enabled option instead. + */ + enabled?: boolean; + /** + * Specifies font options for area labels. + * @deprecated Use the layers | label | font option instead. + */ + font?: viz.core.Font; + }; + /** + * Specifies the name of the palette or a custom range of colors to be used for coloring a map. + * @deprecated Use the layers | palette option instead. + */ + palette?: any; + /** + * Specifies the number of colors in a palette. + * @deprecated Use the layers | paletteSize option instead. + */ + paletteSize?: number; + /** + * Allows you to paint areas with similar attributes in the same color. + * @deprecated Use the layers | colorGroups option instead. + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring areas. + * @deprecated Use the layers | colorGroupingField option instead. + */ + colorGroupingField?: string; + /** + * Specifies a color for the area border when the area is selected. + * @deprecated Use the layers | selectedBorderColor option instead. + */ + selectedBorderColor?: string; + /** + * Specifies a color for an area when this area is selected. + * @deprecated Use the layers | selectedColor option instead. + */ + selectedColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is selected. + * @deprecated Use the layers | selectedBorderWidth option instead. + */ + selectedBorderWidth?: number; + /** + * Specifies whether single or multiple areas can be selected on a vector map. + * @deprecated Use the layers | selectionMode option instead. + */ + selectionMode?: string; + } + export interface MarkerSettings { + /** + * Specifies a color for the marker border. + * @deprecated Use the layers | borderColor option instead. + */ + borderColor?: string; + /** + * Specifies the width of the marker border in pixels. + * @deprecated Use the layers | borderWidth option instead. + */ + borderWidth?: number; + /** + * Specifies a color for a marker of the dot or bubble type. + * @deprecated Use the layers | color option instead. + */ + color?: string; + /** + * Specifies the function that customizes each marker individually. + * @deprecated Use the layers | customize option instead. + */ + customize?: (markerInfo: Marker) => MarkerSettings; + /** + * Specifies the pixel-measured width of the marker border when the marker is hovered over. + * @deprecated Use the layers | hoveredBorderWidth option instead. + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is hovered over. + * @deprecated Use the layers | hoveredBorderColor option instead. + */ + hoveredBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is hovered over. + * @deprecated Use the layers | hoveredColor option instead. + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of a marker when it is hovered over. + * @deprecated Use the layers | hoverEnabled option instead. + */ + hoverEnabled?: boolean; + /** + * Specifies marker label options. + * @deprecated Use the layers | label option instead. + */ + label?: { + /** + * Enables marker labels. + * @deprecated Use the layers | label | enabled option instead. + */ + enabled?: boolean; + /** + * Specifies font options for marker labels. + * @deprecated Use the layers | label | font option instead. + */ + font?: viz.core.Font; + }; + /** + * Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | maxSize option instead. + */ + maxSize?: number; + /** + * Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | minSize option instead. + */ + minSize?: number; + /** + * Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | opacity option instead. + */ + opacity?: number; + /** + * Specifies the pixel-measured width of the marker border when the marker is selected. + * @deprecated Use the layers | selectedBorderWidth option instead. + */ + selectedBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is selected. + * @deprecated Use the layers | selectedBorderColor option instead. + */ + selectedBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is selected. + * @deprecated Use the layers | selectedColor option instead. + */ + selectedColor?: string; + /** + * Specifies whether a single or multiple markers can be selected on a vector map. + * @deprecated Use the layers | selectionMode option instead. + */ + selectionMode?: string; + /** + * Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. + * @deprecated Use the layers | size option instead. + */ + size?: number; + /** + * Specifies the type of markers to be used on the map. + * @deprecated Use the layers | elementType option instead. + */ + type?: string; + /** + * Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. + * @deprecated Use the layers | palette option instead. + */ + palette?: any; + /** + * Allows you to paint markers with similar attributes in the same color. + * @deprecated Use the layers | colorGroups option instead. + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring markers. + * @deprecated Use the layers | colorGroupingField option instead. + */ + colorGroupingField?: string; + /** + * Allows you to display bubbles with similar attributes in the same size. + * @deprecated Use the layers | sizeGroups option instead. + */ + sizeGroups?: Array; + /** + * Specifies the field that provides data to be used for sizing bubble markers. + * @deprecated Use the layers | sizeGroupingField option instead. + */ + sizeGroupingField?: string; + } + export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions { + /** + * An object specifying options for the map areas. + * @deprecated Use the "area" type element of the layers array. + */ + areaSettings?: AreaSettings; + /** Specifies the options for the map background. */ + background?: { + /** Specifies a color for the background border. */ + borderColor?: string; + /** Specifies a color for the background. */ + color?: string; + }; + /** Specifies options for dxVectorMap widget layers. */ + layers?: Array; + /** Specifies the map projection. */ + projection?: Object; + /** Specifies the positioning of a map in geographical coordinates. */ + bounds?: Array; + /** Specifies the options of the control bar. */ + controlBar?: { + /** Specifies a color for the outline of the control bar elements. */ + borderColor?: string; + /** Specifies a color for the inner area of the control bar elements. */ + color?: string; + /** Specifies whether or not to display the control bar. */ + enabled?: boolean; + /** Specifies the margin of the control bar in pixels. */ + margin?: number; + /** Specifies the position of the control bar. */ + horizontalAlignment?: string; + /** Specifies the position of the control bar. */ + verticalAlignment?: string; + /** Specifies the opacity of the control bar. */ + opacity?: number; + }; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** + * Specifies a data source for the map area. + * @deprecated Use the layers | dataSource option instead. + */ + mapData?: any; + /** + * Specifies a data source for the map markers. + * @deprecated Use the layers | dataSource option instead. + */ + markers?: any; + /** + * An object specifying options for the map markers. + * @deprecated Use the "marker" type element of the layers array. + */ + markerSettings?: MarkerSettings; + /** Specifies the size of the dxVectorMap widget. */ + size?: viz.core.Size; + /** Specifies a title for the vector map. */ + title?: viz.core.Title; + /** Specifies tooltip options. */ + tooltip?: viz.core.Tooltip; + /** Configures map legends. */ + legends?: Array; + /** Specifies whether or not the map should respond when a user rolls the mouse wheel. */ + wheelEnabled?: boolean; + /** Specifies whether the map should respond to touch gestures. */ + touchEnabled?: boolean; + /** Disables the zooming capability. */ + zoomingEnabled?: boolean; + /** Specifies the geographical coordinates of the center for a map. */ + center?: Array; + /** A handler for the centerChanged event. */ + onCenterChanged?: (e: { + center: Array; + component: dxVectorMap; + element: Element; + }) => void; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** Specifies a number that is used to zoom a map initially. */ + zoomFactor?: number; + /** Specifies a map's maximum zoom factor. */ + maxZoomFactor?: number; + /** A handler for the zoomFactorChanged event. */ + onZoomFactorChanged?: (e: { + component: dxVectorMap; + element: Element; + zoomFactor: number; + }) => void; + /** A handler for the click event. */ + onClick?: any; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + component: dxVectorMap; + element: Element; + target: MapLayerElement; + }) => void; + /** + * A handler for the areaClick event. + * @deprecated Use the onClick option instead. + */ + onAreaClick?: any; + /** + * A handler for the areaSelectionChanged event. + * @deprecated Use the onSelectionChanged option instead. + */ + onAreaSelectionChanged?: (e: { + target: Area; + component: dxVectorMap; + element: Element; + }) => void; + /** + * A handler for the markerClick event. + * @deprecated Use the onClick option instead. + */ + onMarkerClick?: any; + /** + * A handler for the markerSelectionChanged event. + * @deprecated Use the onSelecitonChanged option instead. + */ + onMarkerSelectionChanged?: (e: { + target: Marker; + component: dxVectorMap; + element: Element; + }) => void; + /** Disables the panning capability. */ + panningEnabled?: boolean; + } + export interface Legend extends viz.core.BaseLegend { + /** Specifies the color of item markers in the legend. The specified color applied only when the legend uses 'size' source. */ + markerColor?: string; + /** Specifies text for legend items. */ + customizeText?: (itemInfo: { start: number; end: number; index: number; color: string; size: number; }) => string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item. */ + customizeHint?: (itemInfo: { start: number; end: number; index: number; color: string; size: number }) => string; + /** Specifies the source of data for the legend. */ + source?: { + /** Specifies a layer to which the legend belongs. */ + layer?: string; + /** Specifies the type of the legend grouping. */ + grouping?: string; + } + } + /** A vector map widget. */ + export class dxVectorMap extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxVectorMapOptions); + constructor(element: Element, options?: dxVectorMapOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(): void; + /** Gets the current coordinates of the map center. */ + center(): Array; + /** Sets the coordinates of the map center. */ + center(centerCoordinates: Array): void; + /** + * Deselects all the selected areas on a map. The areas are displayed in their initial style after. + * @deprecated Use the layer's clearSelection() method instead. + */ + clearAreaSelection(): void; + /** + * Deselects all the selected markers on a map. The markers are displayed in their initial style after. + * @deprecated Use the layer's clearSelection() method instead. + */ + clearMarkerSelection(): void; + /** Deselects all the selected area and markers on a map at once. The areas and markers are displayed in their initial style after. */ + clearSelection(): void; + /** Converts client area coordinates into map coordinates. */ + convertCoordinates(x: number, y: number): Array; + /** Gets all map layers. */ + getLayers(): Array; + /** Gets the layer by its index. */ + getLayerByIndex(index: number): MapLayer; + /** Gets the layer by its name. */ + getLayerByName(name: string): MapLayer; + /** + * Returns an array with all the map areas. + * @deprecated Use the layer's getElements() method instead. + */ + getAreas(): Array; + /** + * Returns an array with all the map markers. + * @deprecated Use the layer's getElements() method instead. + */ + getMarkers(): Array; + /** Gets the current coordinates of the map viewport. */ + viewport(): Array; + /** Sets the coordinates of the map viewport. */ + viewport(viewportCoordinates: Array): void; + /** Gets the current value of the map zoom factor. */ + zoomFactor(): number; + /** Sets the value of the map zoom factor. */ + zoomFactor(zoomFactor: number): void; + } + export var projection: ProjectionCreator; + export interface ProjectionCreator { + /** Creates a new projection. */ + (data: { + to?: (coordinates: Array) => Array; + from?: (coordinates: Array) => Array; + aspectRatio?: number; + }): Object; + /** Gets the default or custom projection from the projection storage. */ + get(name: string): Object; + /** Adds a new projection to the internal projections storage. */ + add(name: string, projection: Object): void; + } +} +interface JQuery { + dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; + dxVectorMap(methodName: string, ...params: any[]): any; + dxVectorMap(methodName: "instance"): DevExpress.viz.map.dxVectorMap; +} +declare module DevExpress.viz.sparklines { + export interface SparklineTooltip extends viz.core.Tooltip { + /** + * Specifies how a tooltip is horizontally aligned relative to the graph. + * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. + */ + horizontalAlignment?: string; + /** + * Specifies how a tooltip is vertically aligned relative to the graph. + * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. + */ + verticalAlignment?: string; + } + export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions { + /** Specifies the blank space between the widget's extreme elements and the boundaries of the area provided for the widget in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of the widget. */ + size?: viz.core.Size; + /** Specifies tooltip options. */ + tooltip?: SparklineTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + } + /** Overridden by descriptions for particular widgets. */ + export class BaseSparkline extends viz.core.BaseWidget { + /** Redraws a widget. */ + render(): void; + } + export interface dxBulletOptions extends BaseSparklineOptions { + /** Specifies a color for the bullet bar. */ + color?: string; + /** Specifies an end value for the invisible scale. */ + endScaleValue?: number; + /** Specifies whether or not to show the target line. */ + showTarget?: boolean; + /** Specifies whether or not to show the line indicating zero on the invisible scale. */ + showZeroLevel?: boolean; + /** Specifies a start value for the invisible scale. */ + startScaleValue?: number; + /** Specifies the value indicated by the target line. */ + target?: number; + /** Specifies a color for both the target and zero level lines. */ + targetColor?: string; + /** Specifies the width of the target line. */ + targetWidth?: number; + /** Specifies the primary value indicated by the bullet bar. */ + value?: number; + } + /** A bullet graph widget. */ + export class dxBullet extends BaseSparkline { + constructor(element: JQuery, options?: dxBulletOptions); + constructor(element: Element, options?: dxBulletOptions); + } + export interface dxSparklineOptions extends BaseSparklineOptions { + /** Specifies the data source field that provides arguments for a sparkline. */ + argumentField?: string; + /** Sets a color for the bars indicating negative values. Available for a sparkline of the bar type only. */ + barNegativeColor?: string; + /** Sets a color for the bars indicating positive values. Available for a sparkline of the bar type only. */ + barPositiveColor?: string; + /** Specifies a data source for the sparkline. */ + dataSource?: any; + /** Sets a color for the boundary of both the first and last points on a sparkline. */ + firstLastColor?: string; + /** Specifies whether a sparkline ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Sets a color for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineColor?: string; + /** Specifies a width for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineWidth?: number; + /** Sets a color for the bars indicating the values that are less than the winloss threshold. Available for a sparkline of the winloss type only. */ + lossColor?: string; + /** Sets a color for the boundary of the maximum point on a sparkline. */ + maxColor?: string; + /** Sets a color for the boundary of the minimum point on a sparkline. */ + minColor?: string; + /** Sets a color for points on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointColor?: string; + /** Specifies the diameter of sparkline points in pixels. Available for the sparklines of line- and area-like types. */ + pointSize?: number; + /** Specifies a symbol to use as a point marker on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointSymbol?: string; + /** Specifies whether or not to indicate both the first and last values on a sparkline. */ + showFirstLast?: boolean; + /** Specifies whether or not to indicate both the minimum and maximum values on a sparkline. */ + showMinMax?: boolean; + /** Determines the type of a sparkline. */ + type?: string; + /** Specifies the data source field that provides values for a sparkline. */ + valueField?: string; + /** Sets a color for the bars indicating the values greater than a winloss threshold. Available for a sparkline of the winloss type only. */ + winColor?: string; + /** Specifies a value that serves as a threshold for the sparkline of the winloss type. */ + winlossThreshold?: number; + /** Specifies the minimum value of the sparkline value axis. */ + minValue?: number; + /** Specifies the maximum value of the sparkline's value axis. */ + maxValue?: number; + } + /** A sparkline widget. */ + export class dxSparkline extends BaseSparkline { + constructor(element: JQuery, options?: dxSparklineOptions); + constructor(element: Element, options?: dxSparklineOptions); + } +} +interface JQuery { + dxBullet(options?: DevExpress.viz.sparklines.dxBulletOptions): JQuery; + dxBullet(methodName: string, ...params: any[]): any; + dxBullet(methodName: "instance"): DevExpress.viz.sparklines.dxBullet; + dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery; + dxSparkline(methodName: string, ...params: any[]): any; + dxSparkline(methodName: "instance"): DevExpress.viz.sparklines.dxSparkline; +} diff --git a/devextreme/devextreme-16.1.6.d.ts b/devextreme/devextreme-16.1.6.d.ts new file mode 100644 index 0000000000..7e612e69d1 --- /dev/null +++ b/devextreme/devextreme-16.1.6.d.ts @@ -0,0 +1,8043 @@ +// Type definitions for DevExtreme 16.1.6 +// Project: http://js.devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module DevExpress { + /** Formats values. */ + export interface Format { + /** Specifies a predefined format. */ + type?: String; + /** Specifies the currency code for the 'currency' format. */ + currency?: String; + /** Specifies a precision for values of a numeric format. */ + precision?: number; + /** Parses string values into numeric or date-time values. */ + parser?: (value: any) => any; + /** Specifies a custom format. */ + formatter?: (value: any) => any; + } + /** A mixin that provides a capability to fire and subscribe to events. */ + export interface EventsMixin { + /** Subscribes to a specified event. */ + on(eventName: string, eventHandler: Function): T; + /** Subscribes to the specified events. */ + on(events: { [eventName: string]: Function; }): T; + /** Detaches all event handlers from the specified event. */ + off(eventName: string): Object; + /** Detaches a particular event handler from the specified event. */ + off(eventName: string, eventHandler: Function): T; + } + /** An object that serves as a namespace for the methods required to perform validation. */ + export module validationEngine { + export interface IValidator { + validate(): ValidatorValidationResult; + reset(): void; + } + export interface ValidatorValidationResult { + isValid: boolean; + name?: string; + value: any; + brokenRule: any; + validationRules: any[]; + } + export interface ValidationGroupValidationResult { + isValid: boolean; + brokenRules: any[]; + validators: IValidator[]; + } + export interface GroupConfig extends EventsMixin { + group: any; + validators: IValidator[]; + validate(): ValidationGroupValidationResult; + reset(): void; + } + /** Provides access to the object that represents the specified validation group. */ + export function getGroupConfig(group: any): GroupConfig + /** Provides access to the object that represents the default validation group. */ + export function getGroupConfig(): GroupConfig + /** Validates rules of the validators that belong to the specified validation group. */ + export function validateGroup(group: any): ValidationGroupValidationResult; + /** Validates rules of the validators that belong to the default validation group. */ + export function validateGroup(): ValidationGroupValidationResult; + /** Resets the values and validation result of the editors that belong to the specified validation group. */ + export function resetGroup(group: any): void; + /** Resets the values and validation result of the editors that belong to the default validation group. */ + export function resetGroup(): void; + /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ + export function validateModel(model: Object): ValidationGroupValidationResult; + /** Registers all the dxValidator objects extending fields of the specified ViewModel. */ + export function registerModelForValidation(model: Object): void; + /** Unregisters all the dxValidator objects extending fields of the specified ViewModel. */ + export function unregisterModelForValidation(model: Object): void; + } + export var hardwareBackButton: JQueryCallback; + /** Processes the hardware back button click. */ + export function processHardwareBackButton(): void; + /** Hides the last displayed overlay widget. */ + export function hideTopOverlay(): boolean; + /** + * Specifies whether or not the entire application/site supports right-to-left representation. + * @deprecated Use the config(config) method instead. + */ + export var rtlEnabled: boolean; + /** Gets the current global configuration object. */ + export function config(): Object; + /** Sets the global configuration object. */ + export function config(config: Object): void; + /** Registers a new component in the DevExpress.ui namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, componentClass: Object): void; + /** Registers a new component in the specified namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, namespace: Object, componentClass: Object): void; + export function requestAnimationFrame(callback: Function): number; + export function cancelAnimationFrame(requestID: number): void; + /** Custom Knockout binding that links an HTML element with a specific action. */ + export class Action { } + /** An object used to manage OData endpoints in your application. */ + export class EndpointSelector { + constructor(options: { + [key: string]: { + local?: string; + production?: string; + } + }); + /** Returns an endpoint for the specified key. */ + urlFor(key: string): string; + } + /** An object that serves as a namespace for the methods that are used to animate UI elements. */ + export module fx { + /** Defines animation options. */ + export interface AnimationOptions { + /** A function called after animation is completed. */ + complete?: (element: JQuery, config: AnimationOptions) => void; + /** A number specifying wait time before animation execution. */ + delay?: number; + /** A number specifying the time period to wait before the animation of the next stagger item starts. */ + staggerDelay?: number; + /** A number specifying the time in milliseconds spent on animation. */ + duration?: number; + /** A string specifying the type of an easing function used for animation. */ + easing?: string; + /** Specifies the initial animation state. */ + from?: any; + /** A function called before animation is started. */ + start?: (element: JQuery, config: AnimationOptions) => void; + /** Specifies a final animation state. */ + to?: any; + /** A string value specifying the animation type. */ + type?: string; + /** Specifies the animation direction for the "slideIn" and "slideOut" animation types. */ + direction?: string; + } + /** Animates the specified element. */ + export function animate(element: HTMLElement, config: AnimationOptions): Object; + /** Returns a value indicating whether the specified element is being animated. */ + export function isAnimating(element: HTMLElement): boolean; + /** Stops the animation. */ + export function stop(element: HTMLElement, jumpToEnd: boolean): void; + } + /** The manager that performs several specified animations at a time. */ + export class TransitionExecutor { + /** Deletes all the animations registered in the Transition Executor by using the enter(elements, animation) and leave(elements, animation) methods. */ + reset(): void; + /** Registers a set of elements that should be animated as "entering" using the specified animation configuration. */ + enter(elements: JQuery, animation: any): void; + /** Registers a set of elements that should be animated as "leaving" using the specified animation configuration. */ + leave(elements: JQuery, animation: any): void; + /** Starts all the animations registered using the enter(elements, animation) and leave(elements, animation) methods beforehand. */ + start(config: Object): JQueryPromise; + /** Stops all started animations. */ + stop(): void; + } + export class AnimationPresetCollection { + /** Resets all the changes made in the animation repository. */ + resetToDefaults(): void; + /** Deletes the specified animation or clears all the animation repository, if an animation name is not passed. */ + clear(name: string): void; + /** Adds the specified animation preset to the animation repository by the specified name. */ + registerPreset(name: string, config: any): void; + /** Applies the changes made in the animation repository. */ + applyChanges(): void; + /** Returns the configuration of the animation found in the animation repository by the specified name for the current device. */ + getPreset(name: string): void; + /** Registers predefined animations in the animation repository. */ + registerDefaultPresets(): void; + } + /** A repository of animations. */ + export var animationPresets: AnimationPresetCollection; + /** The device object defines the device on which the application is running. */ + export interface Device { + /** Indicates whether or not the device platform is Android. */ + android?: boolean; + /** Specifies the type of the device on which the application is running. */ + deviceType?: string; + /** Indicates whether or not the device platform is generic, which means that the application will look and behave according to a generic "light" or "dark" theme. */ + generic?: boolean; + /** Indicates whether or not the device platform is iOS. */ + ios?: boolean; + /** Indicates whether or not the device type is 'phone'. */ + phone?: boolean; + /** Specifies the platform of the device on which the application is running. */ + platform?: string; + /** Indicates whether or not the device type is 'tablet'. */ + tablet?: boolean; + /** Specifies an array with the major and minor versions of the device platform. */ + version?: Array; + /** Indicates whether or not the device platform is Windows. */ + win?: boolean; + /** Specifies a performance grade of the current device. */ + grade?: string; + } + export class Devices implements EventsMixin { + constructor(options: { window: Window }); + /** Overrides actual device information to force the application to operate as if it was running on a specified device. */ + current(deviceName: any): void; + /** Returns information about the current device. */ + current(): Device; + orientationChanged: JQueryCallback; + /** Returns the current device orientation. */ + orientation(): string; + /** Returns real information about the current device regardless of the value passed to the devices.current(deviceName) method. */ + real(): Device; + on(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + on(eventName: string, eventHandler: Function): Devices; + on(events: { [eventName: string]: Function; }): Devices; + off(eventName: "orientationChanged"): Devices; + off(eventName: string): Devices; + off(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + off(eventName: string, eventHandler: Function): Devices; + } + /** An object that serves as a namespace for the methods and events specifying information on the current device. */ + export var devices: Devices; + /** The position object specifies the widget positioning options. */ + export interface PositionOptions { + /** The target element position that the widget is positioned against. */ + at?: any; + /** The element within which the widget is positioned. */ + boundary?: Object; + /** Specifies the horizontal and vertical offset from the window's boundaries. */ + boundaryOffset?: any; + /** Specifies how to move the widget if it overflows the screen. */ + collision?: any; + /** The position of the widget to align against the target element. */ + my?: any; + /** The target element that the widget is positioned against. */ + of?: Object; + /** Specifies horizontal and vertical offset in pixels. */ + offset?: any; + } + export interface ComponentOptions { + /** A handler for the initialized event. */ + onInitialized?: Function; + /** A handler for the optionChanged event. */ + onOptionChanged?: Function; + /** A handler for the disposing event. */ + onDisposing?: Function; + } + /** A base class for all components and widgets. */ + export class Component { + constructor(options?: ComponentOptions) + /** Prevents the component from refreshing until the endUpdate() method is called. */ + beginUpdate(): void; + /** Enables the component to refresh after the beginUpdate() method call. */ + endUpdate(): void; + /** Returns an instance of this component class. */ + instance(): Component; + /** Returns the configuration options of this component. */ + option(): { + [optionKey: string]: any; + }; + /** Sets one or more options of this component. */ + option(options: { + [optionKey: string]: any; + }): void; + /** Gets the value of the specified configuration option of this component. */ + option(optionName: string): any; + /** Sets a value to the specified configuration option of this component. */ + option(optionName: string, optionValue: any): void; + } + export interface DOMComponentOptions extends ComponentOptions { + /** Specifies whether or not the current component supports a right-to-left representation. */ + rtlEnabled?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the width of the widget. */ + width?: any; + /** A bag for holding any options that require two-way binding (Angular approach specific) */ + bindingOptions?: { [key: string]: any; }; + } + /** A base class for all components. */ + export class DOMComponent extends Component { + constructor(element: JQuery, options?: DOMComponentOptions); + constructor(element: HTMLElement, options?: DOMComponentOptions); + /** Returns the root HTML element of the widget. */ + element(): JQuery; + /** Specifies the device-dependent default configuration options for this component. */ + static defaultOptions(rule: { + device?: any; + options?: any; + }): void; + } + export module data { + export interface ODataError extends Error { + httpStatus?: number; + errorDetails?: any; + } + export interface StoreOptions { + /** A handler for the modified event. */ + onModified?: () => void; + /** A handler for the modifying event. */ + onModifying?: () => void; + /** A handler for the removed event. */ + onRemoved?: (key: any) => void; + /** A handler for the removing event. */ + onRemoving?: (key: any) => void; + /** A handler for the updated event. */ + onUpdated?: (key: any, values: Object) => void; + /** A handler for the updating event. */ + onUpdating?: (key: any, values: Object) => void; + /** A handler for the loaded event. */ + onLoaded?: (result: Array) => void; + /** A handler for the loading event. */ + onLoading?: (loadOptions: LoadOptions) => void; + /** A handler for the inserted event. */ + onInserted?: (values: Object, key: any) => void; + /** A handler for the inserting event. */ + onInserting?: (values: Object) => void; + /** Specifies the function called when the Store causes an error. */ + errorHandler?: (e: Error) => void; + /** Specifies the key properties within the data associated with the Store. */ + key?: any; + } + export interface LoadOptions { + filter?: Object; + sort?: Object; + select?: Object; + expand?: Object; + group?: Object; + skip?: number; + take?: number; + userData?: Object; + requireTotalCount?: boolean; + } + /** The base class for all Stores. */ + export class Store implements EventsMixin { + constructor(options?: StoreOptions); + /** Returns the data item specified by the key. */ + byKey(key: any): JQueryPromise; + /** Adds an item to the data associated with this Store. */ + insert(values: Object): JQueryPromise; + /** Returns the key expression specified via the key configuration option. */ + key(): any; + /** Returns the key of the Store item that matches the specified object. */ + keyOf(obj: Object): any; + /** Starts loading data. */ + load(obj?: LoadOptions): JQueryPromise; + /** Removes the data item specified by the key. */ + remove(key: any): JQueryPromise; + /** Obtains the total count of items that will be returned by the load() function. */ + totalCount(options?: { + filter?: Object; + group?: Object; + }): JQueryPromise; + /** Updates the data item specified by the key. */ + update(key: any, values: Object): JQueryPromise; + on(eventName: "removing", eventHandler: (key: any) => void): Store; + on(eventName: "removed", eventHandler: (key: any) => void): Store; + on(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "inserting", eventHandler: (values: Object) => void): Store; + on(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + on(eventName: "modifying", eventHandler: () => void): Store; + on(eventName: "modified", eventHandler: () => void): Store; + on(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + on(eventName: "loaded", eventHandler: (result: Array) => void): Store; + on(eventName: string, eventHandler: Function): Store; + on(events: { [eventName: string]: Function; }): Store; + off(eventName: "removing"): Store; + off(eventName: "removed"): Store; + off(eventName: "updating"): Store; + off(eventName: "updated"): Store; + off(eventName: "inserting"): Store; + off(eventName: "inserted"): Store; + off(eventName: "modifying"): Store; + off(eventName: "modified"): Store; + off(eventName: "loading"): Store; + off(eventName: "loaded"): Store; + off(eventName: string): Store; + off(eventName: "removing", eventHandler: (key: any) => void): Store; + off(eventName: "removed", eventHandler: (key: any) => void): Store; + off(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "inserting", eventHandler: (values: Object) => void): Store; + off(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + off(eventName: "modifying", eventHandler: () => void): Store; + off(eventName: "modified", eventHandler: () => void): Store; + off(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + off(eventName: "loaded", eventHandler: (result: Array) => void): Store; + off(eventName: string, eventHandler: Function): Store; + } + export interface ArrayStoreOptions extends StoreOptions { + /** Specifies the array associated with this Store. */ + data?: Array; + } + /** A Store accessing an in-memory array. */ + export class ArrayStore extends Store { + constructor(options?: ArrayStoreOptions); + /** Clears all data associated with the current ArrayStore. */ + clear(): void; + /** Creates the Query object for the underlying array. */ + createQuery(): Query; + } + interface Promise { + then(doneFn?: Function, failFn?: Function, progressFn?: Function): Promise; + } + export interface CustomStoreOptions extends StoreOptions { + /** Specifies whether or not the store combines the search expression with the filter expression. */ + useDefaultSearch?: boolean; + /** The user implementation of the byKey(key, extraOptions) method. */ + byKey?: (key: any) => Promise; + /** The user implementation of the insert(values) method. */ + insert?: (values: Object) => Promise; + /** The user implementation of the load(options) method. */ + load?: (options?: LoadOptions) => Promise; + /** The user implementation of the remove(key) method. */ + remove?: (key: any) => Promise; + /** The user implementation of the totalCount(options) method. */ + totalCount?: (options?: { + filter?: Object; + group?: Object; + }) => Promise; + /** The user implementation of the update(key, values) method. */ + update?: (key: any, values: Object) => Promise; + } + /** A Store object that enables you to implement your own data access logic. */ + export class CustomStore extends Store { + constructor(options: CustomStoreOptions); + } + export interface DataSourceOptions { + /** Specifies data filtering conditions. */ + filter?: Object; + /** Specifies data grouping conditions. */ + group?: Object; + /** The item mapping function. */ + map?: (record: any) => any; + /** Specifies the maximum number of items the page can contain. */ + pageSize?: number; + /** Specifies whether a DataSource loads data by pages, or all items at once. */ + paginate?: boolean; + /** The data post processing function. */ + postProcess?: (data: any[]) => any[]; + /** Specifies a value by which the required items are searched. */ + searchExpr?: Object; + /** Specifies the comparison operation used to search for the required items. */ + searchOperation?: string; + /** Specifies the value to which the search expression is compared. */ + searchValue?: Object; + /** Specifies the initial select option value. */ + select?: Object; + /** An array of the strings that represent the names of the navigation properties to be loaded simultaneously with the OData store's entity. */ + expand?: Object; + /** The bag of custom parameters passed to the query executed when the DataSource load operation is invoked. */ + customQueryParams?: Object; + /** Specifies whether or not the DataSource instance requests the total count of items available in the storage. */ + requireTotalCount?: boolean; + /** Specifies the initial sort option value. */ + sort?: Object; + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Error) => void; + } + export interface OperationPromise extends JQueryPromise { + operationId: number; + } + /** An object that provides access to a data web service or local data storage for collection container widgets. */ + export class DataSource implements EventsMixin { + constructor(url: string); + constructor(data: Array); + constructor(options: CustomStoreOptions); + constructor(options: DataSourceOptions); + /** Disposes all resources associated with this DataSource. */ + dispose(): void; + /** Returns the current filter option value. */ + filter(): Object; + /** Sets the filter option value. */ + filter(filterExpr: Object): void; + /** Returns the current group option value. */ + group(): Object; + /** Sets the group option value. */ + group(groupExpr: Object): void; + /** Indicates whether or not the current page contains fewer items than the number of items specified by the pageSize configuration option. */ + isLastPage(): boolean; + /** Indicates whether or not at least one load() method execution has successfully finished. */ + isLoaded(): boolean; + /** Indicates whether or not the DataSource is currently being loaded. */ + isLoading(): boolean; + /** Returns the array of items currently operated by the DataSource. */ + items(): Array; + /** Returns the key expression. */ + key(): any; + /** Starts loading data. */ + load(): OperationPromise>; + /** Clears currently loaded DataSource items and calls the load() method. */ + reload(): OperationPromise>; + /** Returns an object that would be passed to the load() method of the underlying Store according to the current data shaping option values of the current DataSource instance. */ + loadOptions(): Object; + /** Returns the current pageSize option value. */ + pageSize(): number; + /** Sets the pageSize option value. */ + pageSize(value: number): void; + /** Specifies the index of the currently loaded page. */ + pageIndex(): number; + /** Specifies the index of the page to be loaded during the next load() method execution. */ + pageIndex(newIndex: number): void; + /** Returns the current paginate option value. */ + paginate(): boolean; + /** Sets the paginate option value. */ + paginate(value: boolean): void; + /** Returns the searchExpr option value. */ + searchExpr(): Object; + /** Sets the searchExpr option value. */ + searchExpr(...expr: Object[]): void; + /** Returns the currently specified search operation. */ + searchOperation(): string; + /** Sets the current search operation. */ + searchOperation(op: string): void; + /** Returns the searchValue option value. */ + searchValue(): Object; + /** Sets the searchValue option value. */ + searchValue(value: Object): void; + /** Returns the current select option value. */ + select(): Object; + /** Sets the select option value. */ + select(expr: Object): void; + /** Returns the current requireTotalCount option value. */ + requireTotalCount(): boolean; + /** Sets the requireTotalCount option value. */ + requireTotalCount(value: boolean): void; + /** Returns the current sort option value. */ + sort(): Object; + /** Sets the sort option value. */ + sort(sortExpr: Object): void; + /** Returns the underlying Store instance. */ + store(): Store; + /** Returns the number of data items available in an underlying Store after the last load() operation without paging. */ + totalCount(): number; + /** Cancels the load operation associated with the specified identifier. */ + cancel(operationId: number): boolean; + on(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + on(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + on(eventName: "changed", eventHandler: () => void): DataSource; + on(eventName: string, eventHandler: Function): DataSource; + on(events: { [eventName: string]: Function; }): DataSource; + off(eventName: "loadingChanged"): DataSource; + off(eventName: "loadError"): DataSource; + off(eventName: "changed"): DataSource; + off(eventName: string): DataSource; + off(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + off(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + off(eventName: "changed", eventHandler: () => void): DataSource; + off(eventName: string, eventHandler: Function): DataSource; + } + /** An object used to work with primitive data types not supported by JavaScript when accessing an OData web service. */ + export class EdmLiteral { + /** Creates an EdmLiteral instance and assigns the specified value to it. */ + constructor(value: string); + /** Returns a string representation of the value associated with this EdmLiteral object. */ + valueOf(): string; + } + /** An object used to generate and hold the GUID. */ + export class Guid { + /** Creates a new Guid instance that holds the specified GUID. */ + constructor(value: string); + /** Creates a new Guid instance holding the generated GUID. */ + constructor(); + /** Returns a string representation of the Guid instance. */ + toString(): string; + /** Returns a string representation of the Guid instance. */ + valueOf(): string; + } + export interface LocalStoreOptions extends ArrayStoreOptions { + /** Specifies the time (in miliseconds) after the change operation, before the data is flushed. */ + flushInterval?: number; + /** Specifies whether the data is flushed immediatelly after each change operation, or after the delay specified via the flushInterval option. */ + immediate?: boolean; + /** The unique identifier used to distinguish the data within the HTML5 Web Storage. */ + name?: string; + } + /** A Store providing access to the HTML5 Web Storage. */ + export class LocalStore extends ArrayStore { + constructor(options?: LocalStoreOptions); + /** Removes all data associated with this Store. */ + clear(): void; + } + export interface ODataContextOptions extends ODataStoreOptions { + /** Specifies the list of entities to be accessed via the ODataContext. */ + entities?: Object; + /** Specifies the function called if the ODataContext causes an error. */ + errorHandler?: (e: Error) => void; + } + /** Provides access to the entire OData service. */ + export class ODataContext { + constructor(options?: ODataContextOptions); + /** Initiates the specified WebGet service operation that returns a value. For the information on service operations, refer to the OData documentation. */ + get(operationName: string, params: Object): JQueryPromise; + /** Initiates the specified WebGet service operation that returns nothing. For the information on service operations, refer to the OData documentation. */ + invoke(operationName: string, params: Object, httpMethod: Object): JQueryPromise; + /** Return a special proxy object to describe the entity link. */ + objectLink(entityAlias: string, key: any): Object; + } + export interface ODataStoreOptions extends StoreOptions { + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: { + url: string; + async: boolean; + method: string; + timeout: number; + params: Object; + payload: Object; + headers: Object; + }) => void; + /** Specifies whether the ODataStore uses the JSONP approach to access non-CORS-compatible remote services. */ + jsonp?: boolean; + /** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, Boolean, Single, Decimal and Guid. */ + keyType?: any; + /** Specifies whether or not dates in a response are deserialized. */ + deserializeDates?: boolean; + /** Specifies the URL of the data service being accessed via the current ODataContext. */ + url?: string; + /** Specifies the version of the OData protocol used to interact with the data service. */ + version?: number; + /** Specifies the value of the withCredentials field of the underlying jqXHR object. */ + withCredentials?: boolean; + } + /** A Store providing access to a separate OData web service entity. */ + export class ODataStore extends Store { + constructor(options?: ODataStoreOptions); + /** Creates the Query object for the OData endpoint. */ + createQuery(loadOptions: Object): Object; + /** Returns the data item specified by the key. */ + byKey(key: any, extraOptions?: { expand?: Object }): JQueryPromise; + } + /** An universal chainable data query interface object. */ + export interface Query { + /** Calculates a custom summary for the items in the current Query. */ + aggregate(step: (accumulator: any, value: any) => any): JQueryPromise; + /** Calculates a custom summary for the items in the current Query. */ + aggregate(seed: any, step: (accumulator: any, value: any) => any, finalize: (result: any) => any): JQueryPromise; + /** Calculates the average item value for the current Query. */ + avg(getter: Object): JQueryPromise; + /** Finds the item with the maximum getter value. */ + max(getter: Object): JQueryPromise; + /** Finds the item with the maximum value in the Query. */ + max(): JQueryPromise; + /** Finds the item with the minimum value in the Query. */ + min(): JQueryPromise; + /** Finds the item with the minimum getter value. */ + min(getter: Object): JQueryPromise; + /** Calculates the average item value for the current Query, if each Query item has a numeric type. */ + avg(): JQueryPromise; + /** Returns the total count of items in the current Query. */ + count(): JQueryPromise; + /** Executes the Query. */ + enumerate(): JQueryPromise; + /** Filters the current Query data. */ + filter(criteria: Array): Query; + /** Filters the current Query data. */ + filter(predicate: (item: any) => boolean): Query; + /** Groups the current Query data. */ + groupBy(getter: Object): Query; + /** Applies the specified transformation to each item. */ + select(getter: Object): Query; + /** Limits the data item count. */ + slice(skip: number, take?: number): Query; + /** Sorts current Query data. */ + sortBy(getter: Object, desc: boolean): Query; + /** Sorts current Query data. */ + sortBy(getter: Object): Query; + /** Calculates the sum of item getter values in the current Query. */ + sum(getter: Object): JQueryPromise; + /** Calculates the sum of item values in the current Query. */ + sum(): JQueryPromise; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object): Query; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object, desc: boolean): Query; + /** Returns the array of current Query items. */ + toArray(): Array; + } + /** The global data layer error handler. */ + export var errorHandler: (e: Error) => void; + /** Encodes the specified string or array of bytes to base64 encoding. */ + export function base64_encode(input: any): string; + /** Creates a Query instance. */ + export function query(array: Array): Query; + /** Creates a Query instance for accessing the remote service specified by a URL. */ + export function query(url: string, queryOptions: Object): Query; + /** This section describes the utility objects provided by the DevExtreme data layer. */ + export var utils: { + /** Compiles a getter function from the getter expression. */ + compileGetter(expr: any): Function; + /** Compiles a setter function from the setter expression. */ + compileSetter(expr: any): Function; + odata: { + /** Holds key value converters for OData. */ + keyConverters: { + String(value: any): string; + Int32(value: any): number; + Int64(value: any): EdmLiteral; + Guid(value: any): Guid; + Boolean(value: any): boolean; + Single(value: any): EdmLiteral; + Decimal(value: any): EdmLiteral; + }; + } + } + } + /** An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications. */ + export module ui { + export interface WidgetOptions extends DOMComponentOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + /** Specifies whether or not the widget can be focused. */ + focusStateEnabled?: boolean; + /** Specifies a shortcut key that sets focus on the widget element. */ + accessKey?: string; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** Specifies the widget tab index. */ + tabIndex?: number; + /** Specifies the text of the hint displayed for the widget. */ + hint?: string; + } + /** The base class for widgets. */ + export class Widget extends DOMComponent { + constructor(options?: WidgetOptions); + /** Redraws the widget. */ + repaint(): void; + /** Sets focus on the widget. */ + focus(): void; + /** Registers a handler when a specified key is pressed. */ + registerKeyHandler(key: string, handler: Function): void; + } + export interface CollectionWidgetOptions extends WidgetOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** The time period in milliseconds before the onItemHold event is raised. */ + itemHoldTimeout?: number; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + loopItemFocus?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + onContentReady?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemContextMenu event. */ + onItemContextMenu?: Function; + /** A handler for the itemHold event. */ + onItemHold?: Function; + /** A handler for the itemRendered event. */ + onItemRendered?: Function; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** The index of the currently selected widget item. */ + selectedIndex?: number; + /** The selected item object. */ + selectedItem?: Object; + /** An array of currently selected item objects. */ + selectedItems?: Array; + /** A handler for the itemDeleting event. */ + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + } + /** The base class for widgets containing an item collection. */ + export class CollectionWidget extends Widget { + constructor(element: JQuery, options?: CollectionWidgetOptions); + constructor(element: HTMLElement, options?: CollectionWidgetOptions); + selectItem(itemElement: any): void; + unselectItem(itemElement: any): void; + deleteItem(itemElement: any): JQueryPromise; + isItemSelected(itemElement: any): boolean; + reorderItem(itemElement: any, toItemElement: any): JQueryPromise; + } + export interface DataExpressionMixinOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of a data source item field whose value is held in the value configuration option. */ + valueExpr?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** The currently selected value in the widget. */ + value?: Object; + } + export interface EditorOptions extends WidgetOptions { + /** The currently specified value. */ + value?: Object; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** A Boolean value specifying whether or not the widget is read-only. */ + readOnly?: boolean; + /** Holds the object that defines the error that occurred during validation. */ + validationError?: Object; + /** Specifies whether the editor's value is valid. */ + isValid?: boolean; + /** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ + validationMessageMode?: string; + } + /** A base class for editors. */ + export class Editor extends Widget { + /** Resets the editor's value to undefined. */ + reset(): void; + } + /** An object that serves as a namespace for methods displaying a message in an application/site. */ + export var dialog: { + /** Creates an alert dialog message containing a single "OK" button. */ + alert(message: string, title: string): JQueryPromise; + /** Creates a confirm dialog that contains "Yes" and "No" buttons. */ + confirm(message: string, title: string): JQueryPromise; + /** Creates a custom dialog using the options specified by the passed configuration object. */ + custom(options: { title?: string; message?: string; buttons?: Array; }): { + show(): JQueryPromise; + hide(): void; + hide(value: any): void; + }; + }; + /** Creates a toast message. */ + export function notify(message: any, type: string, displayTime: number): void; + /** Creates a toast message. */ + export function notify(options: Object): void; + /** An object that serves as a namespace for the methods that work with DevExtreme CSS Themes. */ + export var themes: { + /** Returns the name of the currently applied theme. */ + current(): string; + /** Changes the current theme to the specified one. */ + current(themeName: string): void; + }; + /** Sets a specified template engine. */ + export function setTemplateEngine(name: string): void; + /** Sets a custom template engine defined via custom compile and render functions. */ + export function setTemplateEngine(options: Object): void; + } + /** An object that serves as a namespace for utility methods that can be helpful when working with the DevExtreme framework and UI widgets. */ + export var utils: { + /** Sets parameters for the viewport meta tag. */ + initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + /** Requests that the browser call a specified function to update animation before the next repaint. */ + requestAnimationFrame(callback: Function): number; + /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ + cancelAnimationFrame(requestID: number): void; + }; + /** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */ + export module viz { + /** Applies a theme for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(theme: string): void; + /** Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(platform: string, colorScheme: string): void; + /** Registers a new theme based on the existing one. */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** Allows you to export widgets using their SVG markup. */ + export function exportFromMarkup(markup: string, options: Object): void; + /** Applies a predefined or registered custom palette to all visualization widgets at once. */ + export function currentPalette(paletteName: string): void; + /** Obtains the color sets of a predefined or registered palette. */ + export function getPalette(paletteName: string): Object; + /** Registers a new palette. */ + export function registerPalette(paletteName: string, palette: Object): void; + } +} +declare module DevExpress.ui { + export interface dxValidatorValidationAdapter { + /** A function that returns the value to be validated. */ + getValue?: Function; + /** The jQuery.Callbacks() object that is fired when the specified value should be validated. */ + validationRequestsCallbacks?: JQueryCallback; + /** A function that the dxValidator widget calls after validating a specified value. */ + applyValidationResults?: (params: validationEngine.ValidatorValidationResult) => void; + /** A function that resets the validated values. */ + reset?: Function; + /** A function that sets focus to the validated editors when the dxValidationSummary is focused. */ + focus?: Function; + /** A function that returns a Boolean value specifying whether or not to bypass validation. */ + bypass?: Function; + } + export interface dxValidatorOptions extends DOMComponentOptions { + /** An array of validation rules to be checked for the editor with which the dxValidator object is associated. */ + validationRules?: Array; + /** Specifies the editor name to be used in the validation default messages. */ + name?: string; + /** An object that specifies what and when to validate and how to apply the validation result. */ + adapter?: dxValidatorValidationAdapter; + /** Specifies the validation group the editor will be related to. */ + validationGroup?: string; + /** A handler for the validated event. */ + onValidated?: (params: validationEngine.ValidatorValidationResult) => void; + } + /** A widget that is used to validate the associated DevExtreme editors against the defined validation rules. */ + export class dxValidator extends DOMComponent implements validationEngine.IValidator { + constructor(element: JQuery, options?: dxValidatorOptions); + constructor(element: Element, options?: dxValidatorOptions); + /** Validates the value of the editor that is controlled by the current dxValidator object against the list of the specified validation rules. */ + validate(): validationEngine.ValidatorValidationResult; + /** Resets the value and validation result of the editor associated with the current dxValidator object. */ + reset(): void; + } + /** The widget that is used in the Knockout and Angular approaches to combine the editors to be validated. */ + export class dxValidationGroup extends DOMComponent { + constructor(element: JQuery); + constructor(element: Element); + /** Validates rules of the validators that belong to the current validation group. */ + validate(): validationEngine.ValidationGroupValidationResult; + /** Resets the value and validation result of the editors that are included to the current validation group. */ + reset(): void; + } + export interface dxValidationSummaryOptions extends CollectionWidgetOptions { + /** Specifies the validation group for which summary should be generated. */ + validationGroup?: string; + } + /** A widget for displaying the result of checking validation rules for editors. */ + export class dxValidationSummary extends CollectionWidget { + constructor(element: JQuery, options?: dxValidationSummaryOptions); + constructor(element: Element, options?: dxValidationSummaryOptions); + } + export interface dxResizableOptions extends DOMComponentOptions { + /** Specifies which borders of the widget element are used as a handle. */ + handles?: string; + /** Specifies the lower width boundary for resizing. */ + minWidth?: number; + /** Specifies the upper width boundary for resizing. */ + maxWidth?: number; + /** Specifies the lower height boundary for resizing. */ + minHeight?: number; + /** Specifies the upper height boundary for resizing. */ + maxHeight?: number; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + } + /** A widget that displays required content in a resizable element. */ + export class dxResizable extends DOMComponent { + constructor(element: JQuery, options?: dxResizableOptions); + constructor(element: Element, options?: dxResizableOptions); + } + export interface dxTooltipOptions extends dxPopoverOptions { + } + /** A tooltip widget. */ + export class dxTooltip extends dxPopover { + constructor(element: JQuery, options?: dxTooltipOptions); + constructor(element: Element, options?: dxTooltipOptions); + } + export interface dxDropDownListOptions extends dxDropDownEditorOptions, DataExpressionMixinOptions { + /** Returns the value currently displayed by the widget. */ + displayValue?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies whether or not the widget displays unfiltered values until a user types a number of characters exceeding the minSearchLength option value. */ + showDataBeforeSearch?: boolean; + /** Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */ + searchExpr?: any; + /** Specifies the binary operation used to filter data. */ + searchMode?: string; + /** Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed. */ + searchTimeout?: number; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget supports searching. */ + searchEnabled?: boolean; + /** + * Specifies whether or not the widget displays items by pages. + * @deprecated Use the DataSource paging opportunities instead. + */ + pagingEnabled?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** A handler for the itemClick event. */ + onItemClick?: Function; + onContentReady?: Function; + } + /** A base class for drop-down list widgets. */ + export class dxDropDownList extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDropDownListOptions); + constructor(element: Element, options?: dxDropDownListOptions); + } + export interface dxToolbarOptions extends CollectionWidgetOptions { + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** Informs the widget about its location in a view HTML markup. */ + renderAs?: string; + } + /** A toolbar widget. */ + export class dxToolbar extends CollectionWidget { + constructor(element: JQuery, options?: dxToolbarOptions); + constructor(element: Element, options?: dxToolbarOptions); + } + export interface dxToastOptions extends dxOverlayOptions { + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** The time span in milliseconds during which the dxToast widget is visible. */ + displayTime?: number; + height?: any; + /** The dxToast message text. */ + message?: string; + position?: PositionOptions; + shading?: boolean; + /** Specifies the dxToast widget type. */ + type?: string; + width?: any; + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user swipes it out of the screen boundaries. */ + closeOnSwipe?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user clicks it. */ + closeOnClick?: boolean; + } + /** The toast message widget. */ + export class dxToast extends dxOverlay { + constructor(element: JQuery, options?: dxToastOptions); + constructor(element: Element, options?: dxToastOptions); + } + export interface dxTextEditorOptions extends EditorOptions { + /** A handler for the change event. */ + onChange?: Function; + /** A handler for the copy event. */ + onCopy?: Function; + /** A handler for the cut event. */ + onCut?: Function; + /** A handler for the enterKey event. */ + onEnterKey?: Function; + /** A handler for the focusIn event. */ + onFocusIn?: Function; + /** A handler for the focusOut event. */ + onFocusOut?: Function; + /** A handler for the input event. */ + onInput?: Function; + /** A handler for the keyDown event. */ + onKeyDown?: Function; + /** A handler for the keyPress event. */ + onKeyPress?: Function; + /** A handler for the keyUp event. */ + onKeyUp?: Function; + /** A handler for the paste event. */ + onPaste?: Function; + /** The text displayed by the widget when the widget value is empty. */ + placeholder?: string; + /** Specifies whether to display the Clear button in the widget. */ + showClearButton?: boolean; + /** Specifies the current value displayed by the widget. */ + value?: any; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + /** Specifies HTML attributes applied to the inner input element of the widget. */ + attr?: Object; + /** The read-only option that holds the text displayed by the widget input element. */ + text?: string; + focusStateEnabled?: boolean; + hoverStateEnabled?: boolean; + /** The editor mask that specifies the format of the entered string. */ + mask?: string; + /** Specifies a mask placeholder character. */ + maskChar?: string; + /** Specifies custom mask rules. */ + maskRules?: Object; + /** A message displayed when the entered text does not match the specified pattern. */ + maskInvalidMessage?: string; + /** Specifies whether the value option holds only characters entered by a user or prompt characters as well. */ + useMaskedValue?: boolean; + } + /** A base class for text editing widgets. */ + export class dxTextEditor extends Editor { + constructor(element: JQuery, options?: dxTextEditorOptions); + constructor(element: Element, options?: dxTextEditorOptions); + /** Removes focus from the input element. */ + blur(): void; + /** Sets focus to the input element representing the widget. */ + focus(): void; + } + export interface dxTextBoxOptions extends dxTextEditorOptions { + /** Specifies the maximum number of characters you can enter into the textbox. */ + maxLength?: any; + /** The "mode" attribute value of the actual HTML input element representing the text box. */ + mode?: string; + } + /** A single-line text box widget. */ + export class dxTextBox extends dxTextEditor { + constructor(element: JQuery, options?: dxTextBoxOptions); + constructor(element: Element, options?: dxTextBoxOptions); + } + export interface dxTextAreaOptions extends dxTextBoxOptions { + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + /** Specifies the minimum height of the widget. */ + minHeight?: any; + /** Specifies the maximum height of the widget. */ + maxHeight?: any; + /** A Boolean value specifying whether or not the auto resizing mode is enabled. */ + autoResizeEnabled?: boolean; + } + /** A widget used to display and edit multi-line text. */ + export class dxTextArea extends dxTextBox { + constructor(element: JQuery, options?: dxTextAreaOptions); + constructor(element: Element, options?: dxTextAreaOptions); + } + export interface dxTabsOptions extends CollectionWidgetOptions { + /** Specifies whether the widget enables an end-user to select only a single item or multiple items. */ + selectionMode?: string; + /** Specifies whether or not an end-user can scroll tabs by swiping. */ + scrollByContent?: boolean; + /** Specifies whether or not an end-user can scroll tabs. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A tab strip used to switch between pages. */ + export class dxTabs extends CollectionWidget { + constructor(element: JQuery, options?: dxTabsOptions); + constructor(element: Element, options?: dxTabsOptions); + } + export interface dxTabPanelOptions extends dxMultiViewOptions { + /** A handler for the titleClick event. */ + onTitleClick?: any; + /** A handler for the titleHold event. */ + onTitleHold?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** A Boolean value specifying if tabs in the title are scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean indicating whether or not to add scrolling support for tabs in the title. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A widget used to display a view and to switch between several views by clicking the appropriate tabs. */ + export class dxTabPanel extends dxMultiView { + constructor(element: JQuery, options?: dxTabPanelOptions); + constructor(element: Element, options?: dxTabPanelOptions); + } + export interface dxSelectBoxOptions extends dxDropDownListOptions { + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + /** The text that is provided as a hint in the select box editor. */ + placeholder?: string; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + acceptCustomValue?: boolean; + /** Specifies whether or not to display selection controls. */ + showSelectionControls?: boolean; + /** A handler for the customItemCreating event. */ + onCustomItemCreating?: Function; + } + /** A widget that allows you to select an item in a dropdown list. */ + export class dxSelectBox extends dxDropDownList { + constructor(element: JQuery, options?: dxSelectBoxOptions); + constructor(element: Element, options?: dxSelectBoxOptions); + } + export interface dxTagBoxOptions extends dxSelectBoxOptions { + values?: Array; + /** Specifies the selected items. */ + value?: Array; + /** Gets the currently selected items. */ + selectedItems?: Array; + /** Specifies how the widget applies values. */ + applyValueMode?: string; + /** A Boolean value specifying whether or not to hide selected items. */ + hideSelectedItems?: boolean; + /** A handler for the selectAllValueChanged event. */ + onSelectAllValueChanged?: Function; + /** A Boolean value specifying whether or not the widget is multiline. */ + multiline?: boolean; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** The template to be used for rendering tags. */ + tagTemplate?: any; + } + /** A widget that allows you to select multiple items from a dropdown list. */ + export class dxTagBox extends dxSelectBox { + constructor(element: JQuery, options?: dxTagBoxOptions); + constructor(element: Element, options?: dxTagBoxOptions); + } + export interface dxScrollViewOptions extends dxScrollableOptions { + /** A handler for the pullDown event. */ + onPullDown?: Function; + /** Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the reachBottom event. */ + onReachBottom?: Function; + /** Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom. */ + reachBottomText?: string; + /** Specifies the text shown in the pullDown panel displayed when the content is being refreshed. */ + refreshingText?: string; + } + /** A widget used to display scrollable content. */ + export class dxScrollView extends dxScrollable { + constructor(element: JQuery, options?: dxScrollViewOptions); + constructor(element: Element, options?: dxScrollViewOptions); + /** Returns a value indicating if the scrollView content is larger then the widget container. */ + isFull(): boolean; + /** Locks the widget until the release(preventScrollBottom) method is called and executes the function passed to the onPullDown option and the handler assigned to the pullDown event. */ + refresh(): void; + /** Notifies the scroll view that data loading is finished. */ + release(preventScrollBottom: boolean): JQueryPromise; + /** Toggles the loading state of the widget. */ + toggleLoading(showOrHide: boolean): void; + } + export interface dxScrollableLocation { + top?: number; + left?: number; + } + export interface dxScrollableOptions extends DOMComponentOptions { + /** A string value specifying the available scrolling directions. */ + direction?: string; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A handler for the scroll event. */ + onScroll?: Function; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** A handler for the update event. */ + onUpdated?: Function; + /** Indicates whether to use native or simulated scrolling. */ + useNative?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content swiping it up or down. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content using the scrollbar. */ + scrollByThumb?: boolean; + } + /** A widget used to display scrollable content. */ + export class dxScrollable extends DOMComponent { + constructor(element: JQuery, options?: dxScrollableOptions); + constructor(element: Element, options?: dxScrollableOptions); + /** Returns the height of the scrollable widget in pixels. */ + clientHeight(): number; + /** Returns the width of the scrollable widget in pixels. */ + clientWidth(): number; + /** Returns an HTML element of the widget. */ + content(): JQuery; + /** Scrolls the widget content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Scrolls widget content by the specified number of pixels in horizontal and vertical directions. */ + scrollBy(distanceObject: dxScrollableLocation): void; + /** Returns the height of the scrollable content in pixels. */ + scrollHeight(): number; + /** Returns the current scroll position against the leftmost position. */ + scrollLeft(): number; + /** Returns how far the scrollable content is scrolled from the top and from the left. */ + scrollOffset(): dxScrollableLocation; + /** Scrolls widget content to the specified position. */ + scrollTo(targetLocation: number): void; + /** Scrolls widget content to a specified position. */ + scrollTo(targetLocation: dxScrollableLocation): void; + /** Scrolls widget content to the specified element. */ + scrollToElement(element: Element): void; + /** Returns the current scroll position against the topmost position. */ + scrollTop(): number; + /** Returns the width of the scrollable content in pixels. */ + scrollWidth(): number; + /** Updates the dimensions of the scrollable contents. */ + update(): void; + } + export interface dxRadioGroupOptions extends EditorOptions, DataExpressionMixinOptions { + activeStateEnabled?: boolean; + /** Specifies the radio group layout. */ + layout?: string; + } + /** A widget that enables a user to select one item within a list of items represented by radio buttons. */ + export class dxRadioGroup extends CollectionWidget { + constructor(element: JQuery, options?: dxRadioGroupOptions); + constructor(element: Element, options?: dxRadioGroupOptions); + } + export interface dxPopupToolbarItemOptions { + /** Specifies whether or not a toolbar item must be displayed disabled. */ + disabled?: boolean; + /** Specifies html code inserted into the toolbar item element. */ + html?: string; + /** Specifies a location for the item on the toolbar. */ + location?: string; + /** Specifies a configuration object for the widget that presents a toolbar item. */ + options?: Object; + /** Specifies an item template that should be used to render this item only. */ + template?: any; + /** Specifies text displayed for the toolbar item. */ + text?: string; + /** Specifies whether the item is displayed on a top or bottom toolbar. */ + toolbar?: string; + /** Specifies whether or not a widget item must be displayed. */ + visible?: boolean; + /** A widget that presents a toolbar item. */ + widget?: string; + } + export interface dxPopupOptions extends dxOverlayOptions { + /** Specifies whether or not to allow a user to drag the popup window. */ + dragEnabled?: boolean; + /** Specifies whether or not an end user can resize the widget. */ + resizeEnabled?: boolean; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + /** A Boolean value specifying whether or not to display the widget in full-screen mode. */ + fullScreen?: boolean; + position?: PositionOptions; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showTitle?: boolean; + /** The title in the overlay window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + width?: any; + /** Specifies items displayed on the top or bottom toolbar of the popup window. */ + toolbarItems?: Array; + /** Specifies whether or not the widget displays the Close button. */ + showCloseButton?: boolean; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + } + /** A widget that displays required content in a popup window. */ + export class dxPopup extends dxOverlay { + constructor(element: JQuery, options?: dxPopupOptions); + constructor(element: Element, options?: dxPopupOptions); + } + export interface dxPopoverOptions extends dxPopupOptions { + /** An object defining the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** Specifies the height of the widget. */ + height?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + shading?: boolean; + /** A Boolean value specifying whether or not to display the title in the overlay window. */ + showTitle?: boolean; + /** The target element associated with a popover. */ + target?: any; + /** Specifies the width of the widget. */ + width?: any; + } + /** A widget that displays the required content in a popup window. */ + export class dxPopover extends dxPopup { + constructor(element: JQuery, options?: dxPopoverOptions); + constructor(element: Element, options?: dxPopoverOptions); + /** Displays the widget for the specified target element. */ + show(target?: any): JQueryPromise; + } + export interface dxOverlayOptions extends WidgetOptions { + /** An object defining the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** A Boolean value specifying whether or not the widget is closed if a user presses the Back hardware button. */ + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlapping window. */ + closeOnOutsideClick?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + /** Specifies whether or not an end-user can drag the widget. */ + dragEnabled?: boolean; + /** The height of the widget in pixels. */ + height?: any; + /** Specifies the maximum height the widget can reach while resizing. */ + maxHeight?: any; + /** Specifies the maximum width the widget can reach while resizing. */ + maxWidth?: any; + /** Specifies the minimum height the widget can reach while resizing. */ + minHeight?: any; + /** Specifies the minimum width the widget can reach while resizing. */ + minWidth?: any; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** A Boolean value specifying whether or not the main screen is inactive while the widget is active. */ + shading?: boolean; + /** Specifies the shading color. */ + shadingColor?: string; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + onContentReady?: Function; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** The widget width in pixels. */ + width?: any; + } + /** A widget displaying the required content in an overlay window. */ + export class dxOverlay extends Widget { + constructor(element: JQuery, options?: dxOverlayOptions); + constructor(element: Element, options?: dxOverlayOptions); + /** An HTML element of the widget. */ + content(): JQuery; + /** Hides the widget. */ + hide(): JQueryPromise; + /** Recalculates the overlay's size and position. */ + repaint(): void; + /** Shows the widget. */ + show(): JQueryPromise; + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** A static method that specifies the base z-index for all overlay widgets. */ + static baseZIndex(zIndex: number): void; + } + export interface dxNumberBoxOptions extends dxTextEditorOptions { + /** The maximum value accepted by the number box. */ + max?: number; + /** The minimum value accepted by the number box. */ + min?: number; + /** Specifies whether or not to show spin buttons. */ + showSpinButtons?: boolean; + useTouchSpinButtons?: boolean; + /** Specifies by which value the widget value changes when a spin button is clicked. */ + step?: number; + /** The current number box value. */ + value?: number; + /** The "mode" attribute value of the actual HTML input element representing the widget. */ + mode?: string; + /** Specifies the text of the message displayed if the specified value is not a number. */ + invalidValueMessage?: string; + } + /** A textbox widget that enables a user to enter numeric values. */ + export class dxNumberBox extends dxTextEditor { + constructor(element: JQuery, options?: dxNumberBoxOptions); + constructor(element: Element, options?: dxNumberBoxOptions); + } + export interface dxNavBarOptions extends dxTabsOptions { + scrollingEnabled?: boolean; + } + /** A widget that contains items used to navigate through application views. */ + export class dxNavBar extends dxTabs { + constructor(element: JQuery, options?: dxNavBarOptions); + constructor(element: Element, options?: dxNavBarOptions); + } + export interface dxMultiViewOptions extends CollectionWidgetOptions { + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently displayed item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to change the selected index by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget used to display a view and to switch between several views. */ + export class dxMultiView extends CollectionWidget { + constructor(element: JQuery, options?: dxMultiViewOptions); + constructor(element: Element, options?: dxMultiViewOptions); + } + export interface dxMapLocation { + /** The latitude location of the widget. */ + lat?: number; + /** The longitude location of the widget. */ + lng?: number; + } + export interface dxMapMarker { + /** A URL pointing to the custom icon to be used for the marker. */ + iconSrc?: string; + /** Specifies the marker location. */ + location?: dxMapLocation; + /** A callback function performed when the marker is clicked. */ + onClick?: Function; + /** A tooltip to be used for the marker. */ + tooltip?: { + /** Specifies whether a tooltip is visible by default or not. */ + isShown?: boolean; + /** Specifies the tooltip text. */ + text?: string; + } + } + export interface dxMapRoute { + /** Specifies the color of the line displaying the route. */ + color?: string; + /** Specifies a transportation mode to be used in the displayed route. */ + mode?: string; + /** Specifies the opacity of the line displaying the route. */ + opacity?: number; + /** Contains an array of objects making up the route. */ + locations?: Array; + /** Specifies the thickness of the line displaying the route in pixels. */ + weight?: number; + } + export interface dxMapOptions extends WidgetOptions { + /** Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route, or when creating a widget if it initially contains markers or routes. */ + autoAdjust?: boolean; + center?: dxMapLocation; + /** A handler for the click event. */ + onClick?: any; + /** Specifies whether or not map widget controls are available. */ + controls?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** A key used to authenticate the application within the required map provider. */ + key?: { + /** A key used to authenticate the application within the "Bing" map provider. */ + bing?: string; + /** A key used to authenticate the application within the "Google" map provider. */ + google?: string; + /** A key used to authenticate the application within the "Google Static" map provider. */ + googleStatic?: string; + } + /** A handler for the markerAdded event. */ + onMarkerAdded?: Function; + /** A URL pointing to the custom icon to be used for map markers. */ + markerIconSrc?: string; + /** A handler for the markerRemoved event. */ + onMarkerRemoved?: Function; + /** An array of markers displayed on a map. */ + markers?: Array; + /** The name of the current map data provider. */ + provider?: string; + /** A handler for the ready event. */ + onReady?: Function; + /** A handler for the routeAdded event. */ + onRouteAdded?: Function; + /** A handler for the routeRemoved event. */ + onRouteRemoved?: Function; + /** An array of routes shown on the map. */ + routes?: Array; + /** The type of a map to display. */ + type?: string; + /** Specifies the width of the widget. */ + width?: any; + /** The zoom level of the map. */ + zoom?: number; + } + /** An interactive map widget. */ + export class dxMap extends Widget { + constructor(element: JQuery, options?: dxMapOptions); + constructor(element: Element, options?: dxMapOptions); + /** Adds a marker to the map. */ + addMarker(markerOptions: Object): JQueryPromise; + /** Adds a route to the map. */ + addRoute(routeOptions: Object): JQueryPromise; + /** Removes a marker from the map. */ + removeMarker(marker: Object): JQueryPromise; + /** Removes a route from the map. */ + removeRoute(route: any): JQueryPromise; + } + export interface dxLookupOptions extends dxDropDownListOptions { + applyValueMode?: string; + /** An object that defines widget animation options. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + /** The text displayed on the Clear button. */ + clearButtonText?: string; + /** Specifies whether or not the widget cleans the search box when the popup window is displayed. */ + cleanSearchOnOpening?: boolean; + /** A Boolean value specifying whether or not a widget is closed if a user clicks outside of the overlaying window. */ + closeOnOutsideClick?: any; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** A Boolean value specifying whether or not to display the lookup in full-screen mode. */ + fullScreen?: boolean; + focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not to group widget items. */ + grouped?: boolean; + /** The name of the template used to display a group header. */ + groupTemplate?: any; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies the text shown in the pullDown panel, which is displayed when the widget is scrolled to the bottom. */ + pageLoadingText?: string; + /** The text displayed by the widget when nothing is selected. */ + placeholder?: string; + /** The height of the widget popup element. */ + popupHeight?: any; + /** The width of the widget popup element. */ + popupWidth?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the text displayed in the pullDown panel when the widget is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the widget is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + /** A Boolean value specifying whether or not the search bar is visible. */ + searchEnabled?: boolean; + /** The text that is provided as a hint in the lookup's search bar. */ + searchPlaceholder?: string; + /** A Boolean value specifying whether or not the main screen is inactive while the lookup is active. */ + shading?: boolean; + /** Specifies whether to display the Cancel button in the lookup window. */ + showCancelButton?: boolean; + /** + * A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. + * @deprecated Use the pageLoadMode option instead. + */ + showNextButton?: boolean; + /** The title of the lookup window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** Specifies whether or not to show lookup contents in a dxPopover widget. */ + usePopover?: boolean; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showPopupTitle?: boolean; + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + } + /** A widget that allows a user to select predefined values from a lookup window. */ + export class dxLookup extends dxDropDownList { + constructor(element: JQuery, options?: dxLookupOptions); + constructor(element: Element, options?: dxLookupOptions); + } + export interface dxLoadPanelOptions extends dxOverlayOptions { + /** An object defining the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** The delay in milliseconds after which the load panel is displayed. */ + delay?: number; + /** The height of the widget. */ + height?: number; + /** A URL pointing to an image to be used as a load indicator. */ + indicatorSrc?: string; + /** The text displayed in the load panel. */ + message?: string; + /** A Boolean value specifying whether or not to show a load indicator. */ + showIndicator?: boolean; + /** A Boolean value specifying whether or not to show the pane behind the load indicator. */ + showPane?: boolean; + /** The width of the widget. */ + width?: number; + /** Specifies whether or not the widget can be focused. */ + focusStateEnabled?: boolean; + } + /** A widget used to indicate whether or not an element is loading. */ + export class dxLoadPanel extends dxOverlay { + constructor(element: JQuery, options?: dxLoadPanelOptions); + constructor(element: Element, options?: dxLoadPanelOptions); + } + export interface dxLoadIndicatorOptions extends WidgetOptions { + /** Specifies the path to an image used as the indicator. */ + indicatorSrc?: string; + } + /** The widget used to indicate the loading process. */ + export class dxLoadIndicator extends Widget { + constructor(element: JQuery, options?: dxLoadIndicatorOptions); + constructor(element: Element, options?: dxLoadIndicatorOptions); + } + export interface ListOptionsMenuItem { + /** Specifies the menu item text. */ + text?: string; + /** Holds on a function called when the item is clicked. */ + action?: (itemElement: Element, itemData: any) => void; + } + export interface dxListOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not to display a grouped list. */ + grouped?: boolean; + /** The template to be used for rendering item groups. */ + groupTemplate?: any; + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the groupRendered event. */ + onGroupRendered?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemSwipe event. */ + onItemSwipe?: Function; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies the text shown in the pullDown panel, which is displayed when the list is scrolled to the bottom. */ + pageLoadingText?: string; + /** Specifies the text displayed in the pullDown panel when the list is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the list is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + /** A Boolean value specifying whether to enable or disable list scrolling. */ + scrollingEnabled?: boolean; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying if the list is scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value specifying if the list is scrolled using the scrollbar. */ + scrollByThumb?: boolean; + onItemContextMenu?: Function; + onItemHold?: Function; + /** Specifies whether or not an end-user can collapse groups. */ + collapsibleGroups?: boolean; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies whether or not to display controls used to select list items. */ + showSelectionControls?: boolean; + /** Specifies item selection mode. */ + selectionMode?: string; + selectAllText?: string; + /** A handler for the selectAllValueChanged event. */ + onSelectAllValueChanged?: Function; + /** Specifies the array of items for a context menu called for a list item. */ + menuItems?: Array; + /** Specifies whether an item context menu is shown when a user holds or swipes an item. */ + menuMode?: string; + /** Specifies whether or not an end user can delete list items. */ + allowItemDeleting?: boolean; + /** Specifies the way a user can delete items from the list. */ + itemDeleteMode?: string; + /** Specifies whether or not an end user can reorder list items. */ + allowItemReordering?: boolean; + /** Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ + indicateLoading?: boolean; + activeStateEnabled?: boolean; + } + /** A list widget. */ + export class dxList extends CollectionWidget { + constructor(element: JQuery, options?: dxListOptions); + constructor(element: Element, options?: dxListOptions); + /** Returns the height of the widget in pixels. */ + clientHeight(): number; + /** Removes the specified item from the list. */ + deleteItem(itemIndex: any): JQueryPromise; + /** Removes the specified item from the list. */ + deleteItem(itemElement: Element): JQueryPromise; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemIndex: any): boolean; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemElement: Element): boolean; + /** Reloads list data. */ + reload(): void; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemElement: Element, toItemElement: Element): JQueryPromise; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemIndex: any, toItemIndex: any): JQueryPromise; + /** Scrolls the list content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Returns the height of the list content in pixels. */ + scrollHeight(): number; + /** Scrolls list content to the specified position. */ + scrollTo(location: number): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemElement: Element): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemIndex: any): void; + /** Returns how far the list content is scrolled from the top. */ + scrollTop(): number; + /** Selects the specified item from the list. */ + selectItem(itemElement: Element): void; + /** Selects the specified item from the list. */ + selectItem(itemIndex: any): void; + /** Deselects the specified item from the list. */ + unselectItem(itemElement: Element): void; + /** Unselects the specified item from the list. */ + unselectItem(itemIndex: any): void; + /** Updates the widget scrollbar according to widget content size. */ + updateDimensions(): JQueryPromise; + /** Expands the specified group. */ + expandGroup(groupIndex: number): JQueryPromise; + /** Collapses the specified group. */ + collapseGroup(groupIndex: number): JQueryPromise; + } + export interface dxGalleryOptions extends CollectionWidgetOptions { + /** The time, in milliseconds, spent on slide animation. */ + animationDuration?: number; + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to allow users to switch between items by clicking an indicator. */ + indicatorEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently active gallery item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to display an indicator that points to the selected gallery item. */ + showIndicator?: boolean; + /** A Boolean value that specifies the availability of the "Forward" and "Back" navigation buttons. */ + showNavButtons?: boolean; + /** The time interval in milliseconds, after which the gallery switches to the next item. */ + slideshowDelay?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether or not to display parts of previous and next images along the sides of the current image. */ + wrapAround?: boolean; + /** Specifies if the widget stretches images to fit the total gallery width. */ + stretchImages?: boolean; + /** Specifies the width of an area used to display a single image. */ + initialItemWidth?: number; + } + /** An image gallery widget. */ + export class dxGallery extends CollectionWidget { + constructor(element: JQuery, options?: dxGalleryOptions); + constructor(element: Element, options?: dxGalleryOptions); + /** Shows the specified gallery item. */ + goToItem(itemIndex: number, animation: boolean): JQueryPromise; + /** Shows the next gallery item. */ + nextItem(animation: boolean): JQueryPromise; + /** Shows the previous gallery item. */ + prevItem(animation: boolean): JQueryPromise; + } + export interface dxDropDownEditorOptions extends dxTextBoxOptions { + /** Specifies the current value displayed by the widget. */ + value?: Object; + /** A handler for the closed event. */ + onClosed?: Function; + /** A handler for the opened event. */ + onOpened?: Function; + /** Specifies whether or not the drop-down editor is displayed. */ + opened?: boolean; + fieldEditEnabled?: boolean; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + acceptCustomValue?: boolean; + /** Specifies the way an end-user applies the selected value. */ + applyValueMode?: string; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + activeStateEnabled?: boolean; + } + /** A drop-down editor widget. */ + export class dxDropDownEditor extends dxTextBox { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Closes the drop-down editor. */ + close(): void; + /** Opens the drop-down editor. */ + open(): void; + /** Resets the widget's value to null. */ + reset(): void; + /** Returns an <input> element of the widget. */ + field(): JQuery; + /** Returns an HTML element of the popup window content. */ + content(): JQuery; + } + export interface dxDateBoxOptions extends dxTextEditorOptions { + formatString?: any; + /** Specifies the date display format. Applies only if the pickerType option is 'native' */ + displayFormat?: any; + format?: string; + /** A format used to display date/time information. */ + type?: string; + /** The last date that can be selected within the widget. */ + max?: any; + /** The minimum date that can be selected within the widget. */ + min?: any; + /** The text displayed by the widget when the widget value is not yet specified. This text is also used as a title of the date picker. */ + placeholder?: string; + /** + * Specifies whether or not a user can pick out a date using the drop-down calendar. + * @deprecated Use the pickerType option instead. + */ + useCalendar?: boolean; + /** An object or a value, specifying the date and time currently selected using the date box. */ + value?: any; + /** + * Specifies whether or not the widget uses the native HTML input element. + * @deprecated Use the pickerType option instead. + */ + useNative?: boolean; + /** Specifies the interval between neighboring values in the popup list in minutes. */ + interval?: number; + /** Specifies the maximum zoom level of a calendar, which is used to pick the date. */ + maxZoomLevel?: string; + /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ + minZoomLevel?: string; + /** Specifies the type of date/time picker. */ + pickerType?: string; + /** Specifies the message displayed if the typed value is not a valid date or time. */ + invalidDateMessage?: string; + /** Specifies the message displayed if the specified date is later than the max value or earlier than the min value. */ + dateOutOfRangeMessage?: string; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** Specifies whether or not adaptive widget rendering is enabled on a small screen. */ + adaptivityEnabled?: boolean; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + } + /** A date box widget. */ + export class dxDateBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDateBoxOptions); + constructor(element: Element, options?: dxDateBoxOptions); + } + export interface dxCheckBoxOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Specifies the widget state. */ + value?: boolean; + /** Specifies the text displayed by the check box. */ + text?: string; + } + /** A check box widget. */ + export class dxCheckBox extends Editor { + constructor(element: JQuery, options?: dxCheckBoxOptions); + constructor(element: Element, options?: dxCheckBoxOptions); + } + export interface dxCalendarOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Specifies a date displayed on the current calendar page. */ + currentDate?: Date; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** An object or a value, specifying the date and time currently selected in the calendar. */ + value?: any; + /** The latest date the widget allows to select. */ + max?: any; + /** The earliest date the widget allows to select. */ + min?: any; + /** Specifies whether or not the widget displays a button that selects the current date. */ + showTodayButton?: boolean; + /** Specifies the current calendar zoom level. */ + zoomLevel?: string; + /** Specifies the maximum zoom level of the calendar. */ + maxZoomLevel?: string; + /** Specifies the minimum zoom level of the calendar. */ + minZoomLevel?: string; + /** The template to be used for rendering calendar cells. */ + cellTemplate?: any; + } + /** A calendar widget. */ + export class dxCalendar extends Editor { + constructor(element: JQuery, options?: dxCalendarOptions); + constructor(element: Element, options?: dxCalendarOptions); + } + export interface dxButtonOptions extends WidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A handler for the click event. */ + onClick?: any; + /** Specifies the icon to be displayed on the button. */ + icon?: string; + iconSrc?: string; + /** A template to be used for rendering the dxButton widget. */ + template?: any; + /** The text displayed on the button. */ + text?: string; + /** Specifies the button type. */ + type?: string; + /** Specifies the name of the validation group to be accessed in the click event handler. */ + validationGroup?: string; + } + /** A button widget. */ + export class dxButton extends Widget { + constructor(element: JQuery, options?: dxButtonOptions); + constructor(element: Element, options?: dxButtonOptions); + } + export interface dxBoxOptions extends CollectionWidgetOptions { + /** Specifies how widget items are aligned along the main direction. */ + align?: string; + /** Specifies the direction of item positioning in the widget. */ + direction?: string; + /** Specifies how widget items are aligned cross-wise. */ + crossAlign?: string; + } + /** A container widget used to arrange inner elements. */ + export class dxBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxResponsiveBoxOptions extends CollectionWidgetOptions { + /** Specifies the collection of rows for the grid used to position layout elements. */ + rows?: Array; + /** Specifies the collection of columns for the grid used to position layout elements. */ + cols?: Array; + /** Specifies the function returning the screen factor depending on the screen width. */ + screenByWidth?: (width: number) => string; + /** Specifies the screen factor with which all elements are located in a single column. */ + singleColumnScreen?: string; + } + /** A widget used to build an adaptive markup that is dependent on screen resolution. */ + export class dxResponsiveBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxAutocompleteOptions extends dxDropDownListOptions { + /** Specifies the current value displayed by the widget. */ + value?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies the maximum count of items displayed by the widget. */ + maxItemCount?: number; + /** Gets the currently selected item. */ + selectedItem?: Object; + } + /** A textbox widget that supports autocompletion. */ + export class dxAutocomplete extends dxDropDownList { + constructor(element: JQuery, options?: dxAutocompleteOptions); + constructor(element: Element, options?: dxAutocompleteOptions); + /** Opens the drop-down editor. */ + open(): void; + /** Closes the drop-down editor. */ + close(): void; + } + export interface dxAccordionOptions extends CollectionWidgetOptions { + /** A number specifying the time in milliseconds spent on the animation of the expanding or collapsing of a panel. */ + animationDuration?: number; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies whether all items can be collapsed or whether at least one item must always be expanded. */ + collapsible?: boolean; + /** Specifies whether the widget can expand several items or only a single item at once. */ + multiple?: boolean; + /** The template to be used for rendering dxAccordion items. */ + itemTemplate?: any; + /** A handler for the itemTitleClick event. */ + onItemTitleClick?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** The index number of the currently selected item. */ + selectedIndex?: number; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget that displays data source items on collapsible panels. */ + export class dxAccordion extends CollectionWidget { + constructor(element: JQuery, options?: dxAccordionOptions); + constructor(element: Element, options?: dxAccordionOptions); + /** Collapses the specified item. */ + collapseItem(index: number): JQueryPromise; + /** Expands the specified item. */ + expandItem(index: number): JQueryPromise; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + } + export interface dxFileUploaderOptions extends EditorOptions { + /** A read-only option that holds a File instance representing the selected file. */ + value?: Array; + values?: Array; + buttonText?: string; + /** The text displayed on the button that opens the file browser. */ + selectButtonText?: string; + /** The text displayed on the button that starts uploading. */ + uploadButtonText?: string; + /** Specifies the text displayed on the area to which an end-user can drop a file. */ + labelText?: string; + /** Specifies the value passed to the name attribute of the underlying input element. */ + name?: string; + /** Specifies whether the widget enables an end-user to select a single file or multiple files. */ + multiple?: boolean; + /** Specifies a file type or several types accepted by the widget. */ + accept?: string; + /** Specifies a target Url for the upload request. */ + uploadUrl?: string; + /** Specifies if an end user can remove a file from the selection and interrupt uploading. */ + allowCanceling?: boolean; + /** Specifies whether or not the widget displays the list of selected files. */ + showFileList?: boolean; + /** Gets the current progress in percentages. */ + progress?: number; + /** The message displayed by the widget when it is ready to upload the specified files. */ + readyToUploadMessage?: string; + /** The message displayed by the widget when uploading is finished. */ + uploadedMessage?: string; + /** The message displayed by the widget on uploading failure. */ + uploadFailedMessage?: string; + /** Specifies how the widget uploads files. */ + uploadMode?: string; + /** Specifies the method for the upload request. */ + uploadMethod?: string; + /** Specifies headers for the upload request. */ + uploadHeaders?: Object; + /** A handler for the uploadStarted event. */ + onUploadStarted?: Function; + /** A handler for the uploaded event. */ + onUploaded?: Function; + /** A handler for the uploaded event. */ + onProgress?: Function; + /** A handler for the uploadError event. */ + onUploadError?: Function; + /** A handler for the uploadAborted event. */ + onUploadAborted?: Function; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + } + /** A widget used to select and upload a file or multiple files. */ + export class dxFileUploader extends Editor { + constructor(element: JQuery, options?: dxFileUploaderOptions); + constructor(element: Element, options?: dxFileUploaderOptions); + } + export interface dxTrackBarOptions extends EditorOptions { + /** The minimum value the widget can accept. */ + min?: number; + /** The maximum value the widget can accept. */ + max?: number; + /** The current widget value. */ + value?: number; + } + /** A base class for track bar widgets. */ + export class dxTrackBar extends Editor { + constructor(element: JQuery, options?: dxTrackBarOptions); + constructor(element: Element, options?: dxTrackBarOptions); + } + export interface dxProgressBarOptions extends dxTrackBarOptions { + /** Specifies a format for the progress status. */ + statusFormat?: any; + /** Specifies whether or not the widget displays a progress status. */ + showStatus?: boolean; + /** A handler for the complete event. */ + onComplete?: Function; + } + /** A widget used to indicate progress. */ + export class dxProgressBar extends dxTrackBar { + constructor(element: JQuery, options?: dxProgressBarOptions); + constructor(element: Element, options?: dxProgressBarOptions); + } + export interface dxSliderOptions extends dxTrackBarOptions { + activeStateEnabled?: boolean; + /** The slider step size. */ + step?: number; + /** The current slider value. */ + value?: number; + /** Specifies whether or not to highlight a range selected within the widget. */ + showRange?: boolean; + /** Specifies the size of a step by which a slider handle is moved when a user uses the Page up or Page down keyboard shortcuts. */ + keyStep?: number; + /** Specifies options for the slider tooltip. */ + tooltip?: { + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies format for the tooltip. */ + format?: any; + /** Specifies whether the tooltip is located over or under the slider. */ + position?: string; + /** Specifies whether the widget always shows a tooltip or only when a pointer is over the slider. */ + showMode?: string; + }; + /** Specifies options for labels displayed at the min and max values. */ + label?: { + /** Specifies whether or not slider labels are visible. */ + visible?: boolean; + /** Specifies whether labels are located over or under the scale. */ + position?: string; + /** Specifies a format for labels. */ + format?: any; + }; + } + /** A widget that allows a user to select a numeric value within a given range. */ + export class dxSlider extends dxTrackBar { + constructor(element: JQuery, options?: dxSliderOptions); + constructor(element: Element, options?: dxSliderOptions); + } + export interface dxRangeSliderOptions extends dxSliderOptions { + /** The left edge of the interval currently selected using the range slider. */ + start?: number; + /** The right edge of the interval currently selected using the range slider. */ + end?: number; + } + /** A widget that enables a user to select a range of numeric values. */ + export class dxRangeSlider extends dxSlider { + constructor(element: JQuery, options?: dxRangeSliderOptions); + constructor(element: Element, options?: dxRangeSliderOptions); + } + export interface dxFormItemLabel { + /** Specifies the label text. */ + text?: string; + /** Specifies whether or not the label is visible. */ + visible?: boolean; + /** Specifies whether or not a colon is displayed at the end of the current label. */ + showColon?: boolean; + /** Specifies the location of a label against the editor. */ + location?: string; + /** Specifies the label horizontal alignment. */ + alignment?: string; + } + export interface dxFormItem { + /** Specifies the type of the current item. */ + itemType?: string; + /** Specifies whether or not the current form item is visible. */ + visible?: boolean; + /** Specifies the sequence number of the item in a form, group or tab. */ + visibleIndex?: number; + /** Specifies a CSS class to be applied to the form item. */ + cssClass?: string; + /** Specifies the number of columns spanned by the item. */ + colSpan?: number; + } + export interface dxFormEmptyItem extends dxFormItem { + /** Specifies the form item name. */ + name?: string; + } + export interface dxFormSimpleItem extends dxFormItem { + /** Specifies the path to the formData object field bound to the current form item. */ + dataField?: string; + /** Specifies the form item name. */ + name?: string; + /** Specifies which editor widget is used to display and edit the form item value. */ + editorType?: string; + /** Specifies configuration options for the editor widget of the current form item. */ + editorOptions?: Object; + /** A template to be used for rendering the form item. */ + template?: any; + /** Specifies the help text displayed for the current form item. */ + helpText?: string; + /** Specifies whether the current form item is required. */ + isRequired?: boolean; + /** Specifies options for the form item label. */ + label?: dxFormItemLabel; + /** An array of validation rules to be checked for the form item editor. */ + validationRules?: Array; + } + /** Specifies dependency between the screen factor and the count of columns. */ + export interface ColCountResponsible { + /** The count of columns for an extra small-sized screen. */ + xs?: number; + /** The count of columns for a small-sized screen. */ + sm?: number; + /** The count of columns for a middle-sized screen. */ + md?: number; + /** The count of columns for a large screen size. */ + lg?: number; + } + export interface dxFormGroupItem extends dxFormItem { + /** Specifies the group caption. */ + caption?: string; + /** A template to be used for rendering a group item. */ + template?: any; + /** The count of columns in the group layout. */ + colCount?: number; + /** Specifies dependency between the screen factor and the count of columns in the tab layout. */ + colCountByScreen?: ColCountResponsible; + /** Specifies whether or not all group item labels are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the group. */ + items?: Array; + } + export interface dxFormTab { + /** Specifies the tab title. */ + title?: string; + /** The count of columns in the tab layout. */ + colCount?: number; + /** Specifies dependency between the screen factor and the count of columns in the group layout. */ + colCountByScreen?: ColCountResponsible; + /** Specifies whether or not labels of items displayed within the current tab are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the tab. */ + items?: Array; + /** Specifies a badge text for the tab. */ + badge?: string; + /** A Boolean value specifying whether or not the tab can respond to user interaction. */ + disabled?: boolean; + /** Specifies the icon to be displayed on the tab. */ + icon?: string; + /** The template to be used for rendering the tab. */ + tabTemplate?: any; + /** The template to be used for rendering the tab content. */ + template?: any; + } + export interface dxFormTabbedItem extends dxFormItem { + /** Holds a configuration object for the dxTabPanel widget used to display the current form item. */ + tabPanelOptions?: Object; + /** An array of tab configuration objects. */ + tabs?: Array; + } + export interface dxFormOptions extends WidgetOptions { + /** An object providing data for the form. */ + formData?: Object; + /** The count of columns in the form layout. */ + colCount?: any; + /** Specifies dependency between the screen factor and the count of columns in the form layout. */ + colCountByScreen?: ColCountResponsible; + /** Specifies the function returning the screen factor depending on the screen width. */ + screenByWidth?: (width: number) => string; + /** Specifies the location of a label against the editor. */ + labelLocation?: string; + /** Specifies whether or not all editors on the form are read-only. */ + readOnly?: boolean; + /** A handler for the fieldDataChanged event. */ + onFieldDataChanged?: (e: Object) => void; + /** A handler for the editorEnterKey event. */ + onEditorEnterKey?: (e: Object) => void; + /** Specifies a function that customizes a form item after it has been created. */ + customizeItem?: Function; + /** The minimum column width used for calculating column count in the form layout. */ + minColWidth?: number; + /** Specifies whether or not all root item labels are aligned. */ + alignItemLabels?: boolean; + /** Specifies whether or not item labels in all groups are aligned. */ + alignItemLabelsInAllGroups?: boolean; + /** Specifies whether or not a colon is displayed at the end of form labels. */ + showColonAfterLabel?: boolean; + /** Specifies whether or not the required mark is displayed for required fields. */ + showRequiredMark?: boolean; + /** Specifies whether or not the optional mark is displayed for optional fields. */ + showOptionalMark?: boolean; + /** The text displayed for required fields. */ + requiredMark?: string; + /** The text displayed for optional fields. */ + optionalMark?: string; + /** Specifies the message that is shown for end-users if a required field value is not specified. */ + requiredMessage?: string; + /** Specifies whether or not the total validation summary is displayed on the form. */ + showValidationSummary?: boolean; + /** Holds an array of form items. */ + items?: Array; + /** A Boolean value specifying whether to enable or disable form scrolling. */ + scrollingEnabled?: boolean; + onContentReady?: Function; + } + /** A form widget used to display and edit values of object fields. */ + export class dxForm extends Widget { + constructor(element: JQuery, options?: dxFormOptions); + constructor(element: Element, options?: dxFormOptions); + /** Updates the specified field of the formData object and the corresponding editor on the form. */ + updateData(dataField: string, value: any): void; + /** Updates the specified fields of the formData object and the corresponding editors on the form. */ + updateData(data: Object): void; + /** Updates the value of a form item option. */ + itemOption(field: string, option: string, value: any): void; + /** Updates the values of form item options. */ + itemOption(field: string, options: Object): void; + /** Returns an editor instance associated with the specified formData field. */ + getEditor(field: string): Object; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + /** Validates the values of all editors on the form against the list of the validation rules specified for each form item. */ + validate(): Object; + /** Resets the editor's value to undefined. */ + resetValues(): void; + } + export interface dxDeferRenderingOptions extends WidgetOptions { + /** Indicates if a load indicator should be shown until the widget's content is rendered. */ + showLoadIndicator?: boolean; + /** Specifies the jQuery.Promise or boolean value, which when resolved, forces widget content to render. */ + renderWhen?: any; + /** Specifies the animation to be used to show the rendered content. */ + animation?: fx.AnimationOptions; + /** Specifies a jQuery selector of items that should be rendered using a staggered animation. */ + staggerItemSelector?: string; + /** Specifies a callback function that is called when the widget's content has finished rendering but is not yet shown. */ + onRendered?: Function; + /** Specifies a callback function that is called when widget content is shown and animation has completed. */ + onShown?: Function; + } + /** A container for elements that must be rendered at a specified moment. */ + export class dxDeferRendering extends Widget { + constructor(element: JQuery, options?: dxDeferRenderingOptions); + constructor(element: Element, options?: dxDeferRenderingOptions); + } +} +interface JQuery { + dxProgressBar(): JQuery; + dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; + dxProgressBar(options: string): any; + dxProgressBar(options: string, ...params: any[]): any; + dxProgressBar(options: DevExpress.ui.dxProgressBarOptions): JQuery; + dxSlider(): JQuery; + dxSlider(options: "instance"): DevExpress.ui.dxSlider; + dxSlider(options: string): any; + dxSlider(options: string, ...params: any[]): any; + dxSlider(options: DevExpress.ui.dxSliderOptions): JQuery; + dxRangeSlider(): JQuery; + dxRangeSlider(options: "instance"): DevExpress.ui.dxRangeSlider; + dxRangeSlider(options: string): any; + dxRangeSlider(options: string, ...params: any[]): any; + dxRangeSlider(options: DevExpress.ui.dxRangeSliderOptions): JQuery; + dxFileUploader(): JQuery; + dxFileUploader(options: "instance"): DevExpress.ui.dxFileUploader; + dxFileUploader(options: string): any; + dxFileUploader(options: string, ...params: any[]): any; + dxFileUploader(options: DevExpress.ui.dxFileUploaderOptions): JQuery; + dxValidator(): JQuery; + dxValidator(options: "instance"): DevExpress.ui.dxValidator; + dxValidator(options: string): any; + dxValidator(options: string, ...params: any[]): any; + dxValidator(options: DevExpress.ui.dxValidatorOptions): JQuery; + dxValidationGroup(): JQuery; + dxValidationGroup(options: "instance"): DevExpress.ui.dxValidationGroup; + dxValidationGroup(options: string): any; + dxValidationGroup(options: string, ...params: any[]): any; + dxValidationSummary(): JQuery; + dxValidationSummary(options: "instance"): DevExpress.ui.dxValidationSummary; + dxValidationSummary(options: string): any; + dxValidationSummary(options: string, ...params: any[]): any; + dxValidationSummary(options: DevExpress.ui.dxValidationSummaryOptions): JQuery; + dxTooltip(): JQuery; + dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; + dxTooltip(options: string): any; + dxTooltip(options: string, ...params: any[]): any; + dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; + dxResizable(): JQuery; + dxResizable(options: "instance"): DevExpress.ui.dxResizable; + dxResizable(options: string): any; + dxResizable(options: string, ...params: any[]): any; + dxResizable(options: DevExpress.ui.dxResizableOptions): JQuery; + dxDropDownList(): JQuery; + dxDropDownList(options: "instance"): DevExpress.ui.dxDropDownList; + dxDropDownList(options: string): any; + dxDropDownList(options: string, ...params: any[]): any; + dxDropDownList(options: DevExpress.ui.dxDropDownListOptions): JQuery; + dxToolbar(): JQuery; + dxToolbar(options: "instance"): DevExpress.ui.dxToolbar; + dxToolbar(options: string): any; + dxToolbar(options: string, ...params: any[]): any; + dxToolbar(options: DevExpress.ui.dxToolbarOptions): JQuery; + dxToast(): JQuery; + dxToast(options: "instance"): DevExpress.ui.dxToast; + dxToast(options: string): any; + dxToast(options: string, ...params: any[]): any; + dxToast(options: DevExpress.ui.dxToastOptions): JQuery; + dxTextEditor(): JQuery; + dxTextEditor(options: "instance"): DevExpress.ui.dxTextEditor; + dxTextEditor(options: string): any; + dxTextEditor(options: string, ...params: any[]): any; + dxTextEditor(options: DevExpress.ui.dxTextEditorOptions): JQuery; + dxTextBox(): JQuery; + dxTextBox(options: "instance"): DevExpress.ui.dxTextBox; + dxTextBox(options: string): any; + dxTextBox(options: string, ...params: any[]): any; + dxTextBox(options: DevExpress.ui.dxTextBoxOptions): JQuery; + dxTextArea(): JQuery; + dxTextArea(options: "instance"): DevExpress.ui.dxTextArea; + dxTextArea(options: string): any; + dxTextArea(options: string, ...params: any[]): any; + dxTextArea(options: DevExpress.ui.dxTextAreaOptions): JQuery; + dxTabs(): JQuery; + dxTabs(options: "instance"): DevExpress.ui.dxTabs; + dxTabs(options: string): any; + dxTabs(options: string, ...params: any[]): any; + dxTabs(options: DevExpress.ui.dxTabsOptions): JQuery; + dxTabPanel(): JQuery; + dxTabPanel(options: "instance"): DevExpress.ui.dxTabPanel; + dxTabPanel(options: string): any; + dxTabPanel(options: string, ...params: any[]): any; + dxTabPanel(options: DevExpress.ui.dxTabPanelOptions): JQuery; + dxSelectBox(): JQuery; + dxSelectBox(options: "instance"): DevExpress.ui.dxSelectBox; + dxSelectBox(options: string): any; + dxSelectBox(options: string, ...params: any[]): any; + dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery; + dxTagBox(): JQuery; + dxTagBox(options: "instance"): DevExpress.ui.dxTagBox; + dxTagBox(options: string): any; + dxTagBox(options: string, ...params: any[]): any; + dxTagBox(options: DevExpress.ui.dxTagBoxOptions): JQuery; + dxScrollView(): JQuery; + dxScrollView(options: "instance"): DevExpress.ui.dxScrollView; + dxScrollView(options: string): any; + dxScrollView(options: string, ...params: any[]): any; + dxScrollView(options: DevExpress.ui.dxScrollViewOptions): JQuery; + dxScrollable(): JQuery; + dxScrollable(options: "instance"): DevExpress.ui.dxScrollable; + dxScrollable(options: string): any; + dxScrollable(options: string, ...params: any[]): any; + dxScrollable(options: DevExpress.ui.dxScrollableOptions): JQuery; + dxRadioGroup(): JQuery; + dxRadioGroup(options: "instance"): DevExpress.ui.dxRadioGroup; + dxRadioGroup(options: string): any; + dxRadioGroup(options: string, ...params: any[]): any; + dxRadioGroup(options: DevExpress.ui.dxRadioGroupOptions): JQuery; + dxPopup(): JQuery; + dxPopup(options: "instance"): DevExpress.ui.dxPopup; + dxPopup(options: string): any; + dxPopup(options: string, ...params: any[]): any; + dxPopup(options: DevExpress.ui.dxPopupOptions): JQuery; + dxPopover(): JQuery; + dxPopover(options: "instance"): DevExpress.ui.dxPopover; + dxPopover(options: string): any; + dxPopover(options: string, ...params: any[]): any; + dxPopover(options: DevExpress.ui.dxPopoverOptions): JQuery; + dxOverlay(): JQuery; + dxOverlay(options: "instance"): DevExpress.ui.dxOverlay; + dxOverlay(options: string): any; + dxOverlay(options: string, ...params: any[]): any; + dxOverlay(options: DevExpress.ui.dxOverlayOptions): JQuery; + dxNumberBox(): JQuery; + dxNumberBox(options: "instance"): DevExpress.ui.dxNumberBox; + dxNumberBox(options: string): any; + dxNumberBox(options: string, ...params: any[]): any; + dxNumberBox(options: DevExpress.ui.dxNumberBoxOptions): JQuery; + dxNavBar(): JQuery; + dxNavBar(options: "instance"): DevExpress.ui.dxNavBar; + dxNavBar(options: string): any; + dxNavBar(options: string, ...params: any[]): any; + dxNavBar(options: DevExpress.ui.dxNavBarOptions): JQuery; + dxMultiView(): JQuery; + dxMultiView(options: "instance"): DevExpress.ui.dxMultiView; + dxMultiView(options: string): any; + dxMultiView(options: string, ...params: any[]): any; + dxMultiView(options: DevExpress.ui.dxMultiViewOptions): JQuery; + dxMap(): JQuery; + dxMap(options: "instance"): DevExpress.ui.dxMap; + dxMap(options: string): any; + dxMap(options: string, ...params: any[]): any; + dxMap(options: DevExpress.ui.dxMapOptions): JQuery; + dxLookup(): JQuery; + dxLookup(options: "instance"): DevExpress.ui.dxLookup; + dxLookup(options: string): any; + dxLookup(options: string, ...params: any[]): any; + dxLookup(options: DevExpress.ui.dxLookupOptions): JQuery; + dxLoadPanel(): JQuery; + dxLoadPanel(options: "instance"): DevExpress.ui.dxLoadPanel; + dxLoadPanel(options: string): any; + dxLoadPanel(options: string, ...params: any[]): any; + dxLoadPanel(options: DevExpress.ui.dxLoadPanelOptions): JQuery; + dxLoadIndicator(): JQuery; + dxLoadIndicator(options: "instance"): DevExpress.ui.dxLoadIndicator; + dxLoadIndicator(options: string): any; + dxLoadIndicator(options: string, ...params: any[]): any; + dxLoadIndicator(options: DevExpress.ui.dxLoadIndicatorOptions): JQuery; + dxList(): JQuery; + dxList(options: "instance"): DevExpress.ui.dxList; + dxList(options: string): any; + dxList(options: string, ...params: any[]): any; + dxList(options: DevExpress.ui.dxListOptions): JQuery; + dxGallery(): JQuery; + dxGallery(options: "instance"): DevExpress.ui.dxGallery; + dxGallery(options: string): any; + dxGallery(options: string, ...params: any[]): any; + dxGallery(options: DevExpress.ui.dxGalleryOptions): JQuery; + dxDropDownEditor(): JQuery; + dxDropDownEditor(options: "instance"): DevExpress.ui.dxDropDownEditor; + dxDropDownEditor(options: string): any; + dxDropDownEditor(options: string, ...params: any[]): any; + dxDropDownEditor(options: DevExpress.ui.dxDropDownEditorOptions): JQuery; + dxDateBox(): JQuery; + dxDateBox(options: "instance"): DevExpress.ui.dxDateBox; + dxDateBox(options: string): any; + dxDateBox(options: string, ...params: any[]): any; + dxDateBox(options: DevExpress.ui.dxDateBoxOptions): JQuery; + dxCheckBox(): JQuery; + dxCheckBox(options: "instance"): DevExpress.ui.dxCheckBox; + dxCheckBox(options: string): any; + dxCheckBox(options: string, ...params: any[]): any; + dxCheckBox(options: DevExpress.ui.dxCheckBoxOptions): JQuery; + dxBox(): JQuery; + dxBox(options: "instance"): DevExpress.ui.dxBox; + dxBox(options: string): any; + dxBox(options: string, ...params: any[]): any; + dxBox(options: DevExpress.ui.dxBoxOptions): JQuery; + dxButton(): JQuery; + dxButton(options: "instance"): DevExpress.ui.dxButton; + dxButton(options: string): any; + dxButton(options: string, ...params: any[]): any; + dxButton(options: DevExpress.ui.dxButtonOptions): JQuery; + dxCalendar(): JQuery; + dxCalendar(options: "instance"): DevExpress.ui.dxCalendar; + dxCalendar(options: string): any; + dxCalendar(options: string, ...params: any[]): any; + dxCalendar(options: DevExpress.ui.dxCalendarOptions): JQuery; + dxAccordion(): JQuery; + dxAccordion(options: "instance"): DevExpress.ui.dxAccordion; + dxAccordion(options: string): any; + dxAccordion(options: string, ...params: any[]): any; + dxAccordion(options: DevExpress.ui.dxAccordionOptions): JQuery; + dxResponsiveBox(): JQuery; + dxResponsiveBox(options: "instance"): DevExpress.ui.dxResponsiveBox; + dxResponsiveBox(options: string): any; + dxResponsiveBox(options: string, ...params: any[]): any; + dxResponsiveBox(options: DevExpress.ui.dxResponsiveBoxOptions): JQuery; + dxAutocomplete(): JQuery; + dxAutocomplete(options: "instance"): DevExpress.ui.dxAutocomplete; + dxAutocomplete(options: string): any; + dxAutocomplete(options: string, ...params: any[]): any; + dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; + dxForm(): JQuery; + dxForm(options: "instance"): DevExpress.ui.dxForm; + dxForm(options: string): any; + dxForm(options: string, ...params: any[]): any; + dxForm(options: DevExpress.ui.dxFormOptions): JQuery; +} + +declare module DevExpress.ui { + export interface dxTileViewOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the height of the base tile view item. */ + baseItemHeight?: number; + /** Specifies the width of the base tile view item. */ + baseItemWidth?: number; + /** Specifies whether tiles are placed horizontally or vertically. */ + direction?: string; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the distance in pixels between adjacent tiles. */ + itemMargin?: number; + /** A Boolean value specifying whether or not to display a scrollbar. */ + showScrollbar?: boolean; + } + /** A widget displaying several blocks of data as tiles. */ + export class dxTileView extends CollectionWidget { + constructor(element: JQuery, options?: dxTileViewOptions); + constructor(element: Element, options?: dxTileViewOptions); + /** Returns the current scroll position of the widget content. */ + scrollPosition(): number; + } + export interface dxSwitchOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Text displayed when the widget is in a disabled state. */ + offText?: string; + /** Text displayed when the widget is in an enabled state. */ + onText?: string; + /** A Boolean value specifying whether the current switch state is "On" or "Off". */ + value?: boolean; + } + /** A switch widget. */ + export class dxSwitch extends Editor { + constructor(element: JQuery, options?: dxSwitchOptions); + constructor(element: Element, options?: dxSwitchOptions); + } + export interface dxSlideOutViewOptions extends WidgetOptions { + /** Specifies the current menu position. */ + menuPosition?: string; + /** Specifies whether or not the menu panel is visible. */ + menuVisible?: boolean; + /** Specifies whether or not the menu is shown when a user swipes the widget content. */ + swipeEnabled?: boolean; + /** A template to be used for rendering menu panel content. */ + menuTemplate?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal a custom menu. */ + export class dxSlideOutView extends Widget { + constructor(element: JQuery, options?: dxSlideOutViewOptions); + constructor(element: Element, options?: dxSlideOutViewOptions); + /** Returns an HTML element of the widget menu block. */ + menuContent(): JQuery; + /** Returns an HTML element of the widget content block. */ + content(): JQuery; + /** Displays the widget's menu block. */ + showMenu(): JQueryPromise; + /** Hides the widget's menu block. */ + hideMenu(): JQueryPromise; + /** Toggles the visibility of the widget's menu block. */ + toggleMenuVisibility(): JQueryPromise; + } + export interface dxSlideOutOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not to display a grouped menu. */ + menuGrouped?: boolean; + /** Specifies the current menu position. */ + menuPosition?: string; + /** The name of the template used to display a group header. */ + menuGroupTemplate?: any; + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** A handler for the menuGroupRendered event. */ + onMenuGroupRendered?: Function; + /** A handler for the menuItemRendered event. */ + onMenuItemRendered?: Function; + /** Specifies whether or not the slide-out menu is displayed. */ + menuVisible?: boolean; + /** Indicates whether the menu can be shown/hidden by swiping the widget's main panel. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal an item list. */ + export class dxSlideOut extends CollectionWidget { + constructor(element: JQuery, options?: dxSlideOutOptions); + constructor(element: Element, options?: dxSlideOutOptions); + /** Hides the widget's slide-out menu. */ + hideMenu(): JQueryPromise; + /** Displays the widget's slide-out menu. */ + showMenu(): JQueryPromise; + /** Toggles the visibility of the widget's slide-out menu. */ + toggleMenuVisibility(showing: boolean): JQueryPromise; + } + export interface dxPivotOptions extends CollectionWidgetOptions { + /** The index of the currently active pivot item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + } + /** A widget that is similar to a traditional tab control, but optimized for the phone with simplified end-user interaction. */ + export class dxPivot extends CollectionWidget { + constructor(element: JQuery, options?: dxPivotOptions); + constructor(element: Element, options?: dxPivotOptions); + } + export interface dxPanoramaOptions extends CollectionWidgetOptions { + /** An object exposing options for setting a background image for the panorama. */ + backgroundImage?: { + /** Specifies the height of the panorama's background image. */ + height?: number; + /** Specifies the URL of the image that is used as the panorama's background image. */ + url?: string; + /** Specifies the width of the panorama's background image. */ + width?: number; + }; + /** The index of the currently active panorama item. */ + selectedIndex?: number; + /** Specifies the widget content title. */ + title?: string; + } + /** A widget displaying the required content in a long horizontal canvas that extends beyond the frames of the screen. */ + export class dxPanorama extends CollectionWidget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + } + export interface dxDropDownMenuOptions extends WidgetOptions { + /** A handler for the buttonClick event. */ + onButtonClick?: any; + /** The name of the icon to be displayed by the DropDownMenu button. */ + buttonIcon?: string; + /** The text displayed in the DropDownMenu button. */ + buttonText?: string; + buttonIconSrc?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** Specifies whether or not to show the drop down menu within a dxPopover widget. */ + usePopover?: boolean; + /** The width of the menu popup in pixels. */ + popupWidth?: any; + /** The height of the menu popup in pixels. */ + popupHeight?: any; + /** Specifies whether or not the drop-down menu is displayed. */ + opened?: boolean; + hoverStateEnabled?: boolean; + activeStateEnabled?: boolean; + } + /** A drop-down menu widget. */ + export class dxDropDownMenu extends Widget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Opens the drop-down menu. */ + open(): void; + /** Closes the drop-down menu. */ + close(): void; + } + export interface dxActionSheetOptions extends CollectionWidgetOptions { + /** A handler for the cancelClick event. */ + onCancelClick?: any; + /** The text displayed in the button that closes the action sheet. */ + cancelText?: string; + /** Specifies whether or not to display the Cancel button in action sheet. */ + showCancelButton?: boolean; + /** A Boolean value specifying whether or not the title of the action sheet is visible. */ + showTitle?: boolean; + /** Specifies the element the action sheet popover points at. */ + target?: any; + /** The title of the action sheet. */ + title?: string; + /** Specifies whether or not to show the action sheet within a dxPopover widget. */ + usePopover?: boolean; + /** A Boolean value specifying whether or not the dxActionSheet widget is visible. */ + visible?: boolean; + } + /** A widget consisting of a set of choices related to a certain task. */ + export class dxActionSheet extends CollectionWidget { + constructor(element: JQuery, options?: dxActionSheetOptions); + constructor(element: Element, options?: dxActionSheetOptions); + /** Hides the widget. */ + hide(): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Shows or hides the widget depending on the Boolean value passed as the parameter. */ + toggle(showing: boolean): JQueryPromise; + } +} +interface JQuery { + dxTileView(): JQuery; + dxTileView(options: "instance"): DevExpress.ui.dxTileView; + dxTileView(options: string): any; + dxTileView(options: string, ...params: any[]): any; + dxTileView(options: DevExpress.ui.dxTileViewOptions): JQuery; + dxSwitch(): JQuery; + dxSwitch(options: "instance"): DevExpress.ui.dxSwitch; + dxSwitch(options: string): any; + dxSwitch(options: string, ...params: any[]): any; + dxSwitch(options: DevExpress.ui.dxSwitchOptions): JQuery; + dxSlideOut(): JQuery; + dxSlideOut(options: "instance"): DevExpress.ui.dxSlideOut; + dxSlideOut(options: string): any; + dxSlideOut(options: string, ...params: any[]): any; + dxSlideOut(options: DevExpress.ui.dxSlideOutOptions): JQuery; + dxPivot(): JQuery; + dxPivot(options: "instance"): DevExpress.ui.dxPivot; + dxPivot(options: string): any; + dxPivot(options: string, ...params: any[]): any; + dxPivot(options: DevExpress.ui.dxPivotOptions): JQuery; + dxPanorama(): JQuery; + dxPanorama(options: "instance"): DevExpress.ui.dxPanorama; + dxPanorama(options: string): any; + dxPanorama(options: string, ...params: any[]): any; + dxPanorama(options: DevExpress.ui.dxPanoramaOptions): JQuery; + dxActionSheet(): JQuery; + dxActionSheet(options: "instance"): DevExpress.ui.dxActionSheet; + dxActionSheet(options: string): any; + dxActionSheet(options: string, ...params: any[]): any; + dxActionSheet(options: DevExpress.ui.dxActionSheetOptions): JQuery; + dxDropDownMenu(): JQuery; + dxDropDownMenu(options: "instance"): DevExpress.ui.dxDropDownMenu; + dxDropDownMenu(options: string): any; + dxDropDownMenu(options: string, ...params: any[]): any; + dxDropDownMenu(options: DevExpress.ui.dxDropDownMenuOptions): JQuery; +} +declare module DevExpress.data { + export interface XmlaStoreOptions { + /** The HTTP address to an XMLA OLAP server. */ + url?: string; + /** The name of the database associated with the Store. */ + catalog?: string; + /** The cube name. */ + cube?: string; + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: Object) => void; + } + /** A Store that provides access to an OLAP cube using the XMLA standard. */ + export class XmlaStore { + constructor(options: XmlaStoreOptions); + } + export interface PivotGridField { + index?: number; + /** A boolean value specifying whether or not the field is visible in the pivot grid and the Field Chooser. */ + visible?: boolean; + /** Name of the data source field containing data for the pivot grid field. */ + dataField?: string; + /** A caption that will be displayed in the pivot grid's field chooser and field panel to identify the field. */ + caption?: string; + /** Specifies a type of field values. */ + dataType?: string; + /** Specifies how the values of the current field are combined into groups. Cannot be used for the XmlaStore store type. */ + groupInterval?: any; + /** Specifies how to aggregate field data. Cannot be used for the XmlaStore store type. */ + summaryType?: string; + /** Allows you to use a custom aggregate function to calculate the summary values. Cannot be used for the XmlaStore store type. */ + calculateCustomSummary?: (options: { + summaryProcess?: string; + value?: any; + totalValue?: any; + }) => void; + /** Specifies the function that determines how to split data from the data source into ranges for header items. Cannot be used for the XmlaStore store type. */ + selector?: (data: Object) => any; + /** Type of the area where the field is located. */ + area?: string; + /** Index among the other fields displayed within the same area. */ + areaIndex?: number; + /** The name of the folder in which the field is located. */ + displayFolder?: string; + /** The name of the group to which the field belongs. */ + groupName?: string; + /** The index of the field within a group. */ + groupIndex?: number; + /** Specifies the sort order of field values. */ + sortOrder?: string; + /** Specifies how field data should be sorted. Can be used for the XmlaStore store type only. */ + sortBy?: string; + /** Sorts the header items of this field by the summary values of another field. */ + sortBySummaryField?: string; + /** The array of field names that specify a path to column/row whose summary field is used for sorting of this field's header items. */ + sortBySummaryPath?: Array; + /** The filter values for the current field. */ + filterValues?: Array; + /** The filter type for the current field. */ + filterType?: string; + /** Indicates whether all header items of the field's header level are expanded. */ + expanded?: boolean; + /** Specifies whether the field should be treated as a Data Field. */ + isMeasure?: boolean; + /** Specifies whether or not long text in header items should be wrapped. */ + wordWrapEnabled?: boolean; + /** Specifies a display format for field values. */ + format?: any; + /** Specifies a callback function that returns the text to be displayed in the cells of a field. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** + * Specifies a precision for formatted field values. + * @deprecated Use the format | precision option instead. + */ + precision?: number; + /** Specifies how to sort the header items. */ + sortingMethod?: (a: Object, b: Object) => number; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies the absolute width of the field in the pivot grid. */ + width?: number; + /** Specifies the summary post-processing algorithm. */ + summaryDisplayMode?: string; + /** Specifies whether to summarize each next summary value with the previous one by rows or columns. */ + runningTotal?: string; + /** Specifies whether to allow the predefined summary post-processing functions ('absoluteVariation' and 'percentVariation') and runningTotal to take values of different groups into account. */ + allowCrossGroupCalculation?: boolean; + /** Specifies a callback function that allows you to modify summary values after they are calculated. */ + calculateSummaryValue?: (e: Object) => number; + /** Specifies whether or not to display Total values for the field. */ + showTotals?: boolean; + /** Specifies whether or not to display Grand Total values for the field. */ + showGrandTotals?: boolean; + } + export class SummaryCell { + /** Gets the parent cell in a specified direction. */ + parent(direction: string): SummaryCell; + /** Gets all children cells in a specified direction. */ + children(direction: string): Array; + /** Gets a partial Grand Total cell of a row or column. */ + grandTotal(direction: string): SummaryCell; + /** Gets the Grand Total of the entire pivot grid. */ + grandTotal(): SummaryCell; + /** Gets the cell next to the current one in a specified direction. */ + next(direction: string): SummaryCell; + /** Gets the cell next to current in a specified direction. */ + next(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the cell prior to the current one in a specified direction. */ + prev(direction: string): SummaryCell; + /** Gets the cell previous to current in a specified direction. */ + prev(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the child cell in a specified direction. */ + child(direction: string, fieldValue: any): SummaryCell; + /** Gets the cell located by the path of the source cell with one field value changed. */ + slice(field: PivotGridField, value: any): SummaryCell; + /** Gets the row or column field to which the current cell belongs. */ + field(area: string): PivotGridField; + /** Gets the value of the current cell. */ + value(): any; + /** Gets the value of the current cell. */ + value(isCalculatedValue: boolean): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField, isCalculatedValue: boolean): any; + } + export interface PivotGridDataSourceOptions { + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** Indicates whether or not the automatic field generation from data in the Store is enabled. */ + retrieveFields?: boolean; + /** Specifies data filtering conditions. Cannot be used for the XmlaStore store type. */ + filter?: Object; + /** An array of pivot grid fields. */ + fields?: Array; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Object) => void; + /** A handler for the fieldsPrepared event. */ + onFieldsPrepared?: (e?: Array) => void; + } + /** An object that provides access to data for the dxPivotGrid widget. */ + export class PivotGridDataSource implements EventsMixin { + constructor(options?: PivotGridDataSource); + /** Starts reloading data from any store and updating the data source. */ + reload(): JQueryPromise; + /** Starts updating the data source. Reloads data from the XMLA store only. */ + load(): JQueryPromise; + /** Indicates whether or not the PivotGridDataSource is currently being loaded. */ + isLoading(): boolean; + /** Gets data displayed in a PivotGrid. */ + getData(): Object; + /** Gets all fields within a specified area. */ + getAreaFields(area: string, collectGroups: boolean): Array; + /** Gets all fields from the data source. */ + fields(): Array; + /** Sets the fields option. */ + fields(fields: Array): void; + /** Gets current options of a specified field. */ + field(id: any): PivotGridField; + /** Sets one or more options of a specified field. */ + field(id: any, field: PivotGridField): void; + /** Collapses a specified header item. */ + collapseHeaderItem(area: string, path: Array): void; + /** Expands a specified header item. */ + expandHeaderItem(area: string, path: Array): void; + /** Expands all header items of a field. */ + expandAll(id: any): void; + /** Collapses all header items of a field. */ + collapseAll(id: any): void; + /** Disposes of all resources associated with this PivotGridDataSource. */ + dispose(): void; + /** Gets the current filter expression. Cannot be used for the XmlaStore store type. */ + filter(): Object; + /** Applies a new filter expression. Cannot be used for the XmlaStore store type. */ + filter(filterExpr: Object): void; + /** Provides access to a list of records (facts) that were used to calculate a specific summary. */ + createDrillDownDataSource(options: { + columnPath?: Array; + rowPath?: Array; + dataIndex?: number; + maxRowCount?: number; + customColumns?: Array; + }): DevExpress.data.DataSource; + /** Gets the current PivotGridDataSource state (fields configuration, sorting, filters, expanded headers, etc.) */ + state(): Object; + /** Sets the PivotGridDataSource state. */ + state(state: Object): void; + on(eventName: string, eventHandler: Function): PivotGridDataSource; + on(events: { [eventName: string]: Function; }): PivotGridDataSource; + off(eventName: string): PivotGridDataSource; + off(eventName: string, eventHandler: Function): PivotGridDataSource; + } +} +declare module DevExpress.ui { + export interface dxSchedulerOptions extends WidgetOptions { + /** Specifies a date displayed on the current scheduler view by default. */ + currentDate?: any; + /** The earliest date the widget allows you to select. */ + min?: Date; + /** The latest date the widget allows you to select. */ + max?: Date; + /** Specifies the view used in the scheduler by default. */ + currentView?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** The template to be used for rendering appointments. */ + appointmentTemplate?: any; + /** The template to be used for rendering an appointment tooltip. */ + appointmentTooltipTemplate?: any; + /** Lists the views to be available within the scheduler's View Selector. */ + views?: Array; + /** Specifies the resource kinds by which the scheduler's appointments are grouped in a timetable. */ + groups?: Array; + /** Specifies a start hour in the scheduler view's time interval. */ + startDayHour?: number; + /** Specifies an end hour in the scheduler view's time interval. */ + endDayHour?: number; + /** Specifies whether or not the "All-day" panel is visible. */ + showAllDayPanel?: boolean; + /** Specifies cell duration in minutes. */ + cellDuration?: number; + /** Specifies the edit mode for recurring appointments. */ + recurrenceEditMode?: string; + /** Specifies which editing operations an end-user can perform on appointments. */ + editing?: { + /** Specifies whether or not an end-user can add appointments. */ + allowAdding?: boolean; + /** Specifies whether or not an end-user can change appointment options. */ + allowUpdating?: boolean; + /** Specifies whether or not an end-user can delete appointments. */ + allowDeleting?: boolean; + /** Specifies whether or not an end-user can change an appointment duration. */ + allowResizing?: boolean; + /** Specifies whether or not an end-user can drag appointments. */ + allowDragging?: boolean; + } + /** Specifies an array of resources available in the scheduler. */ + resources?: Array<{ + /** Indicates whether or not several resources of this kind can be assigned to an appointment. */ + allowMultiple?: boolean; + /** + * Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. + * @deprecated Use the useColorAsDefault option instead. + */ + mainColor?: boolean; + /** Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. */ + useColorAsDefault?: boolean; + /** A data source used to fetch resources to be available in the scheduler. */ + dataSource?: any; + /** Specifies the resource object field whose value is displayed by the Resource editor in the Appointment popup window. */ + displayExpr?: any; + /** Specifies the resource object field that is used as a value of the Resource editor in the Appointment popup window. */ + valueExpr?: any; + /** + * The name of the appointment object field that specifies a resource of this kind. + * @deprecated Use the fieldExpr option instead. + */ + field?: string; + /** The name of the appointment object field that specifies a resource of this kind. */ + fieldExpr?: string; + /** Specifies the label of the Appointment popup window field that allows end users to assign a resource of this kind. */ + label?: string; + }>; + /** A handler for the AppointmentAdding event. */ + onAppointmentAdding?: Function; + /** A handler for the appointmentAdded event. */ + onAppointmentAdded?: Function; + /** A handler for the AppointmentUpdating event. */ + onAppointmentUpdating?: Function; + /** A handler for the appointmentUpdated event. */ + onAppointmentUpdated?: Function; + /** A handler for the AppointmentDeleting event. */ + onAppointmentDeleting?: Function; + /** A handler for the appointmentDeleted event. */ + onAppointmentDeleted?: Function; + /** A handler for the appointmentRendered event. */ + onAppointmentRendered?: Function; + /** A handler for the appointmentClick event. */ + onAppointmentClick?: any; + /** A handler for the appointmentDblClick event. */ + onAppointmentDblClick?: any; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the appointmentFormCreated event. */ + onAppointmentFormCreated?: Function; + /** A handler for the contentReady event. */ + onContentReady?: Function; + horizontalScrollingEnabled?: boolean; + /** Specifies whether or not an end-user can scroll the view in both directions at the same time. */ + crossScrollingEnabled?: boolean; + /** Specifies whether a user can switch views using tabs or a drop-down menu. */ + useDropDownViewSwitcher?: boolean; + /** Specifies the name of the data source item field that defines the start of an appointment. */ + startDateExpr?: string; + /** Specifies the name of the data source item field that defines the ending of an appointment. */ + endDateExpr?: string; + /** Specifies the name of the data source item field that holds the subject of an appointment. */ + textExpr?: string; + /** Specifies the name of the data source item field whose value holds the description of the corresponding appointment. */ + descriptionExpr?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding appointment is an all-day appointment. */ + allDayExpr?: string; + /** Specifies the name of the data source item field that defines a recurrence rule for generating recurring appointments. */ + recurrenceRuleExpr?: string; + /** Specifies the name of the data source item field that defines exceptions for the current recurring appointment. */ + recurrenceExceptionExpr?: string; + /** Specifies the name of the data source item field that defines the timezone of the appointment start date. */ + startDateTimeZoneExpr?: string; + /** Specifies the name of the data source item field that defines the timezone of the appointment end date. */ + endDateTimeZoneExpr?: string; + /** Specifies whether filtering is performed on the server or client side. */ + remoteFiltering?: boolean; + /** Specifies the timezone of the widget. */ + timeZone?: string; + /** The text or HTML markup displayed by the widget if the item collection is empty. Available for the Agenda view only. */ + noDataText?: string; + } + /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ + export class dxScheduler extends Widget { + constructor(element: JQuery, options?: dxSchedulerOptions); + constructor(element: Element, options?: dxSchedulerOptions); + /** Add the appointment defined by the object passed as a parameter to the data associated with the widget. */ + addAppointment(appointment: Object): void; + /** Updates the appointment specified by the first method parameter by the appointment object specified by the second method parameter in the the data associated with the widget. */ + updateAppointment(target: Object, appointment: Object): void; + /** Deletes the appointment defined by the parameter from the the data associated with the widget. */ + deleteAppointment(appointment: Object): void; + /** Scrolls the scheduler work space to the specified time of the specified day. */ + scrollToTime(hours: number, minutes: number, date: Date): void; + /** Displayes the Appointment Details popup. */ + showAppointmentPopup(appointmentData: Object, createNewAppointment?: boolean, currentAppointmentData?: Object): void; + /** Returns the start date of the current view. */ + getStartViewDate(): Date; + /** Returns the end date of the current view. */ + getEndViewDate(): Date; + } + export interface dxColorBoxOptions extends dxDropDownEditorOptions { + /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ + applyButtonText?: string; + applyValueMode?: string; + /** Specifies the text displayed on the button that cancels changes and closes the drop-down editor. */ + cancelButtonText?: string; + /** Specifies whether or not the widget value includes the alpha channel component. */ + editAlphaChannel?: boolean; + /** Specifies the size of a step by which a handle is moved using a keyboard shortcut. */ + keyStep?: number; + } + /** A widget used to specify a color value. */ + export class dxColorBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxColorBoxOptions); + constructor(element: Element, options?: dxColorBoxOptions); + } + export interface HierarchicalCollectionWidgetOptions extends CollectionWidgetOptions { + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of the data source item field used as a key. */ + keyExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is selected. */ + selectedExpr?: any; + /** Specifies the name of the data source item field that contains an array of nested items. */ + itemsExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is disabled. */ + disabledExpr?: any; + hoverStateEnabled?: boolean; + focusStateEnabled?: boolean; + } + export class HierarchicalCollectionWidget extends CollectionWidget { + } + export interface dxTreeViewOptions extends HierarchicalCollectionWidgetOptions { + /** Specifies whether or not to animate item collapsing and expanding. */ + animationEnabled?: boolean; + /** Specifies whether a nested or plain array is used as a data source. */ + dataStructure?: string; + /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ + expandAllEnabled?: boolean; + /** + * Specifies whether or not a check box is displayed at each tree view item. + * @deprecated Use the showCheckBoxesMode options instead. + */ + showCheckBoxes?: boolean; + /** Specifies the current check boxes display mode. */ + showCheckBoxesMode?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is displayed expanded. */ + expandedExpr?: any; + /** Specifies whether or not to select nodes recursively. */ + selectNodesRecursive?: boolean; + /** Specifies whether or not all parent nodes of an initially expanded node are displayed expanded. */ + expandNodesRecursive?: boolean; + /** + * Specifies whether the "Select All" check box is displayed over the tree view. + * @deprecated Use the showCheckBoxesMode options instead. + */ + selectAllEnabled?: boolean; + /** Specifies whether or not an item becomes selected if a user clicks it. */ + selectByClick?: boolean; + /** Specifies the text displayed at the "Select All" check box. */ + selectAllText?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node includes child nodes. */ + hasItemsExpr?: any; + /** Specifies the name of the data source item field for holding the parent key of the corresponding node. */ + parentIdExpr?: any; + /** Specifies if the virtual mode is enabled. */ + virtualModeEnabled?: boolean; + /** Specifies the parent ID value of the root item. */ + rootValue?: Object; + /** Specifies the current value used to filter tree view items. */ + searchValue?: string; + /** A string value specifying available scrolling directions. */ + scrollDirection?: string; + /** A handler for the itemSelectionChanged event. */ + onItemSelectionChanged?: Function; + /** A handler for the itemExpanded event. */ + onItemExpanded?: Function; + /** A handler for the itemCollapsed event. */ + onItemCollapsed?: Function; + onItemClick?: Function; + onItemContextMenu?: Function; + onItemRendered?: Function; + onItemHold?: Function; + } + /** A widget displaying specified data items as a tree. */ + export class dxTreeView extends HierarchicalCollectionWidget { + constructor(element: JQuery, options?: dxTreeViewOptions); + constructor(element: Element, options?: dxTreeViewOptions); + /** Updates the tree view scrollbars according to the current size of the widget content. */ + updateDimensions(): JQueryPromise; + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + /** Expands the specified item. */ + expandItem(itemElement: any): void; + /** Collapses the specified item. */ + collapseItem(itemElement: any): void; + /** Returns all nodes of the tree view. */ + getNodes(): Array; + /** Selects all widget items. */ + selectAll(): void; + /** Unselects all widget items. */ + unselectAll(): void; + } + export interface dxMenuBaseOptions extends HierarchicalCollectionWidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the name of the CSS class associated with the menu. */ + cssClass?: string; + /** Holds an array of menu items. */ + items?: Array; + /** + * Specifies whether or not an item becomes selected if an end-user clicks it. + * @deprecated Use the selectByClick option instead. + */ + selectionByClick?: boolean; + /** Specifies whether or not an item becomes selected if a user clicks it. */ + selectByClick?: boolean; + /** Specifies the selection mode supported by the menu. */ + selectionMode?: string; + /** Specifies options of submenu showing and hiding. */ + showSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay of submenu show and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + } + export class dxMenuBase extends HierarchicalCollectionWidget { + constructor(element: JQuery, options?: dxMenuBaseOptions); + constructor(element: Element, options?: dxMenuBaseOptions); + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + } + export interface dxMenuOptions extends dxMenuBaseOptions { + /** Specifies whether or not the submenu is hidden when the mouse pointer leaves it. */ + hideSubmenuOnMouseLeave?: boolean; + /** Specifies whether the menu has horizontal or vertical orientation. */ + orientation?: string; + /** Specifies options for showing and hiding the first level submenu. */ + showFirstSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay in submenu showing and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + /** Specifies the direction at which the submenus are displayed. */ + submenuDirection?: string; + /** A handler for the submenuHidden event. */ + onSubmenuHidden?: Function; + /** Specifies whether or not adaptive widget rendering is enabled on a small screen. */ + adaptivityEnabled?: boolean; + /** A handler for the submenuHiding event. */ + onSubmenuHiding?: Function; + /** A handler for the submenuShowing event. */ + onSubmenuShowing?: Function; + /** A handler for the submenuShown event. */ + onSubmenuShown?: Function; + } + /** A menu widget. */ + export class dxMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxMenuOptions); + constructor(element: Element, options?: dxMenuOptions); + } + export interface dxContextMenuOptions extends dxMenuBaseOptions { + /** Holds an object that specifies options of alternative menu invocation. */ + alternativeInvocationMode?: { + /** Specifies whether or not the standard context menu invocation (on a right mouse click or on a long tap) is disabled. */ + enabled?: Boolean; + /** Specifies the element used to invoke the context menu. */ + invokingElement?: any; + }; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** A handler for the positioning event. */ + onPositioning?: Function; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the direction at which submenus are displayed. */ + submenuDirection?: string; + /** The target element associated with a popover. */ + target?: any; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + } + /** A context menu widget. */ + export class dxContextMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxContextMenuOptions); + constructor(element: Element, options?: dxContextMenuOptions); + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Hides the widget. */ + hide(): JQueryPromise; + } + export interface dxRemoteOperations { + /** Specifies whether or not filtering must be performed on the server side. */ + filtering?: boolean; + /** Specifies whether or not paging must be performed on the server side. */ + paging?: boolean; + /** Specifies whether or not sorting must be performed on the server side. */ + sorting?: boolean; + /** Specifies whether or not grouping must be performed on the server side. */ + grouping?: boolean; + /** Specifies whether or not summaries calculation must be performed on the server side. */ + summary?: boolean; + } + export interface dxDataGridRow { + data: Object; + key: any; + rowIndex: number; + rowType: string; + groupIndex: number; + isExpanded: boolean; + isSelected: boolean; + values: Array; + } + export interface dxDataGridColumn { + /** Specifies the content alignment within column cells. */ + alignment?: string; + /** Specifies whether the values in a column can be edited at runtime. Setting this option makes sense only when editing is enabled for a grid. */ + allowEditing?: boolean; + /** Specifies whether or not a column can be used for filtering grid records. Setting this option makes sense only when the filter row and column header filtering are visible. */ + allowFiltering?: boolean; + /** Specifies whether or not to allow filtering by this column using its header. */ + allowHeaderFiltering?: boolean; + /** Specifies whether or not the column can be anchored to a grid edge by end users. Setting this option makes sense only when the columnFixing | enabled option is set to true. */ + allowFixing?: boolean; + /** Specifies if a column can be used for searching grid records. Setting this option makes sense only when the search panel is visible. */ + allowSearch?: boolean; + /** Specifies whether the user can group data by values of this column. Applies only when grouping is enabled. */ + allowGrouping?: boolean; + /** Specifies whether or not a column can be hidden by a user. Setting this option makes sense only when the column chooser is visible. */ + allowHiding?: boolean; + /** Specifies whether or not a particular column can be used in column reordering. Setting this option makes sense only when the allowColumnReordering option is set to true. */ + allowReordering?: boolean; + /** Specifies whether or not a particular column can be resized by a user. Setting this option makes sense only when the allowColumnResizing option is true. */ + allowResizing?: boolean; + /** Specifies whether grid records can be sorted by a specific column at runtime. Setting this option makes sense only when the sorting mode differs from none. */ + allowSorting?: boolean; + /** Specifies whether groups appear expanded or not when records are grouped by a specific column. Setting this option makes sense only when grouping is allowed for this column. */ + autoExpandGroup?: boolean; + /** Specifies a callback function that returns a value to be displayed in a column cell. */ + calculateCellValue?: (rowData: Object) => string; + /** Specifies a callback function to be invoked after the cell value is edited by an end-user and before the new value is saved to the data source. */ + setCellValue?: (rowData: Object, value: any) => void; + /** Specifies a callback function that defines filters for customary calculated grid cells. */ + calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string, target: string) => Array; + /** Specifies a caption for a column. */ + caption?: string; + /** Specifies a custom template for grid column cells. */ + cellTemplate?: any; + /** Specifies a CSS class to be applied to a column. */ + cssClass?: string; + /** Specifies how to get a value to be displayed in a cell when it is not in an editing state. */ + calculateDisplayValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for grouping column cells. */ + calculateGroupValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for sorting column cells. */ + calculateSortValue?: any; + /** Specifies a callback function that returns the text to be displayed in the cells of a column. */ + customizeText?: (cellInfo: { value: any; valueText: string; target: string; groupInterval: any }) => string; + /** Specifies the field of a data source that provides data for a column. */ + dataField?: string; + /** Specifies the required type of column values. */ + dataType?: string; + /** Specifies a custom template for the cell of a grid column when it is in an editing state. */ + editCellTemplate?: any; + /** Specifies configuration options for the editor widget of the current column. */ + editorOptions?: Object; + /** Specifies whether HTML tags are displayed as plain text or applied to the values of the column. */ + encodeHtml?: boolean; + /** In a boolean column, replaces all false items with a specified text. */ + falseText?: string; + /** Specifies the set of available filter operations. */ + filterOperations?: Array; + /** Specifies a filter value for a column. */ + filterValue?: any; + /** Specifies initial filter values for the column's header filter. */ + filterValues?: Array; + /** Specifies whether to include or exclude the records with the values selected in the column's header filter. */ + filterType?: string; + /** Indicates whether the column takes part in horizontal grid scrolling or is anchored to a grid edge. */ + fixed?: boolean; + /** Specifies the order according to which grid columns must be concealed when the widget adapts to the screen or container size. */ + hidingPriority?: number; + /** Specifies the grid edge to which the column is anchored. */ + fixedPosition?: string; + /** Specifies a format for the values displayed in a column. */ + format?: any; + /** Specifies a custom template for the group cell of a grid column. */ + groupCellTemplate?: any; + /** Specifies the index of a column when grid records are grouped by the values of this column. */ + groupIndex?: number; + /** Specifies a custom template for the header of a grid column. */ + headerCellTemplate?: any; + /** Specifies options of a lookup column. */ + lookup?: { + /** Specifies whether or not a user can nullify values of a lookup column. */ + allowClearing?: boolean; + /** Specifies the data source providing data for a lookup column. */ + dataSource?: any; + /** Specifies the expression defining the data source field whose values must be displayed. */ + displayExpr?: any; + /** Specifies the expression defining the data source field whose values must be replaced. */ + valueExpr?: string; + }; + /** Specifies column-level options for filtering using a column header filter. */ + headerFilter?: { + /** Specifies the data source to be used for the header filter. */ + dataSource?: any; + /** Specifies how header filter values should be combined into groups. */ + groupInterval?: any; + }; + /** + * Specifies a precision for formatted values displayed in a column. + * @deprecated Use the format | precision option instead. + */ + precision?: number; + /** Specifies the default filter operation of a column. */ + selectedFilterOperation?: string; + /** Specifies whether or not the column displays its values by using editors. */ + showEditorAlways?: boolean; + /** Specifies whether or not to display the column when grid records are grouped by it. */ + showWhenGrouped?: boolean; + /** Specifies the index of a column when grid records are sorted by the values of this column. */ + sortIndex?: number; + /** Specifies the initial sort order of column values. */ + sortOrder?: string; + /** In a boolean column, replaces all true items with a specified text. */ + trueText?: string; + /** Specifies whether a column is visible or not. */ + visible?: boolean; + /** Specifies the sequence number of the column in the grid. */ + visibleIndex?: number; + /** Specifies a column width in pixels or percentages. */ + width?: any; + /** Specifies an array of validation rules to be checked when updating column cell values. */ + validationRules?: Array; + /** Specifies whether or not to display the header of a hidden column in the column chooser. */ + showInColumnChooser?: boolean; + /** Specifies the identifier of the column. */ + name?: string; + /** The form item configuration object. Used only when the editing mode is "form". */ + formItem?: DevExpress.ui.dxFormItem; + /** An array of grid columns. */ + columns?: Array; + /** Specifies the band column that owns the current column. Accepts the index of the band column in the columns array. */ + ownerBand?: number; + /** Specifies whether the column bands other columns or not. */ + isBand?: boolean; + } + export interface dxDataGridOptions extends WidgetOptions { + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** Indicates whether to show the error row for the grid. */ + errorRowEnabled?: boolean; + /** A handler for the rowValidating event. */ + onRowValidating?: (e: Object) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** A handler for the initNewRow event. */ + onInitNewRow?: (e: { data: Object }) => void; + /** A handler for the rowInserted event. */ + onRowInserted?: (e: { data: Object; key: any }) => void; + /** A handler for the rowInserting event. */ + onRowInserting?: (e: { data: Object; cancel: any }) => void; + /** A handler for the rowRemoved event. */ + onRowRemoved?: (e: { data: Object; key: any }) => void; + /** A handler for the rowRemoving event. */ + onRowRemoving?: (e: { data: Object; key: any; cancel: any }) => void; + /** A handler for the rowUpdated event. */ + onRowUpdated?: (e: { data: Object; key: any }) => void; + /** A handler for the rowUpdating event. */ + onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: any }) => void; + /** Enables a hint that appears when a user hovers the mouse pointer over a cell with truncated content. */ + cellHintEnabled?: boolean; + /** Specifies whether or not the widget should hide columns in order to adapt to the screen or container size. */ + columnHidingEnabled?: boolean; + /** Specifies whether or not grid columns can be reordered by a user. */ + allowColumnReordering?: boolean; + /** Specifies whether or not grid columns can be resized by a user. */ + allowColumnResizing?: boolean; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the cellHoverChanged event. */ + onCellHoverChanged?: (e: Object) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: Object) => void; + /** A handler for the adaptiveDetailRowPreparing event. */ + onAdaptiveDetailRowPreparing?: (e: Object) => void; + /** Specifies whether or not the width of grid columns depends on column content. */ + columnAutoWidth?: boolean; + /** Specifies the options of a column chooser. */ + columnChooser?: { + /** Specifies text displayed by the column chooser panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether a user can invoke the column chooser or not. */ + enabled?: boolean; + /** Specifies how the end-user chooses columns. */ + mode?: string; + /** Specifies the height of the column chooser panel. */ + height?: number; + /** Specifies text displayed in the title of the column chooser panel. */ + title?: string; + /** Specifies the width of the column chooser panel. */ + width?: number; + }; + /** Specifies options for column fixing. */ + columnFixing?: { + /** Indicates if column fixing is enabled. */ + enabled?: boolean; + /** Contains options that specify texts for column-fixing related commands in the column header's context menu. */ + texts?: { + /** Specifies text for a context menu item that fixes the column for which the context menu is invoked. */ + fix?: string; + /** Specifies text for a context menu item that unfixes the column for which the context menu is invoked. */ + unfix?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the left grid edge. */ + leftPosition?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the right grid edge. */ + rightPosition?: string; + }; + }; + /** Specifies options for filtering using a column header filter. */ + headerFilter?: { + /** Indicates whether or not the column header filter button is visible. */ + visible?: boolean; + /** Specifies the height of the dropdown menu invoked when using a column header filter. */ + height?: number; + /** Specifies the width of the dropdown menu invoked when using a column header filter. */ + width?: number; + /** Contains options that specify texts for the dropdown menu invoked when you use a column header filter. */ + texts?: { + /** Specifies text for the item specifying an empty value in the column header filter's dropdown menu. */ + emptyValue?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu and applies specified filtering. */ + ok?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu without applying performed selection. */ + cancel?: string; + } + }; + /** An array of grid columns. */ + columns?: Array; + onContentReady?: Function; + /** Specifies a function that customizes grid columns after they are created. */ + customizeColumns?: (columns: Array) => void; + /** Customizes grid columns and data before exporting. */ + customizeExportData?: (columns: Array, rows: Array) => void; + /** Specifies a data source for the grid. */ + dataSource?: any; + /** Specifies whether or not to enable data caching. */ + cacheEnabled?: boolean; + /** A handler for the editingStart event. */ + onEditingStart?: (e: { + data: Object; + key: any; + cancel: boolean; + column: dxDataGridColumn + }) => void; + /** A handler for the editorPrepared event. */ + onEditorPrepared?: (e: Object) => void; + /** A handler for the editorPreparing event. */ + onEditorPreparing?: (e: Object) => void; + /** Contains options that specify how grid content can be changed. */ + editing?: { + editMode?: string; + editEnabled?: boolean; + insertEnabled?: boolean; + removeEnabled?: boolean; + /** Specifies how grid values can be edited manually. */ + mode?: string; + /** Specifies whether or not grid records can be edited at runtime. */ + allowUpdating?: boolean; + /** Specifies whether or not new grid records can be added at runtime. */ + allowAdding?: boolean; + /** Specifies whether or not grid records can be deleted at runtime. */ + allowDeleting?: boolean; + /** The form configuration object. Used only when the editing mode is "form". */ + form?: DevExpress.ui.dxFormOptions; + /** Contains options that specify texts for editing-related grid controls. */ + texts?: { + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Save" button. Setting this option makes sense only when the mode option is set to batch. */ + saveAllChanges?: string; + /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + cancelRowChanges?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Revert" button. Setting this option makes sense only when the mode option is set to batch. */ + cancelAllChanges?: string; + /** Specifies a message to be displayed by a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteMessage?: string; + /** Specifies text to be displayed in the title of a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteTitle?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Cancel changes" button. Setting this option makes sense only when the mode option is set to cell and the validation capabilities are enabled. */ + validationCancelChanges?: string; + /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the allowDeleting option is set to true. */ + deleteRow?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Add" button. Setting this option makes sense only when the allowAdding option is true. */ + addRow?: string; + /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + editRow?: string; + /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + saveRowChanges?: string; + /** Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the allowDeleting option is set to true. */ + undeleteRow?: string; + }; + }; + /** Specifies filter row options. */ + filterRow?: { + /** Specifies when to apply a filter. */ + applyFilter?: string; + /** Specifies text for the hint that pops up when a user hovers the mouse pointer over the "Apply Filter" button. */ + applyFilterText?: string; + /** Specifies descriptions for filter operations. */ + operationDescriptions?: { + "=": string; + "<>": string; + "<": string; + "<=": string; + ">": string; + ">=": string; + "startswith": string; + "contains": string; + "notcontains": string; + "endswith": string; + }; + /** Specifies text for the reset operation in a filter list. */ + resetOperationText?: string; + /** Specifies text for the operation of clearing the applied filter when a select box is used. */ + showAllText?: string; + /** Specifies text for the range start in the 'between' filter type. */ + betweenStartText?: string; + /** Specifies text for the range end in the 'between' filter type. */ + betweenEndText?: string; + /** Specifies whether or not an icon that allows the user to choose a filter operation is visible. */ + showOperationChooser?: boolean; + /** Specifies whether the filter row is visible or not. */ + visible?: boolean; + }; + /** Specifies grouping settings and the behavior of grouped grid records. */ + grouping?: { + /** Specifies whether the user can collapse grouped records in a grid or not. */ + allowCollapsing?: boolean; + /** Specifies whether groups appear expanded or not. */ + autoExpandAll?: boolean; + /** Enables the user to group data using the context menu. */ + contextMenuEnabled?: boolean; + /** Specifies the event on which a group will be expanded/collapsed. */ + expandMode?: string; + groupContinuedMessage?: string; + groupContinuesMessage?: string; + /** Defines the texts of grouping-related visual elements. */ + texts?: { + /** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */ + groupContinuedMessage?: string; + /** Specifies the message displayed in a group row when the corresponding group continues on the next page. */ + groupContinuesMessage?: string; + /** Specifies the text of the context menu item that groups data by a specific column. */ + groupByThisColumn?: string; + /** Specifies the text of the context menu item that clears grouping settings of a specific column. */ + ungroup?: string; + /** Specifies the text of the context menu item that clears grouping settings of all columns. */ + ungroupAll?: string; + } + }; + /** Configures the group panel. */ + groupPanel?: { + /** Specifies whether columns can be dragged onto or from the group panel. */ + allowColumnDragging?: boolean; + /** Specifies text displayed by the group panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether the group panel is visible or not. */ + visible?: any; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Specifies whether to show the load panel or not. */ + enabled?: any; + /** Specifies the height of the load panel in pixels. */ + height?: number; + /** Specifies a URL pointing to an image to be used as a loading indicator. */ + indicatorSrc?: string; + /** Specifies whether or not a loading indicator must be displayed on the load panel. */ + showIndicator?: boolean; + /** Specifies whether or not the pane of the load panel must be displayed. */ + showPane?: boolean; + /** Specifies text displayed by the load panel. */ + text?: string; + /** Specifies the width of the load panel in pixels. */ + width?: number; + }; + /** Specifies text displayed when a grid does not contain any records. */ + noDataText?: string; + /** Specifies the options of a grid pager. */ + pager?: { + /** Specifies the page sizes that can be selected at runtime. */ + allowedPageSizes?: any; + /** Specifies whether to show the page size selector or not. */ + showPageSizeSelector?: boolean; + /** Specifies whether to show the pager or not. */ + visible?: any; + /** Specifies the text accompanying the page navigator. */ + infoText?: string; + /** Specifies whether or not to display the text accompanying the page navigator. This text is specified by the infoText option. */ + showInfo?: boolean; + /** Specifies whether or not to display buttons that switch the grid to the previous or next page. */ + showNavigationButtons?: boolean; + }; + /** Specifies paging options. */ + paging?: { + /** Specifies whether dxDataGrid loads data page by page or all at once. */ + enabled?: boolean; + /** Specifies the grid page that should be displayed by default. */ + pageIndex?: number; + /** Specifies the size of grid pages. */ + pageSize?: number; + }; + /** Specifies whether or not grid rows must be shaded in a different way. */ + rowAlternationEnabled?: boolean; + /** Specifies whether to enable two-way data binding. */ + twoWayBindingEnabled?: boolean; + /** A handler for the rowClick event. */ + onRowClick?: any; + /** A handler for the rowPrepared event. */ + onRowPrepared?: (e: Object) => void; + /** Specifies a custom template for grid rows. */ + rowTemplate?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not a grid must preload pages adjacent to the current page when using virtual scrolling. */ + preloadEnabled?: boolean; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + /** Specifies the scrollbar display policy. */ + showScrollbar?: string; + /** Specifies whether or not the scrolling by content is enabled. */ + scrollByContent?: boolean; + /** Specifies whether or not the scrollbar thumb scrolling enabled. */ + scrollByThumb?: boolean; + }; + /** Specifies options of the search panel. */ + searchPanel?: { + /** Specifies whether or not search strings in the located grid records should be highlighted. */ + highlightSearchText?: boolean; + /** Specifies text displayed by the search panel when no search string was typed. */ + placeholder?: string; + /** Specifies whether the search panel is visible or not. */ + visible?: boolean; + /** Specifies whether to search all columns or only visible ones. */ + searchVisibleColumnsOnly?: boolean; + /** Specifies the width of the search panel in pixels. */ + width?: number; + /** Sets a search string for the search panel. */ + text?: string; + }; + /** Specifies the operations that must be performed on the server side. */ + remoteOperations?: any; + /** Allows you to sort groups according to the values of group summary items. */ + sortByGroupSummaryInfo?: Array<{ + /** Specifies the group summary item whose values must be used to sort groups. */ + summaryItem?: string; + /** Specifies the identifier of the column that must be used in grouping so that sorting by group summary item values be applied. */ + groupColumn?: string; + /** Specifies the sort order of group summary item values. */ + sortOrder?: string; + }>; + /** Allows you to build a master-detail interface in the grid. */ + masterDetail?: { + /** Enables an end-user to expand/collapse detail sections. */ + enabled?: boolean; + /** Specifies whether detail sections appear expanded or collapsed. */ + autoExpandAll?: boolean; + /** Specifies the template for detail sections. */ + template?: any; + }; + /** Configures client-side export. */ + export?: { + /** Enables the client-side export feature. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies whether to enable Excel filtering for the exported data in the resulting XLSX file. */ + excelFilterEnabled?: boolean; + /** Specifies whether to enable word wrapping for the exported data in the resulting XLSX file. */ + excelWrapTextEnabled?: boolean; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE9 and Safari browsers. */ + proxyUrl?: string; + /** Allows an end user to export selected rows only. */ + allowExportSelectedData?: boolean; + /** Contains options that specify texts for the export-related commands and hints. */ + texts?: { + /** Specifies the hint of the Export button when the allowExportSelectedData option is true. */ + exportTo?: string; + exportToExcel?: string; + excelFormat?: string; + selectedRows?: string; + /** Specifies the text of the command that exports all data. */ + exportAll?: string; + /** Specifies the text of the drop-down menu command that exports selected rows. */ + exportSelectedRows?: string; + } + }; + /** Specifies the keys of the records that must appear selected initially. */ + selectedRowKeys?: Array; + /** Specifies options of runtime selection. */ + selection?: { + /** Specifies the checkbox row display policy in the multiple mode. */ + showCheckBoxesMode?: string; + /** Specifies whether the user can select all grid records at once. */ + allowSelectAll?: boolean; + /** Specifies the selection mode. */ + mode?: string; + }; + /** A handler for the dataErrorOccured event. */ + onDataErrorOccurred?: (e: { error: Error }) => void; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + currentSelectedRowKeys: Array; + currentDeselectedRowKeys: Array; + selectedRowKeys: Array; + selectedRowsData: Array; + }) => void; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A handler for the keyDown event. */ + onKeyDown?: (e: Object) => void; + /** A handler for the rowExpanding event. */ + onRowExpanding?: (e: Object) => void; + /** A handler for the rowExpanded event. */ + onRowExpanded?: (e: Object) => void; + /** A handler for the rowCollapsing event. */ + onRowCollapsing?: (e: Object) => void; + /** A handler for the rowCollapsed event. */ + onRowCollapsed?: (e: Object) => void; + /** Specifies whether column headers are visible or not. */ + showColumnHeaders?: boolean; + /** Specifies whether or not vertical lines separating one grid column from another are visible. */ + showColumnLines?: boolean; + /** Specifies whether or not horizontal lines separating one grid row from another are visible. */ + showRowLines?: boolean; + /** Specifies options of runtime sorting. */ + sorting?: { + /** Specifies text for the context menu item that sets an ascending sort order in a column. */ + ascendingText?: string; + /** Specifies text for the context menu item that resets sorting settings for a column. */ + clearText?: string; + /** Specifies text for the context menu item that sets a descending sort order in a column. */ + descendingText?: string; + /** Specifies the runtime sorting mode. */ + mode?: string; + }; + /** Specifies options of state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (state: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + /** Specifies the options of the grid summary. */ + summary?: { + /** Contains options that specify text patterns for summary items. */ + texts?: { + /** Specifies a pattern for the 'sum' summary items when they are displayed in the parent column. */ + sum?: string; + /** Specifies a pattern for the 'sum' summary items displayed in a group row or in any other column rather than the parent one. */ + sumOtherColumn?: string; + /** Specifies a pattern for the 'min' summary items when they are displayed in the parent column. */ + min?: string; + /** Specifies a pattern for the 'min' summary items displayed in a group row or in any other column rather than the parent one. */ + minOtherColumn?: string; + /** Specifies a pattern for the 'max' summary items when they are displayed in the parent column. */ + max?: string; + /** Specifies a pattern for the 'max' summary items displayed in a group row or in any other column rather than the parent one. */ + maxOtherColumn?: string; + /** Specifies a pattern for the 'avg' summary items when they are displayed in the parent column. */ + avg?: string; + /** Specifies a pattern for the 'avg' summary items displayed in a group row or in any other column rather than the parent one. */ + avgOtherColumn?: string; + /** Specifies a pattern for the 'count' summary items. */ + count?: string; + }; + /** Specifies items of the group summary. */ + groupItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the column that provides data for a group summary item. */ + column?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** + * Specifies a precision for the summary item value of a numeric format. + * @deprecated Use the valueFormat | precision option instead. + */ + precision?: number; + /** Specifies whether or not a summary item must be displayed in the group footer. */ + showInGroupFooter?: boolean; + /** Indicates whether to display group summary items in parentheses after the group row header or to align them by the corresponding columns within the group row. */ + alignByColumn?: boolean; + /** Specifies the column that must hold the summary item when this item is displayed in the group footer or aligned by a column in the group row. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: any; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + }>; + /** Specifies items of the total summary. */ + totalItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the alignment of a summary item. */ + alignment?: string; + /** Specifies the column that provides data for a summary item. */ + column?: string; + /** Specifies a CSS class to be applied to a summary item. */ + cssClass?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** + * Specifies a precision for the summary item value of a numeric format. + * @deprecated Use the valueFormat | precision option instead. + */ + precision?: number; + /** Specifies the column that must hold the summary item. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: any; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + }>; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + /** Allows you to use a custom aggregate function to calculate the value of a summary item. */ + calculateCustomSummary?: (options: { + component: dxDataGrid; + name?: string; + value: any; + totalValue: any; + summaryProcess: string + }) => void; + }; + /** Specifies whether text that does not fit into a column should be wrapped. */ + wordWrapEnabled?: boolean; + } + /** A data grid widget. */ + export class dxDataGrid extends Widget { + constructor(element: JQuery, options?: dxDataGridOptions); + constructor(element: Element, options?: dxDataGridOptions); + /** Ungroups grid records. */ + clearGrouping(): void; + /** Clears sorting settings of all grid columns at once. */ + clearSorting(): void; + /** Allows you to obtain a cell by its row index and the data field of its column. */ + getCellElement(rowIndex: number, dataField: string): any; + /** Allows you to obtain a cell by its row index and the visible index of its column. */ + getCellElement(rowIndex: number, visibleColumnIndex: number): any; + /** Returns the current state of the grid. */ + state(): Object; + /** Sets the grid state. */ + state(state: Object): void; + /** Allows you to obtain the row index by a data key. */ + getRowIndexByKey(key: any): number; + /** Allows you to obtain the data key by a row index. */ + getKeyByRowIndex(rowIndex: number): any; + /** Adds a new column to a grid. */ + addColumn(columnOptions: dxDataGridColumn): void; + /** Removes the column from the grid. */ + deleteColumn(id: any): void; + /** Displays the load panel. */ + beginCustomLoading(messageText: string): void; + /** Discards changes made in a grid. */ + cancelEditData(): void; + /** Checks whether or not the grid contains unsaved changes. */ + hasEditData(): boolean; + /** Clears all the filters of a specific type applied to grid records. */ + clearFilter(): void; + /** Deselects all grid records. */ + clearSelection(): void; + /** Draws the cell being edited from the editing state. Use this method when the edit mode is batch. */ + closeEditCell(): void; + /** Collapses groups or master rows in a grid. */ + collapseAll(groupIndex?: number): void; + /** Returns the number of data columns in a grid. */ + columnCount(): number; + /** Returns the value of a specific column option. */ + columnOption(id: any, optionName: string): any; + /** Sets an option of a specific column. */ + columnOption(id: any, optionName: string, optionValue: any): void; + /** Returns the options of a column by an identifier. */ + columnOption(id: any): Object; + /** Sets several options of a column at once. */ + columnOption(id: any, options: Object): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, visibleColumnIndex: number): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, dataField: string): void; + /** Sets a specific row into the editing state. */ + editRow(rowIndex: number): void; + /** Gets the cell value. */ + cellValue(rowIndex: number, dataField: string): any; + /** Gets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number): any; + /** Sets the cell value. */ + cellValue(rowIndex: number, dataField: string, value: any): void; + /** Sets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number, value: any): void; + /** Hides the load panel. */ + endCustomLoading(): void; + /** Expands groups or master rows in a grid. */ + expandAll(groupIndex: number): void; + /** Allows you to find out whether a specific group or master row is expanded or collapsed. */ + isRowExpanded(key: any): boolean; + /** Allows you to expand a specific group or master row by its key. */ + expandRow(key: any): void; + /** Allows you to collapse a specific group or master row by its key. */ + collapseRow(key: any): void; + /** Checks whether a specific adaptive detail row is expanded or collapsed. */ + isAdaptiveDetailRowExpanded(key: any): void; + /** Expands an adaptive detail row by the key of its parent data row. */ + expandAdaptiveDetailRow(key: any): void; + /** Collapses the currently expanded adaptive detail row (if there is one). */ + collapseAdaptiveDetailRow(): void; + /** Applies a filter to the grid's data source. */ + filter(filterExpr?: any): void; + /** Returns a filter expression applied to the grid's data source using the filter(filterExpr) method. */ + filter(): any; + /** Returns a filter expression applied to the grid using all possible scenarious. */ + getCombinedFilter(): any; + /** Gets the keys of currently selected grid records. */ + getSelectedRowKeys(): Array; + /** Gets the data objects of currently selected grid records. */ + getSelectedRowsData(): Array; + /** Hides the column chooser panel. */ + hideColumnChooser(): void; + /** Adds a new data row to a grid. */ + addRow(): void; + /** + * Adds a new data row to a grid. + * @deprecated Use the addRow() method instead. + */ + insertRow(): void; + /** Returns the key corresponding to the passed data object. */ + keyOf(obj: Object): any; + /** Switches a grid to a specified page. */ + pageIndex(newIndex: number): void; + /** Gets the index of the current page. */ + pageIndex(): number; + /** Sets the page size. */ + pageSize(value: number): void; + /** Gets the current page size. */ + pageSize(): number; + /** Refreshes grid data. */ + refresh(): JQueryPromise; + /** Removes a specific row from a grid. */ + deleteRow(rowIndex: number): void; + /** + * Removes a specific row from a grid. + * @deprecated Use the deleteRow(rowIndex) method instead. + */ + removeRow(rowIndex: number): void; + /** Saves changes made in a grid. */ + saveEditData(): JQueryPromise; + /** Searches grid records by a search string. */ + searchByText(text: string): void; + /** Selects all grid records. */ + selectAll(): void; + /** Deselects the rows that are currently selected within the applied filter. */ + deselectAll(): void; + /** Selects specific grid records. */ + selectRows(keys: Array, preserve: boolean): void; + /** Deselects specific grid records. */ + deselectRows(keys: Array): void; + /** Selects grid rows by indexes. */ + selectRowsByIndexes(indexes: Array): void; + /** Allows you to find out whether a row is selected or not. */ + isRowSelected(key: any): boolean; + /** Invokes the column chooser panel. */ + showColumnChooser(): void; + startSelectionWithCheckboxes(): boolean; + /** Returns how many pages the grid contains. */ + pageCount(): number; + /** Returns the number of records currently held by a grid. */ + totalCount(): number; + /** Recovers a row deleted in the batch edit mode. */ + undeleteRow(rowIndex: number): void; + /** Allows you to obtain a data object by its key. */ + byKey(key: any): JQueryPromise; + /** Gets the value of a total summary item. */ + getTotalSummaryValue(summaryItemName: string): any; + /** Exports grid data to Excel. */ + exportToExcel(selectionOnly: boolean): void; + /** Updates the grid to the size of its content. */ + updateDimensions(): void; + /** Focuses the specified cell element in the grid. */ + focus(element?: JQuery): void; + } + export interface dxPivotGridOptions extends WidgetOptions { + onContentReady?: Function; + /** Specifies a data source for the pivot grid. */ + dataSource?: any; + useNativeScrolling?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + }; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Specifies the area to which data field headers must belong. */ + dataFieldArea?: string; + /** Configures the field panel. */ + fieldPanel?: { + /** Makes fields on the field panel draggable. */ + allowFieldDragging?: boolean; + /** Shows/hides filter fields on the field panel. */ + showFilterFields?: boolean; + /** Shows/hides data fields on the field panel. */ + showDataFields?: boolean; + /** Shows/hides column fields on the field panel. */ + showColumnFields?: boolean; + /** Shows/hides row fields on the field panel. */ + showRowFields?: boolean; + /** Shows/hides the field panel. */ + visible?: boolean; + /** Specifies the placeholders of the field areas. */ + texts?: { + /** Specifies the placeholder of the column field area. */ + columnFieldArea?: string; + /** Specifies the placeholder of the row field area. */ + rowFieldArea?: string; + /** Specifies the placeholder of the filter field area. */ + filterFieldArea?: string; + /** Specifies the placeholder of the data field area. */ + dataFieldArea?: string; + } + } + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies whether long text in header items should be wrapped. */ + wordWrapEnabled?: boolean; + /** Specifies whether to display the Total rows. */ + showRowTotals?: boolean; + /** Specifies whether to display the Grand Total row. */ + showRowGrandTotals?: boolean; + /** Specifies whether to display the Total columns. */ + showColumnTotals?: boolean; + /** Specifies whether to display the Grand Total column. */ + showColumnGrandTotals?: boolean; + /** Specifies whether or not to hide rows and columns with no data. */ + hideEmptySummaryCells?: boolean; + /** Specifies where to show the total rows or columns. */ + showTotalsPrior?: string; + /** Specifies the layout of items in the row header. */ + rowHeaderLayout?: string; + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** The Field Chooser configuration options. */ + fieldChooser?: { + /** Enables or disables the field chooser. */ + enabled?: boolean; + /** Specifies the field chooser layout. */ + layout?: number; + /** Specifies the text to display as a title of the field chooser popup window. */ + title?: string; + /** Specifies the field chooser width. */ + width?: number; + /** Specifies the field chooser height. */ + height?: number; + /** Strings that can be changed or localized in the pivot grid's integrated Field Chooser. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** Strings that can be changed or localized in the dxPivotGrid widget. */ + texts?: { + /** The string to display as a header of the Grand Total row and column. */ + grandTotal?: string; + /** The string to display as a header of the Total row and column. */ + total?: string; + /** Specifies the text displayed when a pivot grid does not contain any fields. */ + noData?: string; + /** The string to display as a Show Field Chooser context menu item. */ + showFieldChooser?: string; + /** The string to display as an Expand All context menu item. */ + expandAll?: string; + /** The string to display as a Collapse All context menu item. */ + collapseAll?: string; + /** The string to display as a Sort Column by Summary Value context menu item. */ + sortColumnBySummary?: string; + /** The string to display as a Sort Row by Summary Value context menu item. */ + sortRowBySummary?: string; + /** The string to display as a Remove All Sorting context menu item. */ + removeAllSorting?: string; + /** The string to display as an Export to Excel file context menu item. */ + exportToExcel?: string; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Enables or disables the load panel. */ + enabled?: boolean; + /** Specifies the height of the load panel. */ + height?: number; + /** Specifies the URL pointing to an image that will be used as a load indicator. */ + indicatorSrc?: string; + /** Specifies whether or not to show a load indicator. */ + showIndicator?: boolean; + /** Specifies whether or not to show load panel background. */ + showPane?: boolean; + /** Specifies the text to display inside a load panel. */ + text?: string; + /** Specifies the width of the load panel. */ + width?: number; + }; + /** A handler for the cellClick event. */ + onCellClick?: (e: any) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: any) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** Configures client-side export. */ + export?: { + /** Enables client-side export. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE9 and Safari browsers. */ + proxyUrl?: string; + }; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A configuration object specifying options related to state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (gridState: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + } + /** A data summarization widget for multi-dimensional data analysis and data mining. */ + export class dxPivotGrid extends Widget { + constructor(element: JQuery, options?: dxPivotGridOptions); + constructor(element: Element, options?: dxPivotGridOptions); + /** Gets the PivotGridDataSource instance. */ + getDataSource(): DevExpress.data.PivotGridDataSource; + /** Gets the dxPopup instance of the field chooser window. */ + getFieldChooserPopup(): DevExpress.ui.dxPopup; + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + /** Exports pivot grid data to the Excel file. */ + exportToExcel(): void; + /** Binds a dxChart to the dxPivotGrid. */ + bindChart(chart: any, integrationOptions?: { + inverted?: boolean; + dataFieldsDisplayMode?: string; + putDataFieldsInto?: string; + alternateDataFields?: boolean; + processCell?: Function; + customizeChart?: Function; + customizeSeries?: Function; + }): any; + } + export interface dxPivotGridFieldChooserOptions extends WidgetOptions { + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the field chooser layout. */ + layout?: number; + /** The data source of a dxPivotGrid widget. */ + dataSource?: DevExpress.data.PivotGridDataSource; + onContentReady?: Function; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** Strings that can be changed or localized in the dxPivotGridFieldChooser widget. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** A complementary widget for dxPivotGrid that allows you to manage data displayed in the dxPivotGrid. */ + export class dxPivotGridFieldChooser extends Widget { + constructor(element: JQuery, options?: dxPivotGridFieldChooserOptions); + constructor(element: Element, options?: dxPivotGridFieldChooserOptions); + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + /** Gets the PivotGridDataSource instance. */ + getDataSource(): DevExpress.data.PivotGridDataSource; + } +} +interface JQuery { + dxTreeView(): JQuery; + dxTreeView(options: "instance"): DevExpress.ui.dxTreeView; + dxTreeView(options: string): any; + dxTreeView(options: string, ...params: any[]): any; + dxTreeView(options: DevExpress.ui.dxTreeViewOptions): JQuery; + dxMenuBase(): JQuery; + dxMenuBase(options: "instance"): DevExpress.ui.dxMenuBase; + dxMenuBase(options: string): any; + dxMenuBase(options: string, ...params: any[]): any; + dxMenuBase(options: DevExpress.ui.dxMenuBaseOptions): JQuery; + dxMenu(): JQuery; + dxMenu(options: "instance"): DevExpress.ui.dxMenu; + dxMenu(options: string): any; + dxMenu(options: string, ...params: any[]): any; + dxMenu(options: DevExpress.ui.dxMenuOptions): JQuery; + dxContextMenu(): JQuery; + dxContextMenu(options: "instance"): DevExpress.ui.dxContextMenu; + dxContextMenu(options: string): any; + dxContextMenu(options: string, ...params: any[]): any; + dxContextMenu(options: DevExpress.ui.dxContextMenuOptions): JQuery; + dxColorBox(): JQuery; + dxColorBox(options: "instance"): DevExpress.ui.dxColorBox; + dxColorBox(options: string): any; + dxColorBox(options: string, ...params: any[]): any; + dxColorBox(options: DevExpress.ui.dxColorBoxOptions): JQuery; + dxDataGrid(): JQuery; + dxDataGrid(options: "instance"): DevExpress.ui.dxDataGrid; + dxDataGrid(options: string): any; + dxDataGrid(options: string, ...params: any[]): any; + dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; + dxPivotGrid(): JQuery; + dxPivotGrid(options: "instance"): DevExpress.ui.dxPivotGrid; + dxPivotGrid(options: string): any; + dxPivotGrid(options: string, ...params: any[]): any; + dxPivotGrid(options: DevExpress.ui.dxPivotGridOptions): JQuery; + dxPivotGridFieldChooser(): JQuery; + dxPivotGridFieldChooser(options: "instance"): DevExpress.ui.dxPivotGridFieldChooser; + dxPivotGridFieldChooser(options: string): any; + dxPivotGridFieldChooser(options: string, ...params: any[]): any; + dxPivotGridFieldChooser(options: DevExpress.ui.dxPivotGridFieldChooserOptions): JQuery; + dxScheduler(): JQuery; + dxScheduler(options: "instance"): DevExpress.ui.dxScheduler; + dxScheduler(options: string): any; + dxScheduler(options: string, ...params: any[]): any; + dxScheduler(options: DevExpress.ui.dxSchedulerOptions): JQuery; +} +declare module DevExpress.framework { + /** An object used to store information on the views displayed in an application. */ + export class ViewCache { + viewRemoved: JQueryCallback; + /** Removes all the viewInfo objects from the cache. */ + clear(): void; + /** Obtains a viewInfo object from the cache by the specified key. */ + getView(key: string): Object; + /** Checks whether or not a viewInfo object is contained in the view cache under the specified key. */ + hasView(key: string): boolean; + /** Removes a viewInfo object from the cache by the specified key. */ + removeView(key: string): Object; + /** Adds the specified viewInfo object to the cache under the specified key. */ + setView(key: string, viewInfo: Object): void; + } + export interface dxCommandOptions extends DOMComponentOptions { + /** Specifies an action performed when the execute() method of the command is called. */ + onExecute?: any; + /** Indicates whether or not the widget that displays this command is disabled. */ + disabled?: boolean; + /** Specifies whether the current command is rendered when a view is being rendered or after a view is shown. */ + renderStage?: string; + /** Specifies the name of the icon shown inside the widget associated with this command. */ + icon?: string; + iconSrc?: string; + /** The identifier of the command. */ + id?: string; + /** Specifies the title of the widget associated with this command. */ + title?: string; + /** Specifies the type of the button, if the command is rendered as a dxButton widget. */ + type?: string; + /** A Boolean value specifying whether or not the widget associated with this command is visible. */ + visible?: boolean; + } + /** A markup component used to define markup options for a command. */ + export class dxCommand extends DOMComponent { + constructor(element: JQuery, options: dxCommandOptions); + constructor(options: dxCommandOptions); + /** Executes the action associated with this command. */ + execute(): void; + } + /** An object responsible for routing. */ + export class Router { + /** Adds a routing rule to the list of registered rules. */ + register(pattern: string, defaults?: Object, constraints?: Object): void; + /** Decodes the specified URI to an object using the registered routing rules. */ + parse(uri: string): Object; + /** Formats an object to a URI. */ + format(obj: Object): string; + } + export interface StateManagerOptions { + /** A storage to which the state manager saves the application state. */ + storage?: Object; + } + /** An object used to store the current application state. */ + export class StateManager { + constructor(options?: StateManagerOptions); + /** Adds an object that implements an interface of a state source to the state manager's collection of state sources. */ + addStateSource(stateSource: Object): void; + /** Removes a specified state source from the state manager's collection of state sources. */ + removeStateSource(stateSource: Object): void; + /** Saves the current application state. */ + saveState(): void; + /** Restores the application state that has been saved by the saveState() method to the state storage. */ + restoreState(): void; + /** Removes the application state that has been saved by the saveState() method to the state storage. */ + clearState(): void; + } + export module html { + export var layoutSets: Array; + export var animationSets: { [animationSetName: string]: AnimationSet }; + export interface AnimationSet { + [animationName: string]: any + } + export interface HtmlApplicationOptions { + /** Specifies where the commands that are defined in the application's views must be displayed. */ + commandMapping?: Object; + /** Specifies whether or not view caching is disabled. */ + disableViewCache?: boolean; + /** An array of layout controllers that should be used to show application views in the current navigation context. */ + layoutSet?: any; + /** Specifies the animation presets that are used to animate different UI elements in the current application. */ + animationSet?: AnimationSet; + /** Specifies whether the current application must behave as a mobile or web application. */ + mode?: string; + /** Specifies the object that represents a root namespace of the application. */ + namespace?: Object; + /** Specifies application behavior when the user navigates to a root view. */ + navigateToRootViewMode?: string; + /** An array of dxCommand configuration objects used to define commands available from the application's global navigation. */ + navigation?: Array; + /** A state manager to be used in the application. */ + stateManager?: StateManager; + /** Specifies the storage to be used by the application's state manager to store the application state. */ + stateStorage?: Object; + /** Indicates whether on not to use the title of the previously displayed view as text on the Back button. */ + useViewTitleAsBackText?: boolean; + /** A custom view cache to be used in the application. */ + viewCache?: Object; + /** Specifies a limit for the views that can be cached. */ + viewCacheSize?: number; + /** Specifies the current version of application templates. */ + templatesVersion?: string; + /** Specifies options for the viewport meta tag of a mobile browser. */ + viewPort?: JQuery; + /** A custom router to be used in the application. */ + router?: Router; + } + /** An object used to manage views, as well as control the application life cycle. */ + export class HtmlApplication implements EventsMixin { + constructor(options: HtmlApplicationOptions); + afterViewSetup: JQueryCallback; + beforeViewSetup: JQueryCallback; + initialized: JQueryCallback; + navigating: JQueryCallback; + navigatingBack: JQueryCallback; + resolveLayoutController: JQueryCallback; + resolveViewCacheKey: JQueryCallback; + viewDisposed: JQueryCallback; + viewDisposing: JQueryCallback; + viewHidden: JQueryCallback; + viewRendered: JQueryCallback; + viewShowing: JQueryCallback; + viewShown: JQueryCallback; + /** Provides access to the ViewCache object. */ + viewCache: ViewCache; + /** An array of dxCommand components that are created based on the application's navigation option value. */ + navigation: Array; + /** Provides access to the StateManager object. */ + stateManager: StateManager; + /** Provides access to the Router object. */ + router: Router; + /** Navigates to the URI preceding the current one in the navigation history. */ + back(): void; + /** Returns a Boolean value indicating whether or not backwards navigation is currently possible. */ + canBack(): boolean; + /** Calls the clearState() method of the application's StateManager object. */ + clearState(): void; + /** Creates global navigation commands. */ + createNavigation(navigationConfig: Array): void; + /** Returns an HTML template of the specified view. */ + getViewTemplate(viewName: string): JQuery; + /** Returns a configuration object used to create a dxView component for a specified view. */ + getViewTemplateInfo(viewName: string): Object; + /** Adds a specified HTML template to a collection of view or layout templates. */ + loadTemplates(source: any): JQueryPromise; + /** Navigates to the specified URI. */ + navigate(uri?: any, options?: Object): void; + /** Renders navigation commands to the navigation command containers that are located in the layouts used in the application. */ + renderNavigation(): void; + /** Calls the restoreState() method of the application's StateManager object. */ + restoreState(): void; + /** Calls the saveState method of the application's StateManager object. */ + saveState(): void; + /** Provides access to the object that defines the current context to be considered when choosing an appropriate template for a view. */ + templateContext(): Object; + on(eventName: "initialized", eventHandler: () => void): HtmlApplication; + on(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + on(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + on(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + on(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: string, eventHandler: Function): HtmlApplication; + on(events: { [eventName: string]: Function; }): HtmlApplication; + off(eventName: "initialized"): HtmlApplication; + off(eventName: "afterViewSetup"): HtmlApplication; + off(eventName: "beforeViewSetup"): HtmlApplication; + off(eventName: "navigating"): HtmlApplication; + off(eventName: "navigatingBack"): HtmlApplication; + off(eventName: "resolveLayoutController"): HtmlApplication; + off(eventName: "resolveViewCacheKey"): HtmlApplication; + off(eventName: "viewDisposed"): HtmlApplication; + off(eventName: "viewDisposing"): HtmlApplication; + off(eventName: "viewHidden"): HtmlApplication; + off(eventName: "viewRendered"): HtmlApplication; + off(eventName: "viewShowing"): HtmlApplication; + off(eventName: "viewShown"): HtmlApplication; + off(eventName: string): HtmlApplication; + off(eventName: "initialized", eventHandler: () => void): HtmlApplication; + off(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + off(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + off(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + off(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: string, eventHandler: Function): HtmlApplication; + } + } +} +declare module DevExpress.viz.core { + export interface Border { + /** Sets a border color for a selected series. */ + color?: string; + /** Sets border visibility for a selected series. */ + visible?: boolean; + /** Sets a border width for a selected series. */ + width?: number; + } + export interface DashedBorder extends Border { + /** Specifies a dash style for the border of a selected series point. */ + dashStyle?: string; + } + export interface DashedBorderWithOpacity extends DashedBorder { + /** Specifies how transparent the vertical crosshair line should be. */ + opacity?: number; + } + export interface Font { + /** Colors the text displayed by the group labels. */ + color?: string; + /** Specifies the font family of the text displayed by the group labels. */ + family?: string; + /** Specifies how transparent the text displayed by the group labels should be. */ + opacity?: number; + /** Specifies the size of the text displayed by the group labels. */ + size?: any; + /** Specifies the font weight of the text displayed by the group labels. */ + weight?: number; + } + export interface Hatching { + direction?: string; + /** Specifies the opacity of hatching lines. */ + opacity?: number; + /** Specifies the distance between hatching lines in pixels. */ + step?: number; + /** Specifies the width of hatching lines in pixels. */ + width?: number; + } + export interface Margins { + /** Specifies the legend's bottom margin in pixels. */ + bottom?: number; + /** Specifies the legend's left margin in pixels. */ + left?: number; + /** Specifies the legend's right margin in pixels. */ + right?: number; + /** Specifies the legend's bottom margin in pixels. */ + top?: number; + } + export interface MarginOptions { + /** Generates space around the widget. */ + margin?: Margins; + } + export interface RedrawOnResizeOptions { + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + } + export interface TitleOptions { + /** Specifies the widget title. */ + title?: Title; + } + export interface ExportOptions { + /** Configures the exporting and printing features. */ + export?: Export; + } + export interface LoadingIndicatorOptions { + /** Configures the loading indicator. */ + loadingIndicator?: LoadingIndicator; + } + export interface LoadingIndicatorMethods { + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + } + export interface Size { + /** Specifies the width of the widget in pixels. */ + width?: number; + /** Specifies the height of the widget in pixels. */ + height?: number; + } + export interface Title { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies the title's alignment in a horizontal direction. */ + horizontalAlignment?: string; + /** Specifies the title's alignment in a vertical direction. */ + verticalAlignment?: string; + /** Generates space around the title. */ + margin?: Margins; + /** Specifies the minimum height that the title occupies. */ + placeholderSize?: number; + /** Specifies the title text. */ + text?: string; + /** Specifies the widget subtitle. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } + } + export interface Export { + /** Enables the client-side exporting in the widget. */ + enabled?: boolean; + /** Enables the printing feature in the widget. Applies only if the export | enabled option is true. */ + printingEnabled?: boolean; + /** Specifies a set of formats available for exporting into. */ + formats?: Array; + /** Specifies a default name for the file to which the widget will be exported. */ + fileName?: string; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable exporting in IE9 and Safari browsers. */ + proxyUrl?: string; + /** Specifies the color that will fill transparent regions in the resulting file or document. */ + backgroundColor?: string; + } + export interface Tooltip { + /** Specifies the length of the tooltip's arrow in pixels. */ + arrowLength?: number; + /** Specifies the appearance of the tooltip's border. */ + border?: DashedBorderWithOpacity; + /** Specifies the color of tooltips. */ + color?: string; + /** Specifies the z-index of tooltips. */ + zIndex?: number; + /** Specifies the container to draw tooltips inside of it. */ + container?: any; + /** Allows you to change tooltip appearance. */ + customizeTooltip?: (arg: Object) => { color?: string; text?: string }; + enabled?: boolean; + /** Specifies the font of the text displayed by a tooltip. */ + font?: Font; + /** Specifies the format of the value displayed by a tooltip. */ + format?: any; + /** Specifies the opacity of tooltips. */ + opacity?: number; + /** Generates space on the left and the right of the text displayed by a tooltip. */ + paddingLeftRight?: number; + /** Generates space above and below the text displayed by a tooltip. */ + paddingTopBottom?: number; + /** + * Specifies the precision of formatted values in a tooltip. + * @deprecated Use the tooltip | format | precision option instead. + */ + precision?: number; + /** Specifies the appearance of the tooltip's shadow. */ + shadow?: { + /** Specifies the blur distance of the tooltip's shadow. */ + blur?: number; + /** Specifies the color of the tooltip's shadow. */ + color?: string; + /** Specifies the horizontal offset of the tooltip's shadow relative to the tooltip itself measured in pixels. */ + offsetX?: number; + /** Specifies the vertical offset of the tooltip's shadow relative to the tooltip itself measured in pixels. */ + offsetY?: number; + /** Specifies the opacity of the tooltip's shadow. */ + opacity?: number; + }; + } + export interface Animation { + /** Determines how long animation runs. */ + duration?: number; + /** Specifies the animation easing mode. */ + easing?: string; + /** Indicates whether or not animation is enabled. */ + enabled?: boolean; + } + export interface LoadingIndicator { + /** Colors the background of the loading indicator. */ + backgroundColor?: string; + /** Specifies font options for the loading indicator. */ + font?: viz.core.Font; + /** Specifies whether to show the loading indicator or not. */ + show?: boolean; + /** Specifies the text to be displayed by the loading indicator. */ + text?: string; + } + export interface LegendBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies a radius for the corners of the legend border. */ + cornerRadius?: number; + } + export interface BaseLegend { + /** Specifies the color of the legend's background. */ + backgroundColor?: string; + /** Specifies legend border settings. */ + border?: viz.core.LegendBorder; + /** Specifies how many columns must be taken to arrange legend items. */ + columnCount?: number; + /** Specifies the spacing between a pair of neighboring legend columns in pixels. */ + columnItemSpacing?: number; + /** Specifies font options for legend items. */ + font?: viz.core.Font; + /** Specifies the legend's position on the map. */ + horizontalAlignment?: string; + /** Specifies the alignment of legend items. */ + itemsAlignment?: string; + /** Specifies the position of text relative to the item marker. */ + itemTextPosition?: string; + /** Specifies the distance between the legend and the container borders in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of item markers in the legend in pixels. */ + markerSize?: number; + /** Specifies whether to arrange legend items horizontally or vertically. */ + orientation?: string; + /** Specifies the spacing between the legend left/right border and legend items in pixels. */ + paddingLeftRight?: number; + /** Specifies the spacing between the legend top/bottom border and legend items in pixels. */ + paddingTopBottom?: number; + /** Specifies how many rows must be taken to arrange legend items. */ + rowCount?: number; + /** Specifies the spacing between a pair of neighboring legend rows in pixels. */ + rowItemSpacing?: number; + /** Specifies the legend's position on the map. */ + verticalAlignment?: string; + /** Specifies whether or not the legend is visible on the map. */ + visible?: boolean; + } + export interface BaseWidgetOptions extends DOMComponentOptions { + /** Specifies the size of the widget in pixels. */ + size?: Size; + /** A handler for the drawn event. */ + onDrawn?: (e: { + component: BaseWidget; + element: Element; + }) => void; + /** A handler for the incidentOccurred event. */ + onIncidentOccurred?: ( + component: BaseWidget, + element: Element, + target: { + id: string; + type: string; + args: any; + text: string; + widget: string; + version: string; + } + ) => void; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */ + pathModified?: boolean; + /** Specifies whether or not the widget supports right-to-left representation. */ + rtlEnabled?: boolean; + /** Sets the name of the theme to be used in the widget. */ + theme?: string; + } + /** This section describes options and methods that are common to all widgets. */ + export class BaseWidget extends DOMComponent { + /** Returns the widget's SVG markup. */ + svg(): string; + /** Exports the widget into a document with a specified name and format. */ + exportTo(): void; + /** Opens the browser's print window. */ + print(): void; + /** Redraws the widget. */ + render(): void; + } +} +declare module DevExpress.viz { + /** + * Applies a theme for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. + */ + export function currentTheme(theme: string): void; + /** + * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. + */ + export function currentTheme(platform: string, colorScheme: string): void; + /** + * Registers a new theme based on the existing one. + * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. + */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** + * Applies a predefined or registered custom palette to all visualization widgets at once. + * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. + */ + export function currentPalette(paletteName: string): void; + /** + * Obtains the color sets of a predefined or registered palette. + * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. + */ + export function getPalette(paletteName: string): Object; + /** + * Registers a new palette. + * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. + */ + export function registerPalette(paletteName: string, palette: Object): void; +} +declare module DevExpress.viz.charts { + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface BaseSeries { + /** Provides information about the state of the series object. */ + fullState: number; + /** Returns the type of the series. */ + type: string; + /** Unselects all the selected points of the series. The points are displayed in an initial style. */ + clearSelection(): void; + /** Gets the color of a particular series. */ + getColor(): string; + /** Gets points from the series point collection based on the specified argument. */ + getPointsByArg(pointArg: any): Array; + /** Gets a point from the series point collection based on the specified point position. */ + getPointByPos(positionIndex: number): Object; + /** Selects the series. The series is displayed in a 'selected' style until another series is selected or the current series is deselected programmatically. */ + select(): void; + /** Selects the specified point. The point is displayed in a 'selected' style. */ + selectPoint(point: BasePoint): void; + /** Deselects the specified point. The point is displayed in an initial style. */ + deselectPoint(point: BasePoint): void; + /** Returns an array of all points in the series. */ + getAllPoints(): Array; + /** Returns visible series points. */ + getVisiblePoints(): Array; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): boolean; + /** Provides information about the selection state of a series. */ + isSelected(): boolean; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface BasePoint { + /** Provides information about the state of the point object. */ + fullState: number; + /** Returns the point's argument value that was set in the data source. */ + originalArgument: any; + /** Returns the point's value that was set in the data source. */ + originalValue: any; + /** Returns the tag of the point. */ + tag: string; + /** Deselects the point. */ + clearSelection(): void; + /** Gets the color of a particular point. */ + getColor(): string; + /** Hides the tooltip of the point. */ + hideTooltip(): void; + /** Provides information about the hover state of a point. */ + isHovered(): boolean; + /** Provides information about the selection state of a point. */ + isSelected(): boolean; + /** Selects the point. The point is displayed in a 'selected' style until another point is selected or the current point is deselected programmatically. */ + select(): void; + /** Shows the tooltip of the point. */ + showTooltip(): void; + /** Allows you to obtain the label of a series point. */ + getLabel(): any; + /** Returns the series object to which the point belongs. */ + series: BaseSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface ChartSeries extends BaseSeries { + /** Returns the name of the series pane. */ + pane: string; + /** Returns the name of the value axis of the series. */ + axis: string; + selectPoint(point: ChartPoint): void; + deselectPoint(point: ChartPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface ChartPoint extends BasePoint { + /** Contains the close value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalCloseValue: any; + /** Contains the high value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalHighValue: any; + /** Contains the low value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalLowValue: any; + /** Contains the first value of the point. This field is useful for points belonging to a series of the range area or range bar type only. */ + originalMinValue: any; + /** Contains the open value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalOpenValue: any; + /** Contains the size of the bubble as it was set in the data source. This field is useful for points belonging to a series of the bubble type only. */ + size: any; + /** Gets the parameters of the point's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + series: ChartSeries; + } + /** This section describes the methods that can be used in code to manipulate the Label object. */ + export interface Label { + /** Gets the parameters of the label's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + /** Hides the point label. */ + hide(): void; + /** Shows the point label. */ + show(): void; + } + export interface PieSeries extends BaseSeries { + selectPoint(point: PiePoint): void; + deselectPoint(point: PiePoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PiePoint extends BasePoint { + /** Gets the percentage value of the specific point. */ + percent: any; + /** Provides information about the visibility state of a point. */ + isVisible(): boolean; + /** Makes a specific point visible. */ + show(): void; + /** Hides a specific point. */ + hide(): void; + series: PieSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface PolarSeries extends BaseSeries { + /** Returns the name of the value axis of the series. */ + axis: string; + selectPoint(point: PolarPoint): void; + deselectPoint(point: PolarPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PolarPoint extends BasePoint { + series: PolarSeries; + } + export interface Strip { + /** Specifies a color for a strip. */ + color?: string; + /** An object that defines the label configuration options of a strip. */ + label?: { + /** Specifies the text displayed in a strip. */ + text?: string; + }; + /** Specifies a start value for a strip. */ + startValue?: any; + /** Specifies an end value for a strip. */ + endValue?: any; + } + export interface BaseSeriesConfigLabel { + /** Specifies a format for arguments displayed by point labels. */ + argumentFormat?: any; + /** + * Specifies a precision for formatted point arguments displayed in point labels. + * @deprecated Use the series | label | argumentFormat | precision instead. + */ + argumentPrecision?: number; + /** Specifies a background color for point labels. */ + backgroundColor?: string; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies connector options for series point labels. */ + connector?: { + /** Specifies the color of label connectors. */ + color?: string; + /** Indicates whether or not label connectors are visible. */ + visible?: boolean; + /** Specifies the width of label connectors. */ + width?: number; + }; + /** Specifies a callback function that returns the text to be displayed by point labels. */ + customizeText?: (pointInfo: Object) => string; + /** Specifies font options for the text displayed in point labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed by point labels. */ + format?: any; + position?: string; + /** + * Specifies a precision for formatted point values displayed in point labels. + * @deprecated Use the series | label | format | precision option instead. + */ + precision?: number; + /** Specifies the angle used to rotate point labels from their initial position. */ + rotationAngle?: number; + /** Specifies the visibility of point labels. */ + visible?: boolean; + } + export interface SeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies whether or not to show labels for points with zero value. Applies only to bar-like series. */ + showForZeroValues?: boolean; + } + export interface ChartSeriesConfigLabel extends SeriesConfigLabel { + /** Aligns point labels in relation to their points. */ + alignment?: string; + /** Along with verticalOffset, shifts point labels from their initial positions. */ + horizontalOffset?: number; + /** Along with horizontalOffset, shifts point labels from their initial positions. */ + verticalOffset?: number; + /** + * Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. + * @deprecated Use the series | label | format | percentPrecision instead. + */ + percentPrecision?: number; + } + export interface BaseCommonSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + axis?: string; + label?: ChartSeriesConfigLabel; + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the dash style of the series' line. */ + dashStyle?: string; + hoverMode?: string; + hoverStyle?: { + border?: viz.core.DashedBorder; + /**

Sets a color for a series when it is hovered over.

*/ + color?: string; + /** Specifies the dash style for the line in a hovered series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a hovered series. */ + width?: number; + }; + /** Specifies whether a chart ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies the minimal length of a displayed bar in pixels. */ + minBarSize?: number; + /** Specifies opacity for a series. */ + opacity?: number; + /** Specifies series elements to be highlighted when a user selects a point. */ + selectionMode?: string; + selectionStyle?: { + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the dash style for the line in a selected series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a selected series. */ + width?: number; + }; + /** Specifies whether or not to show the series in the chart's legend. */ + showInLegend?: boolean; + /** Specifies the name of the stack where the values of the _stackedBar_ series must be located. */ + stack?: string; + /** Specifies the name of the data source field that provides data about a point. */ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + /** Specifies the visibility of a series. */ + visible?: boolean; + /** Specifies a line width. */ + width?: number; + /** Configures error bars. */ + valueErrorBar?: { + /** Specifies whether error bars must be displayed in full or partially. */ + displayMode?: string; + /** Specifies the data field that provides data for low error values. */ + lowValueField?: string; + /** Specifies the data field that provides data for high error values. */ + highValueField?: string; + /** Specifies how error bar values must be calculated. */ + type?: string; + /** Specifies the value to be used for generating error bars. */ + value?: number; + /** Specifies the color of error bars. */ + color?: string; + /** Specifies the opacity of error bars. */ + opacity?: number; + /** Specifies the length of the lines that indicate the error bar edges. */ + edgeLength?: number; + /** Specifies the width of the error bar line. */ + lineWidth?: number; + }; + } + export interface CommonPointOptions { + /** Specifies border options for points in the line and area series. */ + border?: viz.core.Border; + /** Specifies the points color. */ + color?: string; + /** Specifies what series points to highlight when a point is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered point. */ + hoverStyle?: { + /** An object defining the border options for a hovered point. */ + border?: viz.core.Border; + /** Sets a color for a point when it is hovered over. */ + color?: string; + /** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies what series points to highlight when a point is selected. */ + selectionMode?: string; + /** An object defining configuration options for a selected point. */ + selectionStyle?: { + /** An object defining the border options for a selected point. */ + border?: viz.core.Border; + /**

Sets a color for a point when it is selected.

*/ + color?: string; + /** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */ + size?: number; + /** Specifies a symbol for presenting points of the line and area series. */ + symbol?: string; + visible?: boolean; + } + export interface ChartCommonPointOptions extends CommonPointOptions { + /** Substitutes the standard point symbols with an image. */ + image?: { + /** Specifies the height of the image used instead of a point marker. */ + height?: any; + /** Specifies the URL of the image to be used as a point marker. */ + url?: any; + /** Specifies the width of an image that is used as a point marker. */ + width?: any; + }; + } + export interface PolarCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: number; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: string; + /** Specifies the width of an image that is used as a point marker. */ + width?: number; + }; + } + /** An object that defines configuration options for chart series. */ + export interface CommonSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies which data source field provides close values for points of a financial series. */ + closeValueField?: string; + /** Makes bars look rounded. Applies only to bar-like series. */ + cornerRadius?: number; + /** Specifies which data source field provides high values for points of a financial series. */ + highValueField?: string; + /** Specifies a filling color for the body of a series point that visualizes a non-reduced value. Applies only to candlestick series. */ + innerColor?: string; + /** Specifies which data source field provides low values for points of a financial series. */ + lowValueField?: string; + /** Specifies which data source field provides open values for points of a financial series. */ + openValueField?: string; + /** Specifies which pane the series should belong to. Accepts the name of the pane. */ + pane?: string; + point?: ChartCommonPointOptions; + /** Coupled with the rangeValue2Field option, specifies which data source field provides values for a range-like series. */ + rangeValue1Field?: string; + /** Coupled with the rangeValue1Field option, specifies which data source field provides values for a range-like series. */ + rangeValue2Field?: string; + /** Specifies reduction options for financial series. */ + reduction?: { + /** Specifies a color for the points whose price has decreased in comparison to the price of the previous point. */ + color?: string; + /** Specifies whether high, low, open or close prices of points should be compared. */ + level?: string; + }; + /** Specifies which data source field provides size values for bubbles. Required by and applies only to bubble series. */ + sizeField?: string; + } + export interface CommonSeriesSettings extends CommonSeriesConfig { + /** Defines common settings for all area series. */ + area?: CommonSeriesConfig; + /** Defines common settings for all bar series. */ + bar?: CommonSeriesConfig; + /** Defines common settings for all bubble series. */ + bubble?: CommonSeriesConfig; + /** Defines common settings for all candlestick series. */ + candlestick?: CommonSeriesConfig; + /** Defines common settings for all full-stacked area series. */ + fullstackedarea?: CommonSeriesConfig; + /** Defines common settings for all full-stacked spline area series. */ + fullstackedsplinearea?: CommonSeriesConfig; + /** Defines common settings for all full-stacked bar series. */ + fullstackedbar?: CommonSeriesConfig; + /** Defines common settings for all full-stacked line series. */ + fullstackedline?: CommonSeriesConfig; + /** Defines common settings for all full-stacked spline series. */ + fullstackedspline?: CommonSeriesConfig; + /** Defines common settings for all line series. */ + line?: CommonSeriesConfig; + /** Defines common settings for all range area series. */ + rangearea?: CommonSeriesConfig; + /** Defines common settings for all range bar series. */ + rangebar?: CommonSeriesConfig; + /** Defines common settings for all scatter series. */ + scatter?: CommonSeriesConfig; + /** Defines common settings for all spline series. */ + spline?: CommonSeriesConfig; + /** Defines common settings for all spline area series. */ + splinearea?: CommonSeriesConfig; + /** Defines common settings for all stacked area series. */ + stackedarea?: CommonSeriesConfig; + /** Defines common settings for all stacked spline area series. */ + stackedsplinearea?: CommonSeriesConfig; + /** Defines common settings for all stacked bar series. */ + stackedbar?: CommonSeriesConfig; + /** Defines common settings for all stacked line series. */ + stackedline?: CommonSeriesConfig; + /** Defines common settings for all stacked spline series. */ + stackedspline?: CommonSeriesConfig; + /** Defines common settings for all step area series. */ + steparea?: CommonSeriesConfig; + /** Defines common settings for all step line series. */ + stepline?: CommonSeriesConfig; + /** Defines common settings for all stock series. */ + stock?: CommonSeriesConfig; + /** Specifies the type of the series. */ + type?: string; + } + export interface SeriesConfig extends CommonSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + /** An object that defines configuration options for polar chart series. */ + export interface CommonPolarSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies whether or not to close the chart by joining the end point with the first point. */ + closed?: boolean; + label?: SeriesConfigLabel; + point?: PolarCommonPointOptions; + } + export interface CommonPolarSeriesSettings extends CommonPolarSeriesConfig { + /** An object that specifies configuration options for all series of the area type in the chart. */ + area?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonPolarSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface PolarSeriesConfig extends CommonPolarSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + export interface PieSeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies how to shift labels from their initial position in a radial direction in pixels. */ + radialOffset?: number; + /** + * Specifies a precision for the percentage values displayed in labels. + * @deprecated Use the series | label | format | percentPrecision instead. + */ + percentPrecision?: number; + } + /** An object that defines configuration options for chart series. */ + export interface CommonPieSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + /** Specifies the required type for series arguments. */ + argumentType?: string; + /** An object defining the series border configuration options. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the chart elements to highlight when a series is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered series. */ + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /** Sets a color for the series when it is hovered over. */ + color?: string; + /** Specifies the hatching options to be applied when a point is hovered over. */ + hatching?: viz.core.Hatching; + }; + /** + * Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. + * @deprecated Use the innerRadius option instead. + */ + innerRadius?: number; + /** An object defining the label configuration options. */ + label?: PieSeriesConfigLabel; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies a minimal size of a displayed pie segment. */ + minSegmentSize?: number; + /** + * Specifies the direction in which the dxPieChart series points are located. + * @deprecated Use the segmentsDirection option instead. + */ + segmentsDirection?: string; + /**

Specifies the chart elements to highlight when the series is selected.

*/ + selectionMode?: string; + /** An object defining configuration options for the series when it is selected. */ + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the hatching options to be applied when a point is selected. */ + hatching?: viz.core.Hatching; + }; + /** Specifies chart segment grouping options. */ + smallValuesGrouping?: { + /** Specifies the name of the grouped chart segment. This name represents the segment in the chart legend. */ + groupName?: string; + /** Specifies the segment grouping mode. */ + mode?: string; + /** Specifies a threshold for segment values. */ + threshold?: number; + /** Specifies how many segments must not be grouped. */ + topCount?: number; + }; + /** + * Specifies a start angle for a pie chart in arc degrees. + * @deprecated Use the startAngle option instead. + */ + startAngle?: number; + /**

Specifies the name of the data source field that provides data about a point.

*/ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + } + export interface CommonPieSeriesSettings extends CommonPieSeriesConfig { + /** + * Specifies the type of the pie chart series. + * @deprecated Use the type option instead. + */ + type?: string; + } + export interface PieSeriesConfig extends CommonPieSeriesConfig { + /** + * Sets the series type. + * @deprecated Use the type option instead. + */ + type?: string; + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + } + export interface SeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => SeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface PolarSeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => PolarSeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface ChartCommonConstantLineLabel { + /** Specifies font options for constant line labels. */ + font?: viz.core.Font; + /** Specifies the position of constant line labels on the chart plot. */ + position?: string; + /** Makes constant line labels visible. */ + visible?: boolean; + } + export interface PolarCommonConstantLineLabel { + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + } + export interface ConstantLineStyle { + /** Specifies a color for a constant line. */ + color?: string; + /** Specifies a dash style for a constant line. */ + dashStyle?: string; + /** Specifies a constant line width in pixels. */ + width?: number; + } + export interface ChartCommonConstantLineStyle extends ConstantLineStyle { + /** Configures constant line labels. */ + label?: ChartCommonConstantLineLabel; + /** Generates a pixel-measured empty space between the left/right side of a constant line and the constant line label. */ + paddingLeftRight?: number; + /** Generates a pixel-measured empty space between the top/bottom side of a constant line and the constant line label. */ + paddingTopBottom?: number; + } + export interface PolarCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarCommonConstantLineLabel; + } + export interface CommonAxisLabel { + /** Specifies font options for axis labels. */ + font?: viz.core.Font; + /** Specifies the spacing between an axis and its labels in pixels. */ + indentFromAxis?: number; + /** Indicates whether or not axis labels are visible. */ + visible?: boolean; + } + export interface ChartCommonAxisLabel extends CommonAxisLabel { + /** Aligns axis labels in relation to ticks. */ + alignment?: string; + /** Decides how to arrange axis labels when there is not enough space to keep all of them. */ + overlappingBehavior?: { + /** Decides how to arrange axis labels when there is not enough space to keep all of them. */ + mode?: string; + /** Specifies the rotation angle of axis labels. Applies only if the mode option is "rotate". */ + rotationAngle?: number; + /** Adds a pixel-measured empty space between two staggered rows of axis labels. Applies only if the mode option is "stagger". */ + staggeringSpacing?: number; + }; + } + export interface PolarCommonAxisLabel extends CommonAxisLabel { + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: string; + } + export interface CommonAxisTitle { + /** Specifies font options for the axis title. */ + font?: viz.core.Font; + /** Adds a pixel-measured empty space between the axis title and axis labels. */ + margin?: number; + } + export interface BaseCommonAxisSettings { + /** Specifies the color of the line that represents an axis. */ + color?: string; + /** Specifies whether ticks/grid lines of a discrete axis are located between labels or cross the labels. */ + discreteAxisDivisionMode?: string; + /** An object defining the configuration options for the grid lines of an axis in the dxPolarChart widget. */ + grid?: { + /** Specifies a color for grid lines. */ + color?: string; + /** Specifies an opacity for grid lines. */ + opacity?: number; + /** Indicates whether or not the grid lines of an axis are visible. */ + visible?: boolean; + /** Specifies the width of grid lines. */ + width?: number; + }; + /** Specifies the options of the minor grid. */ + minorGrid?: { + /** Specifies a color for the lines of the minor grid. */ + color?: string; + /** Specifies an opacity for the lines of the minor grid. */ + opacity?: number; + /** Indicates whether the minor grid is visible or not. */ + visible?: boolean; + /** Specifies a width for the lines of the minor grid. */ + width?: number; + }; + /** Indicates whether or not an axis is inverted. */ + inverted?: boolean; + /** Specifies the opacity of the line that represents an axis. */ + opacity?: number; + /** Indicates whether or not to set ticks/grid lines of a continuous axis of the 'date-time' type at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** An object defining the configuration options for axis ticks. */ + tick?: { + /** Specifies ticks color. */ + color?: string; + /** Specifies tick opacity. */ + opacity?: number; + /** Indicates whether or not ticks are visible on an axis. */ + visible?: boolean; + /** Specifies tick width. */ + width?: number; + /** Specifies tick length. */ + length?: number; + }; + /** Specifies the options of the minor ticks. */ + minorTick?: { + /** Specifies a color for the minor ticks. */ + color?: string; + /** Specifies an opacity for the minor ticks. */ + opacity?: number; + /** Indicates whether or not the minor ticks are displayed on an axis. */ + visible?: boolean; + /** Specifies minor tick width. */ + width?: number; + /** Specifies minor tick length. */ + length?: number; + }; + /** Indicates whether or not the line that represents an axis in a chart is visible. */ + visible?: boolean; + /** Specifies the width of the line that represents an axis in the chart. */ + width?: number; + } + export interface ChartCommonAxisSettings extends BaseCommonAxisSettings { + /** Configures the appearance of all constant lines in the widget. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** Configures axis labels. */ + label?: ChartCommonAxisLabel; + /** Controls the empty space between the maximum series points and the axis. Applies only to the axes of the "continuous" and "logarithmic" type. */ + maxValueMargin?: number; + /** Controls the empty space between the minimum series points and the axis. Applies only to the axes of the "continuous" and "logarithmic" type. */ + minValueMargin?: number; + /** Reserves a pixel-measured space for the axis. */ + placeholderSize?: number; + /** Configures the appearance of strips. */ + stripStyle?: { + /** Configures the appearance of strip labels. */ + label?: { + /** Specifies font options for strip labels. */ + font?: viz.core.Font; + /** Aligns strip labels in the horizontal direction. */ + horizontalAlignment?: string; + /** Aligns strip labels in the vertical direction. */ + verticalAlignment?: string; + }; + /** Generates a pixel-measured empty space between the left/right border of a strip and the strip label. */ + paddingLeftRight?: number; + /** Generates a pixel-measured empty space between the top/bottom border of a strip and the strip label. */ + paddingTopBottom?: number; + }; + /** Configures axis titles. */ + title?: CommonAxisTitle; + /** Adds an empty space between the axis and the minimum and maximum series points. */ + valueMarginsEnabled?: boolean; + } + export interface PolarCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: PolarCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxPolarChart widget. */ + label?: PolarCommonAxisLabel; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + }; + }; + } + export interface ChartConstantLineLabel extends ChartCommonConstantLineLabel { + /** Aligns constant line labels in the horizontal direction. */ + horizontalAlignment?: string; + /** Aligns constant line labels in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the text of a constant line label. By default, equals to the value of the constant line. */ + text?: string; + } + export interface PolarConstantLineLabel extends PolarCommonConstantLineLabel { + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface AxisLabel { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */ + customizeHint?: (argument: { value: any; valueText: string }) => string; + /** Specifies a callback function that returns the text to be displayed in value axis labels. */ + customizeText?: (argument: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed by axis labels. */ + format?: any; + /** + * Specifies a precision for the formatted value displayed in the axis labels. + * @deprecated Use the valueAxis | label | format | precision option instead. + */ + precision?: number; + } + export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { } + export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { } + export interface AxisTitle extends CommonAxisTitle { + /** Specifies the text of the axis title. */ + text?: string; + } + export interface ChartConstantLineStyle extends ChartCommonConstantLineStyle { + /** Specifies the appearance of the labels of those constant lines that belong to the value axis. */ + label?: ChartConstantLineLabel; + } + export interface ChartConstantLine extends ChartConstantLineStyle { + /** Configures the constant line label. */ + label?: ChartConstantLineLabel; + /** Specifies the value indicated by a constant line. Setting this option is necessary. */ + value?: any; + } + export interface PolarConstantLine extends PolarCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface Axis { + /** Specifies a coefficient for dividing the value axis. */ + axisDivisionFactor?: number; + /** Specifies the order in which discrete values are arranged on the value axis. */ + categories?: Array; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic axis. */ + logarithmBase?: number; + /** Specifies an interval between axis ticks/grid lines. */ + tickInterval?: any; + /** Specifies the interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the number of minor ticks between two neighboring major ticks. */ + minorTickCount?: number; + /** Specifies the required type of the value axis. */ + type?: string; + /** Binds the value axis to a pane. */ + pane?: string; + /** Specifies options for value axis strips. */ + strips?: Array; + } + export interface ChartAxis extends ChartCommonAxisSettings, Axis { + /** Declares a collection of constant lines belonging to the value axis. */ + constantLines?: Array; + /** Specifies the appearance of those constant lines that belong to the value axis. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** Configures the labels of the value axis. */ + label?: ChartAxisLabel; + /** Coupled with the min option, focuses the widget on a specific chart segment. Applies only to the axes of the "continuous" and "logarithmic" type. */ + max?: any; + /** Coupled with the max option, focuses the widget on a specific chart segment. Applies only to the axes of the "continuous" and "logarithmic" type. */ + min?: any; + /** Relocates the value axis. */ + position?: string; + /** Configures the axis title. */ + title?: any; + } + export interface PolarAxis extends PolarCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies options for value axis labels. */ + label?: PolarAxisLabel; + } + export interface ArgumentAxis { + /** Specifies the desired type of axis values. */ + argumentType?: string; + /** Specifies the elements that will be highlighted when the argument axis is hovered over. */ + hoverMode?: string; + } + export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis { } + export interface PolarArgumentAxis extends PolarAxis, ArgumentAxis { + /** Specifies the angle in arc degrees to which the argument axis should be rotated. The positive values rotate the axis clockwise. */ + startAngle?: number; + /** Specifies whether or not to display the first point at the angle specified by the startAngle option. */ + firstPointOnStartAngle?: boolean; + /** Specifies the value to be used as the origin for the argument axis. */ + originValue?: number; + /** Specifies the period of the argument values in the data source. */ + period?: number; + } + export interface ValueAxis { + /** Specifies the name of the value axis. */ + name?: string; + /** Specifies whether or not to indicate a zero value on the value axis. */ + showZero?: boolean; + /** Specifies the desired type of axis values. */ + valueType?: string; + } + export interface ChartValueAxis extends ChartAxis, ValueAxis { + /** Adds a pixel-measured empty space between two side-by-side value axes. Applies if several value axes are located on one side of the chart. */ + multipleAxesSpacing?: number; + /** Synchronizes two or more value axes with each other at a specific value. */ + synchronizedValue?: number; + } + export interface PolarValueAxis extends PolarAxis, ValueAxis { + /** Indicates whether to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + tick?: { + visible?: boolean; + } + } + export interface CommonPane { + /** Specifies the color of the pane's background. */ + backgroundColor?: string; + /** Configures the pane border. */ + border?: PaneBorder; + } + export interface Pane extends CommonPane { + /** Specifies the name of the pane. */ + name?: string; + } + export interface PaneBorder extends viz.core.DashedBorderWithOpacity { + /** Shows/hides the bottom border of the pane. Applies only when the border | visible option is true. */ + bottom?: boolean; + /** Shows/hides the left border of the pane. Applies only when the border | visible option is true. */ + left?: boolean; + /** Shows/hides the right border of the pane. Applies only when the border | visible option is true. */ + right?: boolean; + /** Shows/hides the top border of the pane. Applies only when the border | visible option is true. */ + top?: boolean; + } + export interface ChartAnimation extends viz.core.Animation { + /** Specifies how many series points the widget should have before the animation will be disabled. */ + maxPointCountSupported?: number; + } + export interface BaseChartTooltip extends viz.core.Tooltip { + /** Specifies a format for arguments of the chart's series points. */ + argumentFormat?: any; + /** + * Specifies a precision for formatted arguments displayed in tooltips. + * @deprecated Use the tooltip | argumentFormat | precision option instead. + */ + argumentPrecision?: number; + /** + * Specifies a precision for a percent value displayed in tooltips for stacked series and dxPieChart series. + * @deprecated Use the tooltip | format | percentPrecision option instead. + */ + percentPrecision?: number; + } + export interface BaseChartOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies the widget's width small enough for the layout to begin adapting. */ + width?: number; + /** Specifies the widget's height small enough for the layout to begin adapting. */ + height?: number; + /** Specifies whether or not point labels should be kept when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies animation options. */ + animation?: ChartAnimation; + /** Customizes the appearance of an individual point label. */ + customizeLabel?: (pointInfo: Object) => Object; + /** Customizes the appearance of an individual series point. */ + customizePoint?: (pointInfo: Object) => Object; + /** Specifies the origin of data for the widget. */ + dataSource?: any; + /** Specifies options of a dxChart's (dxPieChart's) legend. */ + legend?: core.BaseLegend; + /** Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** A handler for the done event. */ + onDone?: (e: { + component: BaseChart; + element: Element; + }) => void; + /** A handler for the pointClick event. */ + onPointClick?: any; + /** A handler for the pointHoverChanged event. */ + onPointHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + /** A handler for the pointSelectionChanged event. */ + onPointSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + /** Specifies whether a single point or multiple points can be selected in the chart. */ + pointSelectionMode?: string; + /** Specifies options for the dxChart and dxPieChart widget series. */ + series?: any; + /** Configures tooltips. */ + tooltip?: BaseChartTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + } + /** A base class for all chart widgets included in the ChartJS library. */ + export class BaseChart extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + /** Deselects the chart's selected series. The series is displayed in an initial style. */ + clearSelection(): void; + /** Gets the current size of the widget. */ + getSize(): { width: number; height: number }; + /** Returns an array of all series in the chart. */ + getAllSeries(): Array; + /** Gets a series within the chart's series collection by the specified name (see the name option). */ + getSeriesByName(seriesName: string): BaseSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): BaseSeries; + /** Hides all widget tooltips. */ + hideTooltip(): void; + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(renderOptions?: { + force?: boolean; + animate?: boolean; + asyncSeriesRendering?: boolean; + }): void; + } + export interface AdvancedLegend extends core.BaseLegend { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /**

Specifies a callback function that returns the text to be displayed by legend items.

*/ + customizeText?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /** Specifies what series elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + } + export interface AdvancedOptions extends BaseChartOptions { + /** A handler for the argumentAxisClick event. */ + onArgumentAxisClick?: any; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate the values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort the series points. */ + sortingMethod?: any; + }; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** A handler for the seriesClick event. */ + onSeriesClick?: any; + /** A handler for the seriesHoverChanged event. */ + onSeriesHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** A handler for the seriesSelectionChanged event. */ + onSeriesSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** Specifies whether a single series or multiple series can be selected in the chart. */ + seriesSelectionMode?: string; + /** Specifies how the chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + /** Specifies whether or not all bars in a series must have the same angle, or may have different angles if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; + /** Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ + negativesAsZeroes?: boolean; + } + export interface Legend extends AdvancedLegend { + /** Specifies whether the legend is located outside or inside the chart's plot. */ + position?: string; + } + export interface ChartTooltip extends BaseChartTooltip { + /** Specifies whether the tooltip must be located in the center of a series point or on its edge. Applies to bar-like and bubble series only. */ + location?: string; + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxChartOptions extends AdvancedOptions { + /** Indicates whether or not to synchronize value axes when they are displayed on a single pane. */ + synchronizeMultiAxes?: boolean; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Specifies whether or not to adjust the value axis when zooming the widget. */ + adjustOnZoom?: boolean; + /** Configures the argument axis. */ + argumentAxis?: ChartArgumentAxis; + /** Defines common settings for both the argument and value axis in a chart. */ + commonAxisSettings?: ChartCommonAxisSettings; + /** Defines common settings for all panes in a chart. */ + commonPaneSettings?: CommonPane; + /** Specifies settings common for all series in the chart. */ + commonSeriesSettings?: CommonSeriesSettings; + /** Configures the crosshair feature. */ + crosshair?: { + /** Specifies the color of the crosshair lines. */ + color?: string; + /** Specifies the dash style of the crosshair lines. */ + dashStyle?: string; + /** Enables the crosshair. */ + enabled?: boolean; + /** Specifies how transparent the crosshair lines should be. */ + opacity?: number; + /** Specifies the width of the crosshair lines. */ + width?: number; + /** Configures the horizontal crosshair line individually. */ + horizontalLine?: CrosshaierWithLabel; + /** Configures the vertical crosshair line individually. */ + verticalLine?: CrosshaierWithLabel; + /** Configures the crosshair labels. */ + label?: { + /** Paints the background of the crosshair labels. */ + backgroundColor?: string; + /** Makes the crosshair labels visible. Applies only if the crosshair feature is enabled. */ + visible?: boolean; + /** Specifies font options for the crosshair labels. */ + font?: viz.core.Font; + /** Formats the point value/argument before it will be displayed in the crosshair label. */ + format?: any; + /** + * Specifies a precision for formatted values. + * @deprecated Use the crosshair | label | format | precision option instead. + */ + precision?: number; + /** Customizes the text displayed by the crosshair labels. */ + customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; + } + }; + /** Specifies which pane should be used by default. */ + defaultPane?: string; + /** Specifies a coefficient determining the diameter of the largest bubble. */ + maxBubbleSize?: number; + /** Specifies the diameter of the smallest bubble measured in pixels. */ + minBubbleSize?: number; + /** Declares a collection of panes. */ + panes?: Array; + /** Swaps the axes around making the value axis horizontal and the argument axis vertical. */ + rotated?: boolean; + /** Specifies the options of a chart's legend. */ + legend?: Legend; + onZoomStart?: (e: { + component: BaseChart; + element: Element; + }) => void; + onZoomEnd?: (e: { + component: BaseChart; + element: Element; + rangeStart: any; + rangeEnd: any; + }) => void; + /** Specifies options for dxChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: SeriesTemplate; + tooltip?: ChartTooltip; + /** Configures the value axis. */ + valueAxis?: Array; + /** Enables scrolling in your chart. */ + scrollingMode?: string; + /** Enables zooming in your chart. */ + zoomingMode?: string; + /** Specifies the settings of the scroll bar. */ + scrollBar?: { + /** Specifies whether the scroll bar is visible or not. */ + visible?: boolean; + /** Specifies the spacing between the scroll bar and the chart's plot in pixels. */ + offset?: number; + /** Specifies the color of the scroll bar. */ + color?: string; + /** Specifies the width of the scroll bar in pixels. */ + width?: number; + /** Specifies the opacity of the scroll bar. */ + opacity?: number; + /** Specifies the position of the scroll bar in the chart. */ + position?: string; + }; + } + interface CrosshaierWithLabel extends viz.core.DashedBorderWithOpacity { + /** Configures the label that belongs to the horizontal crosshair line. */ + label?: { + /** Paints the background of the label that belongs to the horizontal crosshair line. */ + backgroundColor?: string; + /** Makes the label of the horizontal crosshair line visible. Applies only if the crosshair feature is enabled and the horizontal line is visible. */ + visible?: boolean; + /** Specifies font options for the label of the horizontal crosshair line. */ + font?: viz.core.Font; + /** Formats the point value before it will be displayed in the crosshair label. */ + format?: any; + /** + * Specifies a precision for formatted values. + * @deprecated Use the crosshair | horizontalLine | label | format | precision option instead. + */ + precision?: number; + /** Customizes the text displayed by the label that belongs to the horizontal crosshair line. */ + customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; + } + } + export interface PolarChartTooltip extends BaseChartTooltip { + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxPolarChartOptions extends AdvancedOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + width?: number; + height?: number; + }; + /** Indicates whether or not to display a "spider web". */ + useSpiderWeb?: boolean; + /** Specifies argument axis options for the dxPolarChart widget. */ + argumentAxis?: PolarArgumentAxis; + /** An object defining the configuration options that are common for all axes of the dxPolarChart widget. */ + commonAxisSettings?: PolarCommonAxisSettings; + /** An object defining the configuration options that are common for all series of the dxPolarChart widget. */ + commonSeriesSettings?: CommonPolarSeriesSettings; + /** Specifies the options of a chart's legend. */ + legend?: AdvancedLegend; + /** Specifies options for dxPolarChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: PolarSeriesTemplate; + tooltip?: PolarChartTooltip; + /** Specifies value axis options for the dxPolarChart widget. */ + valueAxis?: PolarValueAxis; + } + export interface PieLegend extends core.BaseLegend { + /** Specifies what chart elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + /** Specifies a callback function that returns the text to be displayed by a legend item. */ + customizeText?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + } + export interface dxPieChartOptions extends BaseChartOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + keepLabels?: boolean; + }; + /** Specifies dxPieChart legend options. */ + legend?: PieLegend; + /** Specifies options for the series of the dxPieChart widget. */ + series?: Array; + /** Specifies the diameter of the pie. */ + diameter?: number; + /** Specifies the direction that the pie chart segments will occupy. */ + segmentsDirection?: string; + /** Specifies the angle in arc degrees from which the first segment of a pie chart should start. */ + startAngle?: number; + /** Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. The value should be between 0 and 1. */ + innerRadius?: number; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** Specifies how a chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + /** An object defining the configuration options that are common for all series of the dxPieChart widget. */ + commonSeriesSettings?: CommonPieSeriesSettings; + /** Specifies the type of the pie chart series. */ + type?: string; + } +} +declare module DevExpress.viz { + /** A widget providing charts of various types for web applications. */ + export class dxChart extends DevExpress.viz.charts.BaseChart { + constructor(element: JQuery, options?: DevExpress.viz.charts.dxChartOptions); + constructor(element: Element, options?: DevExpress.viz.charts.dxChartOptions); + /** Sets the specified start and end values for the chart's argument axis. */ + zoomArgument(startValue: any, endValue: any): void; + } + /** A circular chart widget for web applications. */ + export class dxPieChart extends DevExpress.viz.charts.BaseChart { + constructor(element: JQuery, options?: DevExpress.viz.charts.dxPieChartOptions); + constructor(element: Element, options?: DevExpress.viz.charts.dxPieChartOptions); + /** + * Provides access to the dxPieChart series. + * @deprecated Use the getAllSeries() method instead. + */ + getSeries(): DevExpress.viz.charts.PieSeries; + } + /** A chart widget displaying data in a polar coordinate system. */ + export class dxPolarChart extends DevExpress.viz.charts.BaseChart { + constructor(element: JQuery, options?: DevExpress.viz.charts.dxPolarChartOptions); + constructor(element: Element, options?: DevExpress.viz.charts.dxPolarChartOptions); + } +} +interface JQuery { + dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; + dxChart(methodName: string, ...params: any[]): any; + dxChart(methodName: "instance"): DevExpress.viz.dxChart; + dxPieChart(options?: DevExpress.viz.charts.dxPieChartOptions): JQuery; + dxPieChart(methodName: string, ...params: any[]): any; + dxPieChart(methodName: "instance"): DevExpress.viz.dxPieChart; + dxPolarChart(options?: DevExpress.viz.charts.dxPolarChartOptions): JQuery; + dxPolarChart(methodName: string, ...params: any[]): any; + dxPolarChart(methodName: "instance"): DevExpress.viz.dxPolarChart; +} +declare module DevExpress.viz.gauges { + export interface BaseRangeContainer { + /** Specifies a range container's background color. */ + backgroundColor?: string; + /** Specifies the offset of the range container from an invisible scale line in pixels. */ + offset?: number; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** An array of objects representing ranges contained in the range container. */ + ranges?: Array<{ startValue: number; endValue: number; color: string }>; + /** Specifies a color of a range. */ + color?: string; + /** Specifies an end value of a range. */ + endValue?: number; + /** Specifies a start value of a range. */ + startValue?: number; + } + export interface ScaleTick { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** + * Specifies an array of custom minor ticks. + * @deprecated Use the scale | customMinorTicks option instead. + */ + customTickValues?: Array; + /** Specifies the length of the scale's minor ticks. */ + length?: number; + /** + * Indicates whether automatically calculated minor ticks are visible or not. + * @deprecated This feature is no longer available. + */ + showCalculatedTicks?: boolean; + /** + * Specifies an interval between minor ticks. + * @deprecated Use the scale | minorTickInterval option instead. + */ + tickInterval?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + } + export interface ScaleMajorTick extends ScaleTick { + /** + * Specifies whether or not to expand the current major tick interval if labels overlap each other. + * @deprecated Use the overlappingBehavior | useAutoArrangement option instead. + */ + useTicksAutoArrangement?: boolean; + } + export interface ScaleMinorTick extends ScaleTick { + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + } + export interface BaseScaleLabel { + /** Specifies whether or not scale labels should be colored similarly to their corresponding ranges in the range container. */ + useRangeColors?: boolean; + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: number; valueText: string }) => string; + /** Specifies the overlap resolving options to be applied to scale labels. */ + overlappingBehavior?: { + /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + useAutoArrangement?: boolean; + /** Specifies what label to hide in case of overlapping. */ + hideFirstOrLast?: string; + }; + /** Specifies font options for the text displayed in the scale labels of the gauge. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: any; + /** + * Specifies a precision for the formatted value displayed in the scale labels. + * @deprecated Use the scale | label | format | precision option instead. + */ + precision?: number; + /** Specifies whether or not scale labels are visible on the gauge. */ + visible?: boolean; + } + export interface BaseScale { + /** Specifies the end value for the scale of the gauge. */ + endValue?: number; + /** + * Specifies whether or not to hide the first scale label. + * @deprecated This feature is no longer available. + */ + hideFirstLabel?: boolean; + /** + * Specifies whether or not to hide the first major tick on the scale. + * @deprecated This feature is no longer available. + */ + hideFirstTick?: boolean; + /** + * Specifies whether or not to hide the last scale label. + * @deprecated This feature is no longer available. + */ + hideLastLabel?: boolean; + /** + * Specifies whether or not to hide the last major tick on the scale. + * @deprecated This feature is no longer available. + */ + hideLastTick?: boolean; + /** Specifies an interval between major ticks. */ + tickInterval?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: number; + /** Specifies an array of custom major ticks. */ + customTicks?: Array; + /** Specifies an array of custom minor ticks. */ + customMinorTicks?: Array; + /** Specifies common options for scale labels. */ + label?: BaseScaleLabel; + /** + * Specifies options of the gauge's major ticks. + * @deprecated Use the tick option instead. + */ + majorTick?: ScaleMajorTick; + /** Specifies options of the gauge's major ticks. */ + tick?: { + /** Specifies the color of the scale's major ticks. */ + color?: string; + /** Specifies the length of the scale's major ticks. */ + length?: number; + /** Indicates whether scale major ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's major ticks. */ + width?: number; + /** Specifies the opacity of the scale's major ticks. */ + opacity?: number; + }; + /** Specifies options of the gauge's minor ticks. */ + minorTick?: ScaleMinorTick; + /** Specifies the start value for the scale of the gauge. */ + startValue?: number; + } + export interface BaseValueIndicator { + /** Specifies the type of subvalue indicators. */ + type?: string; + /** Specifies the background color for the indicator of the rangeBar type. */ + backgroundColor?: string; + /** Specifies the base value for the indicator of the rangeBar type. */ + baseValue?: number; + /** Specifies a color of the indicator. */ + color?: string; + /** Specifies the range bar size for an indicator of the rangeBar type. */ + size?: number; + text?: { + /** Specifies a callback function that returns the text to be displayed in an indicator. */ + customizeText?: (indicatedValue: { value: number; valueText: string }) => string; + font?: viz.core.Font; + /** Specifies a format for the text displayed in an indicator. */ + format?: any; + /** Specifies the range bar's label indent in pixels. */ + indent?: number; + /** + * Specifies a precision for the formatted value displayed by an indicator. + * @deprecated Use the text | format | precision option instead. + */ + precision?: number; + }; + offset?: number; + length?: number; + width?: number; + /** Specifies the length of an arrow for the indicator of the textCloud type in pixels. */ + arrowLength?: number; + /** Sets the array of colors to be used for coloring subvalue indicators. */ + palette?: any; + /** Specifies the distance between the needle and the center of a gauge for the indicator of a needle-like type. */ + indentFromCenter?: number; + /** Specifies the second color for the indicator of the twoColorNeedle type. */ + secondColor?: string; + /** Specifies the length of a twoNeedleColor type indicator tip as a percentage. */ + secondFraction?: number; + /** Specifies the spindle's diameter in pixels for the indicator of a needle-like type. */ + spindleSize?: number; + /** Specifies the inner diameter in pixels, so that the spindle has the shape of a ring. */ + spindleGapSize?: number; + /** Specifies the orientation of the rangeBar indicator on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of the rangeBar indicator on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface SharedGaugeOptions extends viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** Specifies animation options. */ + animation?: viz.core.Animation; + /** + * Specifies a subtitle for the widget. + * @deprecated Use the title | subtitle option instead. + */ + subtitle?: { + /** + * Specifies font options for the subtitle. + * @deprecated Use the title | subtitle | font option instead. + */ + font?: viz.core.Font; + /** + * Specifies a text for the subtitle. + * @deprecated Use the title | subtitle | text option instead. + */ + text?: string; + }; + /** Configures tooltips. */ + tooltip?: viz.core.Tooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + } + export interface BaseGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies options of the gauge's range container. */ + rangeContainer?: BaseRangeContainer; + /** Specifies a gauge's scale options. */ + scale?: BaseScale; + /** Specifies the appearance options of subvalue indicators. */ + subvalueIndicator?: BaseValueIndicator; + /** Specifies a set of subvalues to be designated by the subvalue indicators. */ + subvalues?: Array; + /** Specifies the main value on a gauge. */ + value?: number; + /** Specifies the appearance options of the value indicator. */ + valueIndicator?: BaseValueIndicator; + } + /** A gauge widget. */ + export class dxBaseGauge extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + /** Returns the main gauge value. */ + value(): number; + /** Updates a gauge value. */ + value(value: number): void; + /** Returns an array of gauge subvalues. */ + subvalues(): Array; + /** Updates gauge subvalues. */ + subvalues(subvalues: Array): void; + } + export interface LinearRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of a range container on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + /** Specifies the width of the range container's start and end boundaries in the dxLinearGauge widget. */ + width?: any; + /** Specifies an end width of a range container. */ + end?: number; + /** Specifies a start width of a range container. */ + start?: number; + } + export interface LinearScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface LinearScale extends BaseScale { + /** Specifies the orientation of scale ticks on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + label?: LinearScaleLabel; + /** Specifies the orientation of scale ticks on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface dxLinearGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxLinearGauge widget. */ + geometry?: { + /** Indicates whether to display the dxLinearGauge widget vertically or horizontally. */ + orientation?: string; + }; + /** Specifies gauge range container options. */ + rangeContainer?: LinearRangeContainer; + scale?: LinearScale; + } + export interface CircularRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container in the dxCircularGauge widget. */ + orientation?: string; + /** Specifies the range container's width in pixels. */ + width?: number; + } + export interface CircularScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface CircularScale extends BaseScale { + label?: CircularScaleLabel; + /** Specifies the orientation of scale ticks. */ + orientation?: string; + } + export interface dxCircularGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxCircularGauge widget. */ + geometry?: { + /** Specifies the end angle of the circular gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the circular gauge's arc. */ + startAngle?: number; + }; + /** Specifies gauge range container options. */ + rangeContainer?: CircularRangeContainer; + scale?: CircularScale; + } + export interface dxBarGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies a color for the remaining segment of the bar's track. */ + backgroundColor?: string; + /** Specifies a distance between bars in pixels. */ + barSpacing?: number; + /** Specifies a base value for bars. */ + baseValue?: number; + /** Specifies an end value for the gauge's invisible scale. */ + endValue?: number; + /** Defines the shape of the gauge's arc. */ + geometry?: { + /** Specifies the end angle of the bar gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the bar gauge's arc. */ + startAngle?: number; + }; + /** Specifies the options of the labels that accompany gauge bars. */ + label?: { + /** Specifies a color for the label connector text. */ + connectorColor?: string; + /** Specifies the width of the label connector in pixels. */ + connectorWidth?: number; + /** Specifies a callback function that returns a text for labels. */ + customizeText?: (barValue: { value: number; valueText: string }) => string; + /** Specifies font options for bar labels. */ + font?: viz.core.Font; + /** Specifies a format for bar labels. */ + format?: any; + /** Specifies the distance between the upper bar and bar labels in pixels. */ + indent?: number; + /** + * Specifies a precision for the formatted value displayed by labels. + * @deprecated Use the label | format | precision option instead. + */ + precision?: number; + /** Specifies whether bar labels appear on a gauge or not. */ + visible?: boolean; + }; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** Defines the radius of the bar that is closest to the center relatively to the radius of the topmost bar. */ + relativeInnerRadius?: number; + /** Specifies a start value for the gauge's invisible scale. */ + startValue?: number; + /** Specifies the array of values to be indicated on a bar gauge. */ + values?: Array; + } +} +declare module DevExpress.viz { + /** A widget that represents a gauge with a linear scale. */ + export class dxLinearGauge extends DevExpress.viz.gauges.dxBaseGauge { + constructor(element: JQuery, options?: DevExpress.viz.gauges.dxLinearGaugeOptions); + constructor(element: Element, options?: DevExpress.viz.gauges.dxLinearGaugeOptions); + } + /** A widget that represents a gauge with a circular scale. */ + export class dxCircularGauge extends DevExpress.viz.gauges.dxBaseGauge { + constructor(element: JQuery, options?: DevExpress.viz.gauges.dxCircularGaugeOptions); + constructor(element: Element, options?: DevExpress.viz.gauges.dxCircularGaugeOptions); + } + /** A circular bar widget. */ + export class dxBarGauge extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.gauges.dxBarGaugeOptions); + constructor(element: Element, options?: DevExpress.viz.gauges.dxBarGaugeOptions); + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + /** Returns an array of gauge values. */ + values(): Array; + /** Updates the values displayed by a gauge. */ + values(values: Array): void; + } +} +interface JQuery { + dxLinearGauge(options?: DevExpress.viz.gauges.dxLinearGaugeOptions): JQuery; + dxLinearGauge(methodName: string, ...params: any[]): any; + dxLinearGauge(methodName: "instance"): DevExpress.viz.dxLinearGauge; + dxCircularGauge(options?: DevExpress.viz.gauges.dxCircularGaugeOptions): JQuery; + dxCircularGauge(methodName: string, ...params: any[]): any; + dxCircularGauge(methodName: "instance"): DevExpress.viz.dxCircularGauge; + dxBarGauge(options?: DevExpress.viz.gauges.dxBarGaugeOptions): JQuery; + dxBarGauge(methodName: string, ...params: any[]): any; + dxBarGauge(methodName: "instance"): DevExpress.viz.dxBarGauge; +} +declare module DevExpress.viz.rangeSelector { + export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** Specifies the options for the range selector's background. */ + background?: { + /** Specifies the background color for the dxRangeSelector. */ + color?: string; + /** Specifies image options. */ + image?: { + /** Specifies a location for the image in the background of a range selector. */ + location?: string; + /** Specifies the image's URL. */ + url?: string; + }; + /** Indicates whether or not the background (background color and/or image) is visible. */ + visible?: boolean; + }; + /** Specifies the dxRangeSelector's behavior options. */ + behavior?: { + /** Indicates whether or not you can swap sliders. */ + allowSlidersSwap?: boolean; + /** Indicates whether or not animation is enabled. */ + animationEnabled?: boolean; + /** Specifies when to call the onSelectedRangeChanged function. */ + callSelectedRangeChanged?: string; + /** Indicates whether or not an end user can specify the range using a mouse, without the use of sliders. */ + manualRangeSelectionEnabled?: boolean; + /** Indicates whether or not an end user can shift the selected range to the required location on a scale by clicking. */ + moveSelectedRangeByClick?: boolean; + /** Indicates whether to snap a slider to ticks. */ + snapToTicks?: boolean; + }; + /** Specifies the options required to display a chart as the range selector's background. */ + chart?: { + /** Specifies a coefficient for determining an indent from the bottom background boundary to the lowest chart point. */ + bottomIndent?: number; + /** An object defining the common configuration options for the chart’s series. */ + commonSeriesSettings?: viz.charts.CommonSeriesSettings; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort series points. */ + sortingMethod?: any; + }; + /** Specifies whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; + /** Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ + negativesAsZeroes?: boolean; + /** Sets the name of the palette to be used in the range selector's chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** An object defining the chart’s series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: viz.charts.SeriesTemplate; + /** Specifies a coefficient for determining an indent from the background's top boundary to the topmost chart point. */ + topIndent?: number; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Specifies options for the chart's value axis. */ + valueAxis?: { + /** Indicates whether or not the chart's value axis must be inverted. */ + inverted?: boolean; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic value axis. */ + logarithmBase?: number; + /** Specifies the maximum value of the chart's value axis. */ + max?: number; + /** Specifies the minimum value of the chart's value axis. */ + min?: number; + /** Specifies the type of the value axis. */ + type?: string; + /** Specifies the desired type of axis values. */ + valueType?: string; + }; + }; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies a data source for the scale values and for the chart at the background. */ + dataSource?: any; + /** Specifies the data source field that provides data for the scale. */ + dataSourceField?: string; + /** Specifies options of the range selector's scale. */ + scale?: { + /** Specifies the scale's end value. */ + endValue?: any; + /** Specifies common options for scale labels. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: any; valueText: string; }) => string; + /** Specifies font options for the text displayed in the range selector's scale labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: any; + /** + * Specifies a precision for the formatted value displayed in the scale labels. + * @deprecated Use the scale | label | format | precision option instead. + */ + precision?: number; + /** Specifies a spacing between scale labels and the background bottom edge. */ + topIndent?: number; + /** Specifies whether or not the scale's labels are visible. */ + visible?: boolean; + }; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic scale. */ + logarithmBase?: number; + /** + * Specifies an interval between major ticks. + * @deprecated Use the tickInterval option instead. + */ + majorTickInterval?: any; + /** Specifies an interval between axis ticks. */ + tickInterval?: any; + /** Specifies options for the date-time scale's markers. */ + marker?: { + /** Defines the options that can be set for the text that is displayed by the scale markers. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale markers. */ + customizeText?: (markerValue: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed in scale markers. */ + format?: any; + }; + /** Specifies the height of the marker's separator. */ + separatorHeight?: number; + /** Specifies the space between the marker label and the marker separator. */ + textLeftIndent?: number; + /** Specifies the space between the marker's label and the top edge of the marker's separator. */ + textTopIndent?: number; + /** Specified the indent between the marker and the scale lables. */ + topIndent?: number; + /** Indicates whether scale markers are visible. */ + visible?: boolean; + }; + /** Specifies the maximum range that can be selected. */ + maxRange?: any; + /** Specifies the number of minor ticks between neighboring major ticks. */ + minorTickCount?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the minimum range that can be selected. */ + minRange?: any; + /** Specifies the height of the space reserved for the scale in pixels. */ + placeholderHeight?: number; + /** Indicates whether or not to set ticks of a date-time scale at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** Specifies whether or not to show ticks for the boundary scale values, when neither major ticks nor minor ticks are created for these values. */ + showCustomBoundaryTicks?: boolean; + /** + * Indicates whether or not to show minor ticks on the scale. + * @deprecated Use the minorTick | visible option instead. + */ + showMinorTicks?: boolean; + /** Specifies the scale's start value. */ + startValue?: any; + /** Specifies options defining the appearance of scale ticks. */ + tick?: { + /** Specifies the color of scale ticks (both major and minor ticks). */ + color?: string; + /** Specifies the opacity of scale ticks (both major and minor ticks). */ + opacity?: number; + /** Specifies the width of the scale's ticks (both major and minor ticks). */ + width?: number; + }; + /** Specifies options of the range selector's minor ticks. */ + minorTick?: { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + }; + /** Specifies the type of the scale. */ + type?: string; + /** Specifies whether or not to expand the current tick interval if labels overlap each other. */ + useTicksAutoArrangement?: boolean; + /** Specifies the type of values on the scale. */ + valueType?: string; + /** Specifies the order of arguments on a discrete scale. */ + categories?: Array; + }; + /** Specifies the range to be selected when displaying the dxRangeSelector. */ + selectedRange?: { + /** Specifies the start value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + startValue?: any; + /** Specifies the end value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + endValue?: any; + }; + /** Specifies the color of the selected range. */ + selectedRangeColor?: string; + /** Range selector's indent options. */ + indent?: { + /** Specifies range selector's left indent. */ + left?: number; + /** Specifies range selector's right indent. */ + right?: number; + }; + /** A handler for the selectedRangeChanged event. */ + onSelectedRangeChanged?: (e: { + startValue: any; + endValue: any; + component: dxRangeSelector; + element: Element; + }) => void; + /** Specifies range selector shutter options. */ + shutter?: { + /** Specifies shutter color. */ + color?: string; + /** Specifies the opacity of the color of shutters. */ + opacity?: number; + }; + /** Specifies the appearance of the range selector's slider handles. */ + sliderHandle?: { + /** Specifies the color of the slider handles. */ + color?: string; + /** Specifies the opacity of the slider handles. */ + opacity?: number; + /** Specifies the width of the slider handles. */ + width?: number; + }; + /** Defines the options of the range selector slider markers. */ + sliderMarker?: { + /** Specifies the color of the slider markers. */ + color?: string; + /** Specifies a callback function that returns the text to be displayed by slider markers. */ + customizeText?: (scaleValue: { value: any; valueText: any; }) => string; + /** Specifies font options for the text displayed by the range selector slider markers. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in slider markers. */ + format?: any; + /** Specifies the color used for the slider marker text when the currently selected range does not match the minRange and maxRange values. */ + invalidRangeColor?: string; + /** + * Specifies the empty space between the marker's border and the marker’s text. + * @deprecated Use the paddingTopBottom and paddingLeftRight options instead. + */ + padding?: number; + /** Specifies the empty space between the marker's top and bottom borders and the marker's text. */ + paddingTopBottom?: number; + /** Specifies the empty space between the marker's left and right borders and the marker's text. */ + paddingLeftRight?: number; + /** Specifies the placeholder height of the slider marker. */ + placeholderHeight?: number; + /** + * Specifies in pixels the height and width of the space reserved for the range selector slider markers. + * @deprecated Use the placeholderHeight and indent options instead. + */ + placeholderSize?: { + /** Specifies the height of the placeholder for the left and right slider markers. */ + height?: number; + /** Specifies the width of the placeholder for the left and right slider markers. */ + width?: { + /** Specifies the width of the left slider marker's placeholder. */ + left?: number; + /** Specifies the width of the right slider marker's placeholder. */ + right?: number; + }; + }; + /** + * Specifies a precision for the formatted value displayed in slider markers. + * @deprecated Use the sliderMarker | format | precision option instead. + */ + precision?: number; + /** Indicates whether or not the slider markers are visible. */ + visible?: boolean; + }; + } +} +declare module DevExpress.viz { + /** A widget that allows end users to select a range of values on a scale. */ + export class dxRangeSelector extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions); + constructor(element: Element, options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions); + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(skipChartAnimation?: boolean): void; + /** Returns the currently selected range. */ + getSelectedRange(): { startValue: any; endValue: any; }; + /** Sets a specified range. */ + setSelectedRange(selectedRange: { startValue: any; endValue: any; }): void; + } +} +interface JQuery { + dxRangeSelector(options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; + dxRangeSelector(methodName: string, ...params: any[]): any; + dxRangeSelector(methodName: "instance"): DevExpress.viz.dxRangeSelector; +} +declare module DevExpress.viz.map { + /** This section describes the fields and methods that can be used in code to manipulate the Layer object. */ + export interface MapLayer { + /** The name of the layer. */ + name: string; + /** The layer index in the layers array. */ + index: number; + /** The layer type. Can be "area", "line" or "marker". */ + type: string; + /** The type of the layer elements. */ + elementType: string; + /** Gets all layer elements. */ + getElements(): Array; + /** Deselects all layer elements. */ + clearSelection(): void; + } + /** This section describes the fields and methods that can be used in code to manipulate the Layer Element object. */ + export interface MapLayerElement { + /** The parent layer of the layer element. */ + layer: MapLayer; + /** Gets the layer element coordinates. */ + coordinates(): Object; + /** Sets the value of an attribute. */ + attribute(name: string, value: any): void; + /** Gets the value of an attribute. */ + attribute(name: string): any; + /** Gets the selection state of the layer element. */ + selected(): boolean; + /** Sets the selection state of the layer element. */ + selected(state: boolean): void; + /** Applies the layer element settings and updates element appearance. */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Area object. + * @deprecated Use the Layer Element instead. + */ + export interface Area { + /** + * Contains the element type. + * @deprecated Use the Layer | type instead. + */ + type: string; + /** + * Return the value of an attribute. + * @deprecated Use the Layer Element | attribute(name, value) method instead. + */ + attribute(name: string): any; + /** + * Provides information about the selection state of an area. + * @deprecated Use the Layer Element | selected() method instead. + */ + selected(): boolean; + /** + * Sets a new selection state for an area. + * @deprecated Use the Layer Element | selected(state) method instead. + */ + selected(state: boolean): void; + /** + * Applies the area settings specified as a parameter and updates the area appearance. + * @deprecated Use the Layer Element | applySettings(settings) method instead. + */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Markers object. + * @deprecated Use the Layer Element instead. + */ + export interface Marker { + /** + * Contains the descriptive text accompanying the map marker. + * @deprecated Get the text using the Layer Element | attribute(name) method. The name parameter value for text is set at the dataField option. + */ + text: string; + /** + * Contains the type of the element. + * @deprecated Use the Layer | type instead. + */ + type: string; + /** + * Contains the URL of an image map marker. + * @deprecated Get the image URL using the Layer Element | attribute(name) method. The name parameter value for the image URL is set at the dataField option. + */ + url: string; + /** + * Contains the value of a bubble map marker. + * @deprecated Get the bubble value using the Layer Element | attribute(name) method. The name parameter for the bubble value is set at the dataField option. + */ + value: number; + /** + * Contains the values of a pie map marker. + * @deprecated Get the pie values using the Layer Element | attribute(name) method. The name parameter for pie values is set at the dataField option. + */ + values: Array; + /** + * Returns the value of an attribute. + * @deprecated Use the Layer Element | attribute(name, value) method instead. + */ + attribute(name: string): any; + /** + * Returns the coordinates of a specific marker. + * @deprecated Use the Layer Element | coordinates() method instead. + */ + coordinates(): Array; + /** + * Provides information about the selection state of a marker. + * @deprecated Use the Layer Element | selected() method instead. + */ + selected(): boolean; + /** + * Sets a new selection state for a marker. + * @deprecated Use the Layer Element | selected(state) method instead. + */ + selected(state: boolean): void; + /** + * Applies the marker settings specified as a parameter and updates marker appearance. + * @deprecated Use the Layer Element | applySettings(settings) method instead. + */ + applySettings(settings: any): void; + } + export interface MapLayerSettings { + /** Specifies the layer name. */ + name?: string; + /** Specifies layer type. */ + type?: string; + /** Specifies the type of a marker element. Setting this option makes sense only if the layer type is "marker". */ + elementType?: string; + /** Specifies a data source for the layer. */ + dataSource?: any; + /** Specifies the line width (for layers of a line type) or width of the layer elements border in pixels. */ + borderWidth?: number; + /** Specifies a color for the border of the layer elements. */ + borderColor?: string; + /** Specifies a color for layer elements. */ + color?: string; + /** Specifies a color for the border of the layer element when it is hovered over. */ + hoveredBorderColor?: string; + /** Specifies the pixel-measured line width (for layers of a line type) or width for the border of the layer element when it is hovered over. */ + hoveredBorderWidth?: number; + /** Specifies a color for a layer element when it is hovered over. */ + hoveredColor?: string; + /** Specifies a pixel-measured line width (for layers of a line type) or width for the border of the layer element when it is selected. */ + selectedBorderWidth?: number; + /** Specifies a color for the border of the layer element when it is selected. */ + selectedBorderColor?: string; + /** Specifies a color for the layer element when it is selected. */ + selectedColor?: string; + /** Specifies the layer opacity (from 0 to 1). */ + opacity?: number; + /** Specifies the size of markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "dot", "pie" or "image". */ + size?: number; + /** Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if the layer type is "marker". */ + minSize?: number; + /** Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if the layer type is "marker". */ + maxSize?: number; + /** Specifies whether or not to change the appearance of a layer element when it is hovered over. */ + hoverEnabled?: boolean; + /** Specifies whether single or multiple map elements can be selected on a vector map. */ + selectionMode?: string; + /** Specifies the name of the palette or a custom range of colors to be used for coloring a layer. */ + palette?: any; + /** Specifies the number of colors in a palette. */ + paletteSize?: number; + /** Allows you to paint layer elements with similar attributes in the same color. */ + colorGroups?: Array; + /** Specifies the field that provides data to be used for coloring of layer elements. */ + colorGroupingField?: string; + /** Allows you to display bubbles with similar attributes in the same size. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroups?: Array; + /** Specifies the field that provides data to be used for sizing bubble markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroupingField?: string; + /** Specifies the name of the attribute containing marker data. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble", "pie" or "image". */ + dataField?: string; + /** Specifies the function that customizes each layer element individually. */ + customize?: (eleemnts: Array) => void; + /** Specifies marker label options. */ + label?: { + /** The name of the data source attribute containing marker texts. */ + dataField?: string; + /** Enables marker labels. */ + enabled?: boolean; + /** Specifies font options for marker labels. */ + font?: viz.core.Font; + }; + } + export interface AreaSettings { + /** + * Specifies the width of the area border in pixels. + * @deprecated Use the layers | borderWidth option instead. + */ + borderWidth?: number; + /** + * Specifies a color for the area border. + * @deprecated Use the layers | borderColor option instead. + */ + borderColor?: string; + /** + * Specifies a color for an area. + * @deprecated Use the layers | color option instead. + */ + color?: string; + /** + * Specifies the function that customizes each area individually. + * @deprecated Use the layers | customize option instead. + */ + customize?: (areaInfo: Area) => AreaSettings; + /** + * Specifies a color for the area border when the area is hovered over. + * @deprecated Use the layers | hoveredBorderColor option instead. + */ + hoveredBorderColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is hovered over. + * @deprecated Use the layers | hoveredBorderWidth option instead. + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for an area when this area is hovered over. + * @deprecated Use the layers | hoveredColor option instead. + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of an area when it is hovered over. + * @deprecated Use the layers | hoverEnabled option instead. + */ + hoverEnabled?: boolean; + /** + * Configures area labels. + * @deprecated Use the layers | label option instead. + */ + label?: { + /** + * Specifies the data field that provides data for area labels. + * @deprecated Use the layers | label | dataField option instead. + */ + dataField?: string; + /** + * Enables area labels. + * @deprecated Use the layers | label | enabled option instead. + */ + enabled?: boolean; + /** + * Specifies font options for area labels. + * @deprecated Use the layers | label | font option instead. + */ + font?: viz.core.Font; + }; + /** + * Specifies the name of the palette or a custom range of colors to be used for coloring a map. + * @deprecated Use the layers | palette option instead. + */ + palette?: any; + /** + * Specifies the number of colors in a palette. + * @deprecated Use the layers | paletteSize option instead. + */ + paletteSize?: number; + /** + * Allows you to paint areas with similar attributes in the same color. + * @deprecated Use the layers | colorGroups option instead. + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring areas. + * @deprecated Use the layers | colorGroupingField option instead. + */ + colorGroupingField?: string; + /** + * Specifies a color for the area border when the area is selected. + * @deprecated Use the layers | selectedBorderColor option instead. + */ + selectedBorderColor?: string; + /** + * Specifies a color for an area when this area is selected. + * @deprecated Use the layers | selectedColor option instead. + */ + selectedColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is selected. + * @deprecated Use the layers | selectedBorderWidth option instead. + */ + selectedBorderWidth?: number; + /** + * Specifies whether single or multiple areas can be selected on a vector map. + * @deprecated Use the layers | selectionMode option instead. + */ + selectionMode?: string; + } + export interface MarkerSettings { + /** + * Specifies a color for the marker border. + * @deprecated Use the layers | borderColor option instead. + */ + borderColor?: string; + /** + * Specifies the width of the marker border in pixels. + * @deprecated Use the layers | borderWidth option instead. + */ + borderWidth?: number; + /** + * Specifies a color for a marker of the dot or bubble type. + * @deprecated Use the layers | color option instead. + */ + color?: string; + /** + * Specifies the function that customizes each marker individually. + * @deprecated Use the layers | customize option instead. + */ + customize?: (markerInfo: Marker) => MarkerSettings; + /** + * Specifies the pixel-measured width of the marker border when the marker is hovered over. + * @deprecated Use the layers | hoveredBorderWidth option instead. + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is hovered over. + * @deprecated Use the layers | hoveredBorderColor option instead. + */ + hoveredBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is hovered over. + * @deprecated Use the layers | hoveredColor option instead. + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of a marker when it is hovered over. + * @deprecated Use the layers | hoverEnabled option instead. + */ + hoverEnabled?: boolean; + /** + * Specifies marker label options. + * @deprecated Use the layers | label option instead. + */ + label?: { + /** + * Enables marker labels. + * @deprecated Use the layers | label | enabled option instead. + */ + enabled?: boolean; + /** + * Specifies font options for marker labels. + * @deprecated Use the layers | label | font option instead. + */ + font?: viz.core.Font; + }; + /** + * Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | maxSize option instead. + */ + maxSize?: number; + /** + * Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | minSize option instead. + */ + minSize?: number; + /** + * Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | opacity option instead. + */ + opacity?: number; + /** + * Specifies the pixel-measured width of the marker border when the marker is selected. + * @deprecated Use the layers | selectedBorderWidth option instead. + */ + selectedBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is selected. + * @deprecated Use the layers | selectedBorderColor option instead. + */ + selectedBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is selected. + * @deprecated Use the layers | selectedColor option instead. + */ + selectedColor?: string; + /** + * Specifies whether a single or multiple markers can be selected on a vector map. + * @deprecated Use the layers | selectionMode option instead. + */ + selectionMode?: string; + /** + * Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. + * @deprecated Use the layers | size option instead. + */ + size?: number; + /** + * Specifies the type of markers to be used on the map. + * @deprecated Use the layers | elementType option instead. + */ + type?: string; + /** + * Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. + * @deprecated Use the layers | palette option instead. + */ + palette?: any; + /** + * Allows you to paint markers with similar attributes in the same color. + * @deprecated Use the layers | colorGroups option instead. + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring markers. + * @deprecated Use the layers | colorGroupingField option instead. + */ + colorGroupingField?: string; + /** + * Allows you to display bubbles with similar attributes in the same size. + * @deprecated Use the layers | sizeGroups option instead. + */ + sizeGroups?: Array; + /** + * Specifies the field that provides data to be used for sizing bubble markers. + * @deprecated Use the layers | sizeGroupingField option instead. + */ + sizeGroupingField?: string; + } + export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** + * An object specifying options for the map areas. + * @deprecated Use the "area" type element of the layers array. + */ + areaSettings?: AreaSettings; + /** Specifies the options for the map background. */ + background?: { + /** Specifies a color for the background border. */ + borderColor?: string; + /** Specifies a color for the background. */ + color?: string; + }; + /** Specifies options for dxVectorMap widget layers. */ + layers?: Array; + /** Specifies the map projection. */ + projection?: Object; + /** Specifies the positioning of a map in geographical coordinates. */ + bounds?: Array; + /** Specifies the options of the control bar. */ + controlBar?: { + /** Specifies a color for the outline of the control bar elements. */ + borderColor?: string; + /** Specifies a color for the inner area of the control bar elements. */ + color?: string; + /** Specifies whether or not to display the control bar. */ + enabled?: boolean; + /** Specifies the margin of the control bar in pixels. */ + margin?: number; + /** Specifies the position of the control bar. */ + horizontalAlignment?: string; + /** Specifies the position of the control bar. */ + verticalAlignment?: string; + /** Specifies the opacity of the control bar. */ + opacity?: number; + }; + /** + * Specifies a data source for the map area. + * @deprecated Use the layers | dataSource option instead. + */ + mapData?: any; + /** + * Specifies a data source for the map markers. + * @deprecated Use the layers | dataSource option instead. + */ + markers?: any; + /** + * An object specifying options for the map markers. + * @deprecated Use the "marker" type element of the layers array. + */ + markerSettings?: MarkerSettings; + /** Configures tooltips. */ + tooltip?: viz.core.Tooltip; + /** Configures map legends. */ + legends?: Array; + /** Specifies whether or not the map should respond when a user rolls the mouse wheel. */ + wheelEnabled?: boolean; + /** Specifies whether the map should respond to touch gestures. */ + touchEnabled?: boolean; + /** Disables the zooming capability. */ + zoomingEnabled?: boolean; + /** Specifies the geographical coordinates of the center for a map. */ + center?: Array; + /** A handler for the centerChanged event. */ + onCenterChanged?: (e: { + center: Array; + component: dxVectorMap; + element: Element; + }) => void; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** Specifies a number that is used to zoom a map initially. */ + zoomFactor?: number; + /** Specifies a map's maximum zoom factor. */ + maxZoomFactor?: number; + /** A handler for the zoomFactorChanged event. */ + onZoomFactorChanged?: (e: { + component: dxVectorMap; + element: Element; + zoomFactor: number; + }) => void; + /** A handler for the click event. */ + onClick?: any; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + component: dxVectorMap; + element: Element; + target: MapLayerElement; + }) => void; + /** + * A handler for the areaClick event. + * @deprecated Use the onClick option instead. + */ + onAreaClick?: any; + /** + * A handler for the areaSelectionChanged event. + * @deprecated Use the onSelectionChanged option instead. + */ + onAreaSelectionChanged?: (e: { + target: Area; + component: dxVectorMap; + element: Element; + }) => void; + /** + * A handler for the markerClick event. + * @deprecated Use the onClick option instead. + */ + onMarkerClick?: any; + /** + * A handler for the markerSelectionChanged event. + * @deprecated Use the onSelecitonChanged option instead. + */ + onMarkerSelectionChanged?: (e: { + target: Marker; + component: dxVectorMap; + element: Element; + }) => void; + /** Disables the panning capability. */ + panningEnabled?: boolean; + } + export interface Legend extends viz.core.BaseLegend { + /** Specifies the color of item markers in the legend. The specified color applied only when the legend uses 'size' source. */ + markerColor?: string; + /** Specifies the shape of item markers. */ + markerShape?: string; + /** Specifies text for legend items. */ + customizeText?: (itemInfo: { start: number; end: number; index: number; color: string; size: number; }) => string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item. */ + customizeHint?: (itemInfo: { start: number; end: number; index: number; color: string; size: number }) => string; + /** Specifies the source of data for the legend. */ + source?: { + /** Specifies a layer to which the legend belongs. */ + layer?: string; + /** Specifies the type of the legend grouping. */ + grouping?: string; + } + } + export var projection: ProjectionCreator; + export interface ProjectionCreator { + /** Creates a new projection. */ + (data: { + to?: (coordinates: Array) => Array; + from?: (coordinates: Array) => Array; + aspectRatio?: number; + }): Object; + /** Gets the default or custom projection from the projection storage. */ + get(name: string): Object; + /** Adds a new projection to the internal projections storage. */ + add(name: string, projection: Object): void; + } +} +declare module DevExpress.viz{ + /** A vector map widget. */ + export class dxVectorMap extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.map.dxVectorMapOptions); + constructor(element: Element, options?: DevExpress.viz.map.dxVectorMapOptions); + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + /** Gets the current coordinates of the map center. */ + center(): Array; + /** Sets the coordinates of the map center. */ + center(centerCoordinates: Array): void; + /** + * Deselects all the selected areas on a map. The areas are displayed in their initial style after. + * @deprecated Use the layer's clearSelection() method instead. + */ + clearAreaSelection(): void; + /** + * Deselects all the selected markers on a map. The markers are displayed in their initial style after. + * @deprecated Use the layer's clearSelection() method instead. + */ + clearMarkerSelection(): void; + /** Deselects all the selected area and markers on a map at once. The areas and markers are displayed in their initial style after. */ + clearSelection(): void; + /** Converts client area coordinates into map coordinates. */ + convertCoordinates(x: number, y: number): Array; + /** Gets all map layers. */ + getLayers(): Array; + /** Gets the layer by its index. */ + getLayerByIndex(index: number): DevExpress.viz.map.MapLayer; + /** Gets the layer by its name. */ + getLayerByName(name: string): DevExpress.viz.map.MapLayer; + /** + * Returns an array with all the map areas. + * @deprecated Use the layer's getElements() method instead. + */ + getAreas(): Array; + /** + * Returns an array with all the map markers. + * @deprecated Use the layer's getElements() method instead. + */ + getMarkers(): Array; + /** Gets the current coordinates of the map viewport. */ + viewport(): Array; + /** Sets the coordinates of the map viewport. */ + viewport(viewportCoordinates: Array): void; + /** Gets the current value of the map zoom factor. */ + zoomFactor(): number; + /** Sets the value of the map zoom factor. */ + zoomFactor(zoomFactor: number): void; + } +} +interface JQuery { + dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; + dxVectorMap(methodName: string, ...params: any[]): any; + dxVectorMap(methodName: "instance"): DevExpress.viz.dxVectorMap; +} +declare module DevExpress.viz.sparklines { + export interface SparklineTooltip extends viz.core.Tooltip { + /** + * Specifies how a tooltip is horizontally aligned relative to the graph. + * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. + */ + horizontalAlignment?: string; + /** + * Specifies how a tooltip is vertically aligned relative to the graph. + * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. + */ + verticalAlignment?: string; + } + export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions { + /** Configures the tooltip. */ + tooltip?: SparklineTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + } + /** Overridden by descriptions for particular widgets. */ + export class BaseSparkline extends viz.core.BaseWidget { + } + export interface dxBulletOptions extends BaseSparklineOptions { + /** Specifies a color for the bullet bar. */ + color?: string; + /** Specifies an end value for the invisible scale. */ + endScaleValue?: number; + /** Specifies whether or not to show the target line. */ + showTarget?: boolean; + /** Specifies whether or not to show the line indicating zero on the invisible scale. */ + showZeroLevel?: boolean; + /** Specifies a start value for the invisible scale. */ + startScaleValue?: number; + /** Specifies the value indicated by the target line. */ + target?: number; + /** Specifies a color for both the target and zero level lines. */ + targetColor?: string; + /** Specifies the width of the target line. */ + targetWidth?: number; + /** Specifies the primary value indicated by the bullet bar. */ + value?: number; + } + export interface dxSparklineOptions extends BaseSparklineOptions { + /** Specifies the data source field that provides arguments for a sparkline. */ + argumentField?: string; + /** Sets a color for the bars indicating negative values. Available for a sparkline of the bar type only. */ + barNegativeColor?: string; + /** Sets a color for the bars indicating positive values. Available for a sparkline of the bar type only. */ + barPositiveColor?: string; + /** Specifies a data source for the sparkline. */ + dataSource?: any; + /** Sets a color for the boundary of both the first and last points on a sparkline. */ + firstLastColor?: string; + /** Specifies whether a sparkline ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Sets a color for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineColor?: string; + /** Specifies a width for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineWidth?: number; + /** Sets a color for the bars indicating the values that are less than the winloss threshold. Available for a sparkline of the winloss type only. */ + lossColor?: string; + /** Sets a color for the boundary of the maximum point on a sparkline. */ + maxColor?: string; + /** Sets a color for the boundary of the minimum point on a sparkline. */ + minColor?: string; + /** Sets a color for points on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointColor?: string; + /** Specifies the diameter of sparkline points in pixels. Available for the sparklines of line- and area-like types. */ + pointSize?: number; + /** Specifies a symbol to use as a point marker on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointSymbol?: string; + /** Specifies whether or not to indicate both the first and last values on a sparkline. */ + showFirstLast?: boolean; + /** Specifies whether or not to indicate both the minimum and maximum values on a sparkline. */ + showMinMax?: boolean; + /** Determines the type of a sparkline. */ + type?: string; + /** Specifies the data source field that provides values for a sparkline. */ + valueField?: string; + /** Sets a color for the bars indicating the values greater than a winloss threshold. Available for a sparkline of the winloss type only. */ + winColor?: string; + /** Specifies a value that serves as a threshold for the sparkline of the winloss type. */ + winlossThreshold?: number; + /** Specifies the minimum value of the sparkline value axis. */ + minValue?: number; + /** Specifies the maximum value of the sparkline's value axis. */ + maxValue?: number; + } +} +declare module DevExpress.viz { + /** A bullet graph widget. */ + export class dxBullet extends DevExpress.viz.sparklines.BaseSparkline { + constructor(element: JQuery, options?: DevExpress.viz.sparklines.dxBulletOptions); + constructor(element: Element, options?: DevExpress.viz.sparklines.dxBulletOptions); + } + /** A sparkline widget. */ + export class dxSparkline extends DevExpress.viz.sparklines.BaseSparkline { + constructor(element: JQuery, options?: DevExpress.viz.sparklines.dxSparklineOptions); + constructor(element: Element, options?: DevExpress.viz.sparklines.dxSparklineOptions); + } +} +interface JQuery { + dxBullet(options?: DevExpress.viz.sparklines.dxBulletOptions): JQuery; + dxBullet(methodName: string, ...params: any[]): any; + dxBullet(methodName: "instance"): DevExpress.viz.dxBullet; + dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery; + dxSparkline(methodName: string, ...params: any[]): any; + dxSparkline(methodName: "instance"): DevExpress.viz.dxSparkline; +} +declare module DevExpress.viz.treeMap { + export interface dxTreeMapOptions extends viz.core.BaseWidgetOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** Specifies the origin of data for the widget. */ + dataSource?: any; + /** Specifies the name of the data source field that provides nested items for a group. Applies to hierarchical data sources only. */ + childrenField?: string; + /** Specifies the name of the data source field that provides values for tiles. */ + valueField?: string; + /** Specifies the name of the data source field that provides colors for tiles. */ + colorField?: string; + /** Specifies the name of the data source field that provides texts for tile and group labels. */ + labelField?: string; + /** Specifies the name of the data source field that provides IDs for items. Applies to flat data sources only. */ + idField?: string; + /** Specifies the name of the data source field that provides parent IDs for items. Applies to flat data sources only. */ + parentField?: string; + /** Specifies the layout algorithm. */ + layoutAlgorithm?: any; + /** Specifies the direction in which the items will be laid out. */ + layoutDirection?: string; + /** Configures tiles. */ + tile?: { + /** Configures the tile borders. */ + border?: { + /** Specifies the width of the tile borders in pixels. */ + width?: number; + /** Colors the tile borders. */ + color?: string; + }; + /** Specifies a single color for all tiles. */ + color?: string; + /** Specifies the appearance of tiles in the hover state. */ + hoverStyle?: { + /** Configures the appearance of the tile borders in the hover state. */ + border?: { + /** Specifies the width of the tile borders in pixels. Applies to a tile in the hover state. */ + width?: number; + /** Colors the tile borders in the hover state. */ + color?: string; + }; + /** Colors tiles in the hover state. */ + color?: string; + }; + /** Specifies the appearance of tiles in the selected state. */ + selectionStyle?: { + /** Configures the appearance of the tile borders in the selected state. */ + border?: { + /** Specifies the width of the tile borders in pixels. Applies to a tile in the selected state. */ + width?: number; + /** Colors the tile borders in the selected state. */ + color?: string; + }; + /** Colors tiles in the selected state. */ + color?: string; + }; + /** Configures the tile labels. */ + label?: { + /** Changes the visibility of the tile labels. */ + visible?: boolean; + /** Specifies the font settings of the tile labels. */ + font?: viz.core.Font; + }; + }; + /** Configures groups. */ + group?: { + /** Specifies the height of the group headers in pixels. */ + headerHeight?: number; + /** Configures the group borders. */ + border?: { + /** Specifies the width of the group borders in pixels. */ + width?: number; + /** Colors the group borders. */ + color?: string; + }; + /** Colors the group headers. */ + color?: string; + /** Specifies the appearance of groups in the hover state. */ + hoverStyle?: { + /** Configures the appearance of the group borders in the hover state. */ + border?: { + /** Specifies the width of the group borders in pixels. Applies to a group in the hover state. */ + width?: number; + /** Colors the group borders in the hover state. */ + color?: string; + }; + /** Colors the group headers in the hover state. */ + color?: string; + }; + /** Specifies the appearance of groups in the selected state. */ + selectionStyle?: { + /** Configures the appearance of the group borders in the selected state. */ + border?: { + /** Specifies the width of the group borders in pixels. Applies to a group in the selected state. */ + width?: number; + /** Colors the group borders in the selected state. */ + color?: string; + }; + /** Colors the group headers in the selected state. */ + color?: string; + }; + /** Configures the group labels. */ + label?: { + /** Changes the visibility of the group labels. */ + visible?: boolean; + /** Specifies the font settings of the group labels. */ + font?: viz.core.Font; + }; + }; + /** Manages the color settings. */ + colorizer?: { + /** Specifies the colorizing algorithm. */ + type?: string; + /** Sets the palette to be used for colorizing tiles. */ + palette?: any; + /** Specifies whether or not all tiles in a group must be colored uniformly. Applies only if the type option is "discrete". */ + colorizeGroups?: boolean; + /** Allows you to paint tiles with similar values uniformly. Applies only if the type option is "gradient" or "range". */ + range?: Array; + /** Specifies the name of the data source field whose values define the color of a tile. Applies only if the type option is "gradient" or "range". */ + colorCodeField?: string; + }; + /** Specifies whether tiles and groups change their style in the hover state. */ + hoverEnabled?: boolean; + /** Specifies whether a single or multiple nodes can be in the selected state simultaneously. */ + selectionMode?: string; + /** Specifies how many hierarchical levels must be visualized. */ + maxDepth?: number; + /** Specifies whether the user will interact with a single tile or its group. */ + interactWithGroup?: boolean; + tooltip?: viz.core.Tooltip; + /** A handler for the nodesInitialized event. */ + onNodesInitialized?: (e: { + component: dxTreeMap; + element: Element; + root: TreeMapNode + }) => void; + /** A handler for the nodesRendering event. */ + onNodesRendering?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode + }) => void; + /** A handler for the click event. */ + onClick?: any; + /** A handler for the hoverChanged event. */ + onHoverChanged?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode; + }) => void; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode; + }) => void; + /** A handler for the drill event. */ + onDrill?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode + }) => void; + } + /** This section describes fields and methods that can be used in code to manipulate a Node object. */ + export interface TreeMapNode { + /** The level that the current node occupies in the hierarchy of nodes. */ + level: number; + /** The index of the current node in the array of all nodes on the same level. */ + index: number; + /** The object from the data source visualized by the node. */ + data: Object; + /** Returns the parent node of the current node. */ + getParent(): TreeMapNode; + /** Indicates how many direct descendants the current node has. */ + getChildrenCount(): number; + /** Returns all nodes nested in the current node. */ + getAllChildren(): Array; + /** Returns all descendant nodes. */ + getAllNodes(): Array; + /** Gets a specific node from a collection of direct descendants. */ + getChild(index: number): TreeMapNode; + /** Gets the raw value of the node. */ + value(): number; + /** Returns the label of the node. */ + label(): string; + /** Sets the label to the node. */ + label(label: string): void; + /** Customizes the node. */ + customize(options: any): void; + /** Reverts the appearance of the node to the initial state. */ + resetCustomization(): void; + /** Indicates whether the node is in the hover state or not. */ + isHovered(): boolean; + /** Sets the selection state of a node. */ + select(state: boolean): void; + /** Indicates whether the node is selected or not. */ + isSelected(): boolean; + /** Indicates whether the node is visualized by a tile or a group of tiles. */ + isLeaf(): boolean; + /** Indicates whether the current node is active. */ + isActive(): boolean; + /** Shows the tooltip. */ + showTooltip(): void; + /** Drills down into the node. */ + drillDown(): void; + } +} +declare module DevExpress.viz { + /** A widget for displaying hierarchical data by using nested rectangles. */ + export class dxTreeMap extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.treeMap.dxTreeMapOptions); + constructor(element: Element, options?: DevExpress.viz.treeMap.dxTreeMapOptions); + /** Returns the root node. */ + getRootNode(): DevExpress.viz.treeMap.TreeMapNode; + /** Returns the current node. */ + getCurrentNode(): DevExpress.viz.treeMap.TreeMapNode; + /** Deselects all nodes in the widget. */ + clearSelection(): void; + /** Hides the tooltip. */ + hideTooltip(): void; + /** Drills one level up. */ + drillUp(): void; + /** Resets the drill down level. */ + resetDrillDown(): void; + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + } +} +interface JQuery { + dxTreeMap(options?: DevExpress.viz.treeMap.dxTreeMapOptions): JQuery; + dxTreeMap(methodName: string, ...params: any[]): any; + dxTreeMap(methodName: "instance"): DevExpress.viz.dxTreeMap; +} diff --git a/devextreme/devextreme-16.1.7.d.ts b/devextreme/devextreme-16.1.7.d.ts new file mode 100644 index 0000000000..a3273c19dd --- /dev/null +++ b/devextreme/devextreme-16.1.7.d.ts @@ -0,0 +1,8052 @@ +// Type definitions for DevExtreme 16.1.7 +// Project: http://js.devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module DevExpress { + /** Formats values. */ + export interface Format { + /** Specifies a predefined format. */ + type?: String; + /** Specifies the currency code for the 'currency' format. */ + currency?: String; + /** Specifies a precision for values of a numeric format. */ + precision?: number; + /** Parses string values into numeric or date-time values. */ + parser?: (value: any) => any; + /** Specifies a custom format. */ + formatter?: (value: any) => any; + } + /** A mixin that provides a capability to fire and subscribe to events. */ + export interface EventsMixin { + /** Subscribes to a specified event. */ + on(eventName: string, eventHandler: Function): T; + /** Subscribes to the specified events. */ + on(events: { [eventName: string]: Function; }): T; + /** Detaches all event handlers from the specified event. */ + off(eventName: string): Object; + /** Detaches a particular event handler from the specified event. */ + off(eventName: string, eventHandler: Function): T; + } + /** An object that serves as a namespace for the methods required to perform validation. */ + export module validationEngine { + export interface IValidator { + validate(): ValidatorValidationResult; + reset(): void; + } + export interface ValidatorValidationResult { + isValid: boolean; + name?: string; + value: any; + brokenRule: any; + validationRules: any[]; + } + export interface ValidationGroupValidationResult { + isValid: boolean; + brokenRules: any[]; + validators: IValidator[]; + } + export interface GroupConfig extends EventsMixin { + group: any; + validators: IValidator[]; + validate(): ValidationGroupValidationResult; + reset(): void; + } + /** Provides access to the object that represents the specified validation group. */ + export function getGroupConfig(group: any): GroupConfig + /** Provides access to the object that represents the default validation group. */ + export function getGroupConfig(): GroupConfig + /** Validates rules of the validators that belong to the specified validation group. */ + export function validateGroup(group: any): ValidationGroupValidationResult; + /** Validates rules of the validators that belong to the default validation group. */ + export function validateGroup(): ValidationGroupValidationResult; + /** Resets the values and validation result of the editors that belong to the specified validation group. */ + export function resetGroup(group: any): void; + /** Resets the values and validation result of the editors that belong to the default validation group. */ + export function resetGroup(): void; + /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ + export function validateModel(model: Object): ValidationGroupValidationResult; + /** Registers all the dxValidator objects extending fields of the specified ViewModel. */ + export function registerModelForValidation(model: Object): void; + /** Unregisters all the dxValidator objects extending fields of the specified ViewModel. */ + export function unregisterModelForValidation(model: Object): void; + } + export var hardwareBackButton: JQueryCallback; + /** Processes the hardware back button click. */ + export function processHardwareBackButton(): void; + /** Hides the last displayed overlay widget. */ + export function hideTopOverlay(): boolean; + /** + * Specifies whether or not the entire application/site supports right-to-left representation. + * @deprecated Use the config(config) method instead. + */ + export var rtlEnabled: boolean; + /** Gets the current global configuration object. */ + export function config(): Object; + /** Sets the global configuration object. */ + export function config(config: Object): void; + /** Registers a new component in the DevExpress.ui namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, componentClass: Object): void; + /** Registers a new component in the specified namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, namespace: Object, componentClass: Object): void; + export function requestAnimationFrame(callback: Function): number; + export function cancelAnimationFrame(requestID: number): void; + /** Custom Knockout binding that links an HTML element with a specific action. */ + export class Action { } + /** An object used to manage OData endpoints in your application. */ + export class EndpointSelector { + constructor(options: { + [key: string]: { + local?: string; + production?: string; + } + }); + /** Returns an endpoint for the specified key. */ + urlFor(key: string): string; + } + /** An object that serves as a namespace for the methods that are used to animate UI elements. */ + export module fx { + /** Defines animation options. */ + export interface AnimationOptions { + /** A function called after animation is completed. */ + complete?: (element: JQuery, config: AnimationOptions) => void; + /** A number specifying wait time before animation execution. */ + delay?: number; + /** A number specifying the time period to wait before the animation of the next stagger item starts. */ + staggerDelay?: number; + /** A number specifying the time in milliseconds spent on animation. */ + duration?: number; + /** A string specifying the type of an easing function used for animation. */ + easing?: string; + /** Specifies the initial animation state. */ + from?: any; + /** A function called before animation is started. */ + start?: (element: JQuery, config: AnimationOptions) => void; + /** Specifies a final animation state. */ + to?: any; + /** A string value specifying the animation type. */ + type?: string; + /** Specifies the animation direction for the "slideIn" and "slideOut" animation types. */ + direction?: string; + } + /** Animates the specified element. */ + export function animate(element: HTMLElement, config: AnimationOptions): Object; + /** Returns a value indicating whether the specified element is being animated. */ + export function isAnimating(element: HTMLElement): boolean; + /** Stops the animation. */ + export function stop(element: HTMLElement, jumpToEnd: boolean): void; + } + /** The manager that performs several specified animations at a time. */ + export class TransitionExecutor { + /** Deletes all the animations registered in the Transition Executor by using the enter(elements, animation) and leave(elements, animation) methods. */ + reset(): void; + /** Registers a set of elements that should be animated as "entering" using the specified animation configuration. */ + enter(elements: JQuery, animation: any): void; + /** Registers a set of elements that should be animated as "leaving" using the specified animation configuration. */ + leave(elements: JQuery, animation: any): void; + /** Starts all the animations registered using the enter(elements, animation) and leave(elements, animation) methods beforehand. */ + start(config: Object): JQueryPromise; + /** Stops all started animations. */ + stop(): void; + } + export class AnimationPresetCollection { + /** Resets all the changes made in the animation repository. */ + resetToDefaults(): void; + /** Deletes the specified animation or clears all the animation repository, if an animation name is not passed. */ + clear(name: string): void; + /** Adds the specified animation preset to the animation repository by the specified name. */ + registerPreset(name: string, config: any): void; + /** Applies the changes made in the animation repository. */ + applyChanges(): void; + /** Returns the configuration of the animation found in the animation repository by the specified name for the current device. */ + getPreset(name: string): void; + /** Registers predefined animations in the animation repository. */ + registerDefaultPresets(): void; + } + /** A repository of animations. */ + export var animationPresets: AnimationPresetCollection; + /** The device object defines the device on which the application is running. */ + export interface Device { + /** Indicates whether or not the device platform is Android. */ + android?: boolean; + /** Specifies the type of the device on which the application is running. */ + deviceType?: string; + /** Indicates whether or not the device platform is generic, which means that the application will look and behave according to a generic "light" or "dark" theme. */ + generic?: boolean; + /** Indicates whether or not the device platform is iOS. */ + ios?: boolean; + /** Indicates whether or not the device type is 'phone'. */ + phone?: boolean; + /** Specifies the platform of the device on which the application is running. */ + platform?: string; + /** Indicates whether or not the device type is 'tablet'. */ + tablet?: boolean; + /** Specifies an array with the major and minor versions of the device platform. */ + version?: Array; + /** Indicates whether or not the device platform is Windows. */ + win?: boolean; + /** Specifies a performance grade of the current device. */ + grade?: string; + } + export class Devices implements EventsMixin { + constructor(options: { window: Window }); + /** Overrides actual device information to force the application to operate as if it was running on a specified device. */ + current(deviceName: any): void; + /** Returns information about the current device. */ + current(): Device; + orientationChanged: JQueryCallback; + /** Returns the current device orientation. */ + orientation(): string; + /** Returns real information about the current device regardless of the value passed to the devices.current(deviceName) method. */ + real(): Device; + on(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + on(eventName: string, eventHandler: Function): Devices; + on(events: { [eventName: string]: Function; }): Devices; + off(eventName: "orientationChanged"): Devices; + off(eventName: string): Devices; + off(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + off(eventName: string, eventHandler: Function): Devices; + } + /** An object that serves as a namespace for the methods and events specifying information on the current device. */ + export var devices: Devices; + /** The position object specifies the widget positioning options. */ + export interface PositionOptions { + /** The target element position that the widget is positioned against. */ + at?: any; + /** The element within which the widget is positioned. */ + boundary?: Object; + /** Specifies the horizontal and vertical offset from the window's boundaries. */ + boundaryOffset?: any; + /** Specifies how to move the widget if it overflows the screen. */ + collision?: any; + /** The position of the widget to align against the target element. */ + my?: any; + /** The target element that the widget is positioned against. */ + of?: Object; + /** Specifies horizontal and vertical offset in pixels. */ + offset?: any; + } + export interface ComponentOptions { + /** A handler for the initialized event. */ + onInitialized?: Function; + /** A handler for the optionChanged event. */ + onOptionChanged?: Function; + /** A handler for the disposing event. */ + onDisposing?: Function; + } + /** A base class for all components and widgets. */ + export class Component { + constructor(options?: ComponentOptions) + /** Prevents the component from refreshing until the endUpdate() method is called. */ + beginUpdate(): void; + /** Enables the component to refresh after the beginUpdate() method call. */ + endUpdate(): void; + /** Returns an instance of this component class. */ + instance(): Component; + /** Returns the configuration options of this component. */ + option(): { + [optionKey: string]: any; + }; + /** Sets one or more options of this component. */ + option(options: { + [optionKey: string]: any; + }): void; + /** Gets the value of the specified configuration option of this component. */ + option(optionName: string): any; + /** Sets a value to the specified configuration option of this component. */ + option(optionName: string, optionValue: any): void; + } + export interface DOMComponentOptions extends ComponentOptions { + /** Specifies whether or not the current component supports a right-to-left representation. */ + rtlEnabled?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the width of the widget. */ + width?: any; + /** A bag for holding any options that require two-way binding (Angular approach specific) */ + bindingOptions?: { [key: string]: any; }; + } + /** A base class for all components. */ + export class DOMComponent extends Component { + constructor(element: JQuery, options?: DOMComponentOptions); + constructor(element: HTMLElement, options?: DOMComponentOptions); + /** Returns the root HTML element of the widget. */ + element(): JQuery; + /** Specifies the device-dependent default configuration options for this component. */ + static defaultOptions(rule: { + device?: any; + options?: any; + }): void; + } + export module data { + export interface ODataError extends Error { + httpStatus?: number; + errorDetails?: any; + } + export interface StoreOptions { + /** A handler for the modified event. */ + onModified?: () => void; + /** A handler for the modifying event. */ + onModifying?: () => void; + /** A handler for the removed event. */ + onRemoved?: (key: any) => void; + /** A handler for the removing event. */ + onRemoving?: (key: any) => void; + /** A handler for the updated event. */ + onUpdated?: (key: any, values: Object) => void; + /** A handler for the updating event. */ + onUpdating?: (key: any, values: Object) => void; + /** A handler for the loaded event. */ + onLoaded?: (result: Array) => void; + /** A handler for the loading event. */ + onLoading?: (loadOptions: LoadOptions) => void; + /** A handler for the inserted event. */ + onInserted?: (values: Object, key: any) => void; + /** A handler for the inserting event. */ + onInserting?: (values: Object) => void; + /** Specifies the function called when the Store causes an error. */ + errorHandler?: (e: Error) => void; + /** Specifies the key properties within the data associated with the Store. */ + key?: any; + } + export interface LoadOptions { + filter?: Object; + sort?: Object; + select?: Object; + expand?: Object; + group?: Object; + skip?: number; + take?: number; + userData?: Object; + requireTotalCount?: boolean; + } + /** The base class for all Stores. */ + export class Store implements EventsMixin { + constructor(options?: StoreOptions); + /** Returns the data item specified by the key. */ + byKey(key: any): JQueryPromise; + /** Adds an item to the data associated with this Store. */ + insert(values: Object): JQueryPromise; + /** Returns the key expression specified via the key configuration option. */ + key(): any; + /** Returns the key of the Store item that matches the specified object. */ + keyOf(obj: Object): any; + /** Starts loading data. */ + load(obj?: LoadOptions): JQueryPromise; + /** Removes the data item specified by the key. */ + remove(key: any): JQueryPromise; + /** Obtains the total count of items that will be returned by the load() function. */ + totalCount(options?: { + filter?: Object; + group?: Object; + }): JQueryPromise; + /** Updates the data item specified by the key. */ + update(key: any, values: Object): JQueryPromise; + on(eventName: "removing", eventHandler: (key: any) => void): Store; + on(eventName: "removed", eventHandler: (key: any) => void): Store; + on(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "inserting", eventHandler: (values: Object) => void): Store; + on(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + on(eventName: "modifying", eventHandler: () => void): Store; + on(eventName: "modified", eventHandler: () => void): Store; + on(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + on(eventName: "loaded", eventHandler: (result: Array) => void): Store; + on(eventName: string, eventHandler: Function): Store; + on(events: { [eventName: string]: Function; }): Store; + off(eventName: "removing"): Store; + off(eventName: "removed"): Store; + off(eventName: "updating"): Store; + off(eventName: "updated"): Store; + off(eventName: "inserting"): Store; + off(eventName: "inserted"): Store; + off(eventName: "modifying"): Store; + off(eventName: "modified"): Store; + off(eventName: "loading"): Store; + off(eventName: "loaded"): Store; + off(eventName: string): Store; + off(eventName: "removing", eventHandler: (key: any) => void): Store; + off(eventName: "removed", eventHandler: (key: any) => void): Store; + off(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "inserting", eventHandler: (values: Object) => void): Store; + off(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + off(eventName: "modifying", eventHandler: () => void): Store; + off(eventName: "modified", eventHandler: () => void): Store; + off(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + off(eventName: "loaded", eventHandler: (result: Array) => void): Store; + off(eventName: string, eventHandler: Function): Store; + } + export interface ArrayStoreOptions extends StoreOptions { + /** Specifies the array associated with this Store. */ + data?: Array; + } + /** A Store accessing an in-memory array. */ + export class ArrayStore extends Store { + constructor(options?: ArrayStoreOptions); + /** Clears all data associated with the current ArrayStore. */ + clear(): void; + /** Creates the Query object for the underlying array. */ + createQuery(): Query; + } + interface Promise { + then(doneFn?: Function, failFn?: Function, progressFn?: Function): Promise; + } + export interface CustomStoreOptions extends StoreOptions { + /** Specifies whether or not the store combines the search expression with the filter expression. */ + useDefaultSearch?: boolean; + /** The user implementation of the byKey(key, extraOptions) method. */ + byKey?: (key: any) => Promise; + /** The user implementation of the insert(values) method. */ + insert?: (values: Object) => Promise; + /** The user implementation of the load(options) method. */ + load?: (options?: LoadOptions) => Promise; + /** The user implementation of the remove(key) method. */ + remove?: (key: any) => Promise; + /** The user implementation of the totalCount(options) method. */ + totalCount?: (options?: { + filter?: Object; + group?: Object; + }) => Promise; + /** The user implementation of the update(key, values) method. */ + update?: (key: any, values: Object) => Promise; + } + /** A Store object that enables you to implement your own data access logic. */ + export class CustomStore extends Store { + constructor(options: CustomStoreOptions); + } + export interface DataSourceOptions { + /** Specifies data filtering conditions. */ + filter?: Object; + /** Specifies data grouping conditions. */ + group?: Object; + /** The item mapping function. */ + map?: (record: any) => any; + /** Specifies the maximum number of items the page can contain. */ + pageSize?: number; + /** Specifies whether a DataSource loads data by pages, or all items at once. */ + paginate?: boolean; + /** The data post processing function. */ + postProcess?: (data: any[]) => any[]; + /** Specifies a value by which the required items are searched. */ + searchExpr?: Object; + /** Specifies the comparison operation used to search for the required items. */ + searchOperation?: string; + /** Specifies the value to which the search expression is compared. */ + searchValue?: Object; + /** Specifies the initial select option value. */ + select?: Object; + /** An array of the strings that represent the names of the navigation properties to be loaded simultaneously with the OData store's entity. */ + expand?: Object; + /** The bag of custom parameters passed to the query executed when the DataSource load operation is invoked. */ + customQueryParams?: Object; + /** Specifies whether or not the DataSource instance requests the total count of items available in the storage. */ + requireTotalCount?: boolean; + /** Specifies the initial sort option value. */ + sort?: Object; + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Error) => void; + } + export interface OperationPromise extends JQueryPromise { + operationId: number; + } + /** An object that provides access to a data web service or local data storage for collection container widgets. */ + export class DataSource implements EventsMixin { + constructor(url: string); + constructor(data: Array); + constructor(options: CustomStoreOptions); + constructor(options: DataSourceOptions); + /** Disposes all resources associated with this DataSource. */ + dispose(): void; + /** Returns the current filter option value. */ + filter(): Object; + /** Sets the filter option value. */ + filter(filterExpr: Object): void; + /** Returns the current group option value. */ + group(): Object; + /** Sets the group option value. */ + group(groupExpr: Object): void; + /** Indicates whether or not the current page contains fewer items than the number of items specified by the pageSize configuration option. */ + isLastPage(): boolean; + /** Indicates whether or not at least one load() method execution has successfully finished. */ + isLoaded(): boolean; + /** Indicates whether or not the DataSource is currently being loaded. */ + isLoading(): boolean; + /** Returns the array of items currently operated by the DataSource. */ + items(): Array; + /** Returns the key expression. */ + key(): any; + /** Starts loading data. */ + load(): OperationPromise>; + /** Clears currently loaded DataSource items and calls the load() method. */ + reload(): OperationPromise>; + /** Returns an object that would be passed to the load() method of the underlying Store according to the current data shaping option values of the current DataSource instance. */ + loadOptions(): Object; + /** Returns the current pageSize option value. */ + pageSize(): number; + /** Sets the pageSize option value. */ + pageSize(value: number): void; + /** Specifies the index of the currently loaded page. */ + pageIndex(): number; + /** Specifies the index of the page to be loaded during the next load() method execution. */ + pageIndex(newIndex: number): void; + /** Returns the current paginate option value. */ + paginate(): boolean; + /** Sets the paginate option value. */ + paginate(value: boolean): void; + /** Returns the searchExpr option value. */ + searchExpr(): Object; + /** Sets the searchExpr option value. */ + searchExpr(...expr: Object[]): void; + /** Returns the currently specified search operation. */ + searchOperation(): string; + /** Sets the current search operation. */ + searchOperation(op: string): void; + /** Returns the searchValue option value. */ + searchValue(): Object; + /** Sets the searchValue option value. */ + searchValue(value: Object): void; + /** Returns the current select option value. */ + select(): Object; + /** Sets the select option value. */ + select(expr: Object): void; + /** Returns the current requireTotalCount option value. */ + requireTotalCount(): boolean; + /** Sets the requireTotalCount option value. */ + requireTotalCount(value: boolean): void; + /** Returns the current sort option value. */ + sort(): Object; + /** Sets the sort option value. */ + sort(sortExpr: Object): void; + /** Returns the underlying Store instance. */ + store(): Store; + /** Returns the number of data items available in an underlying Store after the last load() operation without paging. */ + totalCount(): number; + /** Cancels the load operation associated with the specified identifier. */ + cancel(operationId: number): boolean; + on(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + on(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + on(eventName: "changed", eventHandler: () => void): DataSource; + on(eventName: string, eventHandler: Function): DataSource; + on(events: { [eventName: string]: Function; }): DataSource; + off(eventName: "loadingChanged"): DataSource; + off(eventName: "loadError"): DataSource; + off(eventName: "changed"): DataSource; + off(eventName: string): DataSource; + off(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + off(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + off(eventName: "changed", eventHandler: () => void): DataSource; + off(eventName: string, eventHandler: Function): DataSource; + } + /** An object used to work with primitive data types not supported by JavaScript when accessing an OData web service. */ + export class EdmLiteral { + /** Creates an EdmLiteral instance and assigns the specified value to it. */ + constructor(value: string); + /** Returns a string representation of the value associated with this EdmLiteral object. */ + valueOf(): string; + } + /** An object used to generate and hold the GUID. */ + export class Guid { + /** Creates a new Guid instance that holds the specified GUID. */ + constructor(value: string); + /** Creates a new Guid instance holding the generated GUID. */ + constructor(); + /** Returns a string representation of the Guid instance. */ + toString(): string; + /** Returns a string representation of the Guid instance. */ + valueOf(): string; + } + export interface LocalStoreOptions extends ArrayStoreOptions { + /** Specifies the time (in miliseconds) after the change operation, before the data is flushed. */ + flushInterval?: number; + /** Specifies whether the data is flushed immediatelly after each change operation, or after the delay specified via the flushInterval option. */ + immediate?: boolean; + /** The unique identifier used to distinguish the data within the HTML5 Web Storage. */ + name?: string; + } + /** A Store providing access to the HTML5 Web Storage. */ + export class LocalStore extends ArrayStore { + constructor(options?: LocalStoreOptions); + /** Removes all data associated with this Store. */ + clear(): void; + } + export interface ODataContextOptions extends ODataStoreOptions { + /** Specifies the list of entities to be accessed via the ODataContext. */ + entities?: Object; + /** Specifies the function called if the ODataContext causes an error. */ + errorHandler?: (e: Error) => void; + } + /** Provides access to the entire OData service. */ + export class ODataContext { + constructor(options?: ODataContextOptions); + /** Initiates the specified WebGet service operation that returns a value. For the information on service operations, refer to the OData documentation. */ + get(operationName: string, params: Object): JQueryPromise; + /** Initiates the specified WebGet service operation that returns nothing. For the information on service operations, refer to the OData documentation. */ + invoke(operationName: string, params: Object, httpMethod: Object): JQueryPromise; + /** Return a special proxy object to describe the entity link. */ + objectLink(entityAlias: string, key: any): Object; + } + export interface ODataStoreOptions extends StoreOptions { + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: { + url: string; + async: boolean; + method: string; + timeout: number; + params: Object; + payload: Object; + headers: Object; + }) => void; + /** Specifies whether the ODataStore uses the JSONP approach to access non-CORS-compatible remote services. */ + jsonp?: boolean; + /** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, Boolean, Single, Decimal and Guid. */ + keyType?: any; + /** Specifies whether or not dates in a response are deserialized. */ + deserializeDates?: boolean; + /** Specifies the URL of the data service being accessed via the current ODataContext. */ + url?: string; + /** Specifies the version of the OData protocol used to interact with the data service. */ + version?: number; + /** Specifies the value of the withCredentials field of the underlying jqXHR object. */ + withCredentials?: boolean; + } + /** A Store providing access to a separate OData web service entity. */ + export class ODataStore extends Store { + constructor(options?: ODataStoreOptions); + /** Creates the Query object for the OData endpoint. */ + createQuery(loadOptions: Object): Object; + /** Returns the data item specified by the key. */ + byKey(key: any, extraOptions?: { expand?: Object }): JQueryPromise; + } + /** An universal chainable data query interface object. */ + export interface Query { + /** Calculates a custom summary for the items in the current Query. */ + aggregate(step: (accumulator: any, value: any) => any): JQueryPromise; + /** Calculates a custom summary for the items in the current Query. */ + aggregate(seed: any, step: (accumulator: any, value: any) => any, finalize: (result: any) => any): JQueryPromise; + /** Calculates the average item value for the current Query. */ + avg(getter: Object): JQueryPromise; + /** Finds the item with the maximum getter value. */ + max(getter: Object): JQueryPromise; + /** Finds the item with the maximum value in the Query. */ + max(): JQueryPromise; + /** Finds the item with the minimum value in the Query. */ + min(): JQueryPromise; + /** Finds the item with the minimum getter value. */ + min(getter: Object): JQueryPromise; + /** Calculates the average item value for the current Query, if each Query item has a numeric type. */ + avg(): JQueryPromise; + /** Returns the total count of items in the current Query. */ + count(): JQueryPromise; + /** Executes the Query. */ + enumerate(): JQueryPromise; + /** Filters the current Query data. */ + filter(criteria: Array): Query; + /** Filters the current Query data. */ + filter(predicate: (item: any) => boolean): Query; + /** Groups the current Query data. */ + groupBy(getter: Object): Query; + /** Applies the specified transformation to each item. */ + select(getter: Object): Query; + /** Limits the data item count. */ + slice(skip: number, take?: number): Query; + /** Sorts current Query data. */ + sortBy(getter: Object, desc: boolean): Query; + /** Sorts current Query data. */ + sortBy(getter: Object): Query; + /** Calculates the sum of item getter values in the current Query. */ + sum(getter: Object): JQueryPromise; + /** Calculates the sum of item values in the current Query. */ + sum(): JQueryPromise; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object): Query; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object, desc: boolean): Query; + /** Returns the array of current Query items. */ + toArray(): Array; + } + /** The global data layer error handler. */ + export var errorHandler: (e: Error) => void; + /** Encodes the specified string or array of bytes to base64 encoding. */ + export function base64_encode(input: any): string; + /** Creates a Query instance. */ + export function query(array: Array): Query; + /** Creates a Query instance for accessing the remote service specified by a URL. */ + export function query(url: string, queryOptions: Object): Query; + /** This section describes the utility objects provided by the DevExtreme data layer. */ + export var utils: { + /** Compiles a getter function from the getter expression. */ + compileGetter(expr: any): Function; + /** Compiles a setter function from the setter expression. */ + compileSetter(expr: any): Function; + odata: { + /** Holds key value converters for OData. */ + keyConverters: { + String(value: any): string; + Int32(value: any): number; + Int64(value: any): EdmLiteral; + Guid(value: any): Guid; + Boolean(value: any): boolean; + Single(value: any): EdmLiteral; + Decimal(value: any): EdmLiteral; + }; + } + } + } + /** An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications. */ + export module ui { + export interface WidgetOptions extends DOMComponentOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + /** Specifies whether or not the widget can be focused. */ + focusStateEnabled?: boolean; + /** Specifies a shortcut key that sets focus on the widget element. */ + accessKey?: string; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** Specifies the widget tab index. */ + tabIndex?: number; + /** Specifies the text of the hint displayed for the widget. */ + hint?: string; + } + /** The base class for widgets. */ + export class Widget extends DOMComponent { + constructor(options?: WidgetOptions); + /** Redraws the widget. */ + repaint(): void; + /** Sets focus on the widget. */ + focus(): void; + /** Registers a handler when a specified key is pressed. */ + registerKeyHandler(key: string, handler: Function): void; + } + export interface CollectionWidgetOptions extends WidgetOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** The time period in milliseconds before the onItemHold event is raised. */ + itemHoldTimeout?: number; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + loopItemFocus?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + onContentReady?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemContextMenu event. */ + onItemContextMenu?: Function; + /** A handler for the itemHold event. */ + onItemHold?: Function; + /** A handler for the itemRendered event. */ + onItemRendered?: Function; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** The index of the currently selected widget item. */ + selectedIndex?: number; + /** The selected item object. */ + selectedItem?: Object; + /** An array of currently selected item objects. */ + selectedItems?: Array; + /** A handler for the itemDeleting event. */ + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + } + /** The base class for widgets containing an item collection. */ + export class CollectionWidget extends Widget { + constructor(element: JQuery, options?: CollectionWidgetOptions); + constructor(element: HTMLElement, options?: CollectionWidgetOptions); + selectItem(itemElement: any): void; + unselectItem(itemElement: any): void; + deleteItem(itemElement: any): JQueryPromise; + isItemSelected(itemElement: any): boolean; + reorderItem(itemElement: any, toItemElement: any): JQueryPromise; + } + export interface DataExpressionMixinOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of a data source item field whose value is held in the value configuration option. */ + valueExpr?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** The currently selected value in the widget. */ + value?: Object; + } + export interface EditorOptions extends WidgetOptions { + /** The currently specified value. */ + value?: Object; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** A Boolean value specifying whether or not the widget is read-only. */ + readOnly?: boolean; + /** Holds the object that defines the error that occurred during validation. */ + validationError?: Object; + /** Specifies whether the editor's value is valid. */ + isValid?: boolean; + /** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ + validationMessageMode?: string; + } + /** A base class for editors. */ + export class Editor extends Widget { + /** Resets the editor's value to undefined. */ + reset(): void; + } + /** An object that serves as a namespace for methods displaying a message in an application/site. */ + export var dialog: { + /** Creates an alert dialog message containing a single "OK" button. */ + alert(message: string, title: string): JQueryPromise; + /** Creates a confirm dialog that contains "Yes" and "No" buttons. */ + confirm(message: string, title: string): JQueryPromise; + /** Creates a custom dialog using the options specified by the passed configuration object. */ + custom(options: { title?: string; message?: string; buttons?: Array; }): { + show(): JQueryPromise; + hide(): void; + hide(value: any): void; + }; + }; + /** Creates a toast message. */ + export function notify(message: any, type: string, displayTime: number): void; + /** Creates a toast message. */ + export function notify(options: Object): void; + /** An object that serves as a namespace for the methods that work with DevExtreme CSS Themes. */ + export var themes: { + /** Returns the name of the currently applied theme. */ + current(): string; + /** Changes the current theme to the specified one. */ + current(themeName: string): void; + }; + /** Sets a specified template engine. */ + export function setTemplateEngine(name: string): void; + /** Sets a custom template engine defined via custom compile and render functions. */ + export function setTemplateEngine(options: Object): void; + } + /** An object that serves as a namespace for utility methods that can be helpful when working with the DevExtreme framework and UI widgets. */ + export var utils: { + /** Sets parameters for the viewport meta tag. */ + initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + /** Requests that the browser call a specified function to update animation before the next repaint. */ + requestAnimationFrame(callback: Function): number; + /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ + cancelAnimationFrame(requestID: number): void; + }; + /** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */ + export module viz { + /** Applies a theme for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(theme: string): void; + /** Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(platform: string, colorScheme: string): void; + /** Registers a new theme based on the existing one. */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** Allows you to export widgets using their SVG markup. */ + export function exportFromMarkup(markup: string, options: Object): void; + /** Applies a predefined or registered custom palette to all visualization widgets at once. */ + export function currentPalette(paletteName: string): void; + /** Obtains the color sets of a predefined or registered palette. */ + export function getPalette(paletteName: string): Object; + /** Registers a new palette. */ + export function registerPalette(paletteName: string, palette: Object): void; + } +} +declare module DevExpress.ui { + export interface dxValidatorValidationAdapter { + /** A function that returns the value to be validated. */ + getValue?: Function; + /** The jQuery.Callbacks() object that is fired when the specified value should be validated. */ + validationRequestsCallbacks?: JQueryCallback; + /** A function that the dxValidator widget calls after validating a specified value. */ + applyValidationResults?: (params: validationEngine.ValidatorValidationResult) => void; + /** A function that resets the validated values. */ + reset?: Function; + /** A function that sets focus to the validated editors when the dxValidationSummary is focused. */ + focus?: Function; + /** A function that returns a Boolean value specifying whether or not to bypass validation. */ + bypass?: Function; + } + export interface dxValidatorOptions extends DOMComponentOptions { + /** An array of validation rules to be checked for the editor with which the dxValidator object is associated. */ + validationRules?: Array; + /** Specifies the editor name to be used in the validation default messages. */ + name?: string; + /** An object that specifies what and when to validate, and how to apply the validation result. */ + adapter?: dxValidatorValidationAdapter; + /** Specifies the validation group the editor will be related to. */ + validationGroup?: string; + /** A handler for the validated event. */ + onValidated?: (params: validationEngine.ValidatorValidationResult) => void; + } + /** A widget that is used to validate the associated DevExtreme editors against the defined validation rules. */ + export class dxValidator extends DOMComponent implements validationEngine.IValidator { + constructor(element: JQuery, options?: dxValidatorOptions); + constructor(element: Element, options?: dxValidatorOptions); + /** Validates the value of the editor that is controlled by the current dxValidator object against the list of the specified validation rules. */ + validate(): validationEngine.ValidatorValidationResult; + /** Resets the value and validation result of the editor associated with the current dxValidator object. */ + reset(): void; + } + /** The widget that is used in the Knockout and Angular approaches to combine the editors to be validated. */ + export class dxValidationGroup extends DOMComponent { + constructor(element: JQuery); + constructor(element: Element); + /** Validates rules of the validators that belong to the current validation group. */ + validate(): validationEngine.ValidationGroupValidationResult; + /** Resets the value and validation result of the editors that are included to the current validation group. */ + reset(): void; + } + export interface dxValidationSummaryOptions extends CollectionWidgetOptions { + /** Specifies the validation group for which summary should be generated. */ + validationGroup?: string; + } + /** A widget for displaying the result of checking validation rules for editors. */ + export class dxValidationSummary extends CollectionWidget { + constructor(element: JQuery, options?: dxValidationSummaryOptions); + constructor(element: Element, options?: dxValidationSummaryOptions); + } + export interface dxResizableOptions extends DOMComponentOptions { + /** Specifies which borders of the widget element are used as a handle. */ + handles?: string; + /** Specifies the lower width boundary for resizing. */ + minWidth?: number; + /** Specifies the upper width boundary for resizing. */ + maxWidth?: number; + /** Specifies the lower height boundary for resizing. */ + minHeight?: number; + /** Specifies the upper height boundary for resizing. */ + maxHeight?: number; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + } + /** A widget that displays required content in a resizable element. */ + export class dxResizable extends DOMComponent { + constructor(element: JQuery, options?: dxResizableOptions); + constructor(element: Element, options?: dxResizableOptions); + } + export interface dxTooltipOptions extends dxPopoverOptions { + } + /** A tooltip widget. */ + export class dxTooltip extends dxPopover { + constructor(element: JQuery, options?: dxTooltipOptions); + constructor(element: Element, options?: dxTooltipOptions); + } + export interface dxDropDownListOptions extends dxDropDownEditorOptions, DataExpressionMixinOptions { + /** Returns the value currently displayed by the widget. */ + displayValue?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies whether or not the widget displays unfiltered values until a user types a number of characters exceeding the minSearchLength option value. */ + showDataBeforeSearch?: boolean; + /** Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */ + searchExpr?: any; + /** Specifies the binary operation used to filter data. */ + searchMode?: string; + /** Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed. */ + searchTimeout?: number; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget supports searching. */ + searchEnabled?: boolean; + /** + * Specifies whether or not the widget displays items by pages. + * @deprecated Use the DataSource paging opportunities instead. + */ + pagingEnabled?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** A handler for the itemClick event. */ + onItemClick?: Function; + onContentReady?: Function; + } + /** A base class for drop-down list widgets. */ + export class dxDropDownList extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDropDownListOptions); + constructor(element: Element, options?: dxDropDownListOptions); + } + export interface dxToolbarOptions extends CollectionWidgetOptions { + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** Informs the widget about its location in a view HTML markup. */ + renderAs?: string; + } + /** A toolbar widget. */ + export class dxToolbar extends CollectionWidget { + constructor(element: JQuery, options?: dxToolbarOptions); + constructor(element: Element, options?: dxToolbarOptions); + } + export interface dxToastOptions extends dxOverlayOptions { + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** The time span in milliseconds during which the dxToast widget is visible. */ + displayTime?: number; + height?: any; + /** The dxToast message text. */ + message?: string; + position?: PositionOptions; + shading?: boolean; + /** Specifies the dxToast widget type. */ + type?: string; + width?: any; + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user swipes it out of the screen boundaries. */ + closeOnSwipe?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user clicks it. */ + closeOnClick?: boolean; + } + /** The toast message widget. */ + export class dxToast extends dxOverlay { + constructor(element: JQuery, options?: dxToastOptions); + constructor(element: Element, options?: dxToastOptions); + } + export interface dxTextEditorOptions extends EditorOptions { + /** A handler for the change event. */ + onChange?: Function; + /** A handler for the copy event. */ + onCopy?: Function; + /** A handler for the cut event. */ + onCut?: Function; + /** A handler for the enterKey event. */ + onEnterKey?: Function; + /** A handler for the focusIn event. */ + onFocusIn?: Function; + /** A handler for the focusOut event. */ + onFocusOut?: Function; + /** A handler for the input event. */ + onInput?: Function; + /** A handler for the keyDown event. */ + onKeyDown?: Function; + /** A handler for the keyPress event. */ + onKeyPress?: Function; + /** A handler for the keyUp event. */ + onKeyUp?: Function; + /** A handler for the paste event. */ + onPaste?: Function; + /** The text displayed by the widget when the widget value is empty. */ + placeholder?: string; + /** Specifies whether to display the Clear button in the widget. */ + showClearButton?: boolean; + /** Specifies the current value displayed by the widget. */ + value?: any; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + /** Specifies HTML attributes applied to the inner input element of the widget. */ + attr?: Object; + /** The read-only option that holds the text displayed by the widget input element. */ + text?: string; + focusStateEnabled?: boolean; + hoverStateEnabled?: boolean; + /** The editor mask that specifies the format of the entered string. */ + mask?: string; + /** Specifies a mask placeholder character. */ + maskChar?: string; + /** Specifies custom mask rules. */ + maskRules?: Object; + /** A message displayed when the entered text does not match the specified pattern. */ + maskInvalidMessage?: string; + /** Specifies whether the value option holds only characters entered by a user or prompt characters as well. */ + useMaskedValue?: boolean; + } + /** A base class for text editing widgets. */ + export class dxTextEditor extends Editor { + constructor(element: JQuery, options?: dxTextEditorOptions); + constructor(element: Element, options?: dxTextEditorOptions); + /** Removes focus from the input element. */ + blur(): void; + /** Sets focus to the input element representing the widget. */ + focus(): void; + } + export interface dxTextBoxOptions extends dxTextEditorOptions { + /** Specifies the maximum number of characters you can enter into the textbox. */ + maxLength?: any; + /** The "mode" attribute value of the actual HTML input element representing the text box. */ + mode?: string; + } + /** A single-line text box widget. */ + export class dxTextBox extends dxTextEditor { + constructor(element: JQuery, options?: dxTextBoxOptions); + constructor(element: Element, options?: dxTextBoxOptions); + } + export interface dxTextAreaOptions extends dxTextBoxOptions { + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + /** Specifies the minimum height of the widget. */ + minHeight?: any; + /** Specifies the maximum height of the widget. */ + maxHeight?: any; + /** A Boolean value specifying whether or not the auto resizing mode is enabled. */ + autoResizeEnabled?: boolean; + } + /** A widget used to display and edit multi-line text. */ + export class dxTextArea extends dxTextBox { + constructor(element: JQuery, options?: dxTextAreaOptions); + constructor(element: Element, options?: dxTextAreaOptions); + } + export interface dxTabsOptions extends CollectionWidgetOptions { + /** Specifies whether the widget enables an end-user to select only a single item or multiple items. */ + selectionMode?: string; + /** Specifies whether or not an end-user can scroll tabs by swiping. */ + scrollByContent?: boolean; + /** Specifies whether or not an end-user can scroll tabs. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A tab strip used to switch between pages. */ + export class dxTabs extends CollectionWidget { + constructor(element: JQuery, options?: dxTabsOptions); + constructor(element: Element, options?: dxTabsOptions); + } + export interface dxTabPanelOptions extends dxMultiViewOptions { + /** A handler for the titleClick event. */ + onTitleClick?: any; + /** A handler for the titleHold event. */ + onTitleHold?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** A Boolean value specifying if tabs in the title are scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean indicating whether or not to add scrolling support for tabs in the title. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A widget used to display a view and to switch between several views by clicking the appropriate tabs. */ + export class dxTabPanel extends dxMultiView { + constructor(element: JQuery, options?: dxTabPanelOptions); + constructor(element: Element, options?: dxTabPanelOptions); + } + export interface dxSelectBoxOptions extends dxDropDownListOptions { + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + /** The text that is provided as a hint in the select box editor. */ + placeholder?: string; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + acceptCustomValue?: boolean; + /** Specifies whether or not to display selection controls. */ + showSelectionControls?: boolean; + /** A handler for the customItemCreating event. */ + onCustomItemCreating?: Function; + } + /** A widget that allows you to select an item in a dropdown list. */ + export class dxSelectBox extends dxDropDownList { + constructor(element: JQuery, options?: dxSelectBoxOptions); + constructor(element: Element, options?: dxSelectBoxOptions); + } + export interface dxTagBoxOptions extends dxSelectBoxOptions { + values?: Array; + /** Specifies the selected items. */ + value?: Array; + /** Gets the currently selected items. */ + selectedItems?: Array; + /** Specifies how the widget applies values. */ + applyValueMode?: string; + /** A Boolean value specifying whether or not to hide selected items. */ + hideSelectedItems?: boolean; + /** A handler for the selectAllValueChanged event. */ + onSelectAllValueChanged?: Function; + /** A Boolean value specifying whether or not the widget is multiline. */ + multiline?: boolean; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** The template to be used for rendering tags. */ + tagTemplate?: any; + } + /** A widget that allows you to select multiple items from a dropdown list. */ + export class dxTagBox extends dxSelectBox { + constructor(element: JQuery, options?: dxTagBoxOptions); + constructor(element: Element, options?: dxTagBoxOptions); + } + export interface dxScrollViewOptions extends dxScrollableOptions { + /** A handler for the pullDown event. */ + onPullDown?: Function; + /** Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the reachBottom event. */ + onReachBottom?: Function; + /** Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom. */ + reachBottomText?: string; + /** Specifies the text shown in the pullDown panel displayed when the content is being refreshed. */ + refreshingText?: string; + } + /** A widget used to display scrollable content. */ + export class dxScrollView extends dxScrollable { + constructor(element: JQuery, options?: dxScrollViewOptions); + constructor(element: Element, options?: dxScrollViewOptions); + /** Returns a value indicating if the scrollView content is larger then the widget container. */ + isFull(): boolean; + /** Locks the widget until the release(preventScrollBottom) method is called and executes the function passed to the onPullDown option and the handler assigned to the pullDown event. */ + refresh(): void; + /** Notifies the scroll view that data loading is finished. */ + release(preventScrollBottom: boolean): JQueryPromise; + /** Toggles the loading state of the widget. */ + toggleLoading(showOrHide: boolean): void; + } + export interface dxScrollableLocation { + top?: number; + left?: number; + } + export interface dxScrollableOptions extends DOMComponentOptions { + /** A string value specifying the available scrolling directions. */ + direction?: string; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A handler for the scroll event. */ + onScroll?: Function; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** A handler for the update event. */ + onUpdated?: Function; + /** Indicates whether to use native or simulated scrolling. */ + useNative?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content swiping it up or down. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content using the scrollbar. */ + scrollByThumb?: boolean; + } + /** A widget used to display scrollable content. */ + export class dxScrollable extends DOMComponent { + constructor(element: JQuery, options?: dxScrollableOptions); + constructor(element: Element, options?: dxScrollableOptions); + /** Returns the height of the scrollable widget in pixels. */ + clientHeight(): number; + /** Returns the width of the scrollable widget in pixels. */ + clientWidth(): number; + /** Returns an HTML element of the widget. */ + content(): JQuery; + /** Scrolls the widget content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Scrolls widget content by the specified number of pixels in horizontal and vertical directions. */ + scrollBy(distanceObject: dxScrollableLocation): void; + /** Returns the height of the scrollable content in pixels. */ + scrollHeight(): number; + /** Returns the current scroll position against the leftmost position. */ + scrollLeft(): number; + /** Returns how far the scrollable content is scrolled from the top and from the left. */ + scrollOffset(): dxScrollableLocation; + /** Scrolls widget content to the specified position. */ + scrollTo(targetLocation: number): void; + /** Scrolls widget content to a specified position. */ + scrollTo(targetLocation: dxScrollableLocation): void; + /** Scrolls widget content to the specified element. */ + scrollToElement(element: Element): void; + /** Returns the current scroll position against the topmost position. */ + scrollTop(): number; + /** Returns the width of the scrollable content in pixels. */ + scrollWidth(): number; + /** Updates the dimensions of the scrollable contents. */ + update(): void; + } + export interface dxRadioGroupOptions extends EditorOptions, DataExpressionMixinOptions { + activeStateEnabled?: boolean; + /** Specifies the radio group layout. */ + layout?: string; + } + /** A widget that enables a user to select one item within a list of items represented by radio buttons. */ + export class dxRadioGroup extends CollectionWidget { + constructor(element: JQuery, options?: dxRadioGroupOptions); + constructor(element: Element, options?: dxRadioGroupOptions); + } + export interface dxPopupToolbarItemOptions { + /** Specifies whether or not a toolbar item must be displayed disabled. */ + disabled?: boolean; + /** Specifies html code inserted into the toolbar item element. */ + html?: string; + /** Specifies a location for the item on the toolbar. */ + location?: string; + /** Specifies a configuration object for the widget that presents a toolbar item. */ + options?: Object; + /** Specifies an item template that should be used to render this item only. */ + template?: any; + /** Specifies text displayed for the toolbar item. */ + text?: string; + /** Specifies whether the item is displayed on a top or bottom toolbar. */ + toolbar?: string; + /** Specifies whether or not a widget item must be displayed. */ + visible?: boolean; + /** A widget that presents a toolbar item. */ + widget?: string; + } + export interface dxPopupOptions extends dxOverlayOptions { + /** Specifies whether or not to allow a user to drag the popup window. */ + dragEnabled?: boolean; + /** Specifies whether or not an end user can resize the widget. */ + resizeEnabled?: boolean; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + /** A Boolean value specifying whether or not to display the widget in full-screen mode. */ + fullScreen?: boolean; + position?: PositionOptions; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showTitle?: boolean; + /** The title in the overlay window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + width?: any; + /** Specifies items displayed on the top or bottom toolbar of the popup window. */ + toolbarItems?: Array; + /** Specifies whether or not the widget displays the Close button. */ + showCloseButton?: boolean; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + } + /** A widget that displays required content in a popup window. */ + export class dxPopup extends dxOverlay { + constructor(element: JQuery, options?: dxPopupOptions); + constructor(element: Element, options?: dxPopupOptions); + } + export interface dxPopoverOptions extends dxPopupOptions { + /** An object defining the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** Specifies the height of the widget. */ + height?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + shading?: boolean; + /** A Boolean value specifying whether or not to display the title in the overlay window. */ + showTitle?: boolean; + /** The target element associated with a popover. */ + target?: any; + /** Specifies the width of the widget. */ + width?: any; + } + /** A widget that displays the required content in a popup window. */ + export class dxPopover extends dxPopup { + constructor(element: JQuery, options?: dxPopoverOptions); + constructor(element: Element, options?: dxPopoverOptions); + /** Displays the widget for the specified target element. */ + show(target?: any): JQueryPromise; + } + export interface dxOverlayOptions extends WidgetOptions { + /** An object defining the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** A Boolean value specifying whether or not the widget is closed if a user presses the Back hardware button. */ + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlapping window. */ + closeOnOutsideClick?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + /** Specifies whether or not an end-user can drag the widget. */ + dragEnabled?: boolean; + /** The height of the widget in pixels. */ + height?: any; + /** Specifies the maximum height the widget can reach while resizing. */ + maxHeight?: any; + /** Specifies the maximum width the widget can reach while resizing. */ + maxWidth?: any; + /** Specifies the minimum height the widget can reach while resizing. */ + minHeight?: any; + /** Specifies the minimum width the widget can reach while resizing. */ + minWidth?: any; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** A Boolean value specifying whether or not the main screen is inactive while the widget is active. */ + shading?: boolean; + /** Specifies the shading color. */ + shadingColor?: string; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + onContentReady?: Function; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** The widget width in pixels. */ + width?: any; + } + /** A widget displaying the required content in an overlay window. */ + export class dxOverlay extends Widget { + constructor(element: JQuery, options?: dxOverlayOptions); + constructor(element: Element, options?: dxOverlayOptions); + /** An HTML element of the widget. */ + content(): JQuery; + /** Hides the widget. */ + hide(): JQueryPromise; + /** Recalculates the overlay's size and position. */ + repaint(): void; + /** Shows the widget. */ + show(): JQueryPromise; + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** A static method that specifies the base z-index for all overlay widgets. */ + static baseZIndex(zIndex: number): void; + } + export interface dxNumberBoxOptions extends dxTextEditorOptions { + /** The maximum value accepted by the number box. */ + max?: number; + /** The minimum value accepted by the number box. */ + min?: number; + /** Specifies whether or not to show spin buttons. */ + showSpinButtons?: boolean; + useTouchSpinButtons?: boolean; + /** Specifies by which value the widget value changes when a spin button is clicked. */ + step?: number; + /** The current number box value. */ + value?: number; + /** The "mode" attribute value of the actual HTML input element representing the widget. */ + mode?: string; + /** Specifies the text of the message displayed if the specified value is not a number. */ + invalidValueMessage?: string; + } + /** A textbox widget that enables a user to enter numeric values. */ + export class dxNumberBox extends dxTextEditor { + constructor(element: JQuery, options?: dxNumberBoxOptions); + constructor(element: Element, options?: dxNumberBoxOptions); + } + export interface dxNavBarOptions extends dxTabsOptions { + scrollingEnabled?: boolean; + } + /** A widget that contains items used to navigate through application views. */ + export class dxNavBar extends dxTabs { + constructor(element: JQuery, options?: dxNavBarOptions); + constructor(element: Element, options?: dxNavBarOptions); + } + export interface dxMultiViewOptions extends CollectionWidgetOptions { + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently displayed item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to change the selected index by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget used to display a view and to switch between several views. */ + export class dxMultiView extends CollectionWidget { + constructor(element: JQuery, options?: dxMultiViewOptions); + constructor(element: Element, options?: dxMultiViewOptions); + } + export interface dxMapLocation { + /** The latitude location of the widget. */ + lat?: number; + /** The longitude location of the widget. */ + lng?: number; + } + export interface dxMapMarker { + /** A URL pointing to the custom icon to be used for the marker. */ + iconSrc?: string; + /** Specifies the marker location. */ + location?: dxMapLocation; + /** A callback function performed when the marker is clicked. */ + onClick?: Function; + /** A tooltip to be used for the marker. */ + tooltip?: { + /** Specifies whether a tooltip is visible by default or not. */ + isShown?: boolean; + /** Specifies the tooltip text. */ + text?: string; + } + } + export interface dxMapRoute { + /** Specifies the color of the line displaying the route. */ + color?: string; + /** Specifies a transportation mode to be used in the displayed route. */ + mode?: string; + /** Specifies the opacity of the line displaying the route. */ + opacity?: number; + /** Contains an array of objects making up the route. */ + locations?: Array; + /** Specifies the thickness of the line displaying the route in pixels. */ + weight?: number; + } + export interface dxMapOptions extends WidgetOptions { + /** Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route, or when creating a widget if it initially contains markers or routes. */ + autoAdjust?: boolean; + center?: dxMapLocation; + /** A handler for the click event. */ + onClick?: any; + /** Specifies whether or not map widget controls are available. */ + controls?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** A key used to authenticate the application within the required map provider. */ + key?: { + /** A key used to authenticate the application within the "Bing" map provider. */ + bing?: string; + /** A key used to authenticate the application within the "Google" map provider. */ + google?: string; + /** A key used to authenticate the application within the "Google Static" map provider. */ + googleStatic?: string; + } + /** A handler for the markerAdded event. */ + onMarkerAdded?: Function; + /** A URL pointing to the custom icon to be used for map markers. */ + markerIconSrc?: string; + /** A handler for the markerRemoved event. */ + onMarkerRemoved?: Function; + /** An array of markers displayed on a map. */ + markers?: Array; + /** The name of the current map data provider. */ + provider?: string; + /** A handler for the ready event. */ + onReady?: Function; + /** A handler for the routeAdded event. */ + onRouteAdded?: Function; + /** A handler for the routeRemoved event. */ + onRouteRemoved?: Function; + /** An array of routes shown on the map. */ + routes?: Array; + /** The type of a map to display. */ + type?: string; + /** Specifies the width of the widget. */ + width?: any; + /** The zoom level of the map. */ + zoom?: number; + } + /** An interactive map widget. */ + export class dxMap extends Widget { + constructor(element: JQuery, options?: dxMapOptions); + constructor(element: Element, options?: dxMapOptions); + /** Adds a marker to the map. */ + addMarker(markerOptions: Object): JQueryPromise; + /** Adds a route to the map. */ + addRoute(routeOptions: Object): JQueryPromise; + /** Removes a marker from the map. */ + removeMarker(marker: Object): JQueryPromise; + /** Removes a route from the map. */ + removeRoute(route: any): JQueryPromise; + } + export interface dxLookupOptions extends dxDropDownListOptions { + applyValueMode?: string; + /** An object that defines widget animation options. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + /** The text displayed on the Clear button. */ + clearButtonText?: string; + /** Specifies whether or not the widget cleans the search box when the popup window is displayed. */ + cleanSearchOnOpening?: boolean; + /** A Boolean value specifying whether or not a widget is closed if a user clicks outside of the overlaying window. */ + closeOnOutsideClick?: any; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** A Boolean value specifying whether or not to display the lookup in full-screen mode. */ + fullScreen?: boolean; + focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not to group widget items. */ + grouped?: boolean; + /** The name of the template used to display a group header. */ + groupTemplate?: any; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies the text shown in the pullDown panel, which is displayed when the widget is scrolled to the bottom. */ + pageLoadingText?: string; + /** The text displayed by the widget when nothing is selected. */ + placeholder?: string; + /** The height of the widget popup element. */ + popupHeight?: any; + /** The width of the widget popup element. */ + popupWidth?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the text displayed in the pullDown panel when the widget is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the widget is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + /** A Boolean value specifying whether or not the search bar is visible. */ + searchEnabled?: boolean; + /** The text that is provided as a hint in the lookup's search bar. */ + searchPlaceholder?: string; + /** A Boolean value specifying whether or not the main screen is inactive while the lookup is active. */ + shading?: boolean; + /** Specifies whether to display the Cancel button in the lookup window. */ + showCancelButton?: boolean; + /** + * A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. + * @deprecated Use the pageLoadMode option instead. + */ + showNextButton?: boolean; + /** The title of the lookup window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** Specifies whether or not to show lookup contents in a dxPopover widget. */ + usePopover?: boolean; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showPopupTitle?: boolean; + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + } + /** A widget that allows a user to select predefined values from a lookup window. */ + export class dxLookup extends dxDropDownList { + constructor(element: JQuery, options?: dxLookupOptions); + constructor(element: Element, options?: dxLookupOptions); + } + export interface dxLoadPanelOptions extends dxOverlayOptions { + /** An object defining the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** The delay in milliseconds after which the load panel is displayed. */ + delay?: number; + /** The height of the widget. */ + height?: number; + /** A URL pointing to an image to be used as a load indicator. */ + indicatorSrc?: string; + /** The text displayed in the load panel. */ + message?: string; + /** A Boolean value specifying whether or not to show a load indicator. */ + showIndicator?: boolean; + /** A Boolean value specifying whether or not to show the pane behind the load indicator. */ + showPane?: boolean; + /** The width of the widget. */ + width?: number; + /** Specifies whether or not the widget can be focused. */ + focusStateEnabled?: boolean; + } + /** A widget used to indicate whether or not an element is loading. */ + export class dxLoadPanel extends dxOverlay { + constructor(element: JQuery, options?: dxLoadPanelOptions); + constructor(element: Element, options?: dxLoadPanelOptions); + } + export interface dxLoadIndicatorOptions extends WidgetOptions { + /** Specifies the path to an image used as the indicator. */ + indicatorSrc?: string; + } + /** The widget used to indicate the loading process. */ + export class dxLoadIndicator extends Widget { + constructor(element: JQuery, options?: dxLoadIndicatorOptions); + constructor(element: Element, options?: dxLoadIndicatorOptions); + } + export interface ListOptionsMenuItem { + /** Specifies the menu item text. */ + text?: string; + /** Holds on a function called when the item is clicked. */ + action?: (itemElement: Element, itemData: any) => void; + } + export interface dxListOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not to display a grouped list. */ + grouped?: boolean; + /** The template to be used for rendering item groups. */ + groupTemplate?: any; + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the groupRendered event. */ + onGroupRendered?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemSwipe event. */ + onItemSwipe?: Function; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + /** Specifies the text shown in the pullDown panel, which is displayed when the list is scrolled to the bottom. */ + pageLoadingText?: string; + /** Specifies the text displayed in the pullDown panel when the list is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the list is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + /** A Boolean value specifying whether to enable or disable list scrolling. */ + scrollingEnabled?: boolean; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying if the list is scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value specifying if the list is scrolled using the scrollbar. */ + scrollByThumb?: boolean; + onItemContextMenu?: Function; + onItemHold?: Function; + /** Specifies whether or not an end-user can collapse groups. */ + collapsibleGroups?: boolean; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies whether or not to display controls used to select list items. */ + showSelectionControls?: boolean; + /** Specifies item selection mode. */ + selectionMode?: string; + selectAllText?: string; + /** A handler for the selectAllValueChanged event. */ + onSelectAllValueChanged?: Function; + /** Specifies the array of items for a context menu called for a list item. */ + menuItems?: Array; + /** Specifies whether an item context menu is shown when a user holds or swipes an item. */ + menuMode?: string; + /** Specifies whether or not an end user can delete list items. */ + allowItemDeleting?: boolean; + /** Specifies the way a user can delete items from the list. */ + itemDeleteMode?: string; + /** Specifies whether or not an end user can reorder list items. */ + allowItemReordering?: boolean; + /** Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ + indicateLoading?: boolean; + activeStateEnabled?: boolean; + } + /** A list widget. */ + export class dxList extends CollectionWidget { + constructor(element: JQuery, options?: dxListOptions); + constructor(element: Element, options?: dxListOptions); + /** Returns the height of the widget in pixels. */ + clientHeight(): number; + /** Removes the specified item from the list. */ + deleteItem(itemIndex: any): JQueryPromise; + /** Removes the specified item from the list. */ + deleteItem(itemElement: Element): JQueryPromise; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemIndex: any): boolean; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemElement: Element): boolean; + /** Reloads list data. */ + reload(): void; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemElement: Element, toItemElement: Element): JQueryPromise; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemIndex: any, toItemIndex: any): JQueryPromise; + /** Scrolls the list content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Returns the height of the list content in pixels. */ + scrollHeight(): number; + /** Scrolls list content to the specified position. */ + scrollTo(location: number): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemElement: Element): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemIndex: any): void; + /** Returns how far the list content is scrolled from the top. */ + scrollTop(): number; + /** Selects the specified item from the list. */ + selectItem(itemElement: Element): void; + /** Selects the specified item from the list. */ + selectItem(itemIndex: any): void; + /** Deselects the specified item from the list. */ + unselectItem(itemElement: Element): void; + /** Unselects the specified item from the list. */ + unselectItem(itemIndex: any): void; + /** Updates the widget scrollbar according to widget content size. */ + updateDimensions(): JQueryPromise; + /** Expands the specified group. */ + expandGroup(groupIndex: number): JQueryPromise; + /** Collapses the specified group. */ + collapseGroup(groupIndex: number): JQueryPromise; + } + export interface dxGalleryOptions extends CollectionWidgetOptions { + /** The time, in milliseconds, spent on slide animation. */ + animationDuration?: number; + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to allow users to switch between items by clicking an indicator. */ + indicatorEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently active gallery item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to display an indicator that points to the selected gallery item. */ + showIndicator?: boolean; + /** A Boolean value that specifies the availability of the "Forward" and "Back" navigation buttons. */ + showNavButtons?: boolean; + /** The time interval in milliseconds, after which the gallery switches to the next item. */ + slideshowDelay?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** Specifies whether or not to display parts of previous and next images along the sides of the current image. */ + wrapAround?: boolean; + /** Specifies if the widget stretches images to fit the total gallery width. */ + stretchImages?: boolean; + /** Specifies the width of an area used to display a single image. */ + initialItemWidth?: number; + } + /** An image gallery widget. */ + export class dxGallery extends CollectionWidget { + constructor(element: JQuery, options?: dxGalleryOptions); + constructor(element: Element, options?: dxGalleryOptions); + /** Shows the specified gallery item. */ + goToItem(itemIndex: number, animation: boolean): JQueryPromise; + /** Shows the next gallery item. */ + nextItem(animation: boolean): JQueryPromise; + /** Shows the previous gallery item. */ + prevItem(animation: boolean): JQueryPromise; + } + export interface dxDropDownEditorOptions extends dxTextBoxOptions { + /** Specifies the current value displayed by the widget. */ + value?: Object; + /** A handler for the closed event. */ + onClosed?: Function; + /** A handler for the opened event. */ + onOpened?: Function; + /** Specifies whether or not the drop-down editor is displayed. */ + opened?: boolean; + fieldEditEnabled?: boolean; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + acceptCustomValue?: boolean; + /** Specifies the way an end-user applies the selected value. */ + applyValueMode?: string; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + activeStateEnabled?: boolean; + } + /** A drop-down editor widget. */ + export class dxDropDownEditor extends dxTextBox { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Closes the drop-down editor. */ + close(): void; + /** Opens the drop-down editor. */ + open(): void; + /** Resets the widget's value to null. */ + reset(): void; + /** Returns an <input> element of the widget. */ + field(): JQuery; + /** Returns an HTML element of the popup window content. */ + content(): JQuery; + } + export interface dxDateBoxOptions extends dxTextEditorOptions { + formatString?: any; + /** Specifies the date display format. Applies only if the pickerType option is 'native' */ + displayFormat?: any; + format?: string; + /** A format used to display date/time information. */ + type?: string; + /** The last date that can be selected within the widget. */ + max?: any; + /** The minimum date that can be selected within the widget. */ + min?: any; + /** The text displayed by the widget when the widget value is not yet specified. This text is also used as a title of the date picker. */ + placeholder?: string; + /** + * Specifies whether or not a user can pick out a date using the drop-down calendar. + * @deprecated Use the pickerType option instead. + */ + useCalendar?: boolean; + /** An object or a value, specifying the date and time currently selected using the date box. */ + value?: any; + /** + * Specifies whether or not the widget uses the native HTML input element. + * @deprecated Use the pickerType option instead. + */ + useNative?: boolean; + /** Specifies the interval between neighboring values in the popup list in minutes. */ + interval?: number; + /** Specifies the maximum zoom level of a calendar, which is used to pick the date. */ + maxZoomLevel?: string; + /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ + minZoomLevel?: string; + /** Specifies the type of date/time picker. */ + pickerType?: string; + /** Specifies the message displayed if the typed value is not a valid date or time. */ + invalidDateMessage?: string; + /** Specifies the message displayed if the specified date is later than the max value or earlier than the min value. */ + dateOutOfRangeMessage?: string; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** Specifies whether or not adaptive widget rendering is enabled on a small screen. */ + adaptivityEnabled?: boolean; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + } + /** A date box widget. */ + export class dxDateBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDateBoxOptions); + constructor(element: Element, options?: dxDateBoxOptions); + } + export interface dxCheckBoxOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Specifies the widget state. */ + value?: boolean; + /** Specifies the text displayed by the check box. */ + text?: string; + } + /** A check box widget. */ + export class dxCheckBox extends Editor { + constructor(element: JQuery, options?: dxCheckBoxOptions); + constructor(element: Element, options?: dxCheckBoxOptions); + } + export interface dxCalendarOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Specifies a date displayed on the current calendar page. */ + currentDate?: Date; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** An object or a value, specifying the date and time currently selected in the calendar. */ + value?: any; + /** The latest date the widget allows to select. */ + max?: any; + /** The earliest date the widget allows to select. */ + min?: any; + /** Specifies whether or not the widget displays a button that selects the current date. */ + showTodayButton?: boolean; + /** Specifies the current calendar zoom level. */ + zoomLevel?: string; + /** Specifies the maximum zoom level of the calendar. */ + maxZoomLevel?: string; + /** Specifies the minimum zoom level of the calendar. */ + minZoomLevel?: string; + /** The template to be used for rendering calendar cells. */ + cellTemplate?: any; + } + /** A calendar widget. */ + export class dxCalendar extends Editor { + constructor(element: JQuery, options?: dxCalendarOptions); + constructor(element: Element, options?: dxCalendarOptions); + } + export interface dxButtonOptions extends WidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A handler for the click event. */ + onClick?: any; + /** Specifies the icon to be displayed on the button. */ + icon?: string; + iconSrc?: string; + /** A template to be used for rendering the dxButton widget. */ + template?: any; + /** The text displayed on the button. */ + text?: string; + /** Specifies the button type. */ + type?: string; + /** Specifies the name of the validation group to be accessed in the click event handler. */ + validationGroup?: string; + } + /** A button widget. */ + export class dxButton extends Widget { + constructor(element: JQuery, options?: dxButtonOptions); + constructor(element: Element, options?: dxButtonOptions); + } + export interface dxBoxOptions extends CollectionWidgetOptions { + /** Specifies how widget items are aligned along the main direction. */ + align?: string; + /** Specifies the direction of item positioning in the widget. */ + direction?: string; + /** Specifies how widget items are aligned cross-wise. */ + crossAlign?: string; + } + /** A container widget used to arrange inner elements. */ + export class dxBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxResponsiveBoxOptions extends CollectionWidgetOptions { + /** Specifies the collection of rows for the grid used to position layout elements. */ + rows?: Array; + /** Specifies the collection of columns for the grid used to position layout elements. */ + cols?: Array; + /** Specifies the function returning the screen factor depending on the screen width. */ + screenByWidth?: (width: number) => string; + /** Specifies the screen factor with which all elements are located in a single column. */ + singleColumnScreen?: string; + } + /** A widget used to build an adaptive markup that is dependent on screen resolution. */ + export class dxResponsiveBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxAutocompleteOptions extends dxDropDownListOptions { + /** Specifies the current value displayed by the widget. */ + value?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies the maximum count of items displayed by the widget. */ + maxItemCount?: number; + /** Gets the currently selected item. */ + selectedItem?: Object; + } + /** A textbox widget that supports autocompletion. */ + export class dxAutocomplete extends dxDropDownList { + constructor(element: JQuery, options?: dxAutocompleteOptions); + constructor(element: Element, options?: dxAutocompleteOptions); + /** Opens the drop-down editor. */ + open(): void; + /** Closes the drop-down editor. */ + close(): void; + } + export interface dxAccordionOptions extends CollectionWidgetOptions { + /** A number specifying the time in milliseconds spent on the animation of the expanding or collapsing of a panel. */ + animationDuration?: number; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies whether all items can be collapsed or whether at least one item must always be expanded. */ + collapsible?: boolean; + /** Specifies whether the widget can expand several items or only a single item at once. */ + multiple?: boolean; + /** The template to be used for rendering dxAccordion items. */ + itemTemplate?: any; + /** A handler for the itemTitleClick event. */ + onItemTitleClick?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** The index number of the currently selected item. */ + selectedIndex?: number; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** A widget that displays data source items on collapsible panels. */ + export class dxAccordion extends CollectionWidget { + constructor(element: JQuery, options?: dxAccordionOptions); + constructor(element: Element, options?: dxAccordionOptions); + /** Collapses the specified item. */ + collapseItem(index: number): JQueryPromise; + /** Expands the specified item. */ + expandItem(index: number): JQueryPromise; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + } + export interface dxFileUploaderOptions extends EditorOptions { + /** A read-only option that holds a File instance representing the selected file. */ + value?: Array; + values?: Array; + buttonText?: string; + /** The text displayed on the button that opens the file browser. */ + selectButtonText?: string; + /** The text displayed on the button that starts uploading. */ + uploadButtonText?: string; + /** Specifies the text displayed on the area to which an end-user can drop a file. */ + labelText?: string; + /** Specifies the value passed to the name attribute of the underlying input element. */ + name?: string; + /** Specifies whether the widget enables an end-user to select a single file or multiple files. */ + multiple?: boolean; + /** Specifies a file type or several types accepted by the widget. */ + accept?: string; + /** Specifies a target Url for the upload request. */ + uploadUrl?: string; + /** Specifies if an end user can remove a file from the selection and interrupt uploading. */ + allowCanceling?: boolean; + /** Specifies whether or not the widget displays the list of selected files. */ + showFileList?: boolean; + /** Gets the current progress in percentages. */ + progress?: number; + /** The message displayed by the widget when it is ready to upload the specified files. */ + readyToUploadMessage?: string; + /** The message displayed by the widget when uploading is finished. */ + uploadedMessage?: string; + /** The message displayed by the widget on uploading failure. */ + uploadFailedMessage?: string; + /** Specifies how the widget uploads files. */ + uploadMode?: string; + /** Specifies the method for the upload request. */ + uploadMethod?: string; + /** Specifies headers for the upload request. */ + uploadHeaders?: Object; + /** A handler for the uploadStarted event. */ + onUploadStarted?: Function; + /** A handler for the uploaded event. */ + onUploaded?: Function; + /** A handler for the uploaded event. */ + onProgress?: Function; + /** A handler for the uploadError event. */ + onUploadError?: Function; + /** A handler for the uploadAborted event. */ + onUploadAborted?: Function; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + } + /** A widget used to select and upload a file or multiple files. */ + export class dxFileUploader extends Editor { + constructor(element: JQuery, options?: dxFileUploaderOptions); + constructor(element: Element, options?: dxFileUploaderOptions); + } + export interface dxTrackBarOptions extends EditorOptions { + /** The minimum value the widget can accept. */ + min?: number; + /** The maximum value the widget can accept. */ + max?: number; + /** The current widget value. */ + value?: number; + } + /** A base class for track bar widgets. */ + export class dxTrackBar extends Editor { + constructor(element: JQuery, options?: dxTrackBarOptions); + constructor(element: Element, options?: dxTrackBarOptions); + } + export interface dxProgressBarOptions extends dxTrackBarOptions { + /** Specifies a format for the progress status. */ + statusFormat?: any; + /** Specifies whether or not the widget displays a progress status. */ + showStatus?: boolean; + /** A handler for the complete event. */ + onComplete?: Function; + } + /** A widget used to indicate progress. */ + export class dxProgressBar extends dxTrackBar { + constructor(element: JQuery, options?: dxProgressBarOptions); + constructor(element: Element, options?: dxProgressBarOptions); + } + export interface dxSliderOptions extends dxTrackBarOptions { + activeStateEnabled?: boolean; + /** The slider step size. */ + step?: number; + /** The current slider value. */ + value?: number; + /** Specifies whether or not to highlight a range selected within the widget. */ + showRange?: boolean; + /** Specifies the size of a step by which a slider handle is moved when a user uses the Page up or Page down keyboard shortcuts. */ + keyStep?: number; + /** Specifies options for the slider tooltip. */ + tooltip?: { + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies format for the tooltip. */ + format?: any; + /** Specifies whether the tooltip is located over or under the slider. */ + position?: string; + /** Specifies whether the widget always shows a tooltip or only when a pointer is over the slider. */ + showMode?: string; + }; + /** Specifies options for labels displayed at the min and max values. */ + label?: { + /** Specifies whether or not slider labels are visible. */ + visible?: boolean; + /** Specifies whether labels are located over or under the scale. */ + position?: string; + /** Specifies a format for labels. */ + format?: any; + }; + } + /** A widget that allows a user to select a numeric value within a given range. */ + export class dxSlider extends dxTrackBar { + constructor(element: JQuery, options?: dxSliderOptions); + constructor(element: Element, options?: dxSliderOptions); + } + export interface dxRangeSliderOptions extends dxSliderOptions { + /** The left edge of the interval currently selected using the range slider. */ + start?: number; + /** The right edge of the interval currently selected using the range slider. */ + end?: number; + } + /** A widget that enables a user to select a range of numeric values. */ + export class dxRangeSlider extends dxSlider { + constructor(element: JQuery, options?: dxRangeSliderOptions); + constructor(element: Element, options?: dxRangeSliderOptions); + } + export interface dxFormItemLabel { + /** Specifies the label text. */ + text?: string; + /** Specifies whether or not the label is visible. */ + visible?: boolean; + /** Specifies whether or not a colon is displayed at the end of the current label. */ + showColon?: boolean; + /** Specifies the location of a label against the editor. */ + location?: string; + /** Specifies the label horizontal alignment. */ + alignment?: string; + } + export interface dxFormItem { + /** Specifies the type of the current item. */ + itemType?: string; + /** Specifies whether or not the current form item is visible. */ + visible?: boolean; + /** Specifies the sequence number of the item in a form, group or tab. */ + visibleIndex?: number; + /** Specifies a CSS class to be applied to the form item. */ + cssClass?: string; + /** Specifies the number of columns spanned by the item. */ + colSpan?: number; + } + export interface dxFormEmptyItem extends dxFormItem { + /** Specifies the form item name. */ + name?: string; + } + export interface dxFormSimpleItem extends dxFormItem { + /** Specifies the path to the formData object field bound to the current form item. */ + dataField?: string; + /** Specifies the form item name. */ + name?: string; + /** Specifies which editor widget is used to display and edit the form item value. */ + editorType?: string; + /** Specifies configuration options for the editor widget of the current form item. */ + editorOptions?: Object; + /** A template to be used for rendering the form item. */ + template?: any; + /** Specifies the help text displayed for the current form item. */ + helpText?: string; + /** Specifies whether the current form item is required. */ + isRequired?: boolean; + /** Specifies options for the form item label. */ + label?: dxFormItemLabel; + /** An array of validation rules to be checked for the form item editor. */ + validationRules?: Array; + } + /** Specifies dependency between the screen factor and the count of columns. */ + export interface ColCountResponsible { + /** The count of columns for an extra small-sized screen. */ + xs?: number; + /** The count of columns for a small-sized screen. */ + sm?: number; + /** The count of columns for a middle-sized screen. */ + md?: number; + /** The count of columns for a large screen size. */ + lg?: number; + } + export interface dxFormGroupItem extends dxFormItem { + /** Specifies the group caption. */ + caption?: string; + /** A template to be used for rendering a group item. */ + template?: any; + /** The count of columns in the group layout. */ + colCount?: number; + /** Specifies dependency between the screen factor and the count of columns in the tab layout. */ + colCountByScreen?: ColCountResponsible; + /** Specifies whether or not all group item labels are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the group. */ + items?: Array; + } + export interface dxFormTab { + /** Specifies the tab title. */ + title?: string; + /** The count of columns in the tab layout. */ + colCount?: number; + /** Specifies dependency between the screen factor and the count of columns in the group layout. */ + colCountByScreen?: ColCountResponsible; + /** Specifies whether or not labels of items displayed within the current tab are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the tab. */ + items?: Array; + /** Specifies a badge text for the tab. */ + badge?: string; + /** A Boolean value specifying whether or not the tab can respond to user interaction. */ + disabled?: boolean; + /** Specifies the icon to be displayed on the tab. */ + icon?: string; + /** The template to be used for rendering the tab. */ + tabTemplate?: any; + /** The template to be used for rendering the tab content. */ + template?: any; + } + export interface dxFormTabbedItem extends dxFormItem { + /** Holds a configuration object for the dxTabPanel widget used to display the current form item. */ + tabPanelOptions?: Object; + /** An array of tab configuration objects. */ + tabs?: Array; + } + export interface dxFormOptions extends WidgetOptions { + /** An object providing data for the form. */ + formData?: Object; + /** The count of columns in the form layout. */ + colCount?: any; + /** Specifies dependency between the screen factor and the count of columns in the form layout. */ + colCountByScreen?: ColCountResponsible; + /** Specifies the function returning the screen factor depending on the screen width. */ + screenByWidth?: (width: number) => string; + /** Specifies the location of a label against the editor. */ + labelLocation?: string; + /** Specifies whether or not all editors on the form are read-only. */ + readOnly?: boolean; + /** A handler for the fieldDataChanged event. */ + onFieldDataChanged?: (e: Object) => void; + /** A handler for the editorEnterKey event. */ + onEditorEnterKey?: (e: Object) => void; + /** Specifies a function that customizes a form item after it has been created. */ + customizeItem?: Function; + /** The minimum column width used for calculating column count in the form layout. */ + minColWidth?: number; + /** Specifies whether or not all root item labels are aligned. */ + alignItemLabels?: boolean; + /** Specifies whether or not item labels in all groups are aligned. */ + alignItemLabelsInAllGroups?: boolean; + /** Specifies whether or not a colon is displayed at the end of form labels. */ + showColonAfterLabel?: boolean; + /** Specifies whether or not the required mark is displayed for required fields. */ + showRequiredMark?: boolean; + /** Specifies whether or not the optional mark is displayed for optional fields. */ + showOptionalMark?: boolean; + /** The text displayed for required fields. */ + requiredMark?: string; + /** The text displayed for optional fields. */ + optionalMark?: string; + /** Specifies the message that is shown for end-users if a required field value is not specified. */ + requiredMessage?: string; + /** Specifies whether or not the total validation summary is displayed on the form. */ + showValidationSummary?: boolean; + /** Holds an array of form items. */ + items?: Array; + /** A Boolean value specifying whether to enable or disable form scrolling. */ + scrollingEnabled?: boolean; + onContentReady?: Function; + } + /** A form widget used to display and edit values of object fields. */ + export class dxForm extends Widget { + constructor(element: JQuery, options?: dxFormOptions); + constructor(element: Element, options?: dxFormOptions); + /** Updates the specified field of the formData object and the corresponding editor on the form. */ + updateData(dataField: string, value: any): void; + /** Updates the specified fields of the formData object and the corresponding editors on the form. */ + updateData(data: Object): void; + /** Updates the value of a form item option. */ + itemOption(field: string, option: string, value: any): void; + /** Updates the values of form item options. */ + itemOption(field: string, options: Object): void; + /** Gets the value of the form item option. */ + itemOption(field: string): any; + /** Returns an editor instance associated with the specified formData field or name of the form item. */ + getEditor(field: string): Object; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + /** Validates the values of all editors on the form against the list of the validation rules specified for each form item. */ + validate(): Object; + /** Resets the editor's value to undefined. */ + resetValues(): void; + } + export interface dxDeferRenderingOptions extends WidgetOptions { + /** Indicates if a load indicator should be shown until the widget's content is rendered. */ + showLoadIndicator?: boolean; + /** Specifies the jQuery.Promise or boolean value, which when resolved, forces widget content to render. */ + renderWhen?: any; + /** Specifies the animation to be used to show the rendered content. */ + animation?: fx.AnimationOptions; + /** Specifies a jQuery selector of items that should be rendered using a staggered animation. */ + staggerItemSelector?: string; + /** Specifies a callback function that is called when the widget's content has finished rendering but is not yet shown. */ + onRendered?: Function; + /** Specifies a callback function that is called when widget content is shown and animation has completed. */ + onShown?: Function; + } + /** A container for elements that must be rendered at a specified moment. */ + export class dxDeferRendering extends Widget { + constructor(element: JQuery, options?: dxDeferRenderingOptions); + constructor(element: Element, options?: dxDeferRenderingOptions); + } +} +interface JQuery { + dxProgressBar(): JQuery; + dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; + dxProgressBar(options: string): any; + dxProgressBar(options: string, ...params: any[]): any; + dxProgressBar(options: DevExpress.ui.dxProgressBarOptions): JQuery; + dxSlider(): JQuery; + dxSlider(options: "instance"): DevExpress.ui.dxSlider; + dxSlider(options: string): any; + dxSlider(options: string, ...params: any[]): any; + dxSlider(options: DevExpress.ui.dxSliderOptions): JQuery; + dxRangeSlider(): JQuery; + dxRangeSlider(options: "instance"): DevExpress.ui.dxRangeSlider; + dxRangeSlider(options: string): any; + dxRangeSlider(options: string, ...params: any[]): any; + dxRangeSlider(options: DevExpress.ui.dxRangeSliderOptions): JQuery; + dxFileUploader(): JQuery; + dxFileUploader(options: "instance"): DevExpress.ui.dxFileUploader; + dxFileUploader(options: string): any; + dxFileUploader(options: string, ...params: any[]): any; + dxFileUploader(options: DevExpress.ui.dxFileUploaderOptions): JQuery; + dxValidator(): JQuery; + dxValidator(options: "instance"): DevExpress.ui.dxValidator; + dxValidator(options: string): any; + dxValidator(options: string, ...params: any[]): any; + dxValidator(options: DevExpress.ui.dxValidatorOptions): JQuery; + dxValidationGroup(): JQuery; + dxValidationGroup(options: "instance"): DevExpress.ui.dxValidationGroup; + dxValidationGroup(options: string): any; + dxValidationGroup(options: string, ...params: any[]): any; + dxValidationSummary(): JQuery; + dxValidationSummary(options: "instance"): DevExpress.ui.dxValidationSummary; + dxValidationSummary(options: string): any; + dxValidationSummary(options: string, ...params: any[]): any; + dxValidationSummary(options: DevExpress.ui.dxValidationSummaryOptions): JQuery; + dxTooltip(): JQuery; + dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; + dxTooltip(options: string): any; + dxTooltip(options: string, ...params: any[]): any; + dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; + dxResizable(): JQuery; + dxResizable(options: "instance"): DevExpress.ui.dxResizable; + dxResizable(options: string): any; + dxResizable(options: string, ...params: any[]): any; + dxResizable(options: DevExpress.ui.dxResizableOptions): JQuery; + dxDropDownList(): JQuery; + dxDropDownList(options: "instance"): DevExpress.ui.dxDropDownList; + dxDropDownList(options: string): any; + dxDropDownList(options: string, ...params: any[]): any; + dxDropDownList(options: DevExpress.ui.dxDropDownListOptions): JQuery; + dxToolbar(): JQuery; + dxToolbar(options: "instance"): DevExpress.ui.dxToolbar; + dxToolbar(options: string): any; + dxToolbar(options: string, ...params: any[]): any; + dxToolbar(options: DevExpress.ui.dxToolbarOptions): JQuery; + dxToast(): JQuery; + dxToast(options: "instance"): DevExpress.ui.dxToast; + dxToast(options: string): any; + dxToast(options: string, ...params: any[]): any; + dxToast(options: DevExpress.ui.dxToastOptions): JQuery; + dxTextEditor(): JQuery; + dxTextEditor(options: "instance"): DevExpress.ui.dxTextEditor; + dxTextEditor(options: string): any; + dxTextEditor(options: string, ...params: any[]): any; + dxTextEditor(options: DevExpress.ui.dxTextEditorOptions): JQuery; + dxTextBox(): JQuery; + dxTextBox(options: "instance"): DevExpress.ui.dxTextBox; + dxTextBox(options: string): any; + dxTextBox(options: string, ...params: any[]): any; + dxTextBox(options: DevExpress.ui.dxTextBoxOptions): JQuery; + dxTextArea(): JQuery; + dxTextArea(options: "instance"): DevExpress.ui.dxTextArea; + dxTextArea(options: string): any; + dxTextArea(options: string, ...params: any[]): any; + dxTextArea(options: DevExpress.ui.dxTextAreaOptions): JQuery; + dxTabs(): JQuery; + dxTabs(options: "instance"): DevExpress.ui.dxTabs; + dxTabs(options: string): any; + dxTabs(options: string, ...params: any[]): any; + dxTabs(options: DevExpress.ui.dxTabsOptions): JQuery; + dxTabPanel(): JQuery; + dxTabPanel(options: "instance"): DevExpress.ui.dxTabPanel; + dxTabPanel(options: string): any; + dxTabPanel(options: string, ...params: any[]): any; + dxTabPanel(options: DevExpress.ui.dxTabPanelOptions): JQuery; + dxSelectBox(): JQuery; + dxSelectBox(options: "instance"): DevExpress.ui.dxSelectBox; + dxSelectBox(options: string): any; + dxSelectBox(options: string, ...params: any[]): any; + dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery; + dxTagBox(): JQuery; + dxTagBox(options: "instance"): DevExpress.ui.dxTagBox; + dxTagBox(options: string): any; + dxTagBox(options: string, ...params: any[]): any; + dxTagBox(options: DevExpress.ui.dxTagBoxOptions): JQuery; + dxScrollView(): JQuery; + dxScrollView(options: "instance"): DevExpress.ui.dxScrollView; + dxScrollView(options: string): any; + dxScrollView(options: string, ...params: any[]): any; + dxScrollView(options: DevExpress.ui.dxScrollViewOptions): JQuery; + dxScrollable(): JQuery; + dxScrollable(options: "instance"): DevExpress.ui.dxScrollable; + dxScrollable(options: string): any; + dxScrollable(options: string, ...params: any[]): any; + dxScrollable(options: DevExpress.ui.dxScrollableOptions): JQuery; + dxRadioGroup(): JQuery; + dxRadioGroup(options: "instance"): DevExpress.ui.dxRadioGroup; + dxRadioGroup(options: string): any; + dxRadioGroup(options: string, ...params: any[]): any; + dxRadioGroup(options: DevExpress.ui.dxRadioGroupOptions): JQuery; + dxPopup(): JQuery; + dxPopup(options: "instance"): DevExpress.ui.dxPopup; + dxPopup(options: string): any; + dxPopup(options: string, ...params: any[]): any; + dxPopup(options: DevExpress.ui.dxPopupOptions): JQuery; + dxPopover(): JQuery; + dxPopover(options: "instance"): DevExpress.ui.dxPopover; + dxPopover(options: string): any; + dxPopover(options: string, ...params: any[]): any; + dxPopover(options: DevExpress.ui.dxPopoverOptions): JQuery; + dxOverlay(): JQuery; + dxOverlay(options: "instance"): DevExpress.ui.dxOverlay; + dxOverlay(options: string): any; + dxOverlay(options: string, ...params: any[]): any; + dxOverlay(options: DevExpress.ui.dxOverlayOptions): JQuery; + dxNumberBox(): JQuery; + dxNumberBox(options: "instance"): DevExpress.ui.dxNumberBox; + dxNumberBox(options: string): any; + dxNumberBox(options: string, ...params: any[]): any; + dxNumberBox(options: DevExpress.ui.dxNumberBoxOptions): JQuery; + dxNavBar(): JQuery; + dxNavBar(options: "instance"): DevExpress.ui.dxNavBar; + dxNavBar(options: string): any; + dxNavBar(options: string, ...params: any[]): any; + dxNavBar(options: DevExpress.ui.dxNavBarOptions): JQuery; + dxMultiView(): JQuery; + dxMultiView(options: "instance"): DevExpress.ui.dxMultiView; + dxMultiView(options: string): any; + dxMultiView(options: string, ...params: any[]): any; + dxMultiView(options: DevExpress.ui.dxMultiViewOptions): JQuery; + dxMap(): JQuery; + dxMap(options: "instance"): DevExpress.ui.dxMap; + dxMap(options: string): any; + dxMap(options: string, ...params: any[]): any; + dxMap(options: DevExpress.ui.dxMapOptions): JQuery; + dxLookup(): JQuery; + dxLookup(options: "instance"): DevExpress.ui.dxLookup; + dxLookup(options: string): any; + dxLookup(options: string, ...params: any[]): any; + dxLookup(options: DevExpress.ui.dxLookupOptions): JQuery; + dxLoadPanel(): JQuery; + dxLoadPanel(options: "instance"): DevExpress.ui.dxLoadPanel; + dxLoadPanel(options: string): any; + dxLoadPanel(options: string, ...params: any[]): any; + dxLoadPanel(options: DevExpress.ui.dxLoadPanelOptions): JQuery; + dxLoadIndicator(): JQuery; + dxLoadIndicator(options: "instance"): DevExpress.ui.dxLoadIndicator; + dxLoadIndicator(options: string): any; + dxLoadIndicator(options: string, ...params: any[]): any; + dxLoadIndicator(options: DevExpress.ui.dxLoadIndicatorOptions): JQuery; + dxList(): JQuery; + dxList(options: "instance"): DevExpress.ui.dxList; + dxList(options: string): any; + dxList(options: string, ...params: any[]): any; + dxList(options: DevExpress.ui.dxListOptions): JQuery; + dxGallery(): JQuery; + dxGallery(options: "instance"): DevExpress.ui.dxGallery; + dxGallery(options: string): any; + dxGallery(options: string, ...params: any[]): any; + dxGallery(options: DevExpress.ui.dxGalleryOptions): JQuery; + dxDropDownEditor(): JQuery; + dxDropDownEditor(options: "instance"): DevExpress.ui.dxDropDownEditor; + dxDropDownEditor(options: string): any; + dxDropDownEditor(options: string, ...params: any[]): any; + dxDropDownEditor(options: DevExpress.ui.dxDropDownEditorOptions): JQuery; + dxDateBox(): JQuery; + dxDateBox(options: "instance"): DevExpress.ui.dxDateBox; + dxDateBox(options: string): any; + dxDateBox(options: string, ...params: any[]): any; + dxDateBox(options: DevExpress.ui.dxDateBoxOptions): JQuery; + dxCheckBox(): JQuery; + dxCheckBox(options: "instance"): DevExpress.ui.dxCheckBox; + dxCheckBox(options: string): any; + dxCheckBox(options: string, ...params: any[]): any; + dxCheckBox(options: DevExpress.ui.dxCheckBoxOptions): JQuery; + dxBox(): JQuery; + dxBox(options: "instance"): DevExpress.ui.dxBox; + dxBox(options: string): any; + dxBox(options: string, ...params: any[]): any; + dxBox(options: DevExpress.ui.dxBoxOptions): JQuery; + dxButton(): JQuery; + dxButton(options: "instance"): DevExpress.ui.dxButton; + dxButton(options: string): any; + dxButton(options: string, ...params: any[]): any; + dxButton(options: DevExpress.ui.dxButtonOptions): JQuery; + dxCalendar(): JQuery; + dxCalendar(options: "instance"): DevExpress.ui.dxCalendar; + dxCalendar(options: string): any; + dxCalendar(options: string, ...params: any[]): any; + dxCalendar(options: DevExpress.ui.dxCalendarOptions): JQuery; + dxAccordion(): JQuery; + dxAccordion(options: "instance"): DevExpress.ui.dxAccordion; + dxAccordion(options: string): any; + dxAccordion(options: string, ...params: any[]): any; + dxAccordion(options: DevExpress.ui.dxAccordionOptions): JQuery; + dxResponsiveBox(): JQuery; + dxResponsiveBox(options: "instance"): DevExpress.ui.dxResponsiveBox; + dxResponsiveBox(options: string): any; + dxResponsiveBox(options: string, ...params: any[]): any; + dxResponsiveBox(options: DevExpress.ui.dxResponsiveBoxOptions): JQuery; + dxAutocomplete(): JQuery; + dxAutocomplete(options: "instance"): DevExpress.ui.dxAutocomplete; + dxAutocomplete(options: string): any; + dxAutocomplete(options: string, ...params: any[]): any; + dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; + dxForm(): JQuery; + dxForm(options: "instance"): DevExpress.ui.dxForm; + dxForm(options: string): any; + dxForm(options: string, ...params: any[]): any; + dxForm(options: DevExpress.ui.dxFormOptions): JQuery; +} + +declare module DevExpress.ui { + export interface dxTileViewOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the height of the base tile view item. */ + baseItemHeight?: number; + /** Specifies the width of the base tile view item. */ + baseItemWidth?: number; + /** Specifies whether tiles are placed horizontally or vertically. */ + direction?: string; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the distance in pixels between adjacent tiles. */ + itemMargin?: number; + /** A Boolean value specifying whether or not to display a scrollbar. */ + showScrollbar?: boolean; + } + /** A widget displaying several blocks of data as tiles. */ + export class dxTileView extends CollectionWidget { + constructor(element: JQuery, options?: dxTileViewOptions); + constructor(element: Element, options?: dxTileViewOptions); + /** Returns the current scroll position of the widget content. */ + scrollPosition(): number; + } + export interface dxSwitchOptions extends EditorOptions { + activeStateEnabled?: boolean; + /** Text displayed when the widget is in a disabled state. */ + offText?: string; + /** Text displayed when the widget is in an enabled state. */ + onText?: string; + /** A Boolean value specifying whether the current switch state is "On" or "Off". */ + value?: boolean; + } + /** A switch widget. */ + export class dxSwitch extends Editor { + constructor(element: JQuery, options?: dxSwitchOptions); + constructor(element: Element, options?: dxSwitchOptions); + } + export interface dxSlideOutViewOptions extends WidgetOptions { + /** Specifies the current menu position. */ + menuPosition?: string; + /** Specifies whether or not the menu panel is visible. */ + menuVisible?: boolean; + /** Specifies whether or not the menu is shown when a user swipes the widget content. */ + swipeEnabled?: boolean; + /** A template to be used for rendering menu panel content. */ + menuTemplate?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal a custom menu. */ + export class dxSlideOutView extends Widget { + constructor(element: JQuery, options?: dxSlideOutViewOptions); + constructor(element: Element, options?: dxSlideOutViewOptions); + /** Returns an HTML element of the widget menu block. */ + menuContent(): JQuery; + /** Returns an HTML element of the widget content block. */ + content(): JQuery; + /** Displays the widget's menu block. */ + showMenu(): JQueryPromise; + /** Hides the widget's menu block. */ + hideMenu(): JQueryPromise; + /** Toggles the visibility of the widget's menu block. */ + toggleMenuVisibility(): JQueryPromise; + } + export interface dxSlideOutOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not to display a grouped menu. */ + menuGrouped?: boolean; + /** Specifies the current menu position. */ + menuPosition?: string; + /** The name of the template used to display a group header. */ + menuGroupTemplate?: any; + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** A handler for the menuGroupRendered event. */ + onMenuGroupRendered?: Function; + /** A handler for the menuItemRendered event. */ + onMenuItemRendered?: Function; + /** Specifies whether or not the slide-out menu is displayed. */ + menuVisible?: boolean; + /** Indicates whether the menu can be shown/hidden by swiping the widget's main panel. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal an item list. */ + export class dxSlideOut extends CollectionWidget { + constructor(element: JQuery, options?: dxSlideOutOptions); + constructor(element: Element, options?: dxSlideOutOptions); + /** Hides the widget's slide-out menu. */ + hideMenu(): JQueryPromise; + /** Displays the widget's slide-out menu. */ + showMenu(): JQueryPromise; + /** Toggles the visibility of the widget's slide-out menu. */ + toggleMenuVisibility(showing: boolean): JQueryPromise; + } + export interface dxPivotOptions extends CollectionWidgetOptions { + /** The index of the currently active pivot item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + } + /** A widget that is similar to a traditional tab control, but optimized for the phone with simplified end-user interaction. */ + export class dxPivot extends CollectionWidget { + constructor(element: JQuery, options?: dxPivotOptions); + constructor(element: Element, options?: dxPivotOptions); + } + export interface dxPanoramaOptions extends CollectionWidgetOptions { + /** An object exposing options for setting a background image for the panorama. */ + backgroundImage?: { + /** Specifies the height of the panorama's background image. */ + height?: number; + /** Specifies the URL of the image that is used as the panorama's background image. */ + url?: string; + /** Specifies the width of the panorama's background image. */ + width?: number; + }; + /** The index of the currently active panorama item. */ + selectedIndex?: number; + /** Specifies the widget content title. */ + title?: string; + } + /** A widget displaying the required content in a long horizontal canvas that extends beyond the frames of the screen. */ + export class dxPanorama extends CollectionWidget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + } + export interface dxDropDownMenuOptions extends WidgetOptions { + /** A handler for the buttonClick event. */ + onButtonClick?: any; + /** The name of the icon to be displayed by the DropDownMenu button. */ + buttonIcon?: string; + /** The text displayed in the DropDownMenu button. */ + buttonText?: string; + buttonIconSrc?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** Specifies whether or not to show the drop down menu within a dxPopover widget. */ + usePopover?: boolean; + /** The width of the menu popup in pixels. */ + popupWidth?: any; + /** The height of the menu popup in pixels. */ + popupHeight?: any; + /** Specifies whether or not the drop-down menu is displayed. */ + opened?: boolean; + hoverStateEnabled?: boolean; + activeStateEnabled?: boolean; + } + /** A drop-down menu widget. */ + export class dxDropDownMenu extends Widget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Opens the drop-down menu. */ + open(): void; + /** Closes the drop-down menu. */ + close(): void; + } + export interface dxActionSheetOptions extends CollectionWidgetOptions { + /** A handler for the cancelClick event. */ + onCancelClick?: any; + /** The text displayed in the button that closes the action sheet. */ + cancelText?: string; + /** Specifies whether or not to display the Cancel button in action sheet. */ + showCancelButton?: boolean; + /** A Boolean value specifying whether or not the title of the action sheet is visible. */ + showTitle?: boolean; + /** Specifies the element the action sheet popover points at. */ + target?: any; + /** The title of the action sheet. */ + title?: string; + /** Specifies whether or not to show the action sheet within a dxPopover widget. */ + usePopover?: boolean; + /** A Boolean value specifying whether or not the dxActionSheet widget is visible. */ + visible?: boolean; + } + /** A widget consisting of a set of choices related to a certain task. */ + export class dxActionSheet extends CollectionWidget { + constructor(element: JQuery, options?: dxActionSheetOptions); + constructor(element: Element, options?: dxActionSheetOptions); + /** Hides the widget. */ + hide(): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Shows or hides the widget depending on the Boolean value passed as the parameter. */ + toggle(showing: boolean): JQueryPromise; + } +} +interface JQuery { + dxTileView(): JQuery; + dxTileView(options: "instance"): DevExpress.ui.dxTileView; + dxTileView(options: string): any; + dxTileView(options: string, ...params: any[]): any; + dxTileView(options: DevExpress.ui.dxTileViewOptions): JQuery; + dxSwitch(): JQuery; + dxSwitch(options: "instance"): DevExpress.ui.dxSwitch; + dxSwitch(options: string): any; + dxSwitch(options: string, ...params: any[]): any; + dxSwitch(options: DevExpress.ui.dxSwitchOptions): JQuery; + dxSlideOut(): JQuery; + dxSlideOut(options: "instance"): DevExpress.ui.dxSlideOut; + dxSlideOut(options: string): any; + dxSlideOut(options: string, ...params: any[]): any; + dxSlideOut(options: DevExpress.ui.dxSlideOutOptions): JQuery; + dxPivot(): JQuery; + dxPivot(options: "instance"): DevExpress.ui.dxPivot; + dxPivot(options: string): any; + dxPivot(options: string, ...params: any[]): any; + dxPivot(options: DevExpress.ui.dxPivotOptions): JQuery; + dxPanorama(): JQuery; + dxPanorama(options: "instance"): DevExpress.ui.dxPanorama; + dxPanorama(options: string): any; + dxPanorama(options: string, ...params: any[]): any; + dxPanorama(options: DevExpress.ui.dxPanoramaOptions): JQuery; + dxActionSheet(): JQuery; + dxActionSheet(options: "instance"): DevExpress.ui.dxActionSheet; + dxActionSheet(options: string): any; + dxActionSheet(options: string, ...params: any[]): any; + dxActionSheet(options: DevExpress.ui.dxActionSheetOptions): JQuery; + dxDropDownMenu(): JQuery; + dxDropDownMenu(options: "instance"): DevExpress.ui.dxDropDownMenu; + dxDropDownMenu(options: string): any; + dxDropDownMenu(options: string, ...params: any[]): any; + dxDropDownMenu(options: DevExpress.ui.dxDropDownMenuOptions): JQuery; +} +declare module DevExpress.data { + export interface XmlaStoreOptions { + /** The HTTP address to an XMLA OLAP server. */ + url?: string; + /** The name of the database associated with the Store. */ + catalog?: string; + /** The cube name. */ + cube?: string; + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: Object) => void; + } + /** A Store that provides access to an OLAP cube using the XMLA standard. */ + export class XmlaStore { + constructor(options: XmlaStoreOptions); + } + export interface PivotGridField { + index?: number; + /** A boolean value specifying whether or not the field is visible in the pivot grid and the Field Chooser. */ + visible?: boolean; + /** Name of the data source field containing data for the pivot grid field. */ + dataField?: string; + /** A caption that will be displayed in the pivot grid's field chooser and field panel to identify the field. */ + caption?: string; + /** Specifies a type of field values. */ + dataType?: string; + /** Specifies how the values of the current field are combined into groups. Cannot be used for the XmlaStore store type. */ + groupInterval?: any; + /** Specifies how to aggregate field data. Cannot be used for the XmlaStore store type. */ + summaryType?: string; + /** Allows you to use a custom aggregate function to calculate the summary values. Cannot be used for the XmlaStore store type. */ + calculateCustomSummary?: (options: { + summaryProcess?: string; + value?: any; + totalValue?: any; + }) => void; + /** Specifies the function that determines how to split data from the data source into ranges for header items. Cannot be used for the XmlaStore store type. */ + selector?: (data: Object) => any; + /** Type of the area where the field is located. */ + area?: string; + /** Index among the other fields displayed within the same area. */ + areaIndex?: number; + /** The name of the folder in which the field is located. */ + displayFolder?: string; + /** The name of the group to which the field belongs. */ + groupName?: string; + /** The index of the field within a group. */ + groupIndex?: number; + /** Specifies the sort order of field values. */ + sortOrder?: string; + /** Specifies how field data should be sorted. Can be used for the XmlaStore store type only. */ + sortBy?: string; + /** Sorts the header items of this field by the summary values of another field. */ + sortBySummaryField?: string; + /** The array of field names that specify a path to column/row whose summary field is used for sorting of this field's header items. */ + sortBySummaryPath?: Array; + /** The filter values for the current field. */ + filterValues?: Array; + /** The filter type for the current field. */ + filterType?: string; + /** Indicates whether all header items of the field's header level are expanded. */ + expanded?: boolean; + /** Specifies whether the field should be treated as a Data Field. */ + isMeasure?: boolean; + /** Specifies whether or not long text in header items should be wrapped. */ + wordWrapEnabled?: boolean; + /** Specifies a display format for field values. */ + format?: any; + /** Specifies a callback function that returns the text to be displayed in the cells of a field. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** + * Specifies a precision for formatted field values. + * @deprecated Use the format | precision option instead. + */ + precision?: number; + /** Specifies how to sort the header items. */ + sortingMethod?: (a: Object, b: Object) => number; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies the absolute width of the field in the pivot grid. */ + width?: number; + /** Specifies the summary post-processing algorithm. */ + summaryDisplayMode?: string; + /** Specifies whether to summarize each next summary value with the previous one by rows or columns. */ + runningTotal?: string; + /** Specifies whether to allow the predefined summary post-processing functions ('absoluteVariation' and 'percentVariation') and runningTotal to take values of different groups into account. */ + allowCrossGroupCalculation?: boolean; + /** Specifies a callback function that allows you to modify summary values after they are calculated. */ + calculateSummaryValue?: (e: Object) => number; + /** Specifies whether or not to display Total values for the field. */ + showTotals?: boolean; + /** Specifies whether or not to display Grand Total values for the field. */ + showGrandTotals?: boolean; + } + export class SummaryCell { + /** Gets the parent cell in a specified direction. */ + parent(direction: string): SummaryCell; + /** Gets all children cells in a specified direction. */ + children(direction: string): Array; + /** Gets a partial Grand Total cell of a row or column. */ + grandTotal(direction: string): SummaryCell; + /** Gets the Grand Total of the entire pivot grid. */ + grandTotal(): SummaryCell; + /** Gets the cell next to the current one in a specified direction. */ + next(direction: string): SummaryCell; + /** Gets the cell next to current in a specified direction. */ + next(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the cell prior to the current one in a specified direction. */ + prev(direction: string): SummaryCell; + /** Gets the cell previous to current in a specified direction. */ + prev(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the child cell in a specified direction. */ + child(direction: string, fieldValue: any): SummaryCell; + /** Gets the cell located by the path of the source cell with one field value changed. */ + slice(field: PivotGridField, value: any): SummaryCell; + /** Gets the row or column field to which the current cell belongs. */ + field(area: string): PivotGridField; + /** Gets the value of the current cell. */ + value(): any; + /** Gets the value of the current cell. */ + value(isCalculatedValue: boolean): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField, isCalculatedValue: boolean): any; + } + export interface PivotGridDataSourceOptions { + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** Indicates whether or not the automatic field generation from data in the Store is enabled. */ + retrieveFields?: boolean; + /** Specifies data filtering conditions. Cannot be used for the XmlaStore store type. */ + filter?: Object; + /** An array of pivot grid fields. */ + fields?: Array; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Object) => void; + /** A handler for the fieldsPrepared event. */ + onFieldsPrepared?: (e?: Array) => void; + } + /** An object that provides access to data for the dxPivotGrid widget. */ + export class PivotGridDataSource implements EventsMixin { + constructor(options?: PivotGridDataSourceOptions); + /** Starts reloading data from any store and updating the data source. */ + reload(): JQueryPromise; + /** Starts updating the data source. Reloads data from the XMLA store only. */ + load(): JQueryPromise; + /** Indicates whether or not the PivotGridDataSource is currently being loaded. */ + isLoading(): boolean; + /** Gets data displayed in a PivotGrid. */ + getData(): Object; + /** Gets all fields within a specified area. */ + getAreaFields(area: string, collectGroups: boolean): Array; + /** Gets all fields from the data source. */ + fields(): Array; + /** Sets the fields option. */ + fields(fields: Array): void; + /** Gets current options of a specified field. */ + field(id: any): PivotGridField; + /** Sets one or more options of a specified field. */ + field(id: any, field: PivotGridField): void; + /** Collapses a specified header item. */ + collapseHeaderItem(area: string, path: Array): void; + /** Expands a specified header item. */ + expandHeaderItem(area: string, path: Array): void; + /** Expands all header items of a field. */ + expandAll(id: any): void; + /** Collapses all header items of a field. */ + collapseAll(id: any): void; + /** Disposes of all resources associated with this PivotGridDataSource. */ + dispose(): void; + /** Gets the current filter expression. Cannot be used for the XmlaStore store type. */ + filter(): Object; + /** Applies a new filter expression. Cannot be used for the XmlaStore store type. */ + filter(filterExpr: Object): void; + /** Provides access to a list of records (facts) that were used to calculate a specific summary. */ + createDrillDownDataSource(options: { + columnPath?: Array; + rowPath?: Array; + dataIndex?: number; + maxRowCount?: number; + customColumns?: Array; + }): DevExpress.data.DataSource; + /** Gets the current PivotGridDataSource state (fields configuration, sorting, filters, expanded headers, etc.) */ + state(): Object; + /** Sets the PivotGridDataSource state. */ + state(state: Object): void; + on(eventName: string, eventHandler: Function): PivotGridDataSource; + on(events: { [eventName: string]: Function; }): PivotGridDataSource; + off(eventName: string): PivotGridDataSource; + off(eventName: string, eventHandler: Function): PivotGridDataSource; + } +} +declare module DevExpress.ui { + export interface dxSchedulerOptions extends WidgetOptions { + /** Specifies a date displayed on the current scheduler view by default. */ + currentDate?: any; + /** The earliest date the widget allows you to select. */ + min?: Date; + /** The latest date the widget allows you to select. */ + max?: Date; + /** Specifies the view used in the scheduler by default. */ + currentView?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** The template to be used for rendering appointments. */ + appointmentTemplate?: any; + /** The template to be used for rendering an appointment tooltip. */ + appointmentTooltipTemplate?: any; + /** Lists the views to be available within the scheduler's View Selector. */ + views?: Array; + /** Specifies the resource kinds by which the scheduler's appointments are grouped in a timetable. */ + groups?: Array; + /** Specifies a start hour in the scheduler view's time interval. */ + startDayHour?: number; + /** Specifies an end hour in the scheduler view's time interval. */ + endDayHour?: number; + /** Specifies whether or not the "All-day" panel is visible. */ + showAllDayPanel?: boolean; + /** Specifies cell duration in minutes. */ + cellDuration?: number; + /** Specifies the edit mode for recurring appointments. */ + recurrenceEditMode?: string; + /** Specifies which editing operations an end-user can perform on appointments. */ + editing?: { + /** Specifies whether or not an end-user can add appointments. */ + allowAdding?: boolean; + /** Specifies whether or not an end-user can change appointment options. */ + allowUpdating?: boolean; + /** Specifies whether or not an end-user can delete appointments. */ + allowDeleting?: boolean; + /** Specifies whether or not an end-user can change an appointment duration. */ + allowResizing?: boolean; + /** Specifies whether or not an end-user can drag appointments. */ + allowDragging?: boolean; + } + /** Specifies an array of resources available in the scheduler. */ + resources?: Array<{ + /** Indicates whether or not several resources of this kind can be assigned to an appointment. */ + allowMultiple?: boolean; + /** + * Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. + * @deprecated Use the useColorAsDefault option instead. + */ + mainColor?: boolean; + /** Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. */ + useColorAsDefault?: boolean; + /** A data source used to fetch resources to be available in the scheduler. */ + dataSource?: any; + /** Specifies the resource object field whose value is displayed by the Resource editor in the Appointment popup window. */ + displayExpr?: any; + /** Specifies the resource object field that is used as a value of the Resource editor in the Appointment popup window. */ + valueExpr?: any; + /** + * The name of the appointment object field that specifies a resource of this kind. + * @deprecated Use the fieldExpr option instead. + */ + field?: string; + /** The name of the appointment object field that specifies a resource of this kind. */ + fieldExpr?: string; + /** Specifies the label of the Appointment popup window field that allows end users to assign a resource of this kind. */ + label?: string; + }>; + /** A handler for the AppointmentAdding event. */ + onAppointmentAdding?: Function; + /** A handler for the appointmentAdded event. */ + onAppointmentAdded?: Function; + /** A handler for the AppointmentUpdating event. */ + onAppointmentUpdating?: Function; + /** A handler for the appointmentUpdated event. */ + onAppointmentUpdated?: Function; + /** A handler for the AppointmentDeleting event. */ + onAppointmentDeleting?: Function; + /** A handler for the appointmentDeleted event. */ + onAppointmentDeleted?: Function; + /** A handler for the appointmentRendered event. */ + onAppointmentRendered?: Function; + /** A handler for the appointmentClick event. */ + onAppointmentClick?: any; + /** A handler for the appointmentDblClick event. */ + onAppointmentDblClick?: any; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the appointmentFormCreated event. */ + onAppointmentFormCreated?: Function; + /** A handler for the contentReady event. */ + onContentReady?: Function; + horizontalScrollingEnabled?: boolean; + /** Specifies whether or not an end-user can scroll the view in both directions at the same time. */ + crossScrollingEnabled?: boolean; + /** Specifies whether a user can switch views using tabs or a drop-down menu. */ + useDropDownViewSwitcher?: boolean; + /** Specifies the name of the data source item field that defines the start of an appointment. */ + startDateExpr?: string; + /** Specifies the name of the data source item field that defines the ending of an appointment. */ + endDateExpr?: string; + /** Specifies the name of the data source item field that holds the subject of an appointment. */ + textExpr?: string; + /** Specifies the name of the data source item field whose value holds the description of the corresponding appointment. */ + descriptionExpr?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding appointment is an all-day appointment. */ + allDayExpr?: string; + /** Specifies the name of the data source item field that defines a recurrence rule for generating recurring appointments. */ + recurrenceRuleExpr?: string; + /** Specifies the name of the data source item field that defines exceptions for the current recurring appointment. */ + recurrenceExceptionExpr?: string; + /** Specifies the name of the data source item field that defines the timezone of the appointment start date. */ + startDateTimeZoneExpr?: string; + /** Specifies the name of the data source item field that defines the timezone of the appointment end date. */ + endDateTimeZoneExpr?: string; + /** Specifies whether filtering is performed on the server or client side. */ + remoteFiltering?: boolean; + /** Specifies the timezone of the widget. */ + timeZone?: string; + /** The text or HTML markup displayed by the widget if the item collection is empty. Available for the Agenda view only. */ + noDataText?: string; + } + /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ + export class dxScheduler extends Widget { + constructor(element: JQuery, options?: dxSchedulerOptions); + constructor(element: Element, options?: dxSchedulerOptions); + /** Add the appointment defined by the object passed as a parameter to the data associated with the widget. */ + addAppointment(appointment: Object): void; + /** Updates the appointment specified by the first method parameter by the appointment object specified by the second method parameter in the the data associated with the widget. */ + updateAppointment(target: Object, appointment: Object): void; + /** Deletes the appointment defined by the parameter from the the data associated with the widget. */ + deleteAppointment(appointment: Object): void; + /** Scrolls the scheduler work space to the specified time of the specified day. */ + scrollToTime(hours: number, minutes: number, date: Date): void; + /** Displayes the Appointment Details popup. */ + showAppointmentPopup(appointmentData: Object, createNewAppointment?: boolean, currentAppointmentData?: Object): void; + /** Returns the start date of the current view. */ + getStartViewDate(): Date; + /** Returns the end date of the current view. */ + getEndViewDate(): Date; + } + export interface dxColorBoxOptions extends dxDropDownEditorOptions { + /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ + applyButtonText?: string; + applyValueMode?: string; + /** Specifies the text displayed on the button that cancels changes and closes the drop-down editor. */ + cancelButtonText?: string; + /** Specifies whether or not the widget value includes the alpha channel component. */ + editAlphaChannel?: boolean; + /** Specifies the size of a step by which a handle is moved using a keyboard shortcut. */ + keyStep?: number; + } + /** A widget used to specify a color value. */ + export class dxColorBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxColorBoxOptions); + constructor(element: Element, options?: dxColorBoxOptions); + } + export interface HierarchicalCollectionWidgetOptions extends CollectionWidgetOptions { + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of the data source item field used as a key. */ + keyExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is selected. */ + selectedExpr?: any; + /** Specifies the name of the data source item field that contains an array of nested items. */ + itemsExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is disabled. */ + disabledExpr?: any; + hoverStateEnabled?: boolean; + focusStateEnabled?: boolean; + } + export class HierarchicalCollectionWidget extends CollectionWidget { + } + export interface dxTreeViewOptions extends HierarchicalCollectionWidgetOptions { + /** Specifies whether or not to animate item collapsing and expanding. */ + animationEnabled?: boolean; + /** Specifies whether a nested or plain array is used as a data source. */ + dataStructure?: string; + /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ + expandAllEnabled?: boolean; + /** + * Specifies whether or not a check box is displayed at each tree view item. + * @deprecated Use the showCheckBoxesMode options instead. + */ + showCheckBoxes?: boolean; + /** Specifies the current check boxes display mode. */ + showCheckBoxesMode?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is displayed expanded. */ + expandedExpr?: any; + /** Specifies whether or not to select nodes recursively. */ + selectNodesRecursive?: boolean; + /** Specifies whether or not all parent nodes of an initially expanded node are displayed expanded. */ + expandNodesRecursive?: boolean; + /** + * Specifies whether the "Select All" check box is displayed over the tree view. + * @deprecated Use the showCheckBoxesMode options instead. + */ + selectAllEnabled?: boolean; + /** Specifies whether or not an item becomes selected if a user clicks it. */ + selectByClick?: boolean; + /** Specifies item selection mode. */ + selectionMode?: string; + /** Specifies the text displayed at the "Select All" check box. */ + selectAllText?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node includes child nodes. */ + hasItemsExpr?: any; + /** Specifies the name of the data source item field for holding the parent key of the corresponding node. */ + parentIdExpr?: any; + /** Specifies if the virtual mode is enabled. */ + virtualModeEnabled?: boolean; + /** Specifies the parent ID value of the root item. */ + rootValue?: Object; + /** Specifies the current value used to filter tree view items. */ + searchValue?: string; + /** A string value specifying available scrolling directions. */ + scrollDirection?: string; + /** A handler for the itemSelectionChanged event. */ + onItemSelectionChanged?: Function; + /** A handler for the itemExpanded event. */ + onItemExpanded?: Function; + /** A handler for the itemCollapsed event. */ + onItemCollapsed?: Function; + onItemClick?: Function; + onItemContextMenu?: Function; + onItemRendered?: Function; + onItemHold?: Function; + } + /** A widget displaying specified data items as a tree. */ + export class dxTreeView extends HierarchicalCollectionWidget { + constructor(element: JQuery, options?: dxTreeViewOptions); + constructor(element: Element, options?: dxTreeViewOptions); + /** Updates the tree view scrollbars according to the current size of the widget content. */ + updateDimensions(): JQueryPromise; + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + /** Expands the specified item. */ + expandItem(itemElement: any): void; + /** Collapses the specified item. */ + collapseItem(itemElement: any): void; + /** Returns all nodes of the tree view. */ + getNodes(): Array; + /** Selects all widget items. */ + selectAll(): void; + /** Unselects all widget items. */ + unselectAll(): void; + } + export interface dxMenuBaseOptions extends HierarchicalCollectionWidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: { + /** An object that defines the animation options used when the widget is being shown. */ + show?: fx.AnimationOptions; + /** An object that defines the animation options used when the widget is being hidden. */ + hide?: fx.AnimationOptions; + }; + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the name of the CSS class associated with the menu. */ + cssClass?: string; + /** Holds an array of menu items. */ + items?: Array; + /** + * Specifies whether or not an item becomes selected if an end-user clicks it. + * @deprecated Use the selectByClick option instead. + */ + selectionByClick?: boolean; + /** Specifies whether or not an item becomes selected if a user clicks it. */ + selectByClick?: boolean; + /** Specifies the selection mode supported by the menu. */ + selectionMode?: string; + /** Specifies options of submenu showing and hiding. */ + showSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay of submenu show and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + } + export class dxMenuBase extends HierarchicalCollectionWidget { + constructor(element: JQuery, options?: dxMenuBaseOptions); + constructor(element: Element, options?: dxMenuBaseOptions); + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + } + export interface dxMenuOptions extends dxMenuBaseOptions { + /** Specifies whether or not the submenu is hidden when the mouse pointer leaves it. */ + hideSubmenuOnMouseLeave?: boolean; + /** Specifies whether the menu has horizontal or vertical orientation. */ + orientation?: string; + /** Specifies options for showing and hiding the first level submenu. */ + showFirstSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay in submenu showing and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; + /** Specifies the direction at which the submenus are displayed. */ + submenuDirection?: string; + /** A handler for the submenuHidden event. */ + onSubmenuHidden?: Function; + /** Specifies whether or not adaptive widget rendering is enabled on a small screen. */ + adaptivityEnabled?: boolean; + /** A handler for the submenuHiding event. */ + onSubmenuHiding?: Function; + /** A handler for the submenuShowing event. */ + onSubmenuShowing?: Function; + /** A handler for the submenuShown event. */ + onSubmenuShown?: Function; + } + /** A menu widget. */ + export class dxMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxMenuOptions); + constructor(element: Element, options?: dxMenuOptions); + } + export interface dxContextMenuOptions extends dxMenuBaseOptions { + /** Holds an object that specifies options of alternative menu invocation. */ + alternativeInvocationMode?: { + /** Specifies whether or not an alternative invocation mode is enabled. */ + enabled?: Boolean; + /** Specifies the element used to invoke the context menu. */ + invokingElement?: any; + }; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** A handler for the positioning event. */ + onPositioning?: Function; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the direction at which submenus are displayed. */ + submenuDirection?: string; + /** The target element associated with a popover. */ + target?: any; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + } + /** A context menu widget. */ + export class dxContextMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxContextMenuOptions); + constructor(element: Element, options?: dxContextMenuOptions); + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Hides the widget. */ + hide(): JQueryPromise; + } + export interface dxRemoteOperations { + /** Specifies whether or not filtering must be performed on the server side. */ + filtering?: boolean; + /** Specifies whether or not paging must be performed on the server side. */ + paging?: boolean; + /** Specifies whether or not sorting must be performed on the server side. */ + sorting?: boolean; + /** Specifies whether or not grouping must be performed on the server side. */ + grouping?: boolean; + /** Specifies whether or not summaries calculation must be performed on the server side. */ + summary?: boolean; + } + export interface dxDataGridRow { + data: Object; + key: any; + rowIndex: number; + rowType: string; + groupIndex: number; + isExpanded: boolean; + isSelected: boolean; + values: Array; + } + export interface dxDataGridColumn { + /** Specifies the content alignment within column cells. */ + alignment?: string; + /** Specifies whether the values in a column can be edited at runtime. Setting this option makes sense only when editing is enabled for a grid. */ + allowEditing?: boolean; + /** Specifies whether or not a column can be used for filtering grid records. Setting this option makes sense only when the filter row and column header filtering are visible. */ + allowFiltering?: boolean; + /** Specifies whether or not to allow filtering by this column using its header. */ + allowHeaderFiltering?: boolean; + /** Specifies whether or not the column can be anchored to a grid edge by end users. Setting this option makes sense only when the columnFixing | enabled option is set to true. */ + allowFixing?: boolean; + /** Specifies if a column can be used for searching grid records. Setting this option makes sense only when the search panel is visible. */ + allowSearch?: boolean; + /** Specifies whether the user can group data by values of this column. Applies only when grouping is enabled. */ + allowGrouping?: boolean; + /** Specifies whether or not a column can be hidden by a user. Setting this option makes sense only when the column chooser is visible. */ + allowHiding?: boolean; + /** Specifies whether or not a particular column can be used in column reordering. Setting this option makes sense only when the allowColumnReordering option is set to true. */ + allowReordering?: boolean; + /** Specifies whether or not a particular column can be resized by a user. Setting this option makes sense only when the allowColumnResizing option is true. */ + allowResizing?: boolean; + /** Specifies whether grid records can be sorted by a specific column at runtime. Setting this option makes sense only when the sorting mode differs from none. */ + allowSorting?: boolean; + /** Specifies whether groups appear expanded or not when records are grouped by a specific column. Setting this option makes sense only when grouping is allowed for this column. */ + autoExpandGroup?: boolean; + /** Specifies a callback function that returns a value to be displayed in a column cell. */ + calculateCellValue?: (rowData: Object) => string; + /** Specifies a callback function to be invoked after the cell value is edited by an end-user and before the new value is saved to the data source. */ + setCellValue?: (rowData: Object, value: any) => void; + /** Specifies a callback function that defines filters for customary calculated grid cells. */ + calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string, target: string) => Array; + /** Specifies a caption for a column. */ + caption?: string; + /** Specifies a custom template for grid column cells. */ + cellTemplate?: any; + /** Specifies a CSS class to be applied to a column. */ + cssClass?: string; + /** Specifies how to get a value to be displayed in a cell when it is not in an editing state. */ + calculateDisplayValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for grouping column cells. */ + calculateGroupValue?: any; + /** Specifies a field name or a function that returns a field name or a value to be used for sorting column cells. */ + calculateSortValue?: any; + /** Specifies a callback function that returns the text to be displayed in the cells of a column. */ + customizeText?: (cellInfo: { value: any; valueText: string; target: string; groupInterval: any }) => string; + /** Specifies the field of a data source that provides data for a column. */ + dataField?: string; + /** Specifies the required type of column values. */ + dataType?: string; + /** Specifies a custom template for the cell of a grid column when it is in an editing state. */ + editCellTemplate?: any; + /** Specifies configuration options for the editor widget of the current column. */ + editorOptions?: Object; + /** Specifies whether HTML tags are displayed as plain text or applied to the values of the column. */ + encodeHtml?: boolean; + /** In a boolean column, replaces all false items with a specified text. */ + falseText?: string; + /** Specifies the set of available filter operations. */ + filterOperations?: Array; + /** Specifies a filter value for a column. */ + filterValue?: any; + /** Specifies initial filter values for the column's header filter. */ + filterValues?: Array; + /** Specifies whether to include or exclude the records with the values selected in the column's header filter. */ + filterType?: string; + /** Indicates whether the column takes part in horizontal grid scrolling or is anchored to a grid edge. */ + fixed?: boolean; + /** Specifies the order according to which grid columns must be concealed when the widget adapts to the screen or container size. */ + hidingPriority?: number; + /** Specifies the grid edge to which the column is anchored. */ + fixedPosition?: string; + /** Specifies a format for the values displayed in a column. */ + format?: any; + /** Specifies a custom template for the group cell of a grid column. */ + groupCellTemplate?: any; + /** Specifies the index of a column when grid records are grouped by the values of this column. */ + groupIndex?: number; + /** Specifies a custom template for the header of a grid column. */ + headerCellTemplate?: any; + /** Specifies options of a lookup column. */ + lookup?: { + /** Specifies whether or not a user can nullify values of a lookup column. */ + allowClearing?: boolean; + /** Specifies the data source providing data for a lookup column. */ + dataSource?: any; + /** Specifies the expression defining the data source field whose values must be displayed. */ + displayExpr?: any; + /** Specifies the expression defining the data source field whose values must be replaced. */ + valueExpr?: string; + }; + /** Specifies column-level options for filtering using a column header filter. */ + headerFilter?: { + /** Specifies the data source to be used for the header filter. */ + dataSource?: any; + /** Specifies how header filter values should be combined into groups. */ + groupInterval?: any; + }; + /** + * Specifies a precision for formatted values displayed in a column. + * @deprecated Use the format | precision option instead. + */ + precision?: number; + /** Specifies the default filter operation of a column. */ + selectedFilterOperation?: string; + /** Specifies whether or not the column displays its values by using editors. */ + showEditorAlways?: boolean; + /** Specifies whether or not to display the column when grid records are grouped by it. */ + showWhenGrouped?: boolean; + /** Specifies the index of a column when grid records are sorted by the values of this column. */ + sortIndex?: number; + /** Specifies the initial sort order of column values. */ + sortOrder?: string; + /** In a boolean column, replaces all true items with a specified text. */ + trueText?: string; + /** Specifies whether a column is visible or not. */ + visible?: boolean; + /** Specifies the sequence number of the column in the grid. */ + visibleIndex?: number; + /** Specifies a column width in pixels or percentages. */ + width?: any; + /** Specifies an array of validation rules to be checked when updating column cell values. */ + validationRules?: Array; + /** Specifies whether or not to display the header of a hidden column in the column chooser. */ + showInColumnChooser?: boolean; + /** Specifies the identifier of the column. */ + name?: string; + /** The form item configuration object. Used only when the editing mode is "form". */ + formItem?: DevExpress.ui.dxFormItem; + /** An array of grid columns. */ + columns?: Array; + /** Specifies the band column that owns the current column. Accepts the index of the band column in the columns array. */ + ownerBand?: number; + /** Specifies whether the column bands other columns or not. */ + isBand?: boolean; + } + export interface dxDataGridOptions extends WidgetOptions { + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** Indicates whether to show the error row for the grid. */ + errorRowEnabled?: boolean; + /** A handler for the rowValidating event. */ + onRowValidating?: (e: Object) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** A handler for the initNewRow event. */ + onInitNewRow?: (e: { data: Object }) => void; + /** A handler for the rowInserted event. */ + onRowInserted?: (e: { data: Object; key: any }) => void; + /** A handler for the rowInserting event. */ + onRowInserting?: (e: { data: Object; cancel: any }) => void; + /** A handler for the rowRemoved event. */ + onRowRemoved?: (e: { data: Object; key: any }) => void; + /** A handler for the rowRemoving event. */ + onRowRemoving?: (e: { data: Object; key: any; cancel: any }) => void; + /** A handler for the rowUpdated event. */ + onRowUpdated?: (e: { data: Object; key: any }) => void; + /** A handler for the rowUpdating event. */ + onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: any }) => void; + /** Enables a hint that appears when a user hovers the mouse pointer over a cell with truncated content. */ + cellHintEnabled?: boolean; + /** Specifies whether or not the widget should hide columns in order to adapt to the screen or container size. */ + columnHidingEnabled?: boolean; + /** Specifies whether or not grid columns can be reordered by a user. */ + allowColumnReordering?: boolean; + /** Specifies whether or not grid columns can be resized by a user. */ + allowColumnResizing?: boolean; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the cellHoverChanged event. */ + onCellHoverChanged?: (e: Object) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: Object) => void; + /** A handler for the adaptiveDetailRowPreparing event. */ + onAdaptiveDetailRowPreparing?: (e: Object) => void; + /** Specifies whether or not the width of grid columns depends on column content. */ + columnAutoWidth?: boolean; + /** Specifies the options of a column chooser. */ + columnChooser?: { + /** Specifies text displayed by the column chooser panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether a user can invoke the column chooser or not. */ + enabled?: boolean; + /** Specifies how the end-user chooses columns. */ + mode?: string; + /** Specifies the height of the column chooser panel. */ + height?: number; + /** Specifies text displayed in the title of the column chooser panel. */ + title?: string; + /** Specifies the width of the column chooser panel. */ + width?: number; + }; + /** Specifies options for column fixing. */ + columnFixing?: { + /** Indicates if column fixing is enabled. */ + enabled?: boolean; + /** Contains options that specify texts for column-fixing related commands in the column header's context menu. */ + texts?: { + /** Specifies text for a context menu item that fixes the column for which the context menu is invoked. */ + fix?: string; + /** Specifies text for a context menu item that unfixes the column for which the context menu is invoked. */ + unfix?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the left grid edge. */ + leftPosition?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the right grid edge. */ + rightPosition?: string; + }; + }; + /** Specifies options for filtering using a column header filter. */ + headerFilter?: { + /** Indicates whether or not the column header filter button is visible. */ + visible?: boolean; + /** Specifies the height of the dropdown menu invoked when using a column header filter. */ + height?: number; + /** Specifies the width of the dropdown menu invoked when using a column header filter. */ + width?: number; + /** Contains options that specify texts for the dropdown menu invoked when you use a column header filter. */ + texts?: { + /** Specifies text for the item specifying an empty value in the column header filter's dropdown menu. */ + emptyValue?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu and applies specified filtering. */ + ok?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu without applying performed selection. */ + cancel?: string; + } + }; + /** An array of grid columns. */ + columns?: Array; + onContentReady?: Function; + /** Specifies a function that customizes grid columns after they are created. */ + customizeColumns?: (columns: Array) => void; + /** Customizes grid columns and data before exporting. */ + customizeExportData?: (columns: Array, rows: Array) => void; + /** Specifies a data source for the grid. */ + dataSource?: any; + /** Specifies whether or not to enable data caching. */ + cacheEnabled?: boolean; + /** A handler for the editingStart event. */ + onEditingStart?: (e: { + data: Object; + key: any; + cancel: boolean; + column: dxDataGridColumn + }) => void; + /** A handler for the editorPrepared event. */ + onEditorPrepared?: (e: Object) => void; + /** A handler for the editorPreparing event. */ + onEditorPreparing?: (e: Object) => void; + /** Contains options that specify how grid content can be changed. */ + editing?: { + editMode?: string; + editEnabled?: boolean; + insertEnabled?: boolean; + removeEnabled?: boolean; + /** Specifies how grid values can be edited manually. */ + mode?: string; + /** Specifies whether or not grid records can be edited at runtime. */ + allowUpdating?: boolean; + /** Specifies whether or not new grid records can be added at runtime. */ + allowAdding?: boolean; + /** Specifies whether or not grid records can be deleted at runtime. */ + allowDeleting?: boolean; + /** The form configuration object. Used only when the editing mode is "form". */ + form?: DevExpress.ui.dxFormOptions; + /** Contains options that specify texts for editing-related grid controls. */ + texts?: { + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Save" button. Setting this option makes sense only when the mode option is set to batch. */ + saveAllChanges?: string; + /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + cancelRowChanges?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Revert" button. Setting this option makes sense only when the mode option is set to batch. */ + cancelAllChanges?: string; + /** Specifies a message to be displayed by a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteMessage?: string; + /** Specifies text to be displayed in the title of a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteTitle?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Cancel changes" button. Setting this option makes sense only when the mode option is set to cell and the validation capabilities are enabled. +#####See Also##### +- Validation Engine +- Validation Engine - MVVM Approach */ + validationCancelChanges?: string; + /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the allowDeleting option is set to true. */ + deleteRow?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Add" button. Setting this option makes sense only when the allowAdding option is true. */ + addRow?: string; + /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + editRow?: string; + /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ + saveRowChanges?: string; + /** Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the allowDeleting option is set to true. */ + undeleteRow?: string; + }; + }; + /** Specifies filter row options. */ + filterRow?: { + /** Specifies when to apply a filter. */ + applyFilter?: string; + /** Specifies text for the hint that pops up when a user hovers the mouse pointer over the "Apply Filter" button. */ + applyFilterText?: string; + /** Specifies descriptions for filter operations. */ + operationDescriptions?: { + "=": string; + "<>": string; + "<": string; + "<=": string; + ">": string; + ">=": string; + "startswith": string; + "contains": string; + "notcontains": string; + "endswith": string; + }; + /** Specifies text for the reset operation in a filter list. */ + resetOperationText?: string; + /** Specifies text for the operation of clearing the applied filter when a select box is used. */ + showAllText?: string; + /** Specifies text for the range start in the 'between' filter type. */ + betweenStartText?: string; + /** Specifies text for the range end in the 'between' filter type. */ + betweenEndText?: string; + /** Specifies whether or not an icon that allows the user to choose a filter operation is visible. */ + showOperationChooser?: boolean; + /** Specifies whether the filter row is visible or not. */ + visible?: boolean; + }; + /** Specifies grouping settings and the behavior of grouped grid records. */ + grouping?: { + /** Specifies whether the user can collapse grouped records in a grid or not. */ + allowCollapsing?: boolean; + /** Specifies whether groups appear expanded or not. */ + autoExpandAll?: boolean; + /** Enables the user to group data using the context menu. */ + contextMenuEnabled?: boolean; + /** Specifies the event on which a group will be expanded/collapsed. */ + expandMode?: string; + groupContinuedMessage?: string; + groupContinuesMessage?: string; + /** Defines the texts of grouping-related visual elements. */ + texts?: { + /** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */ + groupContinuedMessage?: string; + /** Specifies the message displayed in a group row when the corresponding group continues on the next page. */ + groupContinuesMessage?: string; + /** Specifies the text of the context menu item that groups data by a specific column. */ + groupByThisColumn?: string; + /** Specifies the text of the context menu item that clears grouping settings of a specific column. */ + ungroup?: string; + /** Specifies the text of the context menu item that clears grouping settings of all columns. */ + ungroupAll?: string; + } + }; + /** Configures the group panel. */ + groupPanel?: { + /** Specifies whether columns can be dragged onto or from the group panel. */ + allowColumnDragging?: boolean; + /** Specifies text displayed by the group panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether the group panel is visible or not. */ + visible?: any; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Specifies whether to show the load panel or not. */ + enabled?: any; + /** Specifies the height of the load panel in pixels. */ + height?: number; + /** Specifies a URL pointing to an image to be used as a loading indicator. */ + indicatorSrc?: string; + /** Specifies whether or not a loading indicator must be displayed on the load panel. */ + showIndicator?: boolean; + /** Specifies whether or not the pane of the load panel must be displayed. */ + showPane?: boolean; + /** Specifies text displayed by the load panel. */ + text?: string; + /** Specifies the width of the load panel in pixels. */ + width?: number; + }; + /** Specifies text displayed when a grid does not contain any records. */ + noDataText?: string; + /** Specifies the options of a grid pager. */ + pager?: { + /** Specifies the page sizes that can be selected at runtime. */ + allowedPageSizes?: any; + /** Specifies whether to show the page size selector or not. */ + showPageSizeSelector?: boolean; + /** Specifies whether to show the pager or not. */ + visible?: any; + /** Specifies the text accompanying the page navigator. */ + infoText?: string; + /** Specifies whether or not to display the text accompanying the page navigator. This text is specified by the infoText option. */ + showInfo?: boolean; + /** Specifies whether or not to display buttons that switch the grid to the previous or next page. */ + showNavigationButtons?: boolean; + }; + /** Specifies paging options. */ + paging?: { + /** Specifies whether dxDataGrid loads data page by page or all at once. */ + enabled?: boolean; + /** Specifies the grid page that should be displayed by default. */ + pageIndex?: number; + /** Specifies the size of grid pages. */ + pageSize?: number; + }; + /** Specifies whether or not grid rows must be shaded in a different way. */ + rowAlternationEnabled?: boolean; + /** Specifies whether to enable two-way data binding. */ + twoWayBindingEnabled?: boolean; + /** A handler for the rowClick event. */ + onRowClick?: any; + /** A handler for the rowPrepared event. */ + onRowPrepared?: (e: Object) => void; + /** Specifies a custom template for grid rows. */ + rowTemplate?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not a grid must preload pages adjacent to the current page when using virtual scrolling. */ + preloadEnabled?: boolean; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + /** Specifies the scrollbar display policy. */ + showScrollbar?: string; + /** Specifies whether or not the scrolling by content is enabled. */ + scrollByContent?: boolean; + /** Specifies whether or not the scrollbar thumb scrolling enabled. */ + scrollByThumb?: boolean; + }; + /** Specifies options of the search panel. */ + searchPanel?: { + /** Specifies whether or not search strings in the located grid records should be highlighted. */ + highlightSearchText?: boolean; + /** Specifies text displayed by the search panel when no search string was typed. */ + placeholder?: string; + /** Specifies whether the search panel is visible or not. */ + visible?: boolean; + /** Specifies whether to search all columns or only visible ones. */ + searchVisibleColumnsOnly?: boolean; + /** Specifies the width of the search panel in pixels. */ + width?: number; + /** Sets a search string for the search panel. */ + text?: string; + }; + /** Specifies the operations that must be performed on the server side. */ + remoteOperations?: any; + /** Allows you to sort groups according to the values of group summary items. */ + sortByGroupSummaryInfo?: Array<{ + /** Specifies the group summary item whose values must be used to sort groups. */ + summaryItem?: string; + /** Specifies the identifier of the column that must be used in grouping so that sorting by group summary item values be applied. */ + groupColumn?: string; + /** Specifies the sort order of group summary item values. */ + sortOrder?: string; + }>; + /** Allows you to build a master-detail interface in the grid. */ + masterDetail?: { + /** Enables an end-user to expand/collapse detail sections. */ + enabled?: boolean; + /** Specifies whether detail sections appear expanded or collapsed. */ + autoExpandAll?: boolean; + /** Specifies the template for detail sections. */ + template?: any; + }; + /** Configures client-side export. */ + export?: { + /** Enables the client-side export feature. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies whether to enable Excel filtering for the exported data in the resulting XLSX file. */ + excelFilterEnabled?: boolean; + /** Specifies whether to enable word wrapping for the exported data in the resulting XLSX file. */ + excelWrapTextEnabled?: boolean; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE9 and Safari browsers. */ + proxyUrl?: string; + /** Allows an end user to export selected rows only. */ + allowExportSelectedData?: boolean; + /** Contains options that specify texts for the export-related commands and hints. */ + texts?: { + /** Specifies the hint of the Export button when the allowExportSelectedData option is true. */ + exportTo?: string; + exportToExcel?: string; + excelFormat?: string; + selectedRows?: string; + /** Specifies the text of the command that exports all data. */ + exportAll?: string; + /** Specifies the text of the drop-down menu command that exports selected rows. */ + exportSelectedRows?: string; + } + }; + /** Specifies the keys of the records that must appear selected initially. */ + selectedRowKeys?: Array; + /** Specifies options of runtime selection. */ + selection?: { + /** Specifies the checkbox row display policy in the multiple mode. */ + showCheckBoxesMode?: string; + /** Specifies whether the user can select all grid records at once. */ + allowSelectAll?: boolean; + /** Specifies the selection mode. */ + mode?: string; + }; + /** A handler for the dataErrorOccured event. */ + onDataErrorOccurred?: (e: { error: Error }) => void; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + currentSelectedRowKeys: Array; + currentDeselectedRowKeys: Array; + selectedRowKeys: Array; + selectedRowsData: Array; + }) => void; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A handler for the keyDown event. */ + onKeyDown?: (e: Object) => void; + /** A handler for the rowExpanding event. */ + onRowExpanding?: (e: Object) => void; + /** A handler for the rowExpanded event. */ + onRowExpanded?: (e: Object) => void; + /** A handler for the rowCollapsing event. */ + onRowCollapsing?: (e: Object) => void; + /** A handler for the rowCollapsed event. */ + onRowCollapsed?: (e: Object) => void; + /** Specifies whether column headers are visible or not. */ + showColumnHeaders?: boolean; + /** Specifies whether or not vertical lines separating one grid column from another are visible. */ + showColumnLines?: boolean; + /** Specifies whether or not horizontal lines separating one grid row from another are visible. */ + showRowLines?: boolean; + /** Specifies options of runtime sorting. */ + sorting?: { + /** Specifies text for the context menu item that sets an ascending sort order in a column. */ + ascendingText?: string; + /** Specifies text for the context menu item that resets sorting settings for a column. */ + clearText?: string; + /** Specifies text for the context menu item that sets a descending sort order in a column. */ + descendingText?: string; + /** Specifies the runtime sorting mode. */ + mode?: string; + }; + /** Specifies options of state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (state: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + /** Specifies the options of the grid summary. */ + summary?: { + /** Contains options that specify text patterns for summary items. */ + texts?: { + /** Specifies a pattern for the 'sum' summary items when they are displayed in the parent column. */ + sum?: string; + /** Specifies a pattern for the 'sum' summary items displayed in a group row or in any other column rather than the parent one. */ + sumOtherColumn?: string; + /** Specifies a pattern for the 'min' summary items when they are displayed in the parent column. */ + min?: string; + /** Specifies a pattern for the 'min' summary items displayed in a group row or in any other column rather than the parent one. */ + minOtherColumn?: string; + /** Specifies a pattern for the 'max' summary items when they are displayed in the parent column. */ + max?: string; + /** Specifies a pattern for the 'max' summary items displayed in a group row or in any other column rather than the parent one. */ + maxOtherColumn?: string; + /** Specifies a pattern for the 'avg' summary items when they are displayed in the parent column. */ + avg?: string; + /** Specifies a pattern for the 'avg' summary items displayed in a group row or in any other column rather than the parent one. */ + avgOtherColumn?: string; + /** Specifies a pattern for the 'count' summary items. */ + count?: string; + }; + /** Specifies items of the group summary. */ + groupItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the column that provides data for a group summary item. */ + column?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** + * Specifies a precision for the summary item value of a numeric format. + * @deprecated Use the valueFormat | precision option instead. + */ + precision?: number; + /** Specifies whether or not a summary item must be displayed in the group footer. */ + showInGroupFooter?: boolean; + /** Indicates whether to display group summary items in parentheses after the group row header or to align them by the corresponding columns within the group row. */ + alignByColumn?: boolean; + /** Specifies the column that must hold the summary item when this item is displayed in the group footer or aligned by a column in the group row. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: any; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + }>; + /** Specifies items of the total summary. */ + totalItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the alignment of a summary item. */ + alignment?: string; + /** Specifies the column that provides data for a summary item. */ + column?: string; + /** Specifies a CSS class to be applied to a summary item. */ + cssClass?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** + * Specifies a precision for the summary item value of a numeric format. + * @deprecated Use the valueFormat | precision option instead. + */ + precision?: number; + /** Specifies the column that must hold the summary item. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: any; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + }>; + /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ + skipEmptyValues?: boolean; + /** Allows you to use a custom aggregate function to calculate the value of a summary item. */ + calculateCustomSummary?: (options: { + component: dxDataGrid; + name?: string; + value: any; + totalValue: any; + summaryProcess: string + }) => void; + }; + /** Specifies whether text that does not fit into a column should be wrapped. */ + wordWrapEnabled?: boolean; + } + /** A data grid widget. */ + export class dxDataGrid extends Widget { + constructor(element: JQuery, options?: dxDataGridOptions); + constructor(element: Element, options?: dxDataGridOptions); + /** Ungroups grid records. */ + clearGrouping(): void; + /** Clears sorting settings of all grid columns at once. */ + clearSorting(): void; + /** Allows you to obtain a cell by its row index and the data field of its column. */ + getCellElement(rowIndex: number, dataField: string): any; + /** Allows you to obtain a cell by its row index and the visible index of its column. */ + getCellElement(rowIndex: number, visibleColumnIndex: number): any; + /** Returns the current state of the grid. */ + state(): Object; + /** Sets the grid state. */ + state(state: Object): void; + /** Allows you to obtain the row index by a data key. */ + getRowIndexByKey(key: any): number; + /** Allows you to obtain the data key by a row index. */ + getKeyByRowIndex(rowIndex: number): any; + /** Adds a new column to a grid. */ + addColumn(columnOptions: dxDataGridColumn): void; + /** Removes the column from the grid. */ + deleteColumn(id: any): void; + /** Displays the load panel. */ + beginCustomLoading(messageText: string): void; + /** Discards changes made in a grid. */ + cancelEditData(): void; + /** Checks whether or not the grid contains unsaved changes. */ + hasEditData(): boolean; + /** Clears all the filters of a specific type applied to grid records. */ + clearFilter(): void; + /** Deselects all grid records. */ + clearSelection(): void; + /** Draws the cell being edited from the editing state. Use this method when the edit mode is batch. */ + closeEditCell(): void; + /** Collapses groups or master rows in a grid. */ + collapseAll(groupIndex?: number): void; + /** Returns the number of data columns in a grid. */ + columnCount(): number; + /** Returns the value of a specific column option. */ + columnOption(id: any, optionName: string): any; + /** Sets an option of a specific column. */ + columnOption(id: any, optionName: string, optionValue: any): void; + /** Returns the options of a column by an identifier. */ + columnOption(id: any): Object; + /** Sets several options of a column at once. */ + columnOption(id: any, options: Object): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, visibleColumnIndex: number): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, dataField: string): void; + /** Sets a specific row into the editing state. */ + editRow(rowIndex: number): void; + /** Gets the cell value. */ + cellValue(rowIndex: number, dataField: string): any; + /** Gets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number): any; + /** Sets the cell value. */ + cellValue(rowIndex: number, dataField: string, value: any): void; + /** Sets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number, value: any): void; + /** Hides the load panel. */ + endCustomLoading(): void; + /** Expands groups or master rows in a grid. */ + expandAll(groupIndex: number): void; + /** Allows you to find out whether a specific group or master row is expanded or collapsed. */ + isRowExpanded(key: any): boolean; + /** Allows you to expand a specific group or master row by its key. */ + expandRow(key: any): void; + /** Allows you to collapse a specific group or master row by its key. */ + collapseRow(key: any): void; + /** Checks whether a specific adaptive detail row is expanded or collapsed. */ + isAdaptiveDetailRowExpanded(key: any): void; + /** Expands an adaptive detail row by the key of its parent data row. */ + expandAdaptiveDetailRow(key: any): void; + /** Collapses the currently expanded adaptive detail row (if there is one). */ + collapseAdaptiveDetailRow(): void; + /** Applies a filter to the grid's data source. */ + filter(filterExpr?: any): void; + /** Returns a filter expression applied to the grid's data source using the filter(filterExpr) method. */ + filter(): any; + /** Returns a filter expression applied to the grid using all possible scenarious. */ + getCombinedFilter(): any; + /** Gets the keys of currently selected grid records. */ + getSelectedRowKeys(): Array; + /** Gets the data objects of currently selected grid records. */ + getSelectedRowsData(): Array; + /** Hides the column chooser panel. */ + hideColumnChooser(): void; + /** Adds a new data row to a grid. */ + addRow(): void; + /** + * Adds a new data row to a grid. + * @deprecated Use the addRow() method instead. + */ + insertRow(): void; + /** Returns the key corresponding to the passed data object. */ + keyOf(obj: Object): any; + /** Switches a grid to a specified page. */ + pageIndex(newIndex: number): void; + /** Gets the index of the current page. */ + pageIndex(): number; + /** Sets the page size. */ + pageSize(value: number): void; + /** Gets the current page size. */ + pageSize(): number; + /** Refreshes grid data. */ + refresh(): JQueryPromise; + /** Removes a specific row from a grid. */ + deleteRow(rowIndex: number): void; + /** + * Removes a specific row from a grid. + * @deprecated Use the deleteRow(rowIndex) method instead. + */ + removeRow(rowIndex: number): void; + /** Saves changes made in a grid. */ + saveEditData(): JQueryPromise; + /** Searches grid records by a search string. */ + searchByText(text: string): void; + /** Selects all grid records. */ + selectAll(): void; + /** Deselects the rows that are currently selected within the applied filter. */ + deselectAll(): void; + /** Selects specific grid records. */ + selectRows(keys: Array, preserve: boolean): void; + /** Deselects specific grid records. */ + deselectRows(keys: Array): void; + /** Selects grid rows by indexes. */ + selectRowsByIndexes(indexes: Array): void; + /** Allows you to find out whether a row is selected or not. */ + isRowSelected(key: any): boolean; + /** Invokes the column chooser panel. */ + showColumnChooser(): void; + startSelectionWithCheckboxes(): boolean; + /** Returns how many pages the grid contains. */ + pageCount(): number; + /** Returns the number of records currently held by a grid. */ + totalCount(): number; + /** Recovers a row deleted in the batch edit mode. */ + undeleteRow(rowIndex: number): void; + /** Allows you to obtain a data object by its key. */ + byKey(key: any): JQueryPromise; + /** Gets the value of a total summary item. */ + getTotalSummaryValue(summaryItemName: string): any; + /** Exports grid data to Excel. */ + exportToExcel(selectionOnly: boolean): void; + /** Updates the grid to the size of its content. */ + updateDimensions(): void; + /** Focuses the specified cell element in the grid. */ + focus(element?: JQuery): void; + } + export interface dxPivotGridOptions extends WidgetOptions { + onContentReady?: Function; + /** Specifies a data source for the pivot grid. */ + dataSource?: any; + useNativeScrolling?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + }; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Specifies the area to which data field headers must belong. */ + dataFieldArea?: string; + /** Configures the field panel. */ + fieldPanel?: { + /** Makes fields on the field panel draggable. */ + allowFieldDragging?: boolean; + /** Shows/hides filter fields on the field panel. */ + showFilterFields?: boolean; + /** Shows/hides data fields on the field panel. */ + showDataFields?: boolean; + /** Shows/hides column fields on the field panel. */ + showColumnFields?: boolean; + /** Shows/hides row fields on the field panel. */ + showRowFields?: boolean; + /** Shows/hides the field panel. */ + visible?: boolean; + /** Specifies the placeholders of the field areas. */ + texts?: { + /** Specifies the placeholder of the column field area. */ + columnFieldArea?: string; + /** Specifies the placeholder of the row field area. */ + rowFieldArea?: string; + /** Specifies the placeholder of the filter field area. */ + filterFieldArea?: string; + /** Specifies the placeholder of the data field area. */ + dataFieldArea?: string; + } + } + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies whether long text in header items should be wrapped. */ + wordWrapEnabled?: boolean; + /** Specifies whether to display the Total rows. */ + showRowTotals?: boolean; + /** Specifies whether to display the Grand Total row. */ + showRowGrandTotals?: boolean; + /** Specifies whether to display the Total columns. */ + showColumnTotals?: boolean; + /** Specifies whether to display the Grand Total column. */ + showColumnGrandTotals?: boolean; + /** Specifies whether or not to hide rows and columns with no data. */ + hideEmptySummaryCells?: boolean; + /** Specifies where to show the total rows or columns. */ + showTotalsPrior?: string; + /** Specifies the layout of items in the row header. */ + rowHeaderLayout?: string; + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** The Field Chooser configuration options. */ + fieldChooser?: { + /** Enables or disables the field chooser. */ + enabled?: boolean; + /** Specifies the field chooser layout. */ + layout?: number; + /** Specifies the text to display as a title of the field chooser popup window. */ + title?: string; + /** Specifies the field chooser width. */ + width?: number; + /** Specifies the field chooser height. */ + height?: number; + /** Strings that can be changed or localized in the pivot grid's integrated Field Chooser. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** Strings that can be changed or localized in the dxPivotGrid widget. */ + texts?: { + /** The string to display as a header of the Grand Total row and column. */ + grandTotal?: string; + /** The string to display as a header of the Total row and column. */ + total?: string; + /** Specifies the text displayed when a pivot grid does not contain any fields. */ + noData?: string; + /** The string to display as a Show Field Chooser context menu item. */ + showFieldChooser?: string; + /** The string to display as an Expand All context menu item. */ + expandAll?: string; + /** The string to display as a Collapse All context menu item. */ + collapseAll?: string; + /** The string to display as a Sort Column by Summary Value context menu item. */ + sortColumnBySummary?: string; + /** The string to display as a Sort Row by Summary Value context menu item. */ + sortRowBySummary?: string; + /** The string to display as a Remove All Sorting context menu item. */ + removeAllSorting?: string; + /** The string to display as an Export to Excel file context menu item. */ + exportToExcel?: string; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Enables or disables the load panel. */ + enabled?: boolean; + /** Specifies the height of the load panel. */ + height?: number; + /** Specifies the URL pointing to an image that will be used as a load indicator. */ + indicatorSrc?: string; + /** Specifies whether or not to show a load indicator. */ + showIndicator?: boolean; + /** Specifies whether or not to show load panel background. */ + showPane?: boolean; + /** Specifies the text to display inside a load panel. */ + text?: string; + /** Specifies the width of the load panel. */ + width?: number; + }; + /** A handler for the cellClick event. */ + onCellClick?: (e: any) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: any) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** Configures client-side export. */ + export?: { + /** Enables client-side export. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE9 and Safari browsers. */ + proxyUrl?: string; + }; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A configuration object specifying options related to state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (gridState: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + } + /** A data summarization widget for multi-dimensional data analysis and data mining. */ + export class dxPivotGrid extends Widget { + constructor(element: JQuery, options?: dxPivotGridOptions); + constructor(element: Element, options?: dxPivotGridOptions); + /** Gets the PivotGridDataSource instance. */ + getDataSource(): DevExpress.data.PivotGridDataSource; + /** Gets the dxPopup instance of the field chooser window. */ + getFieldChooserPopup(): DevExpress.ui.dxPopup; + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + /** Exports pivot grid data to the Excel file. */ + exportToExcel(): void; + /** Binds a dxChart to the dxPivotGrid. */ + bindChart(chart: any, integrationOptions?: { + inverted?: boolean; + dataFieldsDisplayMode?: string; + putDataFieldsInto?: string; + alternateDataFields?: boolean; + processCell?: Function; + customizeChart?: Function; + customizeSeries?: Function; + }): any; + } + export interface dxPivotGridFieldChooserOptions extends WidgetOptions { + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the field chooser layout. */ + layout?: number; + /** The data source of a dxPivotGrid widget. */ + dataSource?: DevExpress.data.PivotGridDataSource; + onContentReady?: Function; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** Strings that can be changed or localized in the dxPivotGridFieldChooser widget. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** A complementary widget for dxPivotGrid that allows you to manage data displayed in the dxPivotGrid. */ + export class dxPivotGridFieldChooser extends Widget { + constructor(element: JQuery, options?: dxPivotGridFieldChooserOptions); + constructor(element: Element, options?: dxPivotGridFieldChooserOptions); + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + /** Gets the PivotGridDataSource instance. */ + getDataSource(): DevExpress.data.PivotGridDataSource; + } +} +interface JQuery { + dxTreeView(): JQuery; + dxTreeView(options: "instance"): DevExpress.ui.dxTreeView; + dxTreeView(options: string): any; + dxTreeView(options: string, ...params: any[]): any; + dxTreeView(options: DevExpress.ui.dxTreeViewOptions): JQuery; + dxMenuBase(): JQuery; + dxMenuBase(options: "instance"): DevExpress.ui.dxMenuBase; + dxMenuBase(options: string): any; + dxMenuBase(options: string, ...params: any[]): any; + dxMenuBase(options: DevExpress.ui.dxMenuBaseOptions): JQuery; + dxMenu(): JQuery; + dxMenu(options: "instance"): DevExpress.ui.dxMenu; + dxMenu(options: string): any; + dxMenu(options: string, ...params: any[]): any; + dxMenu(options: DevExpress.ui.dxMenuOptions): JQuery; + dxContextMenu(): JQuery; + dxContextMenu(options: "instance"): DevExpress.ui.dxContextMenu; + dxContextMenu(options: string): any; + dxContextMenu(options: string, ...params: any[]): any; + dxContextMenu(options: DevExpress.ui.dxContextMenuOptions): JQuery; + dxColorBox(): JQuery; + dxColorBox(options: "instance"): DevExpress.ui.dxColorBox; + dxColorBox(options: string): any; + dxColorBox(options: string, ...params: any[]): any; + dxColorBox(options: DevExpress.ui.dxColorBoxOptions): JQuery; + dxDataGrid(): JQuery; + dxDataGrid(options: "instance"): DevExpress.ui.dxDataGrid; + dxDataGrid(options: string): any; + dxDataGrid(options: string, ...params: any[]): any; + dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; + dxPivotGrid(): JQuery; + dxPivotGrid(options: "instance"): DevExpress.ui.dxPivotGrid; + dxPivotGrid(options: string): any; + dxPivotGrid(options: string, ...params: any[]): any; + dxPivotGrid(options: DevExpress.ui.dxPivotGridOptions): JQuery; + dxPivotGridFieldChooser(): JQuery; + dxPivotGridFieldChooser(options: "instance"): DevExpress.ui.dxPivotGridFieldChooser; + dxPivotGridFieldChooser(options: string): any; + dxPivotGridFieldChooser(options: string, ...params: any[]): any; + dxPivotGridFieldChooser(options: DevExpress.ui.dxPivotGridFieldChooserOptions): JQuery; + dxScheduler(): JQuery; + dxScheduler(options: "instance"): DevExpress.ui.dxScheduler; + dxScheduler(options: string): any; + dxScheduler(options: string, ...params: any[]): any; + dxScheduler(options: DevExpress.ui.dxSchedulerOptions): JQuery; +} +declare module DevExpress.framework { + /** An object used to store information on the views displayed in an application. */ + export class ViewCache { + viewRemoved: JQueryCallback; + /** Removes all the viewInfo objects from the cache. */ + clear(): void; + /** Obtains a viewInfo object from the cache by the specified key. */ + getView(key: string): Object; + /** Checks whether or not a viewInfo object is contained in the view cache under the specified key. */ + hasView(key: string): boolean; + /** Removes a viewInfo object from the cache by the specified key. */ + removeView(key: string): Object; + /** Adds the specified viewInfo object to the cache under the specified key. */ + setView(key: string, viewInfo: Object): void; + } + export interface dxCommandOptions extends DOMComponentOptions { + /** Specifies an action performed when the execute() method of the command is called. */ + onExecute?: any; + /** Indicates whether or not the widget that displays this command is disabled. */ + disabled?: boolean; + /** Specifies whether the current command is rendered when a view is being rendered or after a view is shown. */ + renderStage?: string; + /** Specifies the name of the icon shown inside the widget associated with this command. */ + icon?: string; + iconSrc?: string; + /** The identifier of the command. */ + id?: string; + /** Specifies the title of the widget associated with this command. */ + title?: string; + /** Specifies the type of the button, if the command is rendered as a dxButton widget. */ + type?: string; + /** A Boolean value specifying whether or not the widget associated with this command is visible. */ + visible?: boolean; + } + /** A markup component used to define markup options for a command. */ + export class dxCommand extends DOMComponent { + constructor(element: JQuery, options: dxCommandOptions); + constructor(options: dxCommandOptions); + /** Executes the action associated with this command. */ + execute(): void; + } + /** An object responsible for routing. */ + export class Router { + /** Adds a routing rule to the list of registered rules. */ + register(pattern: string, defaults?: Object, constraints?: Object): void; + /** Decodes the specified URI to an object using the registered routing rules. */ + parse(uri: string): Object; + /** Formats an object to a URI. */ + format(obj: Object): string; + } + export interface StateManagerOptions { + /** A storage to which the state manager saves the application state. */ + storage?: Object; + } + /** An object used to store the current application state. */ + export class StateManager { + constructor(options?: StateManagerOptions); + /** Adds an object that implements an interface of a state source to the state manager's collection of state sources. */ + addStateSource(stateSource: Object): void; + /** Removes a specified state source from the state manager's collection of state sources. */ + removeStateSource(stateSource: Object): void; + /** Saves the current application state. */ + saveState(): void; + /** Restores the application state that has been saved by the saveState() method to the state storage. */ + restoreState(): void; + /** Removes the application state that has been saved by the saveState() method to the state storage. */ + clearState(): void; + } + export module html { + export var layoutSets: Array; + export var animationSets: { [animationSetName: string]: AnimationSet }; + export interface AnimationSet { + [animationName: string]: any + } + export interface HtmlApplicationOptions { + /** Specifies where the commands that are defined in the application's views must be displayed. */ + commandMapping?: Object; + /** Specifies whether or not view caching is disabled. */ + disableViewCache?: boolean; + /** An array of layout controllers that should be used to show application views in the current navigation context. */ + layoutSet?: any; + /** Specifies the animation presets that are used to animate different UI elements in the current application. */ + animationSet?: AnimationSet; + /** Specifies whether the current application must behave as a mobile or web application. */ + mode?: string; + /** Specifies the object that represents a root namespace of the application. */ + namespace?: Object; + /** Specifies application behavior when the user navigates to a root view. */ + navigateToRootViewMode?: string; + /** An array of dxCommand configuration objects used to define commands available from the application's global navigation. */ + navigation?: Array; + /** A state manager to be used in the application. */ + stateManager?: StateManager; + /** Specifies the storage to be used by the application's state manager to store the application state. */ + stateStorage?: Object; + /** Indicates whether on not to use the title of the previously displayed view as text on the Back button. */ + useViewTitleAsBackText?: boolean; + /** A custom view cache to be used in the application. */ + viewCache?: Object; + /** Specifies a limit for the views that can be cached. */ + viewCacheSize?: number; + /** Specifies the current version of application templates. */ + templatesVersion?: string; + /** Specifies options for the viewport meta tag of a mobile browser. */ + viewPort?: JQuery; + /** A custom router to be used in the application. */ + router?: Router; + } + /** An object used to manage views, as well as control the application life cycle. */ + export class HtmlApplication implements EventsMixin { + constructor(options: HtmlApplicationOptions); + afterViewSetup: JQueryCallback; + beforeViewSetup: JQueryCallback; + initialized: JQueryCallback; + navigating: JQueryCallback; + navigatingBack: JQueryCallback; + resolveLayoutController: JQueryCallback; + resolveViewCacheKey: JQueryCallback; + viewDisposed: JQueryCallback; + viewDisposing: JQueryCallback; + viewHidden: JQueryCallback; + viewRendered: JQueryCallback; + viewShowing: JQueryCallback; + viewShown: JQueryCallback; + /** Provides access to the ViewCache object. */ + viewCache: ViewCache; + /** An array of dxCommand components that are created based on the application's navigation option value. */ + navigation: Array; + /** Provides access to the StateManager object. */ + stateManager: StateManager; + /** Provides access to the Router object. */ + router: Router; + /** Navigates to the URI preceding the current one in the navigation history. */ + back(): void; + /** Returns a Boolean value indicating whether or not backwards navigation is currently possible. */ + canBack(): boolean; + /** Calls the clearState() method of the application's StateManager object. */ + clearState(): void; + /** Creates global navigation commands. */ + createNavigation(navigationConfig: Array): void; + /** Returns an HTML template of the specified view. */ + getViewTemplate(viewName: string): JQuery; + /** Returns a configuration object used to create a dxView component for a specified view. */ + getViewTemplateInfo(viewName: string): Object; + /** Adds a specified HTML template to a collection of view or layout templates. */ + loadTemplates(source: any): JQueryPromise; + /** Navigates to the specified URI. */ + navigate(uri?: any, options?: Object): void; + /** Renders navigation commands to the navigation command containers that are located in the layouts used in the application. */ + renderNavigation(): void; + /** Calls the restoreState() method of the application's StateManager object. */ + restoreState(): void; + /** Calls the saveState method of the application's StateManager object. */ + saveState(): void; + /** Provides access to the object that defines the current context to be considered when choosing an appropriate template for a view. */ + templateContext(): Object; + on(eventName: "initialized", eventHandler: () => void): HtmlApplication; + on(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + on(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + on(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + on(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: string, eventHandler: Function): HtmlApplication; + on(events: { [eventName: string]: Function; }): HtmlApplication; + off(eventName: "initialized"): HtmlApplication; + off(eventName: "afterViewSetup"): HtmlApplication; + off(eventName: "beforeViewSetup"): HtmlApplication; + off(eventName: "navigating"): HtmlApplication; + off(eventName: "navigatingBack"): HtmlApplication; + off(eventName: "resolveLayoutController"): HtmlApplication; + off(eventName: "resolveViewCacheKey"): HtmlApplication; + off(eventName: "viewDisposed"): HtmlApplication; + off(eventName: "viewDisposing"): HtmlApplication; + off(eventName: "viewHidden"): HtmlApplication; + off(eventName: "viewRendered"): HtmlApplication; + off(eventName: "viewShowing"): HtmlApplication; + off(eventName: "viewShown"): HtmlApplication; + off(eventName: string): HtmlApplication; + off(eventName: "initialized", eventHandler: () => void): HtmlApplication; + off(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + off(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + off(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + off(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: string, eventHandler: Function): HtmlApplication; + } + } +} +declare module DevExpress.viz.core { + export interface Border { + /** Sets a border color for a selected series. */ + color?: string; + /** Sets border visibility for a selected series. */ + visible?: boolean; + /** Sets a border width for a selected series. */ + width?: number; + } + export interface DashedBorder extends Border { + /** Specifies a dash style for the border of a selected series point. */ + dashStyle?: string; + } + export interface DashedBorderWithOpacity extends DashedBorder { + /** Specifies how transparent the vertical crosshair line should be. */ + opacity?: number; + } + export interface Font { + /** Colors the text displayed by the group labels. */ + color?: string; + /** Specifies the font family of the text displayed by the group labels. */ + family?: string; + /** Specifies how transparent the text displayed by the group labels should be. */ + opacity?: number; + /** Specifies the size of the text displayed by the group labels. */ + size?: any; + /** Specifies the font weight of the text displayed by the group labels. */ + weight?: number; + } + export interface Hatching { + direction?: string; + /** Specifies the opacity of hatching lines. */ + opacity?: number; + /** Specifies the distance between hatching lines in pixels. */ + step?: number; + /** Specifies the width of hatching lines in pixels. */ + width?: number; + } + export interface Margins { + /** Specifies the legend's bottom margin in pixels. */ + bottom?: number; + /** Specifies the legend's left margin in pixels. */ + left?: number; + /** Specifies the legend's right margin in pixels. */ + right?: number; + /** Specifies the legend's bottom margin in pixels. */ + top?: number; + } + export interface MarginOptions { + /** Generates space around the widget. */ + margin?: Margins; + } + export interface RedrawOnResizeOptions { + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + } + export interface TitleOptions { + /** Specifies the widget title. */ + title?: Title; + } + export interface ExportOptions { + /** Configures the exporting and printing features. */ + export?: Export; + } + export interface LoadingIndicatorOptions { + /** Configures the loading indicator. */ + loadingIndicator?: LoadingIndicator; + } + export interface LoadingIndicatorMethods { + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + } + export interface Size { + /** Specifies the width of the widget in pixels. */ + width?: number; + /** Specifies the height of the widget in pixels. */ + height?: number; + } + export interface Title { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies the title's alignment in a horizontal direction. */ + horizontalAlignment?: string; + /** Specifies the title's alignment in a vertical direction. */ + verticalAlignment?: string; + /** Generates space around the title. */ + margin?: Margins; + /** Specifies the minimum height that the title occupies. */ + placeholderSize?: number; + /** Specifies the title text. */ + text?: string; + /** Specifies the widget subtitle. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } + } + export interface Export { + /** Enables the client-side exporting in the widget. */ + enabled?: boolean; + /** Enables the printing feature in the widget. Applies only if the export | enabled option is true. */ + printingEnabled?: boolean; + /** Specifies a set of formats available for exporting into. */ + formats?: Array; + /** Specifies a default name for the file to which the widget will be exported. */ + fileName?: string; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable exporting in IE9 and Safari browsers. */ + proxyUrl?: string; + /** Specifies the color that will fill transparent regions in the resulting file or document. */ + backgroundColor?: string; + } + export interface Tooltip { + /** Specifies the length of the tooltip's arrow in pixels. */ + arrowLength?: number; + /** Specifies the appearance of the tooltip's border. */ + border?: DashedBorderWithOpacity; + /** Specifies the color of tooltips. */ + color?: string; + /** Specifies the z-index of tooltips. */ + zIndex?: number; + /** Specifies the container to draw tooltips inside of it. */ + container?: any; + /** Allows you to change tooltip appearance. */ + customizeTooltip?: (arg: Object) => { color?: string; text?: string }; + enabled?: boolean; + /** Specifies the font of the text displayed by a tooltip. */ + font?: Font; + /** Specifies the format of the value displayed by a tooltip. */ + format?: any; + /** Specifies the opacity of tooltips. */ + opacity?: number; + /** Generates space on the left and the right of the text displayed by a tooltip. */ + paddingLeftRight?: number; + /** Generates space above and below the text displayed by a tooltip. */ + paddingTopBottom?: number; + /** + * Specifies the precision of formatted values in a tooltip. + * @deprecated Use the tooltip | format | precision option instead. + */ + precision?: number; + /** Specifies the appearance of the tooltip's shadow. */ + shadow?: { + /** Specifies the blur distance of the tooltip's shadow. */ + blur?: number; + /** Specifies the color of the tooltip's shadow. */ + color?: string; + /** Specifies the horizontal offset of the tooltip's shadow relative to the tooltip itself measured in pixels. */ + offsetX?: number; + /** Specifies the vertical offset of the tooltip's shadow relative to the tooltip itself measured in pixels. */ + offsetY?: number; + /** Specifies the opacity of the tooltip's shadow. */ + opacity?: number; + }; + } + export interface Animation { + /** Determines how long animation runs. */ + duration?: number; + /** Specifies the animation easing mode. */ + easing?: string; + /** Indicates whether or not animation is enabled. */ + enabled?: boolean; + } + export interface LoadingIndicator { + /** Colors the background of the loading indicator. */ + backgroundColor?: string; + /** Specifies font options for the loading indicator. */ + font?: viz.core.Font; + /** Specifies whether to show the loading indicator or not. */ + show?: boolean; + /** Specifies the text to be displayed by the loading indicator. */ + text?: string; + } + export interface LegendBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies a radius for the corners of the legend border. */ + cornerRadius?: number; + } + export interface BaseLegend { + /** Specifies the color of the legend's background. */ + backgroundColor?: string; + /** Specifies legend border settings. */ + border?: viz.core.LegendBorder; + /** Specifies how many columns must be taken to arrange legend items. */ + columnCount?: number; + /** Specifies the spacing between a pair of neighboring legend columns in pixels. */ + columnItemSpacing?: number; + /** Specifies font options for legend items. */ + font?: viz.core.Font; + /** Specifies the legend's position on the map. */ + horizontalAlignment?: string; + /** Specifies the alignment of legend items. */ + itemsAlignment?: string; + /** Specifies the position of text relative to the item marker. */ + itemTextPosition?: string; + /** Specifies the distance between the legend and the container borders in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of item markers in the legend in pixels. */ + markerSize?: number; + /** Specifies whether to arrange legend items horizontally or vertically. */ + orientation?: string; + /** Specifies the spacing between the legend left/right border and legend items in pixels. */ + paddingLeftRight?: number; + /** Specifies the spacing between the legend top/bottom border and legend items in pixels. */ + paddingTopBottom?: number; + /** Specifies how many rows must be taken to arrange legend items. */ + rowCount?: number; + /** Specifies the spacing between a pair of neighboring legend rows in pixels. */ + rowItemSpacing?: number; + /** Specifies the legend's position on the map. */ + verticalAlignment?: string; + /** Specifies whether or not the legend is visible on the map. */ + visible?: boolean; + } + export interface BaseWidgetOptions extends DOMComponentOptions { + /** Specifies the size of the widget in pixels. */ + size?: Size; + /** A handler for the drawn event. */ + onDrawn?: (e: { + component: BaseWidget; + element: Element; + }) => void; + /** A handler for the incidentOccurred event. */ + onIncidentOccurred?: ( + component: BaseWidget, + element: Element, + target: { + id: string; + type: string; + args: any; + text: string; + widget: string; + version: string; + } + ) => void; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */ + pathModified?: boolean; + /** Specifies whether or not the widget supports right-to-left representation. */ + rtlEnabled?: boolean; + /** Sets the name of the theme to be used in the widget. */ + theme?: string; + } + /** This section describes options and methods that are common to all widgets. */ + export class BaseWidget extends DOMComponent { + /** Returns the widget's SVG markup. */ + svg(): string; + /** Exports the widget into a document with a specified name and format. */ + exportTo(): void; + /** Opens the browser's print window. */ + print(): void; + /** Redraws the widget. */ + render(): void; + } +} +declare module DevExpress.viz { + /** + * Applies a theme for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. + */ + export function currentTheme(theme: string): void; + /** + * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. + */ + export function currentTheme(platform: string, colorScheme: string): void; + /** + * Registers a new theme based on the existing one. + * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. + */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** + * Applies a predefined or registered custom palette to all visualization widgets at once. + * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. + */ + export function currentPalette(paletteName: string): void; + /** + * Obtains the color sets of a predefined or registered palette. + * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. + */ + export function getPalette(paletteName: string): Object; + /** + * Registers a new palette. + * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. + */ + export function registerPalette(paletteName: string, palette: Object): void; +} +declare module DevExpress.viz.charts { + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface BaseSeries { + /** Provides information about the state of the series object. */ + fullState: number; + /** Returns the type of the series. */ + type: string; + /** Unselects all the selected points of the series. The points are displayed in an initial style. */ + clearSelection(): void; + /** Gets the color of a particular series. */ + getColor(): string; + /** Gets points from the series point collection based on the specified argument. */ + getPointsByArg(pointArg: any): Array; + /** Gets a point from the series point collection based on the specified point position. */ + getPointByPos(positionIndex: number): Object; + /** Selects the series. The series is displayed in a 'selected' style until another series is selected or the current series is deselected programmatically. */ + select(): void; + /** Selects the specified point. The point is displayed in a 'selected' style. */ + selectPoint(point: BasePoint): void; + /** Deselects the specified point. The point is displayed in an initial style. */ + deselectPoint(point: BasePoint): void; + /** Returns an array of all points in the series. */ + getAllPoints(): Array; + /** Returns visible series points. */ + getVisiblePoints(): Array; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): boolean; + /** Provides information about the selection state of a series. */ + isSelected(): boolean; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface BasePoint { + /** Provides information about the state of the point object. */ + fullState: number; + /** Returns the point's argument value that was set in the data source. */ + originalArgument: any; + /** Returns the point's value that was set in the data source. */ + originalValue: any; + /** Returns the tag of the point. */ + tag: string; + /** Deselects the point. */ + clearSelection(): void; + /** Gets the color of a particular point. */ + getColor(): string; + /** Hides the tooltip of the point. */ + hideTooltip(): void; + /** Provides information about the hover state of a point. */ + isHovered(): boolean; + /** Provides information about the selection state of a point. */ + isSelected(): boolean; + /** Selects the point. The point is displayed in a 'selected' style until another point is selected or the current point is deselected programmatically. */ + select(): void; + /** Shows the tooltip of the point. */ + showTooltip(): void; + /** Allows you to obtain the label(s) of the series point. */ + getLabel(): any; + /** Returns the series object to which the point belongs. */ + series: BaseSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface ChartSeries extends BaseSeries { + /** Returns the name of the series pane. */ + pane: string; + /** Returns the name of the value axis of the series. */ + axis: string; + selectPoint(point: ChartPoint): void; + deselectPoint(point: ChartPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface ChartPoint extends BasePoint { + /** Contains the close value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalCloseValue: any; + /** Contains the high value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalHighValue: any; + /** Contains the low value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalLowValue: any; + /** Contains the first value of the point. This field is useful for points belonging to a series of the range area or range bar type only. */ + originalMinValue: any; + /** Contains the open value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalOpenValue: any; + /** Contains the size of the bubble as it was set in the data source. This field is useful for points belonging to a series of the bubble type only. */ + size: any; + /** Gets the parameters of the point's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + series: ChartSeries; + } + /** This section describes the methods that can be used in code to manipulate the Label object. */ + export interface Label { + /** Gets the parameters of the label's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + /** Hides the point label. */ + hide(): void; + /** Shows the point label. */ + show(): void; + } + export interface PieSeries extends BaseSeries { + selectPoint(point: PiePoint): void; + deselectPoint(point: PiePoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PiePoint extends BasePoint { + /** Gets the percentage value of the specific point. */ + percent: any; + /** Provides information about the visibility state of a point. */ + isVisible(): boolean; + /** Makes a specific point visible. */ + show(): void; + /** Hides a specific point. */ + hide(): void; + series: PieSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface PolarSeries extends BaseSeries { + /** Returns the name of the value axis of the series. */ + axis: string; + selectPoint(point: PolarPoint): void; + deselectPoint(point: PolarPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PolarPoint extends BasePoint { + series: PolarSeries; + } + export interface Strip { + /** Specifies a color for a strip. */ + color?: string; + /** An object that defines the label configuration options of a strip. */ + label?: { + /** Specifies the text displayed in a strip. */ + text?: string; + }; + /** Specifies a start value for a strip. */ + startValue?: any; + /** Specifies an end value for a strip. */ + endValue?: any; + } + export interface BaseSeriesConfigLabel { + /** Specifies a format for arguments displayed by point labels. */ + argumentFormat?: any; + /** + * Specifies a precision for formatted point arguments displayed in point labels. + * @deprecated Use the series | label | argumentFormat | precision instead. + */ + argumentPrecision?: number; + /** Specifies a background color for point labels. */ + backgroundColor?: string; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies connector options for series point labels. */ + connector?: { + /** Specifies the color of label connectors. */ + color?: string; + /** Indicates whether or not label connectors are visible. */ + visible?: boolean; + /** Specifies the width of label connectors. */ + width?: number; + }; + /** Specifies a callback function that returns the text to be displayed by point labels. */ + customizeText?: (pointInfo: Object) => string; + /** Specifies font options for the text displayed in point labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed by point labels. */ + format?: any; + position?: string; + /** + * Specifies a precision for formatted point values displayed in point labels. + * @deprecated Use the series | label | format | precision option instead. + */ + precision?: number; + /** Specifies the angle used to rotate point labels from their initial position. */ + rotationAngle?: number; + /** Specifies the visibility of point labels. */ + visible?: boolean; + } + export interface SeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies whether or not to show labels for points with zero value. Applies only to bar-like series. */ + showForZeroValues?: boolean; + } + export interface ChartSeriesConfigLabel extends SeriesConfigLabel { + /** Aligns point labels in relation to their points. */ + alignment?: string; + /** Along with verticalOffset, shifts point labels from their initial positions. */ + horizontalOffset?: number; + /** Along with horizontalOffset, shifts point labels from their initial positions. */ + verticalOffset?: number; + /** + * Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. + * @deprecated Use the series | label | format | percentPrecision instead. + */ + percentPrecision?: number; + } + export interface BaseCommonSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + axis?: string; + label?: ChartSeriesConfigLabel; + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the dash style of the series' line. */ + dashStyle?: string; + hoverMode?: string; + hoverStyle?: { + border?: viz.core.DashedBorder; + /**

Sets a color for a series when it is hovered over.

*/ + color?: string; + /** Specifies the dash style for the line in a hovered series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a hovered series. */ + width?: number; + }; + /** Specifies whether a chart ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies the minimal length of a displayed bar in pixels. */ + minBarSize?: number; + /** Specifies opacity for a series. */ + opacity?: number; + /** Specifies series elements to be highlighted when a user selects a point. */ + selectionMode?: string; + selectionStyle?: { + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the dash style for the line in a selected series. */ + dashStyle?: string; + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a selected series. */ + width?: number; + }; + /** Specifies whether or not to show the series in the chart's legend. */ + showInLegend?: boolean; + /** Specifies the name of the stack where the values of the _stackedBar_ series must be located. */ + stack?: string; + /** Specifies the name of the data source field that provides data about a point. */ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + /** Specifies the visibility of a series. */ + visible?: boolean; + /** Specifies a line width. */ + width?: number; + /** Configures error bars. */ + valueErrorBar?: { + /** Specifies whether error bars must be displayed in full or partially. */ + displayMode?: string; + /** Specifies the data field that provides data for low error values. */ + lowValueField?: string; + /** Specifies the data field that provides data for high error values. */ + highValueField?: string; + /** Specifies how error bar values must be calculated. */ + type?: string; + /** Specifies the value to be used for generating error bars. */ + value?: number; + /** Specifies the color of error bars. */ + color?: string; + /** Specifies the opacity of error bars. */ + opacity?: number; + /** Specifies the length of the lines that indicate the error bar edges. */ + edgeLength?: number; + /** Specifies the width of the error bar line. */ + lineWidth?: number; + }; + } + export interface CommonPointOptions { + /** Specifies border options for points in the line and area series. */ + border?: viz.core.Border; + /** Specifies the points color. */ + color?: string; + /** Specifies what series points to highlight when a point is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered point. */ + hoverStyle?: { + /** An object defining the border options for a hovered point. */ + border?: viz.core.Border; + /** Sets a color for a point when it is hovered over. */ + color?: string; + /** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies what series points to highlight when a point is selected. */ + selectionMode?: string; + /** An object defining configuration options for a selected point. */ + selectionStyle?: { + /** An object defining the border options for a selected point. */ + border?: viz.core.Border; + /**

Sets a color for a point when it is selected.

*/ + color?: string; + /** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */ + size?: number; + /** Specifies a symbol for presenting points of the line and area series. */ + symbol?: string; + visible?: boolean; + } + export interface ChartCommonPointOptions extends CommonPointOptions { + /** Substitutes the standard point symbols with an image. */ + image?: { + /** Specifies the height of the image used instead of a point marker. */ + height?: any; + /** Specifies the URL of the image to be used as a point marker. */ + url?: any; + /** Specifies the width of an image that is used as a point marker. */ + width?: any; + }; + } + export interface PolarCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: number; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: string; + /** Specifies the width of an image that is used as a point marker. */ + width?: number; + }; + } + /** An object that defines configuration options for chart series. */ + export interface CommonSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies which data source field provides close values for points of a financial series. */ + closeValueField?: string; + /** Makes bars look rounded. Applies only to bar-like series. */ + cornerRadius?: number; + /** Specifies which data source field provides high values for points of a financial series. */ + highValueField?: string; + /** Specifies a filling color for the body of a series point that visualizes a non-reduced value. Applies only to candlestick series. */ + innerColor?: string; + /** Specifies which data source field provides low values for points of a financial series. */ + lowValueField?: string; + /** Specifies which data source field provides open values for points of a financial series. */ + openValueField?: string; + /** Specifies which pane the series should belong to. Accepts the name of the pane. */ + pane?: string; + point?: ChartCommonPointOptions; + /** Coupled with the rangeValue2Field option, specifies which data source field provides values for a range-like series. */ + rangeValue1Field?: string; + /** Coupled with the rangeValue1Field option, specifies which data source field provides values for a range-like series. */ + rangeValue2Field?: string; + /** Specifies reduction options for financial series. */ + reduction?: { + /** Specifies a color for the points whose price has decreased in comparison to the price of the previous point. */ + color?: string; + /** Specifies whether high, low, open or close prices of points should be compared. */ + level?: string; + }; + /** Specifies which data source field provides size values for bubbles. Required by and applies only to bubble series. */ + sizeField?: string; + } + export interface CommonSeriesSettings extends CommonSeriesConfig { + /** Defines common settings for all area series. */ + area?: CommonSeriesConfig; + /** Defines common settings for all bar series. */ + bar?: CommonSeriesConfig; + /** Defines common settings for all bubble series. */ + bubble?: CommonSeriesConfig; + /** Defines common settings for all candlestick series. */ + candlestick?: CommonSeriesConfig; + /** Defines common settings for all full-stacked area series. */ + fullstackedarea?: CommonSeriesConfig; + /** Defines common settings for all full-stacked spline area series. */ + fullstackedsplinearea?: CommonSeriesConfig; + /** Defines common settings for all full-stacked bar series. */ + fullstackedbar?: CommonSeriesConfig; + /** Defines common settings for all full-stacked line series. */ + fullstackedline?: CommonSeriesConfig; + /** Defines common settings for all full-stacked spline series. */ + fullstackedspline?: CommonSeriesConfig; + /** Defines common settings for all line series. */ + line?: CommonSeriesConfig; + /** Defines common settings for all range area series. */ + rangearea?: CommonSeriesConfig; + /** Defines common settings for all range bar series. */ + rangebar?: CommonSeriesConfig; + /** Defines common settings for all scatter series. */ + scatter?: CommonSeriesConfig; + /** Defines common settings for all spline series. */ + spline?: CommonSeriesConfig; + /** Defines common settings for all spline area series. */ + splinearea?: CommonSeriesConfig; + /** Defines common settings for all stacked area series. */ + stackedarea?: CommonSeriesConfig; + /** Defines common settings for all stacked spline area series. */ + stackedsplinearea?: CommonSeriesConfig; + /** Defines common settings for all stacked bar series. */ + stackedbar?: CommonSeriesConfig; + /** Defines common settings for all stacked line series. */ + stackedline?: CommonSeriesConfig; + /** Defines common settings for all stacked spline series. */ + stackedspline?: CommonSeriesConfig; + /** Defines common settings for all step area series. */ + steparea?: CommonSeriesConfig; + /** Defines common settings for all step line series. */ + stepline?: CommonSeriesConfig; + /** Defines common settings for all stock series. */ + stock?: CommonSeriesConfig; + /** Specifies the type of the series. */ + type?: string; + } + export interface SeriesConfig extends CommonSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + /** An object that defines configuration options for polar chart series. */ + export interface CommonPolarSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies whether or not to close the chart by joining the end point with the first point. */ + closed?: boolean; + label?: SeriesConfigLabel; + point?: PolarCommonPointOptions; + } + export interface CommonPolarSeriesSettings extends CommonPolarSeriesConfig { + /** An object that specifies configuration options for all series of the area type in the chart. */ + area?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonPolarSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface PolarSeriesConfig extends CommonPolarSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + export interface PieSeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies how to shift labels from their initial position in a radial direction in pixels. */ + radialOffset?: number; + /** + * Specifies a precision for the percentage values displayed in labels. + * @deprecated Use the series | label | format | percentPrecision instead. + */ + percentPrecision?: number; + } + /** An object that defines configuration options for chart series. */ + export interface CommonPieSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + /** Specifies the required type for series arguments. */ + argumentType?: string; + /** An object defining the series border configuration options. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the chart elements to highlight when a series is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered series. */ + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /** Sets a color for the series when it is hovered over. */ + color?: string; + /** Specifies the hatching options to be applied when a point is hovered over. */ + hatching?: viz.core.Hatching; + }; + /** + * Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. + * @deprecated Use the innerRadius option instead. + */ + innerRadius?: number; + /** An object defining the label configuration options. */ + label?: PieSeriesConfigLabel; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies a minimal size of a displayed pie segment. */ + minSegmentSize?: number; + /** + * Specifies the direction in which the dxPieChart series points are located. + * @deprecated Use the segmentsDirection option instead. + */ + segmentsDirection?: string; + /**

Specifies the chart elements to highlight when the series is selected.

*/ + selectionMode?: string; + /** An object defining configuration options for the series when it is selected. */ + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the hatching options to be applied when a point is selected. */ + hatching?: viz.core.Hatching; + }; + /** Specifies chart segment grouping options. */ + smallValuesGrouping?: { + /** Specifies the name of the grouped chart segment. This name represents the segment in the chart legend. */ + groupName?: string; + /** Specifies the segment grouping mode. */ + mode?: string; + /** Specifies a threshold for segment values. */ + threshold?: number; + /** Specifies how many segments must not be grouped. */ + topCount?: number; + }; + /** + * Specifies a start angle for a pie chart in arc degrees. + * @deprecated Use the startAngle option instead. + */ + startAngle?: number; + /**

Specifies the name of the data source field that provides data about a point.

*/ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + } + export interface CommonPieSeriesSettings extends CommonPieSeriesConfig { + /** + * Specifies the type of the pie chart series. + * @deprecated Use the type option instead. + */ + type?: string; + } + export interface PieSeriesConfig extends CommonPieSeriesConfig { + /** + * Sets the series type. + * @deprecated Use the type option instead. + */ + type?: string; + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + } + export interface SeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => SeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface PolarSeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => PolarSeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface ChartCommonConstantLineLabel { + /** Specifies font options for constant line labels. */ + font?: viz.core.Font; + /** Specifies the position of constant line labels on the chart plot. */ + position?: string; + /** Makes constant line labels visible. */ + visible?: boolean; + } + export interface PolarCommonConstantLineLabel { + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + } + export interface ConstantLineStyle { + /** Specifies a color for a constant line. */ + color?: string; + /** Specifies a dash style for a constant line. */ + dashStyle?: string; + /** Specifies a constant line width in pixels. */ + width?: number; + } + export interface ChartCommonConstantLineStyle extends ConstantLineStyle { + /** Configures constant line labels. */ + label?: ChartCommonConstantLineLabel; + /** Generates a pixel-measured empty space between the left/right side of a constant line and the constant line label. */ + paddingLeftRight?: number; + /** Generates a pixel-measured empty space between the top/bottom side of a constant line and the constant line label. */ + paddingTopBottom?: number; + } + export interface PolarCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarCommonConstantLineLabel; + } + export interface CommonAxisLabel { + /** Specifies font options for axis labels. */ + font?: viz.core.Font; + /** Specifies the spacing between an axis and its labels in pixels. */ + indentFromAxis?: number; + /** Indicates whether or not axis labels are visible. */ + visible?: boolean; + } + export interface ChartCommonAxisLabel extends CommonAxisLabel { + /** Aligns axis labels in relation to ticks. */ + alignment?: string; + /** Decides how to arrange axis labels when there is not enough space to keep all of them. */ + overlappingBehavior?: { + /** Decides how to arrange axis labels when there is not enough space to keep all of them. */ + mode?: string; + /** Specifies the rotation angle of axis labels. Applies only if the mode option is "rotate". */ + rotationAngle?: number; + /** Adds a pixel-measured empty space between two staggered rows of axis labels. Applies only if the mode option is "stagger". */ + staggeringSpacing?: number; + }; + } + export interface PolarCommonAxisLabel extends CommonAxisLabel { + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: string; + } + export interface CommonAxisTitle { + /** Specifies font options for the axis title. */ + font?: viz.core.Font; + /** Adds a pixel-measured empty space between the axis title and axis labels. */ + margin?: number; + } + export interface BaseCommonAxisSettings { + /** Specifies the color of the line that represents an axis. */ + color?: string; + /** Specifies whether ticks/grid lines of a discrete axis are located between labels or cross the labels. */ + discreteAxisDivisionMode?: string; + /** An object defining the configuration options for the grid lines of an axis in the dxPolarChart widget. */ + grid?: { + /** Specifies a color for grid lines. */ + color?: string; + /** Specifies an opacity for grid lines. */ + opacity?: number; + /** Indicates whether or not the grid lines of an axis are visible. */ + visible?: boolean; + /** Specifies the width of grid lines. */ + width?: number; + }; + /** Specifies the options of the minor grid. */ + minorGrid?: { + /** Specifies a color for the lines of the minor grid. */ + color?: string; + /** Specifies an opacity for the lines of the minor grid. */ + opacity?: number; + /** Indicates whether the minor grid is visible or not. */ + visible?: boolean; + /** Specifies a width for the lines of the minor grid. */ + width?: number; + }; + /** Indicates whether or not an axis is inverted. */ + inverted?: boolean; + /** Specifies the opacity of the line that represents an axis. */ + opacity?: number; + /** Indicates whether or not to set ticks/grid lines of a continuous axis of the 'date-time' type at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** An object defining the configuration options for axis ticks. */ + tick?: { + /** Specifies ticks color. */ + color?: string; + /** Specifies tick opacity. */ + opacity?: number; + /** Indicates whether or not ticks are visible on an axis. */ + visible?: boolean; + /** Specifies tick width. */ + width?: number; + /** Specifies tick length. */ + length?: number; + }; + /** Specifies the options of the minor ticks. */ + minorTick?: { + /** Specifies a color for the minor ticks. */ + color?: string; + /** Specifies an opacity for the minor ticks. */ + opacity?: number; + /** Indicates whether or not the minor ticks are displayed on an axis. */ + visible?: boolean; + /** Specifies minor tick width. */ + width?: number; + /** Specifies minor tick length. */ + length?: number; + }; + /** Indicates whether or not the line that represents an axis in a chart is visible. */ + visible?: boolean; + /** Specifies the width of the line that represents an axis in the chart. */ + width?: number; + } + export interface ChartCommonAxisSettings extends BaseCommonAxisSettings { + /** Configures the appearance of all constant lines in the widget. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** Configures axis labels. */ + label?: ChartCommonAxisLabel; + /** Controls the empty space between the maximum series points and the axis. Applies only to the axes of the "continuous" and "logarithmic" type. */ + maxValueMargin?: number; + /** Controls the empty space between the minimum series points and the axis. Applies only to the axes of the "continuous" and "logarithmic" type. */ + minValueMargin?: number; + /** Reserves a pixel-measured space for the axis. */ + placeholderSize?: number; + /** Configures the appearance of strips. */ + stripStyle?: { + /** Configures the appearance of strip labels. */ + label?: { + /** Specifies font options for strip labels. */ + font?: viz.core.Font; + /** Aligns strip labels in the horizontal direction. */ + horizontalAlignment?: string; + /** Aligns strip labels in the vertical direction. */ + verticalAlignment?: string; + }; + /** Generates a pixel-measured empty space between the left/right border of a strip and the strip label. */ + paddingLeftRight?: number; + /** Generates a pixel-measured empty space between the top/bottom border of a strip and the strip label. */ + paddingTopBottom?: number; + }; + /** Configures axis titles. */ + title?: CommonAxisTitle; + /** Adds an empty space between the axis and the minimum and maximum series points. */ + valueMarginsEnabled?: boolean; + } + export interface PolarCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: PolarCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxPolarChart widget. */ + label?: PolarCommonAxisLabel; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + }; + }; + } + export interface ChartConstantLineLabel extends ChartCommonConstantLineLabel { + /** Aligns constant line labels in the horizontal direction. */ + horizontalAlignment?: string; + /** Aligns constant line labels in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the text of a constant line label. By default, equals to the value of the constant line. */ + text?: string; + } + export interface PolarConstantLineLabel extends PolarCommonConstantLineLabel { + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface AxisLabel { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */ + customizeHint?: (argument: { value: any; valueText: string }) => string; + /** Specifies a callback function that returns the text to be displayed in value axis labels. */ + customizeText?: (argument: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed by axis labels. */ + format?: any; + /** + * Specifies a precision for the formatted value displayed in the axis labels. + * @deprecated Use the valueAxis | label | format | precision option instead. + */ + precision?: number; + } + export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { } + export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { } + export interface AxisTitle extends CommonAxisTitle { + /** Specifies the text of the axis title. */ + text?: string; + } + export interface ChartConstantLineStyle extends ChartCommonConstantLineStyle { + /** Specifies the appearance of the labels of those constant lines that belong to the value axis. */ + label?: ChartConstantLineLabel; + } + export interface ChartConstantLine extends ChartConstantLineStyle { + /** Configures the constant line label. */ + label?: ChartConstantLineLabel; + /** Specifies the value indicated by a constant line. Setting this option is necessary. */ + value?: any; + } + export interface PolarConstantLine extends PolarCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface Axis { + /** Specifies a coefficient for dividing the value axis. */ + axisDivisionFactor?: number; + /** Specifies the order in which discrete values are arranged on the value axis. */ + categories?: Array; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic axis. */ + logarithmBase?: number; + /** Specifies an interval between axis ticks/grid lines. */ + tickInterval?: any; + /** Specifies the interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the number of minor ticks between two neighboring major ticks. */ + minorTickCount?: number; + /** Specifies the required type of the value axis. */ + type?: string; + /** Binds the value axis to a pane. */ + pane?: string; + /** Specifies options for value axis strips. */ + strips?: Array; + } + export interface ChartAxis extends ChartCommonAxisSettings, Axis { + /** Declares a collection of constant lines belonging to the value axis. */ + constantLines?: Array; + /** Specifies the appearance of those constant lines that belong to the value axis. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** Configures the labels of the value axis. */ + label?: ChartAxisLabel; + /** Coupled with the min option, focuses the widget on a specific chart segment. Applies only to the axes of the "continuous" and "logarithmic" type. */ + max?: any; + /** Coupled with the max option, focuses the widget on a specific chart segment. Applies only to the axes of the "continuous" and "logarithmic" type. */ + min?: any; + /** Relocates the value axis. */ + position?: string; + /** Configures the axis title. */ + title?: any; + } + export interface PolarAxis extends PolarCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies options for value axis labels. */ + label?: PolarAxisLabel; + } + export interface ArgumentAxis { + /** Specifies the desired type of axis values. */ + argumentType?: string; + /** Specifies the elements that will be highlighted when the argument axis is hovered over. */ + hoverMode?: string; + } + export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis { } + export interface PolarArgumentAxis extends PolarAxis, ArgumentAxis { + /** Specifies the angle in arc degrees to which the argument axis should be rotated. The positive values rotate the axis clockwise. */ + startAngle?: number; + /** Specifies whether or not to display the first point at the angle specified by the startAngle option. */ + firstPointOnStartAngle?: boolean; + /** Specifies the value to be used as the origin for the argument axis. */ + originValue?: number; + /** Specifies the period of the argument values in the data source. */ + period?: number; + } + export interface ValueAxis { + /** Specifies the name of the value axis. */ + name?: string; + /** Specifies whether or not to indicate a zero value on the value axis. */ + showZero?: boolean; + /** Specifies the desired type of axis values. */ + valueType?: string; + } + export interface ChartValueAxis extends ChartAxis, ValueAxis { + /** Adds a pixel-measured empty space between two side-by-side value axes. Applies if several value axes are located on one side of the chart. */ + multipleAxesSpacing?: number; + /** Synchronizes two or more value axes with each other at a specific value. */ + synchronizedValue?: number; + } + export interface PolarValueAxis extends PolarAxis, ValueAxis { + /** Indicates whether to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + tick?: { + visible?: boolean; + } + } + export interface CommonPane { + /** Specifies the color of the pane's background. */ + backgroundColor?: string; + /** Configures the pane border. */ + border?: PaneBorder; + } + export interface Pane extends CommonPane { + /** Specifies the name of the pane. */ + name?: string; + } + export interface PaneBorder extends viz.core.DashedBorderWithOpacity { + /** Shows/hides the bottom border of the pane. Applies only when the border | visible option is true. */ + bottom?: boolean; + /** Shows/hides the left border of the pane. Applies only when the border | visible option is true. */ + left?: boolean; + /** Shows/hides the right border of the pane. Applies only when the border | visible option is true. */ + right?: boolean; + /** Shows/hides the top border of the pane. Applies only when the border | visible option is true. */ + top?: boolean; + } + export interface ChartAnimation extends viz.core.Animation { + /** Specifies how many series points the widget should have before the animation will be disabled. */ + maxPointCountSupported?: number; + } + export interface BaseChartTooltip extends viz.core.Tooltip { + /** Specifies a format for arguments of the chart's series points. */ + argumentFormat?: any; + /** + * Specifies a precision for formatted arguments displayed in tooltips. + * @deprecated Use the tooltip | argumentFormat | precision option instead. + */ + argumentPrecision?: number; + /** + * Specifies a precision for a percent value displayed in tooltips for stacked series and dxPieChart series. + * @deprecated Use the tooltip | format | percentPrecision option instead. + */ + percentPrecision?: number; + } + export interface BaseChartOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies the widget's width small enough for the layout to begin adapting. */ + width?: number; + /** Specifies the widget's height small enough for the layout to begin adapting. */ + height?: number; + /** Specifies whether or not point labels should be kept when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies animation options. */ + animation?: ChartAnimation; + /** Customizes the appearance of an individual point label. */ + customizeLabel?: (pointInfo: Object) => Object; + /** Customizes the appearance of an individual series point. */ + customizePoint?: (pointInfo: Object) => Object; + /** Specifies the origin of data for the widget. */ + dataSource?: any; + /** Specifies options of a dxChart's (dxPieChart's) legend. */ + legend?: core.BaseLegend; + /** Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** A handler for the done event. */ + onDone?: (e: { + component: BaseChart; + element: Element; + }) => void; + /** A handler for the pointClick event. */ + onPointClick?: any; + /** A handler for the pointHoverChanged event. */ + onPointHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + /** A handler for the pointSelectionChanged event. */ + onPointSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + /** Specifies whether a single point or multiple points can be selected in the chart. */ + pointSelectionMode?: string; + /** Specifies options for the dxChart and dxPieChart widget series. */ + series?: any; + /** Configures tooltips. */ + tooltip?: BaseChartTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => void; + } + /** A base class for all chart widgets included in the ChartJS library. */ + export class BaseChart extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + /** Deselects the chart's selected series. The series is displayed in an initial style. */ + clearSelection(): void; + /** Gets the current size of the widget. */ + getSize(): { width: number; height: number }; + /** Returns an array of all series in the chart. */ + getAllSeries(): Array; + /** Gets a series within the chart's series collection by the specified name (see the name option). */ + getSeriesByName(seriesName: string): BaseSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): BaseSeries; + /** Hides all widget tooltips. */ + hideTooltip(): void; + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(renderOptions?: { + force?: boolean; + animate?: boolean; + asyncSeriesRendering?: boolean; + }): void; + } + export interface AdvancedLegend extends core.BaseLegend { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /**

Specifies a callback function that returns the text to be displayed by legend items.

*/ + customizeText?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /** Specifies what series elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + } + export interface AdvancedOptions extends BaseChartOptions { + /** A handler for the argumentAxisClick event. */ + onArgumentAxisClick?: any; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate the values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort the series points. */ + sortingMethod?: any; + }; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** A handler for the seriesClick event. */ + onSeriesClick?: any; + /** A handler for the seriesHoverChanged event. */ + onSeriesHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** A handler for the seriesSelectionChanged event. */ + onSeriesSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** Specifies whether a single series or multiple series can be selected in the chart. */ + seriesSelectionMode?: string; + /** Specifies how the chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + /** Specifies whether or not all bars in a series must have the same angle, or may have different angles if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; + /** Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ + negativesAsZeroes?: boolean; + } + export interface Legend extends AdvancedLegend { + /** Specifies whether the legend is located outside or inside the chart's plot. */ + position?: string; + } + export interface ChartTooltip extends BaseChartTooltip { + /** Specifies whether the tooltip must be located in the center of a series point or on its edge. Applies to bar-like and bubble series only. */ + location?: string; + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxChartOptions extends AdvancedOptions { + /** Indicates whether or not to synchronize value axes when they are displayed on a single pane. */ + synchronizeMultiAxes?: boolean; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Specifies whether or not to adjust the value axis when zooming the widget. */ + adjustOnZoom?: boolean; + /** Configures the argument axis. */ + argumentAxis?: ChartArgumentAxis; + /** Defines common settings for both the argument and value axis in a chart. */ + commonAxisSettings?: ChartCommonAxisSettings; + /** Defines common settings for all panes in a chart. */ + commonPaneSettings?: CommonPane; + /** Specifies settings common for all series in the chart. */ + commonSeriesSettings?: CommonSeriesSettings; + /** Configures the crosshair feature. */ + crosshair?: { + /** Specifies the color of the crosshair lines. */ + color?: string; + /** Specifies the dash style of the crosshair lines. */ + dashStyle?: string; + /** Enables the crosshair. */ + enabled?: boolean; + /** Specifies how transparent the crosshair lines should be. */ + opacity?: number; + /** Specifies the width of the crosshair lines. */ + width?: number; + /** Configures the horizontal crosshair line individually. */ + horizontalLine?: CrosshaierWithLabel; + /** Configures the vertical crosshair line individually. */ + verticalLine?: CrosshaierWithLabel; + /** Configures the crosshair labels. */ + label?: { + /** Paints the background of the crosshair labels. */ + backgroundColor?: string; + /** Makes the crosshair labels visible. Applies only if the crosshair feature is enabled. */ + visible?: boolean; + /** Specifies font options for the crosshair labels. */ + font?: viz.core.Font; + /** Formats the point value/argument before it will be displayed in the crosshair label. */ + format?: any; + /** + * Specifies a precision for formatted values. + * @deprecated Use the crosshair | label | format | precision option instead. + */ + precision?: number; + /** Customizes the text displayed by the crosshair labels. */ + customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; + } + }; + /** Specifies which pane should be used by default. */ + defaultPane?: string; + /** Specifies a coefficient determining the diameter of the largest bubble. */ + maxBubbleSize?: number; + /** Specifies the diameter of the smallest bubble measured in pixels. */ + minBubbleSize?: number; + /** Declares a collection of panes. */ + panes?: Array; + /** Swaps the axes around making the value axis horizontal and the argument axis vertical. */ + rotated?: boolean; + /** Specifies the options of a chart's legend. */ + legend?: Legend; + /** A handler for the zoomStart event. */ + onZoomStart?: (e: { + component: BaseChart; + element: Element; + }) => void; + /** A handler for the zoomEnd event. */ + onZoomEnd?: (e: { + component: BaseChart; + element: Element; + rangeStart: any; + rangeEnd: any; + }) => void; + /** Specifies options for dxChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: SeriesTemplate; + tooltip?: ChartTooltip; + /** Configures the value axis. */ + valueAxis?: Array; + /** Enables scrolling in your chart. */ + scrollingMode?: string; + /** Enables zooming in your chart. */ + zoomingMode?: string; + /** Specifies the settings of the scroll bar. */ + scrollBar?: { + /** Specifies whether the scroll bar is visible or not. */ + visible?: boolean; + /** Specifies the spacing between the scroll bar and the chart's plot in pixels. */ + offset?: number; + /** Specifies the color of the scroll bar. */ + color?: string; + /** Specifies the width of the scroll bar in pixels. */ + width?: number; + /** Specifies the opacity of the scroll bar. */ + opacity?: number; + /** Specifies the position of the scroll bar in the chart. */ + position?: string; + }; + } + interface CrosshaierWithLabel extends viz.core.DashedBorderWithOpacity { + /** Configures the label that belongs to the horizontal crosshair line. */ + label?: { + /** Paints the background of the label that belongs to the horizontal crosshair line. */ + backgroundColor?: string; + /** Makes the label of the horizontal crosshair line visible. Applies only if the crosshair feature is enabled and the horizontal line is visible. */ + visible?: boolean; + /** Specifies font options for the label of the horizontal crosshair line. */ + font?: viz.core.Font; + /** Formats the point value before it will be displayed in the crosshair label. */ + format?: any; + /** + * Specifies a precision for formatted values. + * @deprecated Use the crosshair | horizontalLine | label | format | precision option instead. + */ + precision?: number; + /** Customizes the text displayed by the label that belongs to the horizontal crosshair line. */ + customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; + } + } + export interface PolarChartTooltip extends BaseChartTooltip { + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxPolarChartOptions extends AdvancedOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + width?: number; + height?: number; + }; + /** Indicates whether or not to display a "spider web". */ + useSpiderWeb?: boolean; + /** Specifies argument axis options for the dxPolarChart widget. */ + argumentAxis?: PolarArgumentAxis; + /** An object defining the configuration options that are common for all axes of the dxPolarChart widget. */ + commonAxisSettings?: PolarCommonAxisSettings; + /** An object defining the configuration options that are common for all series of the dxPolarChart widget. */ + commonSeriesSettings?: CommonPolarSeriesSettings; + /** Specifies the options of a chart's legend. */ + legend?: AdvancedLegend; + /** Specifies options for dxPolarChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: PolarSeriesTemplate; + tooltip?: PolarChartTooltip; + /** Specifies value axis options for the dxPolarChart widget. */ + valueAxis?: PolarValueAxis; + } + export interface PieLegend extends core.BaseLegend { + /** Specifies what chart elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + /** Specifies a callback function that returns the text to be displayed by a legend item. */ + customizeText?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + } + export interface dxPieChartOptions extends BaseChartOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + keepLabels?: boolean; + }; + /** Specifies dxPieChart legend options. */ + legend?: PieLegend; + /** Specifies options for the series of the dxPieChart widget. */ + series?: Array; + /** Specifies the diameter of the pie. */ + diameter?: number; + /** Specifies the direction that the pie chart segments will occupy. */ + segmentsDirection?: string; + /** Specifies the angle in arc degrees from which the first segment of a pie chart should start. */ + startAngle?: number; + /** Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. The value should be between 0 and 1. */ + innerRadius?: number; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** Specifies how a chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + /** An object defining the configuration options that are common for all series of the dxPieChart widget. */ + commonSeriesSettings?: CommonPieSeriesSettings; + /** Specifies the type of the pie chart series. */ + type?: string; + } +} +declare module DevExpress.viz { + /** A widget providing charts of various types for web applications. */ + export class dxChart extends DevExpress.viz.charts.BaseChart { + constructor(element: JQuery, options?: DevExpress.viz.charts.dxChartOptions); + constructor(element: Element, options?: DevExpress.viz.charts.dxChartOptions); + /** Sets the specified start and end values for the chart's argument axis. */ + zoomArgument(startValue: any, endValue: any): void; + } + /** A circular chart widget for web applications. */ + export class dxPieChart extends DevExpress.viz.charts.BaseChart { + constructor(element: JQuery, options?: DevExpress.viz.charts.dxPieChartOptions); + constructor(element: Element, options?: DevExpress.viz.charts.dxPieChartOptions); + /** + * Provides access to the dxPieChart series. + * @deprecated Use the getAllSeries() method instead. + */ + getSeries(): DevExpress.viz.charts.PieSeries; + } + /** A chart widget displaying data in a polar coordinate system. */ + export class dxPolarChart extends DevExpress.viz.charts.BaseChart { + constructor(element: JQuery, options?: DevExpress.viz.charts.dxPolarChartOptions); + constructor(element: Element, options?: DevExpress.viz.charts.dxPolarChartOptions); + } +} +interface JQuery { + dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; + dxChart(methodName: string, ...params: any[]): any; + dxChart(methodName: "instance"): DevExpress.viz.dxChart; + dxPieChart(options?: DevExpress.viz.charts.dxPieChartOptions): JQuery; + dxPieChart(methodName: string, ...params: any[]): any; + dxPieChart(methodName: "instance"): DevExpress.viz.dxPieChart; + dxPolarChart(options?: DevExpress.viz.charts.dxPolarChartOptions): JQuery; + dxPolarChart(methodName: string, ...params: any[]): any; + dxPolarChart(methodName: "instance"): DevExpress.viz.dxPolarChart; +} +declare module DevExpress.viz.gauges { + export interface BaseRangeContainer { + /** Specifies a range container's background color. */ + backgroundColor?: string; + /** Specifies the offset of the range container from an invisible scale line in pixels. */ + offset?: number; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** An array of objects representing ranges contained in the range container. */ + ranges?: Array<{ startValue: number; endValue: number; color: string }>; + /** Specifies a color of a range. */ + color?: string; + /** Specifies an end value of a range. */ + endValue?: number; + /** Specifies a start value of a range. */ + startValue?: number; + } + export interface ScaleTick { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** + * Specifies an array of custom minor ticks. + * @deprecated Use the scale | customMinorTicks option instead. + */ + customTickValues?: Array; + /** Specifies the length of the scale's minor ticks. */ + length?: number; + /** + * Indicates whether automatically calculated minor ticks are visible or not. + * @deprecated This feature is no longer available. + */ + showCalculatedTicks?: boolean; + /** + * Specifies an interval between minor ticks. + * @deprecated Use the scale | minorTickInterval option instead. + */ + tickInterval?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + } + export interface ScaleMajorTick extends ScaleTick { + /** + * Specifies whether or not to expand the current major tick interval if labels overlap each other. + * @deprecated Use the overlappingBehavior | useAutoArrangement option instead. + */ + useTicksAutoArrangement?: boolean; + } + export interface ScaleMinorTick extends ScaleTick { + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + } + export interface BaseScaleLabel { + /** Specifies whether or not scale labels should be colored similarly to their corresponding ranges in the range container. */ + useRangeColors?: boolean; + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: number; valueText: string }) => string; + /** Specifies the overlap resolving options to be applied to scale labels. */ + overlappingBehavior?: { + /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + useAutoArrangement?: boolean; + /** Specifies what label to hide in case of overlapping. */ + hideFirstOrLast?: string; + }; + /** Specifies font options for the text displayed in the scale labels of the gauge. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: any; + /** + * Specifies a precision for the formatted value displayed in the scale labels. + * @deprecated Use the scale | label | format | precision option instead. + */ + precision?: number; + /** Specifies whether or not scale labels are visible on the gauge. */ + visible?: boolean; + } + export interface BaseScale { + /** Specifies the end value for the scale of the gauge. */ + endValue?: number; + /** + * Specifies whether or not to hide the first scale label. + * @deprecated This feature is no longer available. + */ + hideFirstLabel?: boolean; + /** + * Specifies whether or not to hide the first major tick on the scale. + * @deprecated This feature is no longer available. + */ + hideFirstTick?: boolean; + /** + * Specifies whether or not to hide the last scale label. + * @deprecated This feature is no longer available. + */ + hideLastLabel?: boolean; + /** + * Specifies whether or not to hide the last major tick on the scale. + * @deprecated This feature is no longer available. + */ + hideLastTick?: boolean; + /** Specifies an interval between major ticks. */ + tickInterval?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: number; + /** Specifies an array of custom major ticks. */ + customTicks?: Array; + /** Specifies an array of custom minor ticks. */ + customMinorTicks?: Array; + /** Specifies common options for scale labels. */ + label?: BaseScaleLabel; + /** + * Specifies options of the gauge's major ticks. + * @deprecated Use the tick option instead. + */ + majorTick?: ScaleMajorTick; + /** Specifies options of the gauge's major ticks. */ + tick?: { + /** Specifies the color of the scale's major ticks. */ + color?: string; + /** Specifies the length of the scale's major ticks. */ + length?: number; + /** Indicates whether scale major ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's major ticks. */ + width?: number; + /** Specifies the opacity of the scale's major ticks. */ + opacity?: number; + }; + /** Specifies options of the gauge's minor ticks. */ + minorTick?: ScaleMinorTick; + /** Specifies the start value for the scale of the gauge. */ + startValue?: number; + } + export interface BaseValueIndicator { + /** Specifies the type of subvalue indicators. */ + type?: string; + /** Specifies the background color for the indicator of the rangeBar type. */ + backgroundColor?: string; + /** Specifies the base value for the indicator of the rangeBar type. */ + baseValue?: number; + /** Specifies a color of the indicator. */ + color?: string; + /** Specifies the range bar size for an indicator of the rangeBar type. */ + size?: number; + text?: { + /** Specifies a callback function that returns the text to be displayed in an indicator. */ + customizeText?: (indicatedValue: { value: number; valueText: string }) => string; + font?: viz.core.Font; + /** Specifies a format for the text displayed in an indicator. */ + format?: any; + /** Specifies the range bar's label indent in pixels. */ + indent?: number; + /** + * Specifies a precision for the formatted value displayed by an indicator. + * @deprecated Use the text | format | precision option instead. + */ + precision?: number; + }; + offset?: number; + length?: number; + width?: number; + /** Specifies the length of an arrow for the indicator of the textCloud type in pixels. */ + arrowLength?: number; + /** Sets the array of colors to be used for coloring subvalue indicators. */ + palette?: any; + /** Specifies the distance between the needle and the center of a gauge for the indicator of a needle-like type. */ + indentFromCenter?: number; + /** Specifies the second color for the indicator of the twoColorNeedle type. */ + secondColor?: string; + /** Specifies the length of a twoNeedleColor type indicator tip as a percentage. */ + secondFraction?: number; + /** Specifies the spindle's diameter in pixels for the indicator of a needle-like type. */ + spindleSize?: number; + /** Specifies the inner diameter in pixels, so that the spindle has the shape of a ring. */ + spindleGapSize?: number; + /** Specifies the orientation of the rangeBar indicator on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of the rangeBar indicator on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface SharedGaugeOptions extends viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** Specifies animation options. */ + animation?: viz.core.Animation; + /** + * Specifies a subtitle for the widget. + * @deprecated Use the title | subtitle option instead. + */ + subtitle?: { + /** + * Specifies font options for the subtitle. + * @deprecated Use the title | subtitle | font option instead. + */ + font?: viz.core.Font; + /** + * Specifies a text for the subtitle. + * @deprecated Use the title | subtitle | text option instead. + */ + text?: string; + }; + /** Configures tooltips. */ + tooltip?: viz.core.Tooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + } + export interface BaseGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies options of the gauge's range container. */ + rangeContainer?: BaseRangeContainer; + /** Specifies a gauge's scale options. */ + scale?: BaseScale; + /** Specifies the appearance options of subvalue indicators. */ + subvalueIndicator?: BaseValueIndicator; + /** Specifies a set of subvalues to be designated by the subvalue indicators. */ + subvalues?: Array; + /** Specifies the main value on a gauge. */ + value?: number; + /** Specifies the appearance options of the value indicator. */ + valueIndicator?: BaseValueIndicator; + } + /** A gauge widget. */ + export class dxBaseGauge extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + /** Returns the main gauge value. */ + value(): number; + /** Updates a gauge value. */ + value(value: number): void; + /** Returns an array of gauge subvalues. */ + subvalues(): Array; + /** Updates gauge subvalues. */ + subvalues(subvalues: Array): void; + } + export interface LinearRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of a range container on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + /** Specifies the width of the range container's start and end boundaries in the dxLinearGauge widget. */ + width?: any; + /** Specifies an end width of a range container. */ + end?: number; + /** Specifies a start width of a range container. */ + start?: number; + } + export interface LinearScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface LinearScale extends BaseScale { + /** Specifies the orientation of scale ticks on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + label?: LinearScaleLabel; + /** Specifies the orientation of scale ticks on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface dxLinearGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxLinearGauge widget. */ + geometry?: { + /** Indicates whether to display the dxLinearGauge widget vertically or horizontally. */ + orientation?: string; + }; + /** Specifies gauge range container options. */ + rangeContainer?: LinearRangeContainer; + scale?: LinearScale; + } + export interface CircularRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container in the dxCircularGauge widget. */ + orientation?: string; + /** Specifies the range container's width in pixels. */ + width?: number; + } + export interface CircularScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface CircularScale extends BaseScale { + label?: CircularScaleLabel; + /** Specifies the orientation of scale ticks. */ + orientation?: string; + } + export interface dxCircularGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxCircularGauge widget. */ + geometry?: { + /** Specifies the end angle of the circular gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the circular gauge's arc. */ + startAngle?: number; + }; + /** Specifies gauge range container options. */ + rangeContainer?: CircularRangeContainer; + scale?: CircularScale; + } + export interface dxBarGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies a color for the remaining segment of the bar's track. */ + backgroundColor?: string; + /** Specifies a distance between bars in pixels. */ + barSpacing?: number; + /** Specifies a base value for bars. */ + baseValue?: number; + /** Specifies an end value for the gauge's invisible scale. */ + endValue?: number; + /** Defines the shape of the gauge's arc. */ + geometry?: { + /** Specifies the end angle of the bar gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the bar gauge's arc. */ + startAngle?: number; + }; + /** Specifies the options of the labels that accompany gauge bars. */ + label?: { + /** Specifies a color for the label connector text. */ + connectorColor?: string; + /** Specifies the width of the label connector in pixels. */ + connectorWidth?: number; + /** Specifies a callback function that returns a text for labels. */ + customizeText?: (barValue: { value: number; valueText: string }) => string; + /** Specifies font options for bar labels. */ + font?: viz.core.Font; + /** Specifies a format for bar labels. */ + format?: any; + /** Specifies the distance between the upper bar and bar labels in pixels. */ + indent?: number; + /** + * Specifies a precision for the formatted value displayed by labels. + * @deprecated Use the label | format | precision option instead. + */ + precision?: number; + /** Specifies whether bar labels appear on a gauge or not. */ + visible?: boolean; + }; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** Defines the radius of the bar that is closest to the center relatively to the radius of the topmost bar. */ + relativeInnerRadius?: number; + /** Specifies a start value for the gauge's invisible scale. */ + startValue?: number; + /** Specifies the array of values to be indicated on a bar gauge. */ + values?: Array; + } +} +declare module DevExpress.viz { + /** A widget that represents a gauge with a linear scale. */ + export class dxLinearGauge extends DevExpress.viz.gauges.dxBaseGauge { + constructor(element: JQuery, options?: DevExpress.viz.gauges.dxLinearGaugeOptions); + constructor(element: Element, options?: DevExpress.viz.gauges.dxLinearGaugeOptions); + } + /** A widget that represents a gauge with a circular scale. */ + export class dxCircularGauge extends DevExpress.viz.gauges.dxBaseGauge { + constructor(element: JQuery, options?: DevExpress.viz.gauges.dxCircularGaugeOptions); + constructor(element: Element, options?: DevExpress.viz.gauges.dxCircularGaugeOptions); + } + /** A circular bar widget. */ + export class dxBarGauge extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.gauges.dxBarGaugeOptions); + constructor(element: Element, options?: DevExpress.viz.gauges.dxBarGaugeOptions); + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + /** Returns an array of gauge values. */ + values(): Array; + /** Updates the values displayed by a gauge. */ + values(values: Array): void; + } +} +interface JQuery { + dxLinearGauge(options?: DevExpress.viz.gauges.dxLinearGaugeOptions): JQuery; + dxLinearGauge(methodName: string, ...params: any[]): any; + dxLinearGauge(methodName: "instance"): DevExpress.viz.dxLinearGauge; + dxCircularGauge(options?: DevExpress.viz.gauges.dxCircularGaugeOptions): JQuery; + dxCircularGauge(methodName: string, ...params: any[]): any; + dxCircularGauge(methodName: "instance"): DevExpress.viz.dxCircularGauge; + dxBarGauge(options?: DevExpress.viz.gauges.dxBarGaugeOptions): JQuery; + dxBarGauge(methodName: string, ...params: any[]): any; + dxBarGauge(methodName: "instance"): DevExpress.viz.dxBarGauge; +} +declare module DevExpress.viz.rangeSelector { + export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** Specifies the options for the range selector's background. */ + background?: { + /** Specifies the background color for the dxRangeSelector. */ + color?: string; + /** Specifies image options. */ + image?: { + /** Specifies a location for the image in the background of a range selector. */ + location?: string; + /** Specifies the image's URL. */ + url?: string; + }; + /** Indicates whether or not the background (background color and/or image) is visible. */ + visible?: boolean; + }; + /** Specifies the dxRangeSelector's behavior options. */ + behavior?: { + /** Indicates whether or not you can swap sliders. */ + allowSlidersSwap?: boolean; + /** Indicates whether or not animation is enabled. */ + animationEnabled?: boolean; + /** Specifies when to call the onSelectedRangeChanged function. */ + callSelectedRangeChanged?: string; + /** Indicates whether or not an end user can specify the range using a mouse, without the use of sliders. */ + manualRangeSelectionEnabled?: boolean; + /** Indicates whether or not an end user can shift the selected range to the required location on a scale by clicking. */ + moveSelectedRangeByClick?: boolean; + /** Indicates whether to snap a slider to ticks. */ + snapToTicks?: boolean; + }; + /** Specifies the options required to display a chart as the range selector's background. */ + chart?: { + /** Specifies a coefficient for determining an indent from the bottom background boundary to the lowest chart point. */ + bottomIndent?: number; + /** An object defining the common configuration options for the chart’s series. */ + commonSeriesSettings?: viz.charts.CommonSeriesSettings; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort series points. */ + sortingMethod?: any; + }; + /** Specifies whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; + /** Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. */ + negativesAsZeroes?: boolean; + /** Sets the name of the palette to be used in the range selector's chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** An object defining the chart’s series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: viz.charts.SeriesTemplate; + /** Specifies a coefficient for determining an indent from the background's top boundary to the topmost chart point. */ + topIndent?: number; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Specifies options for the chart's value axis. */ + valueAxis?: { + /** Indicates whether or not the chart's value axis must be inverted. */ + inverted?: boolean; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic value axis. */ + logarithmBase?: number; + /** Specifies the maximum value of the chart's value axis. */ + max?: number; + /** Specifies the minimum value of the chart's value axis. */ + min?: number; + /** Specifies the type of the value axis. */ + type?: string; + /** Specifies the desired type of axis values. */ + valueType?: string; + }; + }; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies a data source for the scale values and for the chart at the background. */ + dataSource?: any; + /** Specifies the data source field that provides data for the scale. */ + dataSourceField?: string; + /** Specifies options of the range selector's scale. */ + scale?: { + /** Specifies the scale's end value. */ + endValue?: any; + /** Specifies common options for scale labels. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: any; valueText: string; }) => string; + /** Specifies font options for the text displayed in the range selector's scale labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: any; + /** + * Specifies a precision for the formatted value displayed in the scale labels. + * @deprecated Use the scale | label | format | precision option instead. + */ + precision?: number; + /** Specifies a spacing between scale labels and the background bottom edge. */ + topIndent?: number; + /** Specifies whether or not the scale's labels are visible. */ + visible?: boolean; + }; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic scale. */ + logarithmBase?: number; + /** + * Specifies an interval between major ticks. + * @deprecated Use the tickInterval option instead. + */ + majorTickInterval?: any; + /** Specifies an interval between axis ticks. */ + tickInterval?: any; + /** Specifies options for the date-time scale's markers. */ + marker?: { + /** Defines the options that can be set for the text that is displayed by the scale markers. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale markers. */ + customizeText?: (markerValue: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed in scale markers. */ + format?: any; + }; + /** Specifies the height of the marker's separator. */ + separatorHeight?: number; + /** Specifies the space between the marker label and the marker separator. */ + textLeftIndent?: number; + /** Specifies the space between the marker's label and the top edge of the marker's separator. */ + textTopIndent?: number; + /** Specified the indent between the marker and the scale lables. */ + topIndent?: number; + /** Indicates whether scale markers are visible. */ + visible?: boolean; + }; + /** Specifies the maximum range that can be selected. */ + maxRange?: any; + /** Specifies the number of minor ticks between neighboring major ticks. */ + minorTickCount?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the minimum range that can be selected. */ + minRange?: any; + /** Specifies the height of the space reserved for the scale in pixels. */ + placeholderHeight?: number; + /** Indicates whether or not to set ticks of a date-time scale at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** Specifies whether or not to show ticks for the boundary scale values, when neither major ticks nor minor ticks are created for these values. */ + showCustomBoundaryTicks?: boolean; + /** + * Indicates whether or not to show minor ticks on the scale. + * @deprecated Use the minorTick | visible option instead. + */ + showMinorTicks?: boolean; + /** Specifies the scale's start value. */ + startValue?: any; + /** Specifies options defining the appearance of scale ticks. */ + tick?: { + /** Specifies the color of scale ticks (both major and minor ticks). */ + color?: string; + /** Specifies the opacity of scale ticks (both major and minor ticks). */ + opacity?: number; + /** Specifies the width of the scale's ticks (both major and minor ticks). */ + width?: number; + }; + /** Specifies options of the range selector's minor ticks. */ + minorTick?: { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + }; + /** Specifies the type of the scale. */ + type?: string; + /** Specifies whether or not to expand the current tick interval if labels overlap each other. */ + useTicksAutoArrangement?: boolean; + /** Specifies the type of values on the scale. */ + valueType?: string; + /** Specifies the order of arguments on a discrete scale. */ + categories?: Array; + }; + /** Specifies the range to be selected when displaying the dxRangeSelector. */ + selectedRange?: { + /** Specifies the start value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + startValue?: any; + /** Specifies the end value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + endValue?: any; + }; + /** Specifies the color of the selected range. */ + selectedRangeColor?: string; + /** Range selector's indent options. */ + indent?: { + /** Specifies range selector's left indent. */ + left?: number; + /** Specifies range selector's right indent. */ + right?: number; + }; + /** A handler for the selectedRangeChanged event. */ + onSelectedRangeChanged?: (e: { + startValue: any; + endValue: any; + component: dxRangeSelector; + element: Element; + }) => void; + /** Specifies range selector shutter options. */ + shutter?: { + /** Specifies shutter color. */ + color?: string; + /** Specifies the opacity of the color of shutters. */ + opacity?: number; + }; + /** Specifies the appearance of the range selector's slider handles. */ + sliderHandle?: { + /** Specifies the color of the slider handles. */ + color?: string; + /** Specifies the opacity of the slider handles. */ + opacity?: number; + /** Specifies the width of the slider handles. */ + width?: number; + }; + /** Defines the options of the range selector slider markers. */ + sliderMarker?: { + /** Specifies the color of the slider markers. */ + color?: string; + /** Specifies a callback function that returns the text to be displayed by slider markers. */ + customizeText?: (scaleValue: { value: any; valueText: any; }) => string; + /** Specifies font options for the text displayed by the range selector slider markers. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in slider markers. */ + format?: any; + /** Specifies the color used for the slider marker text when the currently selected range does not match the minRange and maxRange values. */ + invalidRangeColor?: string; + /** + * Specifies the empty space between the marker's border and the marker’s text. + * @deprecated Use the paddingTopBottom and paddingLeftRight options instead. + */ + padding?: number; + /** Specifies the empty space between the marker's top and bottom borders and the marker's text. */ + paddingTopBottom?: number; + /** Specifies the empty space between the marker's left and right borders and the marker's text. */ + paddingLeftRight?: number; + /** Specifies the placeholder height of the slider marker. */ + placeholderHeight?: number; + /** + * Specifies in pixels the height and width of the space reserved for the range selector slider markers. + * @deprecated Use the placeholderHeight and indent options instead. + */ + placeholderSize?: { + /** Specifies the height of the placeholder for the left and right slider markers. */ + height?: number; + /** Specifies the width of the placeholder for the left and right slider markers. */ + width?: { + /** Specifies the width of the left slider marker's placeholder. */ + left?: number; + /** Specifies the width of the right slider marker's placeholder. */ + right?: number; + }; + }; + /** + * Specifies a precision for the formatted value displayed in slider markers. + * @deprecated Use the sliderMarker | format | precision option instead. + */ + precision?: number; + /** Indicates whether or not the slider markers are visible. */ + visible?: boolean; + }; + } +} +declare module DevExpress.viz { + /** A widget that allows end users to select a range of values on a scale. */ + export class dxRangeSelector extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions); + constructor(element: Element, options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions); + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(skipChartAnimation?: boolean): void; + /** Returns the currently selected range. */ + getSelectedRange(): { startValue: any; endValue: any; }; + /** Sets a specified range. */ + setSelectedRange(selectedRange: { startValue: any; endValue: any; }): void; + } +} +interface JQuery { + dxRangeSelector(options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; + dxRangeSelector(methodName: string, ...params: any[]): any; + dxRangeSelector(methodName: "instance"): DevExpress.viz.dxRangeSelector; +} +declare module DevExpress.viz.map { + /** This section describes the fields and methods that can be used in code to manipulate the Layer object. */ + export interface MapLayer { + /** The name of the layer. */ + name: string; + /** The layer index in the layers array. */ + index: number; + /** The layer type. Can be "area", "line" or "marker". */ + type: string; + /** The type of the layer elements. */ + elementType: string; + /** Gets all layer elements. */ + getElements(): Array; + /** Deselects all layer elements. */ + clearSelection(): void; + } + /** This section describes the fields and methods that can be used in code to manipulate the Layer Element object. */ + export interface MapLayerElement { + /** The parent layer of the layer element. */ + layer: MapLayer; + /** Gets the layer element coordinates. */ + coordinates(): Object; + /** Sets the value of an attribute. */ + attribute(name: string, value: any): void; + /** Gets the value of an attribute. */ + attribute(name: string): any; + /** Gets the selection state of the layer element. */ + selected(): boolean; + /** Sets the selection state of the layer element. */ + selected(state: boolean): void; + /** Applies the layer element settings and updates element appearance. */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Area object. + * @deprecated Use the Layer Element instead. + */ + export interface Area { + /** + * Contains the element type. + * @deprecated Use the Layer | type instead. + */ + type: string; + /** + * Return the value of an attribute. + * @deprecated Use the Layer Element | attribute(name, value) method instead. + */ + attribute(name: string): any; + /** + * Provides information about the selection state of an area. + * @deprecated Use the Layer Element | selected() method instead. + */ + selected(): boolean; + /** + * Sets a new selection state for an area. + * @deprecated Use the Layer Element | selected(state) method instead. + */ + selected(state: boolean): void; + /** + * Applies the area settings specified as a parameter and updates the area appearance. + * @deprecated Use the Layer Element | applySettings(settings) method instead. + */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Markers object. + * @deprecated Use the Layer Element instead. + */ + export interface Marker { + /** + * Contains the descriptive text accompanying the map marker. + * @deprecated Get the text using the Layer Element | attribute(name) method. The name parameter value for text is set at the dataField option. + */ + text: string; + /** + * Contains the type of the element. + * @deprecated Use the Layer | type instead. + */ + type: string; + /** + * Contains the URL of an image map marker. + * @deprecated Get the image URL using the Layer Element | attribute(name) method. The name parameter value for the image URL is set at the dataField option. + */ + url: string; + /** + * Contains the value of a bubble map marker. + * @deprecated Get the bubble value using the Layer Element | attribute(name) method. The name parameter for the bubble value is set at the dataField option. + */ + value: number; + /** + * Contains the values of a pie map marker. + * @deprecated Get the pie values using the Layer Element | attribute(name) method. The name parameter for pie values is set at the dataField option. + */ + values: Array; + /** + * Returns the value of an attribute. + * @deprecated Use the Layer Element | attribute(name, value) method instead. + */ + attribute(name: string): any; + /** + * Returns the coordinates of a specific marker. + * @deprecated Use the Layer Element | coordinates() method instead. + */ + coordinates(): Array; + /** + * Provides information about the selection state of a marker. + * @deprecated Use the Layer Element | selected() method instead. + */ + selected(): boolean; + /** + * Sets a new selection state for a marker. + * @deprecated Use the Layer Element | selected(state) method instead. + */ + selected(state: boolean): void; + /** + * Applies the marker settings specified as a parameter and updates marker appearance. + * @deprecated Use the Layer Element | applySettings(settings) method instead. + */ + applySettings(settings: any): void; + } + export interface MapLayerSettings { + /** Specifies the layer name. */ + name?: string; + /** Specifies layer type. */ + type?: string; + /** Specifies the type of a marker element. Setting this option makes sense only if the layer type is "marker". */ + elementType?: string; + /** Specifies a data source for the layer. */ + dataSource?: any; + /** Specifies the line width (for layers of a line type) or width of the layer elements border in pixels. */ + borderWidth?: number; + /** Specifies a color for the border of the layer elements. */ + borderColor?: string; + /** Specifies a color for layer elements. */ + color?: string; + /** Specifies a color for the border of the layer element when it is hovered over. */ + hoveredBorderColor?: string; + /** Specifies the pixel-measured line width (for layers of a line type) or width for the border of the layer element when it is hovered over. */ + hoveredBorderWidth?: number; + /** Specifies a color for a layer element when it is hovered over. */ + hoveredColor?: string; + /** Specifies a pixel-measured line width (for layers of a line type) or width for the border of the layer element when it is selected. */ + selectedBorderWidth?: number; + /** Specifies a color for the border of the layer element when it is selected. */ + selectedBorderColor?: string; + /** Specifies a color for the layer element when it is selected. */ + selectedColor?: string; + /** Specifies the layer opacity (from 0 to 1). */ + opacity?: number; + /** Specifies the size of markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "dot", "pie" or "image". */ + size?: number; + /** Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if the layer type is "marker". */ + minSize?: number; + /** Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if the layer type is "marker". */ + maxSize?: number; + /** Specifies whether or not to change the appearance of a layer element when it is hovered over. */ + hoverEnabled?: boolean; + /** Specifies whether single or multiple map elements can be selected on a vector map. */ + selectionMode?: string; + /** Specifies the name of the palette or a custom range of colors to be used for coloring a layer. */ + palette?: any; + /** Specifies the number of colors in a palette. */ + paletteSize?: number; + /** Allows you to paint layer elements with similar attributes in the same color. */ + colorGroups?: Array; + /** Specifies the field that provides data to be used for coloring of layer elements. */ + colorGroupingField?: string; + /** Allows you to display bubbles with similar attributes in the same size. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroups?: Array; + /** Specifies the field that provides data to be used for sizing bubble markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroupingField?: string; + /** Specifies the name of the attribute containing marker data. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble", "pie" or "image". */ + dataField?: string; + /** Specifies the function that customizes each layer element individually. */ + customize?: (eleemnts: Array) => void; + /** Specifies marker label options. */ + label?: { + /** The name of the data source attribute containing marker texts. */ + dataField?: string; + /** Enables marker labels. */ + enabled?: boolean; + /** Specifies font options for marker labels. */ + font?: viz.core.Font; + }; + } + export interface AreaSettings { + /** + * Specifies the width of the area border in pixels. + * @deprecated Use the layers | borderWidth option instead. + */ + borderWidth?: number; + /** + * Specifies a color for the area border. + * @deprecated Use the layers | borderColor option instead. + */ + borderColor?: string; + /** + * Specifies a color for an area. + * @deprecated Use the layers | color option instead. + */ + color?: string; + /** + * Specifies the function that customizes each area individually. + * @deprecated Use the layers | customize option instead. + */ + customize?: (areaInfo: Area) => AreaSettings; + /** + * Specifies a color for the area border when the area is hovered over. + * @deprecated Use the layers | hoveredBorderColor option instead. + */ + hoveredBorderColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is hovered over. + * @deprecated Use the layers | hoveredBorderWidth option instead. + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for an area when this area is hovered over. + * @deprecated Use the layers | hoveredColor option instead. + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of an area when it is hovered over. + * @deprecated Use the layers | hoverEnabled option instead. + */ + hoverEnabled?: boolean; + /** + * Configures area labels. + * @deprecated Use the layers | label option instead. + */ + label?: { + /** + * Specifies the data field that provides data for area labels. + * @deprecated Use the layers | label | dataField option instead. + */ + dataField?: string; + /** + * Enables area labels. + * @deprecated Use the layers | label | enabled option instead. + */ + enabled?: boolean; + /** + * Specifies font options for area labels. + * @deprecated Use the layers | label | font option instead. + */ + font?: viz.core.Font; + }; + /** + * Specifies the name of the palette or a custom range of colors to be used for coloring a map. + * @deprecated Use the layers | palette option instead. + */ + palette?: any; + /** + * Specifies the number of colors in a palette. + * @deprecated Use the layers | paletteSize option instead. + */ + paletteSize?: number; + /** + * Allows you to paint areas with similar attributes in the same color. + * @deprecated Use the layers | colorGroups option instead. + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring areas. + * @deprecated Use the layers | colorGroupingField option instead. + */ + colorGroupingField?: string; + /** + * Specifies a color for the area border when the area is selected. + * @deprecated Use the layers | selectedBorderColor option instead. + */ + selectedBorderColor?: string; + /** + * Specifies a color for an area when this area is selected. + * @deprecated Use the layers | selectedColor option instead. + */ + selectedColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is selected. + * @deprecated Use the layers | selectedBorderWidth option instead. + */ + selectedBorderWidth?: number; + /** + * Specifies whether single or multiple areas can be selected on a vector map. + * @deprecated Use the layers | selectionMode option instead. + */ + selectionMode?: string; + } + export interface MarkerSettings { + /** + * Specifies a color for the marker border. + * @deprecated Use the layers | borderColor option instead. + */ + borderColor?: string; + /** + * Specifies the width of the marker border in pixels. + * @deprecated Use the layers | borderWidth option instead. + */ + borderWidth?: number; + /** + * Specifies a color for a marker of the dot or bubble type. + * @deprecated Use the layers | color option instead. + */ + color?: string; + /** + * Specifies the function that customizes each marker individually. + * @deprecated Use the layers | customize option instead. + */ + customize?: (markerInfo: Marker) => MarkerSettings; + /** + * Specifies the pixel-measured width of the marker border when the marker is hovered over. + * @deprecated Use the layers | hoveredBorderWidth option instead. + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is hovered over. + * @deprecated Use the layers | hoveredBorderColor option instead. + */ + hoveredBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is hovered over. + * @deprecated Use the layers | hoveredColor option instead. + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of a marker when it is hovered over. + * @deprecated Use the layers | hoverEnabled option instead. + */ + hoverEnabled?: boolean; + /** + * Specifies marker label options. + * @deprecated Use the layers | label option instead. + */ + label?: { + /** + * Enables marker labels. + * @deprecated Use the layers | label | enabled option instead. + */ + enabled?: boolean; + /** + * Specifies font options for marker labels. + * @deprecated Use the layers | label | font option instead. + */ + font?: viz.core.Font; + }; + /** + * Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | maxSize option instead. + */ + maxSize?: number; + /** + * Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | minSize option instead. + */ + minSize?: number; + /** + * Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated Use the layers | opacity option instead. + */ + opacity?: number; + /** + * Specifies the pixel-measured width of the marker border when the marker is selected. + * @deprecated Use the layers | selectedBorderWidth option instead. + */ + selectedBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is selected. + * @deprecated Use the layers | selectedBorderColor option instead. + */ + selectedBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is selected. + * @deprecated Use the layers | selectedColor option instead. + */ + selectedColor?: string; + /** + * Specifies whether a single or multiple markers can be selected on a vector map. + * @deprecated Use the layers | selectionMode option instead. + */ + selectionMode?: string; + /** + * Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. + * @deprecated Use the layers | size option instead. + */ + size?: number; + /** + * Specifies the type of markers to be used on the map. + * @deprecated Use the layers | elementType option instead. + */ + type?: string; + /** + * Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. + * @deprecated Use the layers | palette option instead. + */ + palette?: any; + /** + * Allows you to paint markers with similar attributes in the same color. + * @deprecated Use the layers | colorGroups option instead. + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring markers. + * @deprecated Use the layers | colorGroupingField option instead. + */ + colorGroupingField?: string; + /** + * Allows you to display bubbles with similar attributes in the same size. + * @deprecated Use the layers | sizeGroups option instead. + */ + sizeGroups?: Array; + /** + * Specifies the field that provides data to be used for sizing bubble markers. + * @deprecated Use the layers | sizeGroupingField option instead. + */ + sizeGroupingField?: string; + } + export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** + * An object specifying options for the map areas. + * @deprecated Use the "area" type element of the layers array. + */ + areaSettings?: AreaSettings; + /** Specifies the options for the map background. */ + background?: { + /** Specifies a color for the background border. */ + borderColor?: string; + /** Specifies a color for the background. */ + color?: string; + }; + /** Specifies options for dxVectorMap widget layers. */ + layers?: Array; + /** Specifies the map projection. */ + projection?: Object; + /** Specifies the positioning of a map in geographical coordinates. */ + bounds?: Array; + /** Specifies the options of the control bar. */ + controlBar?: { + /** Specifies a color for the outline of the control bar elements. */ + borderColor?: string; + /** Specifies a color for the inner area of the control bar elements. */ + color?: string; + /** Specifies whether or not to display the control bar. */ + enabled?: boolean; + /** Specifies the margin of the control bar in pixels. */ + margin?: number; + /** Specifies the position of the control bar. */ + horizontalAlignment?: string; + /** Specifies the position of the control bar. */ + verticalAlignment?: string; + /** Specifies the opacity of the control bar. */ + opacity?: number; + }; + /** + * Specifies a data source for the map area. + * @deprecated Use the layers | dataSource option instead. + */ + mapData?: any; + /** + * Specifies a data source for the map markers. + * @deprecated Use the layers | dataSource option instead. + */ + markers?: any; + /** + * An object specifying options for the map markers. + * @deprecated Use the "marker" type element of the layers array. + */ + markerSettings?: MarkerSettings; + /** Configures tooltips. */ + tooltip?: viz.core.Tooltip; + /** Configures map legends. */ + legends?: Array; + /** Specifies whether or not the map should respond when a user rolls the mouse wheel. */ + wheelEnabled?: boolean; + /** Specifies whether the map should respond to touch gestures. */ + touchEnabled?: boolean; + /** Disables the zooming capability. */ + zoomingEnabled?: boolean; + /** Specifies the geographical coordinates of the center for a map. */ + center?: Array; + /** A handler for the centerChanged event. */ + onCenterChanged?: (e: { + center: Array; + component: dxVectorMap; + element: Element; + }) => void; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** Specifies a number that is used to zoom a map initially. */ + zoomFactor?: number; + /** Specifies a map's maximum zoom factor. */ + maxZoomFactor?: number; + /** A handler for the zoomFactorChanged event. */ + onZoomFactorChanged?: (e: { + component: dxVectorMap; + element: Element; + zoomFactor: number; + }) => void; + /** A handler for the click event. */ + onClick?: any; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + component: dxVectorMap; + element: Element; + target: MapLayerElement; + }) => void; + /** + * A handler for the areaClick event. + * @deprecated Use the onClick option instead. + */ + onAreaClick?: any; + /** + * A handler for the areaSelectionChanged event. + * @deprecated Use the onSelectionChanged option instead. + */ + onAreaSelectionChanged?: (e: { + target: Area; + component: dxVectorMap; + element: Element; + }) => void; + /** + * A handler for the markerClick event. + * @deprecated Use the onClick option instead. + */ + onMarkerClick?: any; + /** + * A handler for the markerSelectionChanged event. + * @deprecated Use the onSelecitonChanged option instead. + */ + onMarkerSelectionChanged?: (e: { + target: Marker; + component: dxVectorMap; + element: Element; + }) => void; + /** Disables the panning capability. */ + panningEnabled?: boolean; + } + export interface Legend extends viz.core.BaseLegend { + /** Specifies the color of item markers in the legend. The specified color applied only when the legend uses 'size' source. */ + markerColor?: string; + /** Specifies the shape of item markers. */ + markerShape?: string; + /** Specifies text for legend items. */ + customizeText?: (itemInfo: { start: number; end: number; index: number; color: string; size: number; }) => string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item. */ + customizeHint?: (itemInfo: { start: number; end: number; index: number; color: string; size: number }) => string; + /** Specifies the source of data for the legend. */ + source?: { + /** Specifies a layer to which the legend belongs. */ + layer?: string; + /** Specifies the type of the legend grouping. */ + grouping?: string; + } + } + export var projection: ProjectionCreator; + export interface ProjectionCreator { + /** Creates a new projection. */ + (data: { + to?: (coordinates: Array) => Array; + from?: (coordinates: Array) => Array; + aspectRatio?: number; + }): Object; + /** Gets the default or custom projection from the projection storage. */ + get(name: string): Object; + /** Adds a new projection to the internal projections storage. */ + add(name: string, projection: Object): void; + } +} +declare module DevExpress.viz{ + /** A vector map widget. */ + export class dxVectorMap extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.map.dxVectorMapOptions); + constructor(element: Element, options?: DevExpress.viz.map.dxVectorMapOptions); + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + /** Gets the current coordinates of the map center. */ + center(): Array; + /** Sets the coordinates of the map center. */ + center(centerCoordinates: Array): void; + /** + * Deselects all the selected areas on a map. The areas are displayed in their initial style after. + * @deprecated Use the layer's clearSelection() method instead. + */ + clearAreaSelection(): void; + /** + * Deselects all the selected markers on a map. The markers are displayed in their initial style after. + * @deprecated Use the layer's clearSelection() method instead. + */ + clearMarkerSelection(): void; + /** Deselects all the selected area and markers on a map at once. The areas and markers are displayed in their initial style after. */ + clearSelection(): void; + /** Converts client area coordinates into map coordinates. */ + convertCoordinates(x: number, y: number): Array; + /** Gets all map layers. */ + getLayers(): Array; + /** Gets the layer by its index. */ + getLayerByIndex(index: number): DevExpress.viz.map.MapLayer; + /** Gets the layer by its name. */ + getLayerByName(name: string): DevExpress.viz.map.MapLayer; + /** + * Returns an array with all the map areas. + * @deprecated Use the layer's getElements() method instead. + */ + getAreas(): Array; + /** + * Returns an array with all the map markers. + * @deprecated Use the layer's getElements() method instead. + */ + getMarkers(): Array; + /** Gets the current coordinates of the map viewport. */ + viewport(): Array; + /** Sets the coordinates of the map viewport. */ + viewport(viewportCoordinates: Array): void; + /** Gets the current value of the map zoom factor. */ + zoomFactor(): number; + /** Sets the value of the map zoom factor. */ + zoomFactor(zoomFactor: number): void; + } +} +interface JQuery { + dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; + dxVectorMap(methodName: string, ...params: any[]): any; + dxVectorMap(methodName: "instance"): DevExpress.viz.dxVectorMap; +} +declare module DevExpress.viz.sparklines { + export interface SparklineTooltip extends viz.core.Tooltip { + /** + * Specifies how a tooltip is horizontally aligned relative to the graph. + * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. + */ + horizontalAlignment?: string; + /** + * Specifies how a tooltip is vertically aligned relative to the graph. + * @deprecated Tooltip alignment is no longer useful because the tooltips are aligned automatically. + */ + verticalAlignment?: string; + } + export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions { + /** Configures the tooltip. */ + tooltip?: SparklineTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + } + /** Overridden by descriptions for particular widgets. */ + export class BaseSparkline extends viz.core.BaseWidget { + } + export interface dxBulletOptions extends BaseSparklineOptions { + /** Specifies a color for the bullet bar. */ + color?: string; + /** Specifies an end value for the invisible scale. */ + endScaleValue?: number; + /** Specifies whether or not to show the target line. */ + showTarget?: boolean; + /** Specifies whether or not to show the line indicating zero on the invisible scale. */ + showZeroLevel?: boolean; + /** Specifies a start value for the invisible scale. */ + startScaleValue?: number; + /** Specifies the value indicated by the target line. */ + target?: number; + /** Specifies a color for both the target and zero level lines. */ + targetColor?: string; + /** Specifies the width of the target line. */ + targetWidth?: number; + /** Specifies the primary value indicated by the bullet bar. */ + value?: number; + } + export interface dxSparklineOptions extends BaseSparklineOptions { + /** Specifies the data source field that provides arguments for a sparkline. */ + argumentField?: string; + /** Sets a color for the bars indicating negative values. Available for a sparkline of the bar type only. */ + barNegativeColor?: string; + /** Sets a color for the bars indicating positive values. Available for a sparkline of the bar type only. */ + barPositiveColor?: string; + /** Specifies a data source for the sparkline. */ + dataSource?: any; + /** Sets a color for the boundary of both the first and last points on a sparkline. */ + firstLastColor?: string; + /** Specifies whether a sparkline ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Sets a color for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineColor?: string; + /** Specifies a width for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineWidth?: number; + /** Sets a color for the bars indicating the values that are less than the winloss threshold. Available for a sparkline of the winloss type only. */ + lossColor?: string; + /** Sets a color for the boundary of the maximum point on a sparkline. */ + maxColor?: string; + /** Sets a color for the boundary of the minimum point on a sparkline. */ + minColor?: string; + /** Sets a color for points on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointColor?: string; + /** Specifies the diameter of sparkline points in pixels. Available for the sparklines of line- and area-like types. */ + pointSize?: number; + /** Specifies a symbol to use as a point marker on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointSymbol?: string; + /** Specifies whether or not to indicate both the first and last values on a sparkline. */ + showFirstLast?: boolean; + /** Specifies whether or not to indicate both the minimum and maximum values on a sparkline. */ + showMinMax?: boolean; + /** Determines the type of a sparkline. */ + type?: string; + /** Specifies the data source field that provides values for a sparkline. */ + valueField?: string; + /** Sets a color for the bars indicating the values greater than a winloss threshold. Available for a sparkline of the winloss type only. */ + winColor?: string; + /** Specifies a value that serves as a threshold for the sparkline of the winloss type. */ + winlossThreshold?: number; + /** Specifies the minimum value of the sparkline value axis. */ + minValue?: number; + /** Specifies the maximum value of the sparkline's value axis. */ + maxValue?: number; + } +} +declare module DevExpress.viz { + /** A bullet graph widget. */ + export class dxBullet extends DevExpress.viz.sparklines.BaseSparkline { + constructor(element: JQuery, options?: DevExpress.viz.sparklines.dxBulletOptions); + constructor(element: Element, options?: DevExpress.viz.sparklines.dxBulletOptions); + } + /** A sparkline widget. */ + export class dxSparkline extends DevExpress.viz.sparklines.BaseSparkline { + constructor(element: JQuery, options?: DevExpress.viz.sparklines.dxSparklineOptions); + constructor(element: Element, options?: DevExpress.viz.sparklines.dxSparklineOptions); + } +} +interface JQuery { + dxBullet(options?: DevExpress.viz.sparklines.dxBulletOptions): JQuery; + dxBullet(methodName: string, ...params: any[]): any; + dxBullet(methodName: "instance"): DevExpress.viz.dxBullet; + dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery; + dxSparkline(methodName: string, ...params: any[]): any; + dxSparkline(methodName: "instance"): DevExpress.viz.dxSparkline; +} +declare module DevExpress.viz.treeMap { + export interface dxTreeMapOptions extends viz.core.BaseWidgetOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** Specifies the origin of data for the widget. */ + dataSource?: any; + /** Specifies the name of the data source field that provides nested items for a group. Applies to hierarchical data sources only. */ + childrenField?: string; + /** Specifies the name of the data source field that provides values for tiles. */ + valueField?: string; + /** Specifies the name of the data source field that provides colors for tiles. */ + colorField?: string; + /** Specifies the name of the data source field that provides texts for tile and group labels. */ + labelField?: string; + /** Specifies the name of the data source field that provides IDs for items. Applies to flat data sources only. */ + idField?: string; + /** Specifies the name of the data source field that provides parent IDs for items. Applies to flat data sources only. */ + parentField?: string; + /** Specifies the layout algorithm. */ + layoutAlgorithm?: any; + /** Specifies the direction in which the items will be laid out. */ + layoutDirection?: string; + /** Configures tiles. */ + tile?: { + /** Configures the tile borders. */ + border?: { + /** Specifies the width of the tile borders in pixels. */ + width?: number; + /** Colors the tile borders. */ + color?: string; + }; + /** Specifies a single color for all tiles. */ + color?: string; + /** Specifies the appearance of tiles in the hover state. */ + hoverStyle?: { + /** Configures the appearance of the tile borders in the hover state. */ + border?: { + /** Specifies the width of the tile borders in pixels. Applies to a tile in the hover state. */ + width?: number; + /** Colors the tile borders in the hover state. */ + color?: string; + }; + /** Colors tiles in the hover state. */ + color?: string; + }; + /** Specifies the appearance of tiles in the selected state. */ + selectionStyle?: { + /** Configures the appearance of the tile borders in the selected state. */ + border?: { + /** Specifies the width of the tile borders in pixels. Applies to a tile in the selected state. */ + width?: number; + /** Colors the tile borders in the selected state. */ + color?: string; + }; + /** Colors tiles in the selected state. */ + color?: string; + }; + /** Configures the tile labels. */ + label?: { + /** Changes the visibility of the tile labels. */ + visible?: boolean; + /** Specifies the font settings of the tile labels. */ + font?: viz.core.Font; + }; + }; + /** Configures groups. */ + group?: { + /** Specifies the height of the group headers in pixels. */ + headerHeight?: number; + /** Configures the group borders. */ + border?: { + /** Specifies the width of the group borders in pixels. */ + width?: number; + /** Colors the group borders. */ + color?: string; + }; + /** Colors the group headers. */ + color?: string; + /** Specifies the appearance of groups in the hover state. */ + hoverStyle?: { + /** Configures the appearance of the group borders in the hover state. */ + border?: { + /** Specifies the width of the group borders in pixels. Applies to a group in the hover state. */ + width?: number; + /** Colors the group borders in the hover state. */ + color?: string; + }; + /** Colors the group headers in the hover state. */ + color?: string; + }; + /** Specifies the appearance of groups in the selected state. */ + selectionStyle?: { + /** Configures the appearance of the group borders in the selected state. */ + border?: { + /** Specifies the width of the group borders in pixels. Applies to a group in the selected state. */ + width?: number; + /** Colors the group borders in the selected state. */ + color?: string; + }; + /** Colors the group headers in the selected state. */ + color?: string; + }; + /** Configures the group labels. */ + label?: { + /** Changes the visibility of the group labels. */ + visible?: boolean; + /** Specifies the font settings of the group labels. */ + font?: viz.core.Font; + }; + }; + /** Manages the color settings. */ + colorizer?: { + /** Specifies the colorizing algorithm. */ + type?: string; + /** Sets the palette to be used for colorizing tiles. */ + palette?: any; + /** Specifies whether or not all tiles in a group must be colored uniformly. Applies only if the type option is "discrete". */ + colorizeGroups?: boolean; + /** Allows you to paint tiles with similar values uniformly. Applies only if the type option is "gradient" or "range". */ + range?: Array; + /** Specifies the name of the data source field whose values define the color of a tile. Applies only if the type option is "gradient" or "range". */ + colorCodeField?: string; + }; + /** Specifies whether tiles and groups change their style in the hover state. */ + hoverEnabled?: boolean; + /** Specifies whether a single or multiple nodes can be in the selected state simultaneously. */ + selectionMode?: string; + /** Specifies how many hierarchical levels must be visualized. */ + maxDepth?: number; + /** Specifies whether the user will interact with a single tile or its group. */ + interactWithGroup?: boolean; + tooltip?: viz.core.Tooltip; + /** A handler for the nodesInitialized event. */ + onNodesInitialized?: (e: { + component: dxTreeMap; + element: Element; + root: TreeMapNode + }) => void; + /** A handler for the nodesRendering event. */ + onNodesRendering?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode + }) => void; + /** A handler for the click event. */ + onClick?: any; + /** A handler for the hoverChanged event. */ + onHoverChanged?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode; + }) => void; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode; + }) => void; + /** A handler for the drill event. */ + onDrill?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode + }) => void; + } + /** This section describes fields and methods that can be used in code to manipulate a Node object. */ + export interface TreeMapNode { + /** The level that the current node occupies in the hierarchy of nodes. */ + level: number; + /** The index of the current node in the array of all nodes on the same level. */ + index: number; + /** The object from the data source visualized by the node. */ + data: Object; + /** Returns the parent node of the current node. */ + getParent(): TreeMapNode; + /** Indicates how many direct descendants the current node has. */ + getChildrenCount(): number; + /** Returns all nodes nested in the current node. */ + getAllChildren(): Array; + /** Returns all descendant nodes. */ + getAllNodes(): Array; + /** Gets a specific node from a collection of direct descendants. */ + getChild(index: number): TreeMapNode; + /** Gets the raw value of the node. */ + value(): number; + /** Returns the label of the node. */ + label(): string; + /** Sets the label to the node. */ + label(label: string): void; + /** Customizes the node. */ + customize(options: any): void; + /** Reverts the appearance of the node to the initial state. */ + resetCustomization(): void; + /** Indicates whether the node is in the hover state or not. */ + isHovered(): boolean; + /** Sets the selection state of a node. */ + select(state: boolean): void; + /** Indicates whether the node is selected or not. */ + isSelected(): boolean; + /** Indicates whether the node is visualized by a tile or a group of tiles. */ + isLeaf(): boolean; + /** Indicates whether the current node is active. */ + isActive(): boolean; + /** Shows the tooltip. */ + showTooltip(): void; + /** Drills down into the node. */ + drillDown(): void; + } +} +declare module DevExpress.viz { + /** A widget for displaying hierarchical data by using nested rectangles. */ + export class dxTreeMap extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.treeMap.dxTreeMapOptions); + constructor(element: Element, options?: DevExpress.viz.treeMap.dxTreeMapOptions); + /** Returns the root node. */ + getRootNode(): DevExpress.viz.treeMap.TreeMapNode; + /** Returns the current node. */ + getCurrentNode(): DevExpress.viz.treeMap.TreeMapNode; + /** Deselects all nodes in the widget. */ + clearSelection(): void; + /** Hides the tooltip. */ + hideTooltip(): void; + /** Drills one level up. */ + drillUp(): void; + /** Resets the drill down level. */ + resetDrillDown(): void; + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + } +} +interface JQuery { + dxTreeMap(options?: DevExpress.viz.treeMap.dxTreeMapOptions): JQuery; + dxTreeMap(methodName: string, ...params: any[]): any; + dxTreeMap(methodName: "instance"): DevExpress.viz.dxTreeMap; +} diff --git a/devextreme/devextreme-tests.ts b/devextreme/devextreme-tests.ts index a38aae1f05..8d9bd5bc5b 100644 --- a/devextreme/devextreme-tests.ts +++ b/devextreme/devextreme-tests.ts @@ -258,12 +258,12 @@ namespace Tests.viz { title: 'Long PieChart\'s Title' }; - new DevExpress.viz.charts.dxChart($("chart"), chartOptions); - new DevExpress.viz.charts.dxChart($("#chart").get(0), chartOptions); + new DevExpress.viz.dxChart($("chart"), chartOptions); + new DevExpress.viz.dxChart($("#chart").get(0), chartOptions); $("#chart").dxChart(chartOptions); - new DevExpress.viz.charts.dxPieChart($("#pie-chart"), pieChartOptions); - new DevExpress.viz.charts.dxPieChart($("#pie-chart").get(0), pieChartOptions); + new DevExpress.viz.dxPieChart($("#pie-chart"), pieChartOptions); + new DevExpress.viz.dxPieChart($("#pie-chart").get(0), pieChartOptions); $("#pie-chart").dxPieChart(pieChartOptions); } diff --git a/devextreme/index.d.ts b/devextreme/index.d.ts index bbf6eaad76..6aae49d6cd 100644 --- a/devextreme/index.d.ts +++ b/devextreme/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for DevExtreme 15.2.10 +// Type definitions for DevExtreme 16.1.8 // Project: http://js.devexpress.com/ // Definitions by: DevExpress Inc. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,6 +6,19 @@ /// declare module DevExpress { + /** Formats values. */ + export interface Format { + /** Specifies a predefined format. */ + type?: String; + /** Specifies the currency code for the 'currency' format. */ + currency?: String; + /** Specifies a precision for values of a numeric format. */ + precision?: number; + /** Parses string values into numeric or date-time values. */ + parser?: (value: any) => any; + /** Specifies a custom format. */ + formatter?: (value: any) => any; + } /** A mixin that provides a capability to fire and subscribe to events. */ export interface EventsMixin { /** Subscribes to a specified event. */ @@ -55,25 +68,34 @@ declare module DevExpress { export function resetGroup(): void; /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ export function validateModel(model: Object): ValidationGroupValidationResult; - /** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */ - export function registerModelForValidation(model: Object) : void; + /** Registers all the dxValidator objects extending fields of the specified ViewModel. */ + export function registerModelForValidation(model: Object): void; + /** Unregisters all the dxValidator objects extending fields of the specified ViewModel. */ + export function unregisterModelForValidation(model: Object): void; } export var hardwareBackButton: JQueryCallback; /** Processes the hardware back button click. */ export function processHardwareBackButton(): void; /** Hides the last displayed overlay widget. */ export function hideTopOverlay(): boolean; - /** Specifies whether or not the entire application/site supports right-to-left representation. */ + /** + * Specifies whether or not the entire application/site supports right-to-left representation. + * @deprecated Use the config(config) method instead. + */ export var rtlEnabled: boolean; - /** Registers a new component in the DevExpress.ui namespace as a jQuery plugin, Angular directive and Knockout binding. */ + /** Gets the current global configuration object. */ + export function config(): Object; + /** Sets the global configuration object. */ + export function config(config: Object): void; + /** Registers a new component in the DevExpress.ui namespace as a jQuery plugin, AngularJS directive and Knockout binding. */ export function registerComponent(name: string, componentClass: Object): void; - /** Registers a new component in the specified namespace as a jQuery plugin, Angular directive and Knockout binding. */ + /** Registers a new component in the specified namespace as a jQuery plugin, AngularJS directive and Knockout binding. */ export function registerComponent(name: string, namespace: Object, componentClass: Object): void; export function requestAnimationFrame(callback: Function): number; export function cancelAnimationFrame(requestID: number): void; /** Custom Knockout binding that links an HTML element with a specific action. */ export class Action { } - /** Used to get URLs that vary in a locally running application and the application running on production. */ + /** An object used to manage OData endpoints in your application. */ export class EndpointSelector { constructor(options: { [key: string]: { @@ -81,7 +103,7 @@ declare module DevExpress { production?: string; } }); - /** Returns a local or a productional URL depending on how the application is currently running. */ + /** Returns an endpoint for the specified key. */ urlFor(key: string): string; } /** An object that serves as a namespace for the methods that are used to animate UI elements. */ @@ -96,7 +118,7 @@ declare module DevExpress { staggerDelay?: number; /** A number specifying the time in milliseconds spent on animation. */ duration?: number; - /** A string specifying the type of an easing function used for animation. */ + /** A string specifying the easing function for animation. */ easing?: string; /** Specifies the initial animation state. */ from?: any; @@ -170,7 +192,7 @@ declare module DevExpress { } export class Devices implements EventsMixin { constructor(options: { window: Window }); - /** Overrides actual device information to force the application to operate as if it was running on the specified device. */ + /** Overrides actual device information to force the application to operate as if it was running on a specified device. */ current(deviceName: any): void; /** Returns information about the current device. */ current(): Device; @@ -194,7 +216,7 @@ declare module DevExpress { /** The target element position that the widget is positioned against. */ at?: any; /** The element within which the widget is positioned. */ - boundary?: Object; + boundary?: any; /** Specifies the horizontal and vertical offset from the window's boundaries. */ boundaryOffset?: any; /** Specifies how to move the widget if it overflows the screen. */ @@ -202,7 +224,7 @@ declare module DevExpress { /** The position of the widget to align against the target element. */ my?: any; /** The target element that the widget is positioned against. */ - of?: Object; + of?: any; /** Specifies horizontal and vertical offset in pixels. */ offset?: any; } @@ -217,9 +239,9 @@ declare module DevExpress { /** A base class for all components and widgets. */ export class Component { constructor(options?: ComponentOptions) - /** Prevents the component from refreshing until the endUpdate method is called. */ + /** Prevents the component from refreshing until the endUpdate() method is called. */ beginUpdate(): void; - /** Enables the component to refresh after the beginUpdate method call. */ + /** Enables the component to refresh after the beginUpdate() method call. */ endUpdate(): void; /** Returns an instance of this component class. */ instance(): Component; @@ -460,7 +482,7 @@ declare module DevExpress { isLoading(): boolean; /** Returns the array of items currently operated by the DataSource. */ items(): Array; - /** Returns the key expression. */ + /** Returns the key expression specified by the key configuration option of the underlying Store. */ key(): any; /** Starts loading data. */ load(): OperationPromise>; @@ -585,9 +607,9 @@ declare module DevExpress { }) => void; /** Specifies whether the ODataStore uses the JSONP approach to access non-CORS-compatible remote services. */ jsonp?: boolean; - /** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, and Guid. */ + /** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, Boolean, Single, Decimal and Guid. */ keyType?: any; - /** Specifies whether or not dates found in the response are deserialized. */ + /** Specifies whether or not dates in a response are deserialized. */ deserializeDates?: boolean; /** Specifies the URL of the data service being accessed via the current ODataContext. */ url?: string; @@ -834,6 +856,8 @@ declare module DevExpress { export function currentTheme(platform: string, colorScheme: string): void; /** Registers a new theme based on the existing one. */ export function registerTheme(customTheme: Object, baseTheme: string): void; + /** Allows you to export widgets using their SVG markup. */ + export function exportFromMarkup(markup: string, options: Object): void; /** Applies a predefined or registered custom palette to all visualization widgets at once. */ export function currentPalette(paletteName: string): void; /** Obtains the color sets of a predefined or registered palette. */ @@ -843,13 +867,27 @@ declare module DevExpress { } } declare module DevExpress.ui { + export interface dxValidatorValidationAdapter { + /** A function that returns the value to be validated. */ + getValue?: Function; + /** The jQuery.Callbacks() object that is fired when the specified value should be validated. */ + validationRequestsCallbacks?: JQueryCallback; + /** A function that the Validator widget calls after validating a specified value. */ + applyValidationResults?: (params: validationEngine.ValidatorValidationResult) => void; + /** A function that resets the validated values. */ + reset?: Function; + /** A function that sets focus to the validated editors when the ValidationSummary is focused. */ + focus?: Function; + /** A function that returns a Boolean value specifying whether or not to bypass validation. */ + bypass?: Function; + } export interface dxValidatorOptions extends DOMComponentOptions { /** An array of validation rules to be checked for the editor with which the dxValidator object is associated. */ validationRules?: Array; /** Specifies the editor name to be used in the validation default messages. */ name?: string; - /** An object that specifies what and when to validate and how to apply the validation result. */ - adapter?: Object; + /** An object that specifies what and when to validate, and how to apply the validation result. */ + adapter?: dxValidatorValidationAdapter; /** Specifies the validation group the editor will be related to. */ validationGroup?: string; /** A handler for the validated event. */ @@ -864,7 +902,7 @@ declare module DevExpress.ui { /** Resets the value and validation result of the editor associated with the current dxValidator object. */ reset(): void; } - /** The widget that is used in the Knockout and Angular approaches to combine the editors to be validated. */ + /** The widget that is used in the Knockout and AngularJS approaches to combine the editors to be validated. */ export class dxValidationGroup extends DOMComponent { constructor(element: JQuery); constructor(element: Element); @@ -967,14 +1005,14 @@ declare module DevExpress.ui { /** An object that defines the animation options used when the widget is being hidden. */ hide?: fx.AnimationOptions; }; - /** The time span in milliseconds during which the dxToast widget is visible. */ + /** The time span in milliseconds during which the Toast widget is visible. */ displayTime?: number; height?: any; - /** The dxToast message text. */ + /** The Toast message text. */ message?: string; position?: PositionOptions; shading?: boolean; - /** Specifies the dxToast widget type. */ + /** Specifies the Toast widget type. */ type?: string; width?: any; closeOnBackButton?: boolean; @@ -1061,6 +1099,12 @@ declare module DevExpress.ui { export interface dxTextAreaOptions extends dxTextBoxOptions { /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ spellcheck?: boolean; + /** Specifies the minimum height of the widget. */ + minHeight?: any; + /** Specifies the maximum height of the widget. */ + maxHeight?: any; + /** A Boolean value specifying whether or not the auto resizing mode is enabled. */ + autoResizeEnabled?: boolean; } /** A widget used to display and edit multi-line text. */ export class dxTextArea extends dxTextBox { @@ -1091,9 +1135,9 @@ declare module DevExpress.ui { onTitleRendered?: Function; /** The template to be used for rendering an item title. */ itemTitleTemplate?: any; - /** A Boolean value specifying if the list is scrolled by content. */ + /** A Boolean value specifying if tabs in the title are scrolled by content. */ scrollByContent?: boolean; - /** A Boolean value specifying whether to enable or disable scrolling. */ + /** A Boolean indicating whether or not to add scrolling support for tabs in the title. */ scrollingEnabled?: boolean; /** A Boolean value that specifies the availability of navigation buttons. */ showNavButtons?: boolean; @@ -1111,7 +1155,11 @@ declare module DevExpress.ui { /** The text that is provided as a hint in the select box editor. */ placeholder?: string; /** Specifies whether or not the widget allows an end-user to enter a custom value. */ - fieldEditEnabled?: boolean; + acceptCustomValue?: boolean; + /** Specifies whether or not to display selection controls. */ + showSelectionControls?: boolean; + /** A handler for the customItemCreating event. */ + onCustomItemCreating?: Function; } /** A widget that allows you to select an item in a dropdown list. */ export class dxSelectBox extends dxDropDownList { @@ -1119,10 +1167,23 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxSelectBoxOptions); } export interface dxTagBoxOptions extends dxSelectBoxOptions { - /** Holds the list of selected values. */ values?: Array; - /** A read-only option that holds the last selected value. */ - value?: Object; + /** Specifies the selected items. */ + value?: Array; + /** Gets the currently selected items. */ + selectedItems?: Array; + /** Specifies how the widget applies values. */ + applyValueMode?: string; + /** A Boolean value specifying whether or not to hide selected items. */ + hideSelectedItems?: boolean; + /** A handler for the selectAllValueChanged event. */ + onSelectAllValueChanged?: Function; + /** A Boolean value specifying whether or not the widget is multiline. */ + multiline?: boolean; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** The template to be used for rendering tags. */ + tagTemplate?: any; } /** A widget that allows you to select multiple items from a dropdown list. */ export class dxTagBox extends dxSelectBox { @@ -1223,7 +1284,7 @@ declare module DevExpress.ui { constructor(element: JQuery, options?: dxRadioGroupOptions); constructor(element: Element, options?: dxRadioGroupOptions); } - export interface dxPopupButtonOptions { + export interface dxPopupToolbarItemOptions { /** Specifies whether or not a toolbar item must be displayed disabled. */ disabled?: boolean; /** Specifies html code inserted into the toolbar item element. */ @@ -1246,6 +1307,14 @@ declare module DevExpress.ui { export interface dxPopupOptions extends dxOverlayOptions { /** Specifies whether or not to allow a user to drag the popup window. */ dragEnabled?: boolean; + /** Specifies whether or not an end user can resize the widget. */ + resizeEnabled?: boolean; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; /** A Boolean value specifying whether or not to display the widget in full-screen mode. */ fullScreen?: boolean; position?: PositionOptions; @@ -1257,7 +1326,7 @@ declare module DevExpress.ui { titleTemplate?: any; width?: any; /** Specifies items displayed on the top or bottom toolbar of the popup window. */ - buttons?: Array; + toolbarItems?: Array; /** Specifies whether or not the widget displays the Close button. */ showCloseButton?: boolean; /** A handler for the titleRendered event. */ @@ -1269,7 +1338,7 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxPopupOptions); } export interface dxPopoverOptions extends dxPopupOptions { - /** An object that defines the animation options of the widget. */ + /** An object defining the animation options of the widget. */ animation?: { /** An object that defines the animation options used when the widget is being shown. */ show?: fx.AnimationOptions; @@ -1296,7 +1365,7 @@ declare module DevExpress.ui { show(target?: any): JQueryPromise; } export interface dxOverlayOptions extends WidgetOptions { - /** An object that defines the animation options of the widget. */ + /** An object defining the animation options of the widget. */ animation?: { /** An object that defines the animation options used when the widget is being shown. */ show?: fx.AnimationOptions; @@ -1313,8 +1382,6 @@ declare module DevExpress.ui { deferRendering?: boolean; /** Specifies whether or not an end-user can drag the widget. */ dragEnabled?: boolean; - /** Specifies whether or not an end user can resize the widget. */ - resizeEnabled?: boolean; /** The height of the widget in pixels. */ height?: any; /** Specifies the maximum height the widget can reach while resizing. */ @@ -1327,12 +1394,6 @@ declare module DevExpress.ui { minWidth?: any; /** A handler for the hidden event. */ onHidden?: Function; - /** A handler for the resizeStart event. */ - onResizeStart?: Function; - /** A handler for the resize event. */ - onResize?: Function; - /** A handler for the resizeEnd event. */ - onResizeEnd?: Function; /** A handler for the hiding event. */ onHiding?: Function; /** An object defining widget positioning options. */ @@ -1382,6 +1443,8 @@ declare module DevExpress.ui { value?: number; /** The "mode" attribute value of the actual HTML input element representing the widget. */ mode?: string; + /** Specifies the text of the message displayed if the specified value is not a number. */ + invalidValueMessage?: string; } /** A textbox widget that enables a user to enter numeric values. */ export class dxNumberBox extends dxTextEditor { @@ -1413,15 +1476,43 @@ declare module DevExpress.ui { constructor(element: JQuery, options?: dxMultiViewOptions); constructor(element: Element, options?: dxMultiViewOptions); } + export interface dxMapLocation { + /** The latitude location of the widget. */ + lat?: number; + /** The longitude location of the widget. */ + lng?: number; + } + export interface dxMapMarker { + /** A URL pointing to the custom icon to be used for the marker. */ + iconSrc?: string; + /** Specifies the marker location. */ + location?: dxMapLocation; + /** A callback function performed when the marker is clicked. */ + onClick?: Function; + /** A tooltip to be used for the marker. */ + tooltip?: { + /** Specifies whether a tooltip is visible by default or not. */ + isShown?: boolean; + /** Specifies the tooltip text. */ + text?: string; + } + } + export interface dxMapRoute { + /** Specifies the color of the line displaying the route. */ + color?: string; + /** Specifies a transportation mode to be used in the displayed route. */ + mode?: string; + /** Specifies the opacity of the line displaying the route. */ + opacity?: number; + /** Contains an array of objects making up the route. */ + locations?: Array; + /** Specifies the thickness of the line displaying the route in pixels. */ + weight?: number; + } export interface dxMapOptions extends WidgetOptions { /** Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route, or when creating a widget if it initially contains markers or routes. */ autoAdjust?: boolean; - center?: { - /** The latitude location displayed in the center of the widget. */ - lat?: number; - /** The longitude location displayed in the center of the widget. */ - lng?: number; - }; + center?: dxMapLocation; /** A handler for the click event. */ onClick?: any; /** Specifies whether or not map widget controls are available. */ @@ -1444,7 +1535,7 @@ declare module DevExpress.ui { /** A handler for the markerRemoved event. */ onMarkerRemoved?: Function; /** An array of markers displayed on a map. */ - markers?: Array; + markers?: Array; /** The name of the current map data provider. */ provider?: string; /** A handler for the ready event. */ @@ -1454,7 +1545,7 @@ declare module DevExpress.ui { /** A handler for the routeRemoved event. */ onRouteRemoved?: Function; /** An array of routes shown on the map. */ - routes?: Array; + routes?: Array; /** The type of a map to display. */ type?: string; /** Specifies the width of the widget. */ @@ -1548,7 +1639,7 @@ declare module DevExpress.ui { titleTemplate?: any; /** Specifies whether or not the widget uses native scrolling. */ useNativeScrolling?: boolean; - /** Specifies whether or not to show lookup contents in a dxPopover widget. */ + /** Specifies whether or not to show lookup contents in a Popover widget. */ usePopover?: boolean; /** A handler for the valueChanged event. */ onValueChanged?: Function; @@ -1581,6 +1672,8 @@ declare module DevExpress.ui { showPane?: boolean; /** The width of the widget. */ width?: number; + /** Specifies whether or not the widget can be focused. */ + focusStateEnabled?: boolean; } /** A widget used to indicate whether or not an element is loading. */ export class dxLoadPanel extends dxOverlay { @@ -1596,11 +1689,10 @@ declare module DevExpress.ui { constructor(element: JQuery, options?: dxLoadIndicatorOptions); constructor(element: Element, options?: dxLoadIndicatorOptions); } - /** An object containing items for a context menu called for a list item. */ export interface ListOptionsMenuItem { /** Specifies the menu item text. */ text?: string; - /** Specifies the function called when the menu item is clicked. */ + /** Holds on a function called when the item is clicked. */ action?: (itemElement: Element, itemData: any) => void; } export interface dxListOptions extends CollectionWidgetOptions { @@ -1660,7 +1752,8 @@ declare module DevExpress.ui { /** Specifies item selection mode. */ selectionMode?: string; selectAllText?: string; - onSelectAllChanged?: Function; + /** A handler for the selectAllValueChanged event. */ + onSelectAllValueChanged?: Function; /** Specifies the array of items for a context menu called for a list item. */ menuItems?: Array; /** Specifies whether an item context menu is shown when a user holds or swipes an item. */ @@ -1768,8 +1861,9 @@ declare module DevExpress.ui { onOpened?: Function; /** Specifies whether or not the drop-down editor is displayed. */ opened?: boolean; - /** Specifies whether or not the widget allows an end-user to enter a custom value. */ fieldEditEnabled?: boolean; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + acceptCustomValue?: boolean; /** Specifies the way an end-user applies the selected value. */ applyValueMode?: string; /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ @@ -1792,10 +1886,12 @@ declare module DevExpress.ui { content(): JQuery; } export interface dxDateBoxOptions extends dxTextEditorOptions { - /** A format used to display date/time information. */ + formatString?: any; + /** Specifies the date display format. Applies only if the pickerType option is 'native' */ + displayFormat?: any; format?: string; - /** A Globalize format string specifying the date display format. */ - formatString?: string; + /** A format used to display date/time information. */ + type?: string; /** The last date that can be selected within the widget. */ max?: any; /** The minimum date that can be selected within the widget. */ @@ -1820,7 +1916,7 @@ declare module DevExpress.ui { maxZoomLevel?: string; /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ minZoomLevel?: string; - /** Specifies the type of date/time picker. */ + /** Specifies the type of the date/time picker. */ pickerType?: string; /** Specifies the message displayed if the typed value is not a valid date or time. */ invalidDateMessage?: string; @@ -1828,6 +1924,8 @@ declare module DevExpress.ui { dateOutOfRangeMessage?: string; /** The text displayed on the Apply button. */ applyButtonText?: string; + /** Specifies whether or not adaptive widget rendering is enabled on a small screen. */ + adaptivityEnabled?: boolean; /** The text displayed on the Cancel button. */ cancelButtonText?: string; } @@ -1884,7 +1982,7 @@ declare module DevExpress.ui { /** Specifies the icon to be displayed on the button. */ icon?: string; iconSrc?: string; - /** A template to be used for rendering the dxButton widget. */ + /** A template to be used for rendering the Button widget. */ template?: any; /** The text displayed on the button. */ text?: string; @@ -1954,12 +2052,10 @@ declare module DevExpress.ui { collapsible?: boolean; /** Specifies whether the widget can expand several items or only a single item at once. */ multiple?: boolean; - /** The template to be used for rendering dxAccordion items. */ + /** The template to be used for rendering Accordion items. */ itemTemplate?: any; /** A handler for the itemTitleClick event. */ onItemTitleClick?: any; - /** A handler for the itemTitleHold event. */ - onItemTitleHold?: Function; /** The template to be used for rendering an item title. */ itemTitleTemplate?: any; /** The index number of the currently selected item. */ @@ -1980,8 +2076,7 @@ declare module DevExpress.ui { } export interface dxFileUploaderOptions extends EditorOptions { /** A read-only option that holds a File instance representing the selected file. */ - value?: File; - /** Holds the File instances representing files selected in the widget. */ + value?: Array; values?: Array; buttonText?: string; /** The text displayed on the button that opens the file browser. */ @@ -2012,12 +2107,20 @@ declare module DevExpress.ui { uploadFailedMessage?: string; /** Specifies how the widget uploads files. */ uploadMode?: string; + /** Specifies the method for the upload request. */ + uploadMethod?: string; + /** Specifies headers for the upload request. */ + uploadHeaders?: Object; + /** A handler for the uploadStarted event. */ + onUploadStarted?: Function; /** A handler for the uploaded event. */ onUploaded?: Function; /** A handler for the uploaded event. */ onProgress?: Function; /** A handler for the uploadError event. */ onUploadError?: Function; + /** A handler for the uploadAborted event. */ + onUploadAborted?: Function; /** A handler for the valueChanged event. */ onValueChanged?: Function; } @@ -2147,13 +2250,26 @@ declare module DevExpress.ui { /** An array of validation rules to be checked for the form item editor. */ validationRules?: Array; } + /** Specifies dependency between the screen factor and the count of columns. */ + export interface ColCountResponsible { + /** The count of columns for an extra small-sized screen. */ + xs?: number; + /** The count of columns for a small-sized screen. */ + sm?: number; + /** The count of columns for a middle-sized screen. */ + md?: number; + /** The count of columns for a large screen size. */ + lg?: number; + } export interface dxFormGroupItem extends dxFormItem { /** Specifies the group caption. */ caption?: string; - /** A template to be used for rendering the group item. */ + /** A template to be used for rendering a group item. */ template?: any; /** The count of columns in the group layout. */ colCount?: number; + /** Specifies dependency between the screen factor and the count of columns in the tab layout. */ + colCountByScreen?: ColCountResponsible; /** Specifies whether or not all group item labels are aligned. */ alignItemLabels?: boolean; /** Holds an array of form items displayed within the group. */ @@ -2164,6 +2280,8 @@ declare module DevExpress.ui { title?: string; /** The count of columns in the tab layout. */ colCount?: number; + /** Specifies dependency between the screen factor and the count of columns in the group layout. */ + colCountByScreen?: ColCountResponsible; /** Specifies whether or not labels of items displayed within the current tab are aligned. */ alignItemLabels?: boolean; /** Holds an array of form items displayed within the tab. */ @@ -2180,7 +2298,7 @@ declare module DevExpress.ui { template?: any; } export interface dxFormTabbedItem extends dxFormItem { - /** Holds a configuration object for the dxTabPanel widget used to display the current form item. */ + /** Holds a configuration object for the TabPanel widget used to display the current form item. */ tabPanelOptions?: Object; /** An array of tab configuration objects. */ tabs?: Array; @@ -2190,6 +2308,10 @@ declare module DevExpress.ui { formData?: Object; /** The count of columns in the form layout. */ colCount?: any; + /** Specifies dependency between the screen factor and the count of columns in the form layout. */ + colCountByScreen?: ColCountResponsible; + /** Specifies the function returning the screen factor depending on the screen width. */ + screenByWidth?: (width: number) => string; /** Specifies the location of a label against the editor. */ labelLocation?: string; /** Specifies whether or not all editors on the form are read-only. */ @@ -2238,7 +2360,9 @@ declare module DevExpress.ui { itemOption(field: string, option: string, value: any): void; /** Updates the values of form item options. */ itemOption(field: string, options: Object): void; - /** Returns an editor instance associated with the specified formData field. */ + /** Gets the value of the form item option. */ + itemOption(field: string): any; + /** Returns an editor instance associated with the specified formData field or name of the form item. */ getEditor(field: string): Object; /** Updates the dimensions of the widget contents. */ updateDimensions(): JQueryPromise; @@ -2247,6 +2371,25 @@ declare module DevExpress.ui { /** Resets the editor's value to undefined. */ resetValues(): void; } + export interface dxDeferRenderingOptions extends WidgetOptions { + /** Indicates if a load indicator should be shown until the widget's content is rendered. */ + showLoadIndicator?: boolean; + /** Specifies the jQuery.Promise or boolean value, which when resolved, forces widget content to render. */ + renderWhen?: any; + /** Specifies the animation to be used to show the rendered content. */ + animation?: fx.AnimationOptions; + /** Specifies a jQuery selector of items that should be rendered using a staggered animation. */ + staggerItemSelector?: string; + /** Specifies a callback function that is called when the widget's content has finished rendering but is not yet shown. */ + onRendered?: Function; + /** Specifies a callback function that is called when widget content is shown and animation has completed. */ + onShown?: Function; + } + /** A container for elements that must be rendered at a specified moment. */ + export class dxDeferRendering extends Widget { + constructor(element: JQuery, options?: dxDeferRenderingOptions); + constructor(element: Element, options?: dxDeferRenderingOptions); + } } interface JQuery { dxProgressBar(): JQuery; @@ -2619,7 +2762,7 @@ declare module DevExpress.ui { items?: Array; /** The template to be used for rendering items. */ itemTemplate?: any; - /** Specifies whether or not to show the drop down menu within a dxPopover widget. */ + /** Specifies whether or not to show the drop down menu within a Popover widget. */ usePopover?: boolean; /** The width of the menu popup in pixels. */ popupWidth?: any; @@ -2652,9 +2795,9 @@ declare module DevExpress.ui { target?: any; /** The title of the action sheet. */ title?: string; - /** Specifies whether or not to show the action sheet within a dxPopover widget. */ + /** Specifies whether or not to show the action sheet within a Popover widget. */ usePopover?: boolean; - /** A Boolean value specifying whether or not the dxActionSheet widget is visible. */ + /** A Boolean value specifying whether or not the ActionSheet widget is visible. */ visible?: boolean; } /** A widget consisting of a set of choices related to a certain task. */ @@ -2727,7 +2870,7 @@ declare module DevExpress.data { visible?: boolean; /** Name of the data source field containing data for the pivot grid field. */ dataField?: string; - /** A caption that will be displayed in the pivot grid's field chooser to identify the field. */ + /** A caption that will be displayed in the pivot grid's field chooser and field panel to identify the field. */ caption?: string; /** Specifies a type of field values. */ dataType?: string; @@ -2769,11 +2912,16 @@ declare module DevExpress.data { expanded?: boolean; /** Specifies whether the field should be treated as a Data Field. */ isMeasure?: boolean; + /** Specifies whether or not long text in header items should be wrapped. */ + wordWrapEnabled?: boolean; /** Specifies a display format for field values. */ - format?: string; + format?: any; /** Specifies a callback function that returns the text to be displayed in the cells of a field. */ customizeText?: (cellInfo: { value: any; valueText: string }) => string; - /** Specifies a precision for formatted field values. */ + /** + * Specifies a precision for formatted field values. + * @deprecated Use the format | precision option instead. + */ precision?: number; /** Specifies how to sort the header items. */ sortingMethod?: (a: Object, b: Object) => number; @@ -2803,7 +2951,7 @@ declare module DevExpress.data { export class SummaryCell { /** Gets the parent cell in a specified direction. */ parent(direction: string): SummaryCell; - /** Gets all children cells in a specified direction. */ + /** Gets all child cells in a specified direction. */ children(direction: string): Array; /** Gets a partial Grand Total cell of a row or column. */ grandTotal(direction: string): SummaryCell; @@ -2821,7 +2969,7 @@ declare module DevExpress.data { child(direction: string, fieldValue: any): SummaryCell; /** Gets the cell located by the path of the source cell with one field value changed. */ slice(field: PivotGridField, value: any): SummaryCell; - /** Gets the header cell of a row or column field to which the current cell belongs. */ + /** Gets the row or column field to which the current cell belongs. */ field(area: string): PivotGridField; /** Gets the value of the current cell. */ value(): any; @@ -2850,9 +2998,9 @@ declare module DevExpress.data { /** A handler for the fieldsPrepared event. */ onFieldsPrepared?: (e?: Array) => void; } - /** An object that provides access to data for the dxPivotGrid widget. */ + /** An object that provides access to data for the PivotGrid widget. */ export class PivotGridDataSource implements EventsMixin { - constructor(options?: PivotGridDataSource); + constructor(options?: PivotGridDataSourceOptions); /** Starts reloading data from any store and updating the data source. */ reload(): JQueryPromise; /** Starts updating the data source. Reloads data from the XMLA store only. */ @@ -2965,8 +3113,13 @@ declare module DevExpress.ui { displayExpr?: any; /** Specifies the resource object field that is used as a value of the Resource editor in the Appointment popup window. */ valueExpr?: any; - /** The name of the appointment object field that specifies a resource of this kind. */ + /** + * The name of the appointment object field that specifies a resource of this kind. + * @deprecated Use the fieldExpr option instead. + */ field?: string; + /** The name of the appointment object field that specifies a resource of this kind. */ + fieldExpr?: string; /** Specifies the label of the Appointment popup window field that allows end users to assign a resource of this kind. */ label?: string; }>; @@ -2992,8 +3145,11 @@ declare module DevExpress.ui { onCellClick?: any; /** A handler for the appointmentFormCreated event. */ onAppointmentFormCreated?: Function; - /** Specifies whether or not an end-user can scroll the view horizontally. */ + /** A handler for the contentReady event. */ + onContentReady?: Function; horizontalScrollingEnabled?: boolean; + /** Specifies whether or not an end-user can scroll the view in both directions at the same time. */ + crossScrollingEnabled?: boolean; /** Specifies whether a user can switch views using tabs or a drop-down menu. */ useDropDownViewSwitcher?: boolean; /** Specifies the name of the data source item field that defines the start of an appointment. */ @@ -3010,8 +3166,16 @@ declare module DevExpress.ui { recurrenceRuleExpr?: string; /** Specifies the name of the data source item field that defines exceptions for the current recurring appointment. */ recurrenceExceptionExpr?: string; + /** Specifies the name of the data source item field that defines the timezone of the appointment start date. */ + startDateTimeZoneExpr?: string; + /** Specifies the name of the data source item field that defines the timezone of the appointment end date. */ + endDateTimeZoneExpr?: string; /** Specifies whether filtering is performed on the server or client side. */ remoteFiltering?: boolean; + /** Specifies the timezone of the widget. */ + timeZone?: string; + /** The text or HTML markup displayed by the widget if the item collection is empty. Available for the Agenda view only. */ + noDataText?: string; } /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ export class dxScheduler extends Widget { @@ -3027,6 +3191,10 @@ declare module DevExpress.ui { scrollToTime(hours: number, minutes: number, date: Date): void; /** Displayes the Appointment Details popup. */ showAppointmentPopup(appointmentData: Object, createNewAppointment?: boolean, currentAppointmentData?: Object): void; + /** Returns the start date of the current view. */ + getStartViewDate(): Date; + /** Returns the end date of the current view. */ + getEndViewDate(): Date; } export interface dxColorBoxOptions extends dxDropDownEditorOptions { /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ @@ -3055,10 +3223,6 @@ declare module DevExpress.ui { itemsExpr?: any; /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is disabled. */ disabledExpr?: any; - /** Specifies the name of the data source item field that holds the key of the parent item. */ - parentIdExpr?: any; - /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is expanded. */ - expandedExpr?: any; hoverStateEnabled?: boolean; focusStateEnabled?: boolean; } @@ -3078,6 +3242,8 @@ declare module DevExpress.ui { showCheckBoxes?: boolean; /** Specifies the current check boxes display mode. */ showCheckBoxesMode?: string; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget item is displayed expanded. */ + expandedExpr?: any; /** Specifies whether or not to select nodes recursively. */ selectNodesRecursive?: boolean; /** Specifies whether or not all parent nodes of an initially expanded node are displayed expanded. */ @@ -3087,20 +3253,26 @@ declare module DevExpress.ui { * @deprecated Use the showCheckBoxesMode options instead. */ selectAllEnabled?: boolean; + /** Specifies whether or not an item becomes selected if a user clicks it. */ + selectByClick?: boolean; + /** Specifies item selection mode. */ + selectionMode?: string; /** Specifies the text displayed at the "Select All" check box. */ selectAllText?: string; /** Specifies the name of the data source item field whose value defines whether or not the corresponding node includes child nodes. */ hasItemsExpr?: any; + /** Specifies the name of the data source item field for holding the parent key of the corresponding node. */ + parentIdExpr?: any; /** Specifies if the virtual mode is enabled. */ virtualModeEnabled?: boolean; /** Specifies the parent ID value of the root item. */ - rootValue?: any; + rootValue?: Object; /** Specifies the current value used to filter tree view items. */ searchValue?: string; /** A string value specifying available scrolling directions. */ scrollDirection?: string; - /** A handler for the itemSelected event. */ - onItemSelected?: Function; + /** A handler for the itemSelectionChanged event. */ + onItemSelectionChanged?: Function; /** A handler for the itemExpanded event. */ onItemExpanded?: Function; /** A handler for the itemCollapsed event. */ @@ -3145,8 +3317,13 @@ declare module DevExpress.ui { cssClass?: string; /** Holds an array of menu items. */ items?: Array; - /** Specifies whether or not an item becomes selected if an end-user clicks it. */ - selectionByClick?: boolean; + /** + * Specifies whether or not an item becomes selected if an end-user clicks it. + * @deprecated Use the selectByClick option instead. + */ + selectionByClick?: boolean; + /** Specifies whether or not an item becomes selected if a user clicks it. */ + selectByClick?: boolean; /** Specifies the selection mode supported by the menu. */ selectionMode?: string; /** Specifies options of submenu showing and hiding. */ @@ -3191,6 +3368,8 @@ declare module DevExpress.ui { submenuDirection?: string; /** A handler for the submenuHidden event. */ onSubmenuHidden?: Function; + /** Specifies whether or not adaptive widget rendering is enabled on a small screen. */ + adaptivityEnabled?: boolean; /** A handler for the submenuHiding event. */ onSubmenuHiding?: Function; /** A handler for the submenuShowing event. */ @@ -3206,7 +3385,7 @@ declare module DevExpress.ui { export interface dxContextMenuOptions extends dxMenuBaseOptions { /** Holds an object that specifies options of alternative menu invocation. */ alternativeInvocationMode?: { - /** Specifies whether or not the standard context menu invocation (on a right mouse click or on a long tap) is disabled. */ + /** Specifies whether or not an alternative invocation mode is enabled. */ enabled?: Boolean; /** Specifies the element used to invoke the context menu. */ invokingElement?: any; @@ -3254,14 +3433,14 @@ declare module DevExpress.ui { summary?: boolean; } export interface dxDataGridRow { - /** The data object represented by the row. */ data: Object; - /** The key of the data object represented by the row. */ key: any; - /** The visible index of the row. */ rowIndex: number; - /** The type of the row. */ rowType: string; + groupIndex: number; + isExpanded: boolean; + isSelected: boolean; + values: Array; } export interface dxDataGridColumn { /** Specifies the content alignment within column cells. */ @@ -3276,7 +3455,7 @@ declare module DevExpress.ui { allowFixing?: boolean; /** Specifies if a column can be used for searching grid records. Setting this option makes sense only when the search panel is visible. */ allowSearch?: boolean; - /** Specifies whether a column can be used for grouping grid records at runtime. Setting this option makes sense only when the group panel is visible. */ + /** Specifies whether the user can group data by values of this column. Applies only when grouping is enabled. */ allowGrouping?: boolean; /** Specifies whether or not a column can be hidden by a user. Setting this option makes sense only when the column chooser is visible. */ allowHiding?: boolean; @@ -3307,7 +3486,7 @@ declare module DevExpress.ui { /** Specifies a field name or a function that returns a field name or a value to be used for sorting column cells. */ calculateSortValue?: any; /** Specifies a callback function that returns the text to be displayed in the cells of a column. */ - customizeText?: (cellInfo: { value: any; valueText: string }) => string; + customizeText?: (cellInfo: { value: any; valueText: string; target: string; groupInterval: any }) => string; /** Specifies the field of a data source that provides data for a column. */ dataField?: string; /** Specifies the required type of column values. */ @@ -3330,10 +3509,12 @@ declare module DevExpress.ui { filterType?: string; /** Indicates whether the column takes part in horizontal grid scrolling or is anchored to a grid edge. */ fixed?: boolean; + /** Specifies the order according to which grid columns must be concealed when the widget adapts to the screen or container size. */ + hidingPriority?: number; /** Specifies the grid edge to which the column is anchored. */ fixedPosition?: string; /** Specifies a format for the values displayed in a column. */ - format?: string; + format?: any; /** Specifies a custom template for the group cell of a grid column. */ groupCellTemplate?: any; /** Specifies the index of a column when grid records are grouped by the values of this column. */ @@ -3358,9 +3539,12 @@ declare module DevExpress.ui { /** Specifies how header filter values should be combined into groups. */ groupInterval?: any; }; - /** Specifies a precision for formatted values displayed in a column. */ + /** + * Specifies a precision for formatted values displayed in a column. + * @deprecated Use the format | precision option instead. + */ precision?: number; - /** Specifies a filter operation applied to a column. */ + /** Specifies the default filter operation of a column. */ selectedFilterOperation?: string; /** Specifies whether or not the column displays its values by using editors. */ showEditorAlways?: boolean; @@ -3386,6 +3570,12 @@ declare module DevExpress.ui { name?: string; /** The form item configuration object. Used only when the editing mode is "form". */ formItem?: DevExpress.ui.dxFormItem; + /** An array of grid columns. */ + columns?: Array; + /** Specifies the band column that owns the current column. Accepts the index of the band column in the columns array. */ + ownerBand?: number; + /** Specifies whether the column bands other columns or not. */ + isBand?: boolean; } export interface dxDataGridOptions extends WidgetOptions { /** Specifies whether the outer borders of the grid are visible or not. */ @@ -3412,6 +3602,8 @@ declare module DevExpress.ui { onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: any }) => void; /** Enables a hint that appears when a user hovers the mouse pointer over a cell with truncated content. */ cellHintEnabled?: boolean; + /** Specifies whether or not the widget should hide columns in order to adapt to the screen or container size. */ + columnHidingEnabled?: boolean; /** Specifies whether or not grid columns can be reordered by a user. */ allowColumnReordering?: boolean; /** Specifies whether or not grid columns can be resized by a user. */ @@ -3422,6 +3614,8 @@ declare module DevExpress.ui { onCellHoverChanged?: (e: Object) => void; /** A handler for the cellPrepared event. */ onCellPrepared?: (e: Object) => void; + /** A handler for the adaptiveDetailRowPreparing event. */ + onAdaptiveDetailRowPreparing?: (e: Object) => void; /** Specifies whether or not the width of grid columns depends on column content. */ columnAutoWidth?: boolean; /** Specifies the options of a column chooser. */ @@ -3430,6 +3624,8 @@ declare module DevExpress.ui { emptyPanelText?: string; /** Specifies whether a user can invoke the column chooser or not. */ enabled?: boolean; + /** Specifies how the end-user chooses columns. */ + mode?: string; /** Specifies the height of the column chooser panel. */ height?: number; /** Specifies text displayed in the title of the column chooser panel. */ @@ -3476,6 +3672,8 @@ declare module DevExpress.ui { onContentReady?: Function; /** Specifies a function that customizes grid columns after they are created. */ customizeColumns?: (columns: Array) => void; + /** Customizes grid columns and data before exporting. */ + customizeExportData?: (columns: Array, rows: Array) => void; /** Specifies a data source for the grid. */ dataSource?: any; /** Specifies whether or not to enable data caching. */ @@ -3509,17 +3707,20 @@ declare module DevExpress.ui { form?: DevExpress.ui.dxFormOptions; /** Contains options that specify texts for editing-related grid controls. */ texts?: { - /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Save" button. Setting this option makes sense only when the editMode option is set to batch. */ + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Save" button. Setting this option makes sense only when the mode option is set to batch. */ saveAllChanges?: string; /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ cancelRowChanges?: string; - /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Revert" button. Setting this option makes sense only when the editMode option is set to batch. */ + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Revert" button. Setting this option makes sense only when the mode option is set to batch. */ cancelAllChanges?: string; /** Specifies a message to be displayed by a confirmation window. Setting this option makes sense only when the edit mode is "row". */ confirmDeleteMessage?: string; /** Specifies text to be displayed in the title of a confirmation window. Setting this option makes sense only when the edit mode is "row". */ confirmDeleteTitle?: string; - /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Cancel changes" button. Setting this option makes sense only when the editMode option is set to cell and the validation capabilities are enabled. */ + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Cancel changes" button. Setting this option makes sense only when the mode option is set to cell and the validation capabilities are enabled. +#####See Also##### +- Validation Engine +- Validation Engine - MVVM Approach */ validationCancelChanges?: string; /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the allowDeleting option is set to true. */ deleteRow?: string; @@ -3565,30 +3766,45 @@ declare module DevExpress.ui { /** Specifies whether the filter row is visible or not. */ visible?: boolean; }; - /** Specifies the behavior of grouped grid records. */ + /** Specifies grouping settings and the behavior of grouped grid records. */ grouping?: { /** Specifies whether the user can collapse grouped records in a grid or not. */ allowCollapsing?: boolean; /** Specifies whether groups appear expanded or not. */ autoExpandAll?: boolean; - /** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */ - groupContinuedMessage?: string; - /** Specifies the message displayed in a group row when the corresponding group continues on the next page. */ + /** Enables the user to group data using the context menu. */ + contextMenuEnabled?: boolean; + /** Specifies the event on which a group will be expanded/collapsed. */ + expandMode?: string; + groupContinuedMessage?: string; groupContinuesMessage?: string; + /** Defines the texts of grouping-related visual elements. */ + texts?: { + /** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */ + groupContinuedMessage?: string; + /** Specifies the message displayed in a group row when the corresponding group continues on the next page. */ + groupContinuesMessage?: string; + /** Specifies the text of the context menu item that groups data by a specific column. */ + groupByThisColumn?: string; + /** Specifies the text of the context menu item that clears grouping settings of a specific column. */ + ungroup?: string; + /** Specifies the text of the context menu item that clears grouping settings of all columns. */ + ungroupAll?: string; + } }; - /** Specifies options that configure the group panel. */ + /** Configures the group panel. */ groupPanel?: { /** Specifies whether columns can be dragged onto or from the group panel. */ allowColumnDragging?: boolean; /** Specifies text displayed by the group panel when it does not contain any columns. */ emptyPanelText?: string; /** Specifies whether the group panel is visible or not. */ - visible?: boolean; + visible?: any; }; /** Specifies options configuring the load panel. */ loadPanel?: { /** Specifies whether to show the load panel or not. */ - enabled?: boolean; + enabled?: any; /** Specifies the height of the load panel in pixels. */ height?: number; /** Specifies a URL pointing to an image to be used as a loading indicator. */ @@ -3621,7 +3837,7 @@ declare module DevExpress.ui { }; /** Specifies paging options. */ paging?: { - /** Specifies whether dxDataGrid loads data page by page or all at once. */ + /** Specifies whether DataGrid loads data page by page or all at once. */ enabled?: boolean; /** Specifies the grid page that should be displayed by default. */ pageIndex?: number; @@ -3661,6 +3877,8 @@ declare module DevExpress.ui { placeholder?: string; /** Specifies whether the search panel is visible or not. */ visible?: boolean; + /** Specifies whether to search all columns or only visible ones. */ + searchVisibleColumnsOnly?: boolean; /** Specifies the width of the search panel in pixels. */ width?: number; /** Sets a search string for the search panel. */ @@ -3686,9 +3904,9 @@ declare module DevExpress.ui { /** Specifies the template for detail sections. */ template?: any; }; - /** Specifies options for exporting grid data. */ + /** Configures client-side export. */ export?: { - /** Indicates if the export feature is enabled in the grid. */ + /** Enables the client-side export feature. */ enabled?: boolean; /** Specifies a default name for the file to which grid data is exported. */ fileName?: string; @@ -3696,20 +3914,21 @@ declare module DevExpress.ui { excelFilterEnabled?: boolean; /** Specifies whether to enable word wrapping for the exported data in the resulting XLSX file. */ excelWrapTextEnabled?: boolean; - /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE9 and Safari browsers. */ proxyUrl?: string; - /** Indicates whether to allow end users to export not only the data displayed in the grid, but the selected rows only. */ + /** Allows an end user to export selected rows only. */ allowExportSelectedData?: boolean; /** Contains options that specify texts for the export-related commands and hints. */ texts?: { - /** Specifies text for the Export button when this button invokes a dropdown menu so you can choose the required export format. */ + /** Specifies the hint of the Export button when the allowExportSelectedData option is true. */ exportTo?: string; - /** Specifies text for the Export button's hint when this button exports to the XSLX format without invoking the drop-down menu. */ exportToExcel?: string; - /** Specifies text for the item in the Export dropdown menu that exports grid data to Excel. */ excelFormat?: string; - /** Specifies text for the option in the Export dropdown menu that allows you to choose whether to export all the grid data or the selected rows only. */ selectedRows?: string; + /** Specifies the text of the command that exports all data. */ + exportAll?: string; + /** Specifies the text of the drop-down menu command that exports selected rows. */ + exportSelectedRows?: string; } }; /** Specifies the keys of the records that must appear selected initially. */ @@ -3824,7 +4043,10 @@ declare module DevExpress.ui { }) => string; /** Specifies a pattern for the summary item text. */ displayFormat?: string; - /** Specifies a precision for the summary item value of a numeric format. */ + /** + * Specifies a precision for the summary item value of a numeric format. + * @deprecated Use the valueFormat | precision option instead. + */ precision?: number; /** Specifies whether or not a summary item must be displayed in the group footer. */ showInGroupFooter?: boolean; @@ -3835,7 +4057,7 @@ declare module DevExpress.ui { /** Specifies how to aggregate data for a summary item. */ summaryType?: string; /** Specifies a format for the summary item value. */ - valueFormat?: string; + valueFormat?: any; /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ skipEmptyValues?: boolean; }>; @@ -3856,14 +4078,17 @@ declare module DevExpress.ui { }) => string; /** Specifies a pattern for the summary item text. */ displayFormat?: string; - /** Specifies a precision for the summary item value of a numeric format. */ + /** + * Specifies a precision for the summary item value of a numeric format. + * @deprecated Use the valueFormat | precision option instead. + */ precision?: number; /** Specifies the column that must hold the summary item. */ showInColumn?: string; /** Specifies how to aggregate data for a summary item. */ summaryType?: string; /** Specifies a format for the summary item value. */ - valueFormat?: string; + valueFormat?: any; /** Specifies whether or not to skip empty strings, null and undefined values when calculating a summary. */ skipEmptyValues?: boolean; }>; @@ -3953,6 +4178,12 @@ declare module DevExpress.ui { expandRow(key: any): void; /** Allows you to collapse a specific group or master row by its key. */ collapseRow(key: any): void; + /** Checks whether a specific adaptive detail row is expanded or collapsed. */ + isAdaptiveDetailRowExpanded(key: any): void; + /** Expands an adaptive detail row by the key of its parent data row. */ + expandAdaptiveDetailRow(key: any): void; + /** Collapses the currently expanded adaptive detail row (if there is one). */ + collapseAdaptiveDetailRow(): void; /** Applies a filter to the grid's data source. */ filter(filterExpr?: any): void; /** Returns a filter expression applied to the grid's data source using the filter(filterExpr) method. */ @@ -3983,7 +4214,7 @@ declare module DevExpress.ui { /** Gets the current page size. */ pageSize(): number; /** Refreshes grid data. */ - refresh(): void; + refresh(): JQueryPromise; /** Removes a specific row from a grid. */ deleteRow(rowIndex: number): void; /** @@ -3992,7 +4223,7 @@ declare module DevExpress.ui { */ removeRow(rowIndex: number): void; /** Saves changes made in a grid. */ - saveEditData(): void; + saveEditData(): JQueryPromise; /** Searches grid records by a search string. */ searchByText(text: string): void; /** Selects all grid records. */ @@ -4010,6 +4241,8 @@ declare module DevExpress.ui { /** Invokes the column chooser panel. */ showColumnChooser(): void; startSelectionWithCheckboxes(): boolean; + /** Returns how many pages the grid contains. */ + pageCount(): number; /** Returns the number of records currently held by a grid. */ totalCount(): number; /** Recovers a row deleted in the batch edit mode. */ @@ -4043,8 +4276,38 @@ declare module DevExpress.ui { allowSortingBySummary?: boolean; /** Allows an end-user to change filtering options. */ allowFiltering?: boolean; + /** Specifies the area to which data field headers must belong. */ + dataFieldArea?: string; + /** Configures the field panel. */ + fieldPanel?: { + /** Makes fields on the field panel draggable. */ + allowFieldDragging?: boolean; + /** Shows/hides filter fields on the field panel. */ + showFilterFields?: boolean; + /** Shows/hides data fields on the field panel. */ + showDataFields?: boolean; + /** Shows/hides column fields on the field panel. */ + showColumnFields?: boolean; + /** Shows/hides row fields on the field panel. */ + showRowFields?: boolean; + /** Shows/hides the field panel. */ + visible?: boolean; + /** Specifies the placeholders of the field areas. */ + texts?: { + /** Specifies the placeholder of the column field area. */ + columnFieldArea?: string; + /** Specifies the placeholder of the row field area. */ + rowFieldArea?: string; + /** Specifies the placeholder of the filter field area. */ + filterFieldArea?: string; + /** Specifies the placeholder of the data field area. */ + dataFieldArea?: string; + } + } /** Allows an end-user to expand/collapse all header items within a header level. */ allowExpandAll?: boolean; + /** Specifies whether long text in header items should be wrapped. */ + wordWrapEnabled?: boolean; /** Specifies whether to display the Total rows. */ showRowTotals?: boolean; /** Specifies whether to display the Grand Total row. */ @@ -4057,6 +4320,8 @@ declare module DevExpress.ui { hideEmptySummaryCells?: boolean; /** Specifies where to show the total rows or columns. */ showTotalsPrior?: string; + /** Specifies the layout of items in the row header. */ + rowHeaderLayout?: string; /** Specifies whether the outer borders of the grid are visible or not. */ showBorders?: boolean; /** The Field Chooser configuration options. */ @@ -4085,7 +4350,7 @@ declare module DevExpress.ui { allFields?: string; }; } - /** Strings that can be changed or localized in the dxPivotGrid widget. */ + /** Strings that can be changed or localized in the PivotGrid widget. */ texts?: { /** The string to display as a header of the Grand Total row and column. */ grandTotal?: string; @@ -4131,13 +4396,13 @@ declare module DevExpress.ui { onCellPrepared?: (e: any) => void; /** A handler for the contextMenuPreparing event. */ onContextMenuPreparing?: (e: Object) => void; - /** Specifies options for exporting pivot grid data. */ + /** Configures client-side export. */ export?: { - /** Indicates whether the export feature is enabled for the pivot grid. */ + /** Enables client-side export. */ enabled?: boolean; /** Specifies a default name for the file to which grid data is exported. */ fileName?: string; - /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE9 and Safari browsers. */ proxyUrl?: string; }; /** A handler for the exporting event. */ @@ -4176,22 +4441,34 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxPivotGridOptions); /** Gets the PivotGridDataSource instance. */ getDataSource(): DevExpress.data.PivotGridDataSource; - /** Gets the dxPopup instance of the field chooser window. */ + /** Gets the Popup instance of the field chooser window. */ getFieldChooserPopup(): DevExpress.ui.dxPopup; /** Updates the widget to the size of its content. */ updateDimensions(): void; /** Exports pivot grid data to the Excel file. */ exportToExcel(): void; + /** Binds a Chart to the PivotGrid. */ + bindChart(chart: any, integrationOptions?: { + inverted?: boolean; + dataFieldsDisplayMode?: string; + putDataFieldsInto?: string; + alternateDataFields?: boolean; + processCell?: Function; + customizeChart?: Function; + customizeSeries?: Function; + }): any; } export interface dxPivotGridFieldChooserOptions extends WidgetOptions { /** Specifies the height of the widget. */ height?: any; /** Specifies the field chooser layout. */ layout?: number; - /** The data source of a dxPivotGrid widget. */ + /** The data source of a PivotGrid widget. */ dataSource?: DevExpress.data.PivotGridDataSource; onContentReady?: Function; - /** Strings that can be changed or localized in the dxPivotGridFieldChooser widget. */ + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; + /** Strings that can be changed or localized in the PivotGridFieldChooser widget. */ texts?: { /** The string to display instead of Row Fields. */ rowFields?: string; @@ -4205,12 +4482,14 @@ declare module DevExpress.ui { allFields?: string; }; } - /** A complementary widget for dxPivotGrid that allows you to manage data displayed in the dxPivotGrid. */ + /** A complementary widget for PivotGrid that allows you to manage data displayed in the PivotGrid. */ export class dxPivotGridFieldChooser extends Widget { constructor(element: JQuery, options?: dxPivotGridFieldChooserOptions); constructor(element: Element, options?: dxPivotGridFieldChooserOptions); /** Updates the widget to the size of its content. */ updateDimensions(): void; + /** Gets the PivotGridDataSource instance. */ + getDataSource(): DevExpress.data.PivotGridDataSource; } } interface JQuery { @@ -4289,7 +4568,7 @@ declare module DevExpress.framework { id?: string; /** Specifies the title of the widget associated with this command. */ title?: string; - /** Specifies the type of the button, if the command is rendered as a dxButton widget. */ + /** Specifies the type of the button, if the command is rendered as a Button widget. */ type?: string; /** A Boolean value specifying whether or not the widget associated with this command is visible. */ visible?: boolean; @@ -4543,36 +4822,6 @@ declare module DevExpress.framework { } } declare module DevExpress.viz.core { - /** - * Applies a theme for the entire page with several DevExtreme visualization widgets. - * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. - */ - export function currentTheme(theme: string): void; - /** - * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. - * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. - */ - export function currentTheme(platform: string, colorScheme: string): void; - /** - * Registers a new theme based on the existing one. - * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. - */ - export function registerTheme(customTheme: Object, baseTheme: string): void; - /** - * Applies a predefined or registered custom palette to all visualization widgets at once. - * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. - */ - export function currentPalette(paletteName: string): void; - /** - * Obtains the color sets of a predefined or registered palette. - * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. - */ - export function getPalette(paletteName: string): Object; - /** - * Registers a new palette. - * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. - */ - export function registerPalette(paletteName: string, palette: Object): void; export interface Border { /** Sets a border color for a selected series. */ color?: string; @@ -4586,19 +4835,19 @@ declare module DevExpress.viz.core { dashStyle?: string; } export interface DashedBorderWithOpacity extends DashedBorder { - /** Specifies the opacity of the tooltip's border. */ + /** Specifies how transparent the vertical crosshair line should be. */ opacity?: number; } export interface Font { - /** Specifies the font color for a strip label. */ + /** Colors the text displayed by the group labels. */ color?: string; - /** Specifies the font family for a strip label. */ + /** Specifies the font family of the text displayed by the group labels. */ family?: string; - /** Specifies the font opacity for a strip label. */ + /** Specifies how transparent the text displayed by the group labels should be. */ opacity?: number; - /** Specifies the font size for a strip label. */ + /** Specifies the size of the text displayed by the group labels. */ size?: any; - /** Specifies the font weight for the text displayed in strips. */ + /** Specifies the font weight of the text displayed by the group labels. */ weight?: number; } export interface Hatching { @@ -4611,35 +4860,61 @@ declare module DevExpress.viz.core { width?: number; } export interface Margins { - /** Specifies the distance in pixels between the bottom side of the title and the surrounding widget elements. */ + /** Specifies the legend's bottom margin in pixels. */ bottom?: number; - /** Specifies the distance in pixels between the left side of the title and the surrounding widget elements. */ + /** Specifies the legend's left margin in pixels. */ left?: number; - /** Specifies the distance between the right side of the title and surrounding widget elements in pixels. */ + /** Specifies the legend's right margin in pixels. */ right?: number; - /** Specifies the distance between the top side of the title and surrounding widget elements in pixels. */ + /** Specifies the legend's bottom margin in pixels. */ top?: number; } + export interface MarginOptions { + /** Generates space around the widget. */ + margin?: Margins; + } + export interface RedrawOnResizeOptions { + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + } + export interface TitleOptions { + /** Specifies the widget title. */ + title?: Title; + } + export interface ExportOptions { + /** Configures the exporting and printing features. */ + export?: Export; + } + export interface LoadingIndicatorOptions { + /** Configures the loading indicator. */ + loadingIndicator?: LoadingIndicator; + } + export interface LoadingIndicatorMethods { + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + } export interface Size { - /** Specifies the width of the widget. */ + /** Specifies the width of the widget in pixels. */ width?: number; - /** Specifies the height of the widget. */ + /** Specifies the height of the widget in pixels. */ height?: number; } export interface Title { /** Specifies font options for the title. */ font?: viz.core.Font; - /** Specifies the widget title's horizontal position. */ + /** Specifies the title's alignment in a horizontal direction. */ horizontalAlignment?: string; - /** Specifies the widget title's position in the vertical direction. */ + /** Specifies the title's alignment in a vertical direction. */ verticalAlignment?: string; - /** Specifies the distance between the title and surrounding widget elements in pixels. */ - margin?: viz.core.Margins; - /** Specifies the height of the space reserved for the title. */ + /** Generates space around the title. */ + margin?: Margins; + /** Specifies the minimum height that the title occupies. */ placeholderSize?: number; - /** Specifies text for the title. */ + /** Specifies the title text. */ text?: string; - /** Specifies a subtitle for the widget. */ + /** Specifies the widget subtitle. */ subtitle?: { /** Specifies font options for the subtitle. */ font?: viz.core.Font; @@ -4647,42 +4922,58 @@ declare module DevExpress.viz.core { text?: string; } } + export interface Export { + /** Enables the client-side exporting in the widget. */ + enabled?: boolean; + /** Enables the printing feature in the widget. Applies only if the export | enabled option is true. */ + printingEnabled?: boolean; + /** Specifies a set of formats available for exporting into. */ + formats?: Array; + /** Specifies a default name for the file to which the widget will be exported. */ + fileName?: string; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable exporting in IE9 and Safari browsers. */ + proxyUrl?: string; + /** Specifies the color that will fill transparent regions in the resulting file or document. */ + backgroundColor?: string; + } export interface Tooltip { /** Specifies the length of the tooltip's arrow in pixels. */ arrowLength?: number; /** Specifies the appearance of the tooltip's border. */ - border?: viz.core.DashedBorderWithOpacity; - /** Specifies a color for the tooltip. */ + border?: DashedBorderWithOpacity; + /** Specifies the color of tooltips. */ color?: string; - /** Specifies the z-index for tooltips. */ + /** Specifies the z-index of tooltips. */ zIndex?: number; /** Specifies the container to draw tooltips inside of it. */ container?: any; - /** Specifies text and appearance of a set of tooltips. */ + /** Allows you to change tooltip appearance. */ customizeTooltip?: (arg: Object) => { color?: string; text?: string }; - /** Specifies whether or not the tooltip is enabled. */ enabled?: boolean; - /** Specifies font options for the text displayed by the tooltip. */ + /** Specifies the font of the text displayed by a tooltip. */ font?: Font; - /** Specifies a format for the text displayed by the tooltip. */ - format?: string; - /** Specifies the opacity of a tooltip. */ + /** Specifies the format of the value displayed by a tooltip. */ + format?: any; + /** Specifies the opacity of tooltips. */ opacity?: number; - /** Specifies a distance from the tooltip's left/right boundaries to the inner text in pixels. */ + /** Generates space on the left and the right of the text displayed by a tooltip. */ paddingLeftRight?: number; - /** Specifies a distance from the tooltip's top/bottom boundaries to the inner text in pixels. */ + /** Generates space above and below the text displayed by a tooltip. */ paddingTopBottom?: number; - /** Specifies a precision for formatted values displayed by the tooltip. */ + /** + * Specifies the precision of formatted values in a tooltip. + * @deprecated Use the tooltip | format | precision option instead. + */ precision?: number; - /** Specifies options of the tooltip's shadow. */ + /** Specifies the appearance of the tooltip's shadow. */ shadow?: { /** Specifies the blur distance of the tooltip's shadow. */ blur?: number; /** Specifies the color of the tooltip's shadow. */ color?: string; - /** Specifies the horizontal offset of the tooltip's shadow relative to the tooltip in pixels. */ + /** Specifies the horizontal offset of the tooltip's shadow relative to the tooltip itself measured in pixels. */ offsetX?: number; - /** Specifies the vertical offset of the tooltip's shadow relative to the tooltip in pixels. */ + /** Specifies the vertical offset of the tooltip's shadow relative to the tooltip itself measured in pixels. */ offsetY?: number; /** Specifies the opacity of the tooltip's shadow. */ opacity?: number; @@ -4697,13 +4988,13 @@ declare module DevExpress.viz.core { enabled?: boolean; } export interface LoadingIndicator { - /** Specifies a color for the loading indicator background. */ + /** Colors the background of the loading indicator. */ backgroundColor?: string; - /** Specifies font options for the loading indicator text. */ + /** Specifies font options for the loading indicator. */ font?: viz.core.Font; /** Specifies whether to show the loading indicator or not. */ show?: boolean; - /** Specifies a text to be displayed by the loading indicator. */ + /** Specifies the text to be displayed by the loading indicator. */ text?: string; } export interface LegendBorder extends viz.core.DashedBorderWithOpacity { @@ -4747,6 +5038,8 @@ declare module DevExpress.viz.core { visible?: boolean; } export interface BaseWidgetOptions extends DOMComponentOptions { + /** Specifies the size of the widget in pixels. */ + size?: Size; /** A handler for the drawn event. */ onDrawn?: (e: { component: BaseWidget; @@ -4765,6 +5058,20 @@ declare module DevExpress.viz.core { version: string; } ) => void; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + cancel: boolean; + }) => void; + /** A handler for the fileSaving event. */ + onFileSaving?: (e: { + fileName: string; + format: string; + data: any; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; /** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */ pathModified?: boolean; /** Specifies whether or not the widget supports right-to-left representation. */ @@ -4776,8 +5083,46 @@ declare module DevExpress.viz.core { export class BaseWidget extends DOMComponent { /** Returns the widget's SVG markup. */ svg(): string; + /** Exports the widget into a document with a specified name and format. */ + exportTo(): void; + /** Opens the browser's print window. */ + print(): void; + /** Redraws the widget. */ + render(): void; } } +declare module DevExpress.viz { + /** + * Applies a theme for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. + */ + export function currentTheme(theme: string): void; + /** + * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. + */ + export function currentTheme(platform: string, colorScheme: string): void; + /** + * Registers a new theme based on the existing one. + * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. + */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** + * Applies a predefined or registered custom palette to all visualization widgets at once. + * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. + */ + export function currentPalette(paletteName: string): void; + /** + * Obtains the color sets of a predefined or registered palette. + * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. + */ + export function getPalette(paletteName: string): Object; + /** + * Registers a new palette. + * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. + */ + export function registerPalette(paletteName: string, palette: Object): void; +} declare module DevExpress.viz.charts { /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ export interface BaseSeries { @@ -4842,7 +5187,7 @@ declare module DevExpress.viz.charts { select(): void; /** Shows the tooltip of the point. */ showTooltip(): void; - /** Allows you to obtain the label of a series point. */ + /** Allows you to obtain the label(s) of the series point. */ getLabel(): any; /** Returns the series object to which the point belongs. */ series: BaseSeries; @@ -4931,8 +5276,11 @@ declare module DevExpress.viz.charts { } export interface BaseSeriesConfigLabel { /** Specifies a format for arguments displayed by point labels. */ - argumentFormat?: string; - /** Specifies a precision for formatted point arguments displayed in point labels. */ + argumentFormat?: any; + /** + * Specifies a precision for formatted point arguments displayed in point labels. + * @deprecated Use the series | label | argumentFormat | precision instead. + */ argumentPrecision?: number; /** Specifies a background color for point labels. */ backgroundColor?: string; @@ -4952,9 +5300,12 @@ declare module DevExpress.viz.charts { /** Specifies font options for the text displayed in point labels. */ font?: viz.core.Font; /** Specifies a format for the text displayed by point labels. */ - format?: string; + format?: any; position?: string; - /** Specifies a precision for formatted point values displayed in point labels. */ + /** + * Specifies a precision for formatted point values displayed in point labels. + * @deprecated Use the series | label | format | precision option instead. + */ precision?: number; /** Specifies the angle used to rotate point labels from their initial position. */ rotationAngle?: number; @@ -4962,26 +5313,27 @@ declare module DevExpress.viz.charts { visible?: boolean; } export interface SeriesConfigLabel extends BaseSeriesConfigLabel { - /** Specifies whether or not to show a label when the point has a zero value. */ + /** Specifies whether or not to show labels for points with zero value. Applies only to bar-like series. */ showForZeroValues?: boolean; } export interface ChartSeriesConfigLabel extends SeriesConfigLabel { - /** Specifies how to align point labels relative to the corresponding data points that they represent. */ + /** Aligns point labels in relation to their points. */ alignment?: string; - /** Specifies how to shift point labels horizontally from their initial positions. */ + /** Along with verticalOffset, shifts point labels from their initial positions. */ horizontalOffset?: number; - /** Specifies how to shift point labels vertically from their initial positions. */ + /** Along with horizontalOffset, shifts point labels from their initial positions. */ verticalOffset?: number; - /** Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. */ + /** + * Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. + * @deprecated Use the series | label | format | percentPrecision instead. + */ percentPrecision?: number; } export interface BaseCommonSeriesConfig { /** Specifies the data source field that provides arguments for series points. */ argumentField?: string; axis?: string; - /** An object defining the label configuration options for a series in the dxChart widget. */ label?: ChartSeriesConfigLabel; - /** Specifies border options for point labels. */ border?: viz.core.DashedBorder; /** Specifies a series color. */ color?: string; @@ -4989,7 +5341,6 @@ declare module DevExpress.viz.charts { dashStyle?: string; hoverMode?: string; hoverStyle?: { - /** An object defining the border options for a hovered series. */ border?: viz.core.DashedBorder; /**

Sets a color for a series when it is hovered over.

*/ color?: string; @@ -5007,10 +5358,9 @@ declare module DevExpress.viz.charts { minBarSize?: number; /** Specifies opacity for a series. */ opacity?: number; - /** Specifies the series elements to highlight when the series is selected. */ + /** Specifies series elements to be highlighted when a user selects a point. */ selectionMode?: string; selectionStyle?: { - /** An object defining the border options for a selected series. */ border?: viz.core.DashedBorder; /** Sets a color for a series when it is selected. */ color?: string; @@ -5088,11 +5438,11 @@ declare module DevExpress.viz.charts { visible?: boolean; } export interface ChartCommonPointOptions extends CommonPointOptions { - /** An object specifying the parameters of an image that is used as a point marker. */ + /** Substitutes the standard point symbols with an image. */ image?: { - /** Specifies the height of an image that is used as a point marker. */ + /** Specifies the height of the image used instead of a point marker. */ height?: any; - /** Specifies a URL leading to the image to be used as a point marker. */ + /** Specifies the URL of the image to be used as a point marker. */ url?: any; /** Specifies the width of an image that is used as a point marker. */ width?: any; @@ -5111,84 +5461,83 @@ declare module DevExpress.viz.charts { } /** An object that defines configuration options for chart series. */ export interface CommonSeriesConfig extends BaseCommonSeriesConfig { - /** Specifies the data source field that provides a 'close' value for a _candleStick_ or _stock_ series. */ + /** Specifies which data source field provides close values for points of a financial series. */ closeValueField?: string; - /** Specifies a radius for bar corners. */ + /** Makes bars look rounded. Applies only to bar-like series. */ cornerRadius?: number; - /** Specifies the data source field that provides a 'high' value for a _candleStick_ or _stock_ series. */ + /** Specifies which data source field provides high values for points of a financial series. */ highValueField?: string; - /** Specifies the color for the body (rectangle) of a _candleStick_ series. */ + /** Specifies a filling color for the body of a series point that visualizes a non-reduced value. Applies only to candlestick series. */ innerColor?: string; - /** Specifies the data source field that provides a 'low' value for a _candleStick_ or _stock_ series. */ + /** Specifies which data source field provides low values for points of a financial series. */ lowValueField?: string; - /** Specifies the data source field that provides an 'open' value for a _candleStick_ or _stock_ series. */ + /** Specifies which data source field provides open values for points of a financial series. */ openValueField?: string; - /** Specifies the pane that will be used to display a series. */ + /** Specifies which pane the series should belong to. Accepts the name of the pane. */ pane?: string; - /** An object defining configuration options for points in line-, scatter- and area-like series. */ point?: ChartCommonPointOptions; - /** Specifies the data source field that provides values for one end of a range series. To set the data source field for the other end of the range series, use the rangeValue2Field property. */ + /** Coupled with the rangeValue2Field option, specifies which data source field provides values for a range-like series. */ rangeValue1Field?: string; - /** Specifies the data source field that provides values for the second end of a range series. To set the data source field for the other end of the range series, use the rangeValue1Field property. */ + /** Coupled with the rangeValue1Field option, specifies which data source field provides values for a range-like series. */ rangeValue2Field?: string; - /** Specifies reduction options for the stock or candleStick series. */ + /** Specifies reduction options for financial series. */ reduction?: { - /** Specifies a color for the points whose reduction level price is lower in comparison to the value in the previous point. */ + /** Specifies a color for the points whose price has decreased in comparison to the price of the previous point. */ color?: string; - /** Specifies for which price level (open, high, low or close) to enable reduction options in the series. */ + /** Specifies whether high, low, open or close prices of points should be compared. */ level?: string; }; - /** Specifies the data source field that defines the size of bubbles. */ + /** Specifies which data source field provides size values for bubbles. Required by and applies only to bubble series. */ sizeField?: string; } export interface CommonSeriesSettings extends CommonSeriesConfig { - /**

An object that specifies configuration options for all series of the area type in the chart.

*/ + /** Defines common settings for all area series. */ area?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + /** Defines common settings for all bar series. */ bar?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the bubble type in the chart. */ + /** Defines common settings for all bubble series. */ bubble?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _candleStick_ type in the chart. */ + /** Defines common settings for all candlestick series. */ candlestick?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _fullStackedArea_ type in the chart. */ + /** Defines common settings for all full-stacked area series. */ fullstackedarea?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the Full-Stacked Spline Area type in the chart. */ + /** Defines common settings for all full-stacked spline area series. */ fullstackedsplinearea?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _fullStackedBar_ type in the chart. */ + /** Defines common settings for all full-stacked bar series. */ fullstackedbar?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _fullStackedLine_ type in the chart. */ + /** Defines common settings for all full-stacked line series. */ fullstackedline?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the Full-Stacked Spline type in the chart. */ + /** Defines common settings for all full-stacked spline series. */ fullstackedspline?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + /** Defines common settings for all line series. */ line?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _rangeArea_ type in the chart. */ + /** Defines common settings for all range area series. */ rangearea?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _rangeBar_ type in the chart. */ + /** Defines common settings for all range bar series. */ rangebar?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + /** Defines common settings for all scatter series. */ scatter?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _spline_ type in the chart. */ + /** Defines common settings for all spline series. */ spline?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _splineArea_ type in the chart. */ + /** Defines common settings for all spline area series. */ splinearea?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _stackedArea_ type in the chart. */ + /** Defines common settings for all stacked area series. */ stackedarea?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the Stacked Spline Area type in the chart. */ + /** Defines common settings for all stacked spline area series. */ stackedsplinearea?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + /** Defines common settings for all stacked bar series. */ stackedbar?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _stackedLine_ type in the chart. */ + /** Defines common settings for all stacked line series. */ stackedline?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the Stacked Spline type in the chart. */ + /** Defines common settings for all stacked spline series. */ stackedspline?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _stepArea_ type in the chart. */ + /** Defines common settings for all step area series. */ steparea?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _stepLine_ type in the chart. */ + /** Defines common settings for all step line series. */ stepline?: CommonSeriesConfig; - /** An object that specifies configuration options for all series of the _stock_ type in the chart. */ + /** Defines common settings for all stock series. */ stock?: CommonSeriesConfig; - /** Sets a series type. */ + /** Specifies the type of the series. */ type?: string; } export interface SeriesConfig extends CommonSeriesConfig { @@ -5231,7 +5580,10 @@ declare module DevExpress.viz.charts { export interface PieSeriesConfigLabel extends BaseSeriesConfigLabel { /** Specifies how to shift labels from their initial position in a radial direction in pixels. */ radialOffset?: number; - /** Specifies a precision for the percentage values displayed in labels. */ + /** + * Specifies a precision for the percentage values displayed in labels. + * @deprecated Use the series | label | format | percentPrecision instead. + */ percentPrecision?: number; } /** An object that defines configuration options for chart series. */ @@ -5267,7 +5619,7 @@ declare module DevExpress.viz.charts { /** Specifies a minimal size of a displayed pie segment. */ minSegmentSize?: number; /** - * Specifies the direction in which the dxPieChart series points are located. + * Specifies the direction in which the PieChart series points are located. * @deprecated Use the segmentsDirection option instead. */ segmentsDirection?: string; @@ -5334,11 +5686,11 @@ declare module DevExpress.viz.charts { nameField?: string; } export interface ChartCommonConstantLineLabel { - /** Specifies font options for a constant line label. */ + /** Specifies font options for constant line labels. */ font?: viz.core.Font; - /** Specifies the position of the constant line label relative to the chart plot. */ + /** Specifies the position of constant line labels on the chart plot. */ position?: string; - /** Indicates whether or not to display labels for the axis constant lines. */ + /** Makes constant line labels visible. */ visible?: boolean; } export interface PolarCommonConstantLineLabel { @@ -5356,11 +5708,11 @@ declare module DevExpress.viz.charts { width?: number; } export interface ChartCommonConstantLineStyle extends ConstantLineStyle { - /** An object defining constant line label options. */ + /** Configures constant line labels. */ label?: ChartCommonConstantLineLabel; - /** Specifies the space between the constant line label and the left/right side of the constant line. */ + /** Generates a pixel-measured empty space between the left/right side of a constant line and the constant line label. */ paddingLeftRight?: number; - /** Specifies the space between the constant line label and the top/bottom side of the constant line. */ + /** Generates a pixel-measured empty space between the top/bottom side of a constant line and the constant line label. */ paddingTopBottom?: number; } export interface PolarCommonConstantLineStyle extends ConstantLineStyle { @@ -5376,15 +5728,15 @@ declare module DevExpress.viz.charts { visible?: boolean; } export interface ChartCommonAxisLabel extends CommonAxisLabel { - /** Specifies the label's position relative to the tick (grid line). */ + /** Aligns axis labels in relation to ticks. */ alignment?: string; - /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + /** Decides how to arrange axis labels when there is not enough space to keep all of them. */ overlappingBehavior?: { - /** Specifies how to arrange axis labels. */ + /** Decides how to arrange axis labels when there is not enough space to keep all of them. */ mode?: string; - /** Specifies the angle used to rotate axis labels. */ + /** Specifies the rotation angle of axis labels. Applies only if the mode option is "rotate". */ rotationAngle?: number; - /** Specifies the spacing that must be set between staggered rows when the 'stagger' algorithm is applied. */ + /** Adds a pixel-measured empty space between two staggered rows of axis labels. Applies only if the mode option is "stagger". */ staggeringSpacing?: number; }; } @@ -5393,9 +5745,9 @@ declare module DevExpress.viz.charts { overlappingBehavior?: string; } export interface CommonAxisTitle { - /** Specifies font options for an axis title. */ + /** Specifies font options for the axis title. */ font?: viz.core.Font; - /** Specifies a margin for an axis title in pixels. */ + /** Adds a pixel-measured empty space between the axis title and axis labels. */ margin?: number; } export interface BaseCommonAxisSettings { @@ -5403,7 +5755,7 @@ declare module DevExpress.viz.charts { color?: string; /** Specifies whether ticks/grid lines of a discrete axis are located between labels or cross the labels. */ discreteAxisDivisionMode?: string; - /** An object defining the configuration options for the grid lines of an axis in the dxPolarChart widget. */ + /** An object defining the configuration options for the grid lines of an axis in the PolarChart widget. */ grid?: { /** Specifies a color for grid lines. */ color?: string; @@ -5463,41 +5815,41 @@ declare module DevExpress.viz.charts { width?: number; } export interface ChartCommonAxisSettings extends BaseCommonAxisSettings { - /** Specifies the appearance of all the widget's constant lines. */ + /** Configures the appearance of all constant lines in the widget. */ constantLineStyle?: ChartCommonConstantLineStyle; - /** An object defining the label configuration options that are common for all axes in the dxChart widget. */ + /** Configures axis labels. */ label?: ChartCommonAxisLabel; - /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + /** Controls the empty space between the maximum series points and the axis. Applies only to the axes of the "continuous" and "logarithmic" type. */ maxValueMargin?: number; - /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + /** Controls the empty space between the minimum series points and the axis. Applies only to the axes of the "continuous" and "logarithmic" type. */ minValueMargin?: number; - /** Specifies, in pixels, the space reserved for an axis. */ + /** Reserves a pixel-measured space for the axis. */ placeholderSize?: number; - /** An object defining configuration options for strip style. */ + /** Configures the appearance of strips. */ stripStyle?: { - /** An object defining the configuration options for a strip label style. */ + /** Configures the appearance of strip labels. */ label?: { - /** Specifies font options for a strip label. */ + /** Specifies font options for strip labels. */ font?: viz.core.Font; - /** Specifies the label's position on a strip. */ + /** Aligns strip labels in the horizontal direction. */ horizontalAlignment?: string; - /** Specifies a label's position on a strip. */ + /** Aligns strip labels in the vertical direction. */ verticalAlignment?: string; }; - /** Specifies the spacing, in pixels, between the left/right strip border and the strip label. */ + /** Generates a pixel-measured empty space between the left/right border of a strip and the strip label. */ paddingLeftRight?: number; - /** Specifies the spacing, in pixels, between the top/bottom strip borders and the strip label. */ + /** Generates a pixel-measured empty space between the top/bottom border of a strip and the strip label. */ paddingTopBottom?: number; }; - /** An object defining the title configuration options that are common for all axes in the dxChart widget. */ + /** Configures axis titles. */ title?: CommonAxisTitle; - /** Indicates whether or not to display series with indents from axis boundaries. */ + /** Adds an empty space between the axis and the minimum and maximum series points. */ valueMarginsEnabled?: boolean; } export interface PolarCommonAxisSettings extends BaseCommonAxisSettings { /** Specifies the appearance of all the widget's constant lines. */ constantLineStyle?: PolarCommonConstantLineStyle; - /** An object defining the label configuration options that are common for all axes in the dxPolarChart widget. */ + /** An object defining the label configuration options that are common for all axes in the PolarChart widget. */ label?: PolarCommonAxisLabel; /** An object defining configuration options for strip style. */ stripStyle?: { @@ -5509,11 +5861,11 @@ declare module DevExpress.viz.charts { }; } export interface ChartConstantLineLabel extends ChartCommonConstantLineLabel { - /** Specifies the horizontal alignment of a constant line label. */ + /** Aligns constant line labels in the horizontal direction. */ horizontalAlignment?: string; - /** Specifies the vertical alignment of a constant line label. */ + /** Aligns constant line labels in the vertical direction. */ verticalAlignment?: string; - /** Specifies the text to be displayed in a constant line label. */ + /** Specifies the text of a constant line label. By default, equals to the value of the constant line. */ text?: string; } export interface PolarConstantLineLabel extends PolarCommonConstantLineLabel { @@ -5526,24 +5878,27 @@ declare module DevExpress.viz.charts { /** Specifies a callback function that returns the text to be displayed in value axis labels. */ customizeText?: (argument: { value: any; valueText: string }) => string; /** Specifies a format for the text displayed by axis labels. */ - format?: string; - /** Specifies a precision for the formatted value displayed in the axis labels. */ + format?: any; + /** + * Specifies a precision for the formatted value displayed in the axis labels. + * @deprecated Use the valueAxis | label | format | precision option instead. + */ precision?: number; } export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { } export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { } export interface AxisTitle extends CommonAxisTitle { - /** Specifies the text for the value axis title. */ + /** Specifies the text of the axis title. */ text?: string; } export interface ChartConstantLineStyle extends ChartCommonConstantLineStyle { - /** An object defining constant line label options. */ + /** Specifies the appearance of the labels of those constant lines that belong to the value axis. */ label?: ChartConstantLineLabel; } export interface ChartConstantLine extends ChartConstantLineStyle { - /** An object defining constant line label options. */ + /** Configures the constant line label. */ label?: ChartConstantLineLabel; - /** Specifies a value to be displayed by a constant line. */ + /** Specifies the value indicated by a constant line. Setting this option is necessary. */ value?: any; } export interface PolarConstantLine extends PolarCommonConstantLineStyle { @@ -5567,25 +5922,25 @@ declare module DevExpress.viz.charts { minorTickCount?: number; /** Specifies the required type of the value axis. */ type?: string; - /** Specifies the pane on which the current value axis will be displayed. */ + /** Binds the value axis to a pane. */ pane?: string; /** Specifies options for value axis strips. */ strips?: Array; } export interface ChartAxis extends ChartCommonAxisSettings, Axis { - /** Defines an array of the value axis constant lines. */ + /** Declares a collection of constant lines belonging to the value axis. */ constantLines?: Array; - /** Specifies the appearance options for the constant lines of the value axis. */ + /** Specifies the appearance of those constant lines that belong to the value axis. */ constantLineStyle?: ChartCommonConstantLineStyle; - /** Specifies options for value axis labels. */ + /** Configures the labels of the value axis. */ label?: ChartAxisLabel; - /** Specifies the maximum value on the value axis. */ + /** Coupled with the min option, focuses the widget on a specific chart segment. Applies only to the axes of the "continuous" and "logarithmic" type. */ max?: any; - /** Specifies the minimum value on the value axis. */ + /** Coupled with the max option, focuses the widget on a specific chart segment. Applies only to the axes of the "continuous" and "logarithmic" type. */ min?: any; - /** Specifies the position of the value axis on a chart. */ + /** Relocates the value axis. */ position?: string; - /** Specifies the title for a value axis. */ + /** Configures the axis title. */ title?: any; } export interface PolarAxis extends PolarCommonAxisSettings, Axis { @@ -5620,9 +5975,9 @@ declare module DevExpress.viz.charts { valueType?: string; } export interface ChartValueAxis extends ChartAxis, ValueAxis { - /** Specifies the spacing, in pixels, between multiple value axes in a chart. */ + /** Adds a pixel-measured empty space between two side-by-side value axes. Applies if several value axes are located on one side of the chart. */ multipleAxesSpacing?: number; - /** Specifies the value by which the chart's value axes are synchronized. */ + /** Synchronizes two or more value axes with each other at a specific value. */ synchronizedValue?: number; } export interface PolarValueAxis extends PolarAxis, ValueAxis { @@ -5637,61 +5992,63 @@ declare module DevExpress.viz.charts { } } export interface CommonPane { - /** Specifies a background color in a pane. */ + /** Specifies the color of the pane's background. */ backgroundColor?: string; - /** Specifies the border options of a chart's pane. */ + /** Configures the pane border. */ border?: PaneBorder; } export interface Pane extends CommonPane { - /** Specifies the name of a pane. */ + /** Specifies the name of the pane. */ name?: string; } export interface PaneBorder extends viz.core.DashedBorderWithOpacity { - /** Specifies the bottom border's visibility state in a pane. */ + /** Shows/hides the bottom border of the pane. Applies only when the border | visible option is true. */ bottom?: boolean; - /** Specifies the left border's visibility state in a pane. */ + /** Shows/hides the left border of the pane. Applies only when the border | visible option is true. */ left?: boolean; - /** Specifies the right border's visibility state in a pane. */ + /** Shows/hides the right border of the pane. Applies only when the border | visible option is true. */ right?: boolean; - /** Specifies the top border's visibility state in a pane. */ + /** Shows/hides the top border of the pane. Applies only when the border | visible option is true. */ top?: boolean; } export interface ChartAnimation extends viz.core.Animation { - /** Specifies the maximum series point count in the chart that the animation supports. */ + /** Specifies how many series points the widget should have before the animation will be disabled. */ maxPointCountSupported?: number; } export interface BaseChartTooltip extends viz.core.Tooltip { /** Specifies a format for arguments of the chart's series points. */ - argumentFormat?: string; - /** Specifies a precision for formatted arguments displayed in tooltips. */ + argumentFormat?: any; + /** + * Specifies a precision for formatted arguments displayed in tooltips. + * @deprecated Use the tooltip | argumentFormat | precision option instead. + */ argumentPrecision?: number; - /** Specifies a precision for a percent value displayed in tooltips for stacked series and dxPieChart series. */ + /** + * Specifies a precision for a percent value displayed in tooltips for stacked series and PieChart series. + * @deprecated Use the tooltip | format | percentPrecision option instead. + */ percentPrecision?: number; } - export interface BaseChartOptions extends viz.core.BaseWidgetOptions { + export interface BaseChartOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { /** Specifies adaptive layout options. */ adaptiveLayout?: { - /** Specifies the width of the widget that is small enough for the layout to begin adapting. */ + /** Specifies the widget's width small enough for the layout to begin adapting. */ width?: number; - /** Specifies the height of the widget that is small enough for the layout to begin adapting. */ + /** Specifies the widget's height small enough for the layout to begin adapting. */ height?: number; - /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + /** Specifies whether or not point labels should be kept when the layout is adapting. */ keepLabels?: boolean; }; /** Specifies animation options. */ animation?: ChartAnimation; - /** Specifies a callback function that returns an object with options for a specific point label. */ - customizeLabel?: (labelInfo: Object) => Object; - /** Specifies a callback function that returns an object with options for a specific point. */ + /** Customizes the appearance of an individual point label. */ + customizeLabel?: (pointInfo: Object) => Object; + /** Customizes the appearance of an individual series point. */ customizePoint?: (pointInfo: Object) => Object; - /** Specifies a data source for the chart. */ + /** Specifies the origin of data for the widget. */ dataSource?: any; - /** Specifies the appearance of the loading indicator. */ - loadingIndicator?: viz.core.LoadingIndicator; - /** Specifies options of a dxChart's (dxPieChart's) legend. */ + /** Specifies options of a Chart's or PieChart's legend. */ legend?: core.BaseLegend; - /** Specifies the blank space between the chart's extreme elements and the boundaries of the area provided for the widget (see size) in pixels. */ - margin?: viz.core.Margins; /** Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ palette?: any; /** A handler for the done event. */ @@ -5715,15 +6072,9 @@ declare module DevExpress.viz.charts { }) => void; /** Specifies whether a single point or multiple points can be selected in the chart. */ pointSelectionMode?: string; - /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ - redrawOnResize?: boolean; - /** Specifies options for the dxChart and dxPieChart widget series. */ + /** Specifies options for the Chart and PieChart widget series. */ series?: any; - /** Specifies the size of the widget in pixels. */ - size?: viz.core.Size; - /** Specifies a title for the chart. */ - title?: viz.core.Title; - /** Specifies tooltip options. */ + /** Configures tooltips. */ tooltip?: BaseChartTooltip; /** A handler for the tooltipShown event. */ onTooltipShown?: (e: { @@ -5739,7 +6090,7 @@ declare module DevExpress.viz.charts { }) => void; } /** A base class for all chart widgets included in the ChartJS library. */ - export class BaseChart extends viz.core.BaseWidget { + export class BaseChart extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { /** Deselects the chart's selected series. The series is displayed in an initial style. */ clearSelection(): void; /** Gets the current size of the widget. */ @@ -5750,12 +6101,10 @@ declare module DevExpress.viz.charts { getSeriesByName(seriesName: string): BaseSeries; /** Gets a series within the chart's series collection by its position number. */ getSeriesByPos(seriesIndex: number): BaseSeries; - /** Displays the loading indicator. */ - showLoadingIndicator(): void; - /** Conceals the loading indicator. */ - hideLoadingIndicator(): void; /** Hides all widget tooltips. */ hideTooltip(): void; + showLoadingIndicator(): void; + hideLoadingIndicator(): void; /** Redraws a widget. */ render(renderOptions?: { force?: boolean; @@ -5817,80 +6166,91 @@ declare module DevExpress.viz.charts { position?: string; } export interface ChartTooltip extends BaseChartTooltip { - /** Specifies whether the tooltip must be located in the center of a bar or on its edge. Applies to the Bar and Bubble series. */ + /** Specifies whether the tooltip must be located in the center of a series point or on its edge. Applies to bar-like and bubble series only. */ location?: string; /** Specifies the kind of information to display in a tooltip. */ shared?: boolean; } export interface dxChartOptions extends AdvancedOptions { - adaptiveLayout?: { - keepLabels?: boolean; - }; /** Indicates whether or not to synchronize value axes when they are displayed on a single pane. */ synchronizeMultiAxes?: boolean; /** Specifies whether or not to filter the series points depending on their quantity. */ useAggregation?: boolean; - /** Indicates whether or not to adjust a value axis to the current minimum and maximum values of a zoomed chart. */ + /** Specifies whether or not to adjust the value axis when zooming the widget. */ adjustOnZoom?: boolean; - /** Specifies argument axis options for the dxChart widget. */ + /** Configures the argument axis. */ argumentAxis?: ChartArgumentAxis; - /** An object defining the configuration options that are common for all axes of the dxChart widget. */ + /** Defines common settings for both the argument and value axis in a chart. */ commonAxisSettings?: ChartCommonAxisSettings; - /** An object defining the configuration options that are common for all panes in the dxChart widget. */ + /** Defines common settings for all panes in a chart. */ commonPaneSettings?: CommonPane; - /** An object defining the configuration options that are common for all series of the dxChart widget. */ + /** Specifies settings common for all series in the chart. */ commonSeriesSettings?: CommonSeriesSettings; - /** An object that specifies the appearance options of the chart crosshair. */ + /** Configures the crosshair feature. */ crosshair?: { - /** Specifies a color for the crosshair lines. */ + /** Specifies the color of the crosshair lines. */ color?: string; - /** Specifies a dash style for the crosshair lines. */ + /** Specifies the dash style of the crosshair lines. */ dashStyle?: string; - /** Specifies whether to enable the crosshair or not. */ + /** Enables the crosshair. */ enabled?: boolean; - /** Specifies the opacity of the crosshair lines. */ + /** Specifies how transparent the crosshair lines should be. */ opacity?: number; /** Specifies the width of the crosshair lines. */ width?: number; - /** Specifies the appearance of the horizontal crosshair line. */ + /** Configures the horizontal crosshair line individually. */ horizontalLine?: CrosshaierWithLabel; - /** Specifies the appearance of the vertical crosshair line. */ + /** Configures the vertical crosshair line individually. */ verticalLine?: CrosshaierWithLabel; - /** Specifies the options of the crosshair labels. */ + /** Configures the crosshair labels. */ label?: { - /** Specifies a color for the background of the crosshair labels. */ + /** Paints the background of the crosshair labels. */ backgroundColor?: string; - /** Specifies whether the crosshair labels are visible or not. */ + /** Makes the crosshair labels visible. Applies only if the crosshair feature is enabled. */ visible?: boolean; - /** Specifies font options for the text of the crosshair labels. */ + /** Specifies font options for the crosshair labels. */ font?: viz.core.Font; - /** Specifies the format of the values displayed by crosshair labels. */ - format?: string; - /** Specifies a precision for formatted values. */ + /** Formats the point value/argument before it will be displayed in the crosshair label. */ + format?: any; + /** + * Specifies a precision for formatted values. + * @deprecated Use the crosshair | label | format | precision option instead. + */ precision?: number; /** Customizes the text displayed by the crosshair labels. */ customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; } }; - /** Specifies a default pane for the chart series. */ + /** Specifies which pane should be used by default. */ defaultPane?: string; /** Specifies a coefficient determining the diameter of the largest bubble. */ maxBubbleSize?: number; /** Specifies the diameter of the smallest bubble measured in pixels. */ minBubbleSize?: number; - /** Defines the dxChart widget's pane(s). */ + /** Declares a collection of panes. */ panes?: Array; - /** Swaps the axes round so that the value axis becomes horizontal and the argument axes becomes vertical. */ + /** Swaps the axes around making the value axis horizontal and the argument axis vertical. */ rotated?: boolean; /** Specifies the options of a chart's legend. */ legend?: Legend; - /** Specifies options for dxChart widget series. */ + /** A handler for the zoomStart event. */ + onZoomStart?: (e: { + component: BaseChart; + element: Element; + }) => void; + /** A handler for the zoomEnd event. */ + onZoomEnd?: (e: { + component: BaseChart; + element: Element; + rangeStart: any; + rangeEnd: any; + }) => void; + /** Specifies options for Chart widget series. */ series?: Array; /** Defines options for the series template. */ seriesTemplate?: SeriesTemplate; - /** Specifies tooltip options. */ tooltip?: ChartTooltip; - /** Specifies value axis options for the dxChart widget. */ + /** Configures the value axis. */ valueAxis?: Array; /** Enables scrolling in your chart. */ scrollingMode?: string; @@ -5912,27 +6272,23 @@ declare module DevExpress.viz.charts { position?: string; }; } - /** A widget used to embed charts into HTML JS applications. */ - export class dxChart extends BaseChart { - constructor(element: JQuery, options?: dxChartOptions); - constructor(element: Element, options?: dxChartOptions); - /** Sets the specified start and end values for the chart's argument axis. */ - zoomArgument(startValue: any, endValue: any): void; - } interface CrosshaierWithLabel extends viz.core.DashedBorderWithOpacity { /** Configures the label that belongs to the horizontal crosshair line. */ label?: { - /** Specifies a color for the background of the label that belongs to the horizontal crosshair line. */ + /** Paints the background of the label that belongs to the horizontal crosshair line. */ backgroundColor?: string; - /** Specifies whether the label of the horizontal crosshair line is visible or not. */ + /** Makes the label of the horizontal crosshair line visible. Applies only if the crosshair feature is enabled and the horizontal line is visible. */ visible?: boolean; - /** Specifies font options for the text of the label that belongs to the horizontal crosshair line. */ + /** Specifies font options for the label of the horizontal crosshair line. */ font?: viz.core.Font; - /** Specifies the format of the values displayed by crosshair labels. */ - format?: string; - /** Specifies a precision for formatted values. */ + /** Formats the point value before it will be displayed in the crosshair label. */ + format?: any; + /** + * Specifies a precision for formatted values. + * @deprecated Use the crosshair | horizontalLine | label | format | precision option instead. + */ precision?: number; - /** Customizes the text displayed by the crosshair label that accompany the horizontal line. */ + /** Customizes the text displayed by the label that belongs to the horizontal crosshair line. */ customizeText?: (info: { value: any; valueText: string; point: ChartPoint; }) => string; } } @@ -5945,33 +6301,25 @@ declare module DevExpress.viz.charts { adaptiveLayout?: { width?: number; height?: number; - /** Specifies whether or not point labels can be hidden when the layout is adapting. */ - keepLabels?: boolean; }; /** Indicates whether or not to display a "spider web". */ useSpiderWeb?: boolean; - /** Specifies argument axis options for the dxPolarChart widget. */ + /** Specifies argument axis options for the PolarChart widget. */ argumentAxis?: PolarArgumentAxis; - /** An object defining the configuration options that are common for all axes of the dxPolarChart widget. */ + /** An object defining the configuration options that are common for all axes of the PolarChart widget. */ commonAxisSettings?: PolarCommonAxisSettings; - /** An object defining the configuration options that are common for all series of the dxPolarChart widget. */ + /** An object defining the configuration options that are common for all series of the PolarChart widget. */ commonSeriesSettings?: CommonPolarSeriesSettings; /** Specifies the options of a chart's legend. */ legend?: AdvancedLegend; - /** Specifies options for dxPolarChart widget series. */ + /** Specifies options for PolarChart widget series. */ series?: Array; /** Defines options for the series template. */ seriesTemplate?: PolarSeriesTemplate; - /** Specifies tooltip options. */ tooltip?: PolarChartTooltip; - /** Specifies value axis options for the dxPolarChart widget. */ + /** Specifies value axis options for the PolarChart widget. */ valueAxis?: PolarValueAxis; } - /** A chart widget displaying data in a polar coordinate system. */ - export class dxPolarChart extends BaseChart { - constructor(element: JQuery, options?: dxPolarChartOptions); - constructor(element: Element, options?: dxPolarChartOptions); - } export interface PieLegend extends core.BaseLegend { /** Specifies what chart elements to highlight when a corresponding item in the legend is hovered over. */ hoverMode?: string; @@ -5983,12 +6331,11 @@ declare module DevExpress.viz.charts { export interface dxPieChartOptions extends BaseChartOptions { /** Specifies adaptive layout options. */ adaptiveLayout?: { - /** Specifies whether or not point labels can be hidden when the layout is adapting. */ keepLabels?: boolean; }; - /** Specifies dxPieChart legend options. */ + /** Specifies PieChart legend options. */ legend?: PieLegend; - /** Specifies options for the series of the dxPieChart widget. */ + /** Specifies options for the series of the PieChart widget. */ series?: Array; /** Specifies the diameter of the pie. */ diameter?: number; @@ -6002,32 +6349,46 @@ declare module DevExpress.viz.charts { onLegendClick?: any; /** Specifies how a chart must behave when series point labels overlap. */ resolveLabelOverlapping?: string; - /** An object defining the configuration options that are common for all series of the dxPieChart widget. */ + /** An object defining the configuration options that are common for all series of the PieChart widget. */ commonSeriesSettings?: CommonPieSeriesSettings; /** Specifies the type of the pie chart series. */ type?: string; } - /** A circular chart widget for HTML JS applications. */ - export class dxPieChart extends BaseChart { - constructor(element: JQuery, options?: dxPieChartOptions); - constructor(element: Element, options?: dxPieChartOptions); +} +declare module DevExpress.viz { + /** A widget providing charts of various types for web applications. */ + export class dxChart extends DevExpress.viz.charts.BaseChart { + constructor(element: JQuery, options?: DevExpress.viz.charts.dxChartOptions); + constructor(element: Element, options?: DevExpress.viz.charts.dxChartOptions); + /** Sets the specified start and end values for the chart's argument axis. */ + zoomArgument(startValue: any, endValue: any): void; + } + /** A circular chart widget for web applications. */ + export class dxPieChart extends DevExpress.viz.charts.BaseChart { + constructor(element: JQuery, options?: DevExpress.viz.charts.dxPieChartOptions); + constructor(element: Element, options?: DevExpress.viz.charts.dxPieChartOptions); /** - * Provides access to the dxPieChart series. + * Provides access to the PieChart series. * @deprecated Use the getAllSeries() method instead. */ - getSeries(): PieSeries; + getSeries(): DevExpress.viz.charts.PieSeries; + } + /** A chart widget displaying data in a polar coordinate system. */ + export class dxPolarChart extends DevExpress.viz.charts.BaseChart { + constructor(element: JQuery, options?: DevExpress.viz.charts.dxPolarChartOptions); + constructor(element: Element, options?: DevExpress.viz.charts.dxPolarChartOptions); } } interface JQuery { dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; dxChart(methodName: string, ...params: any[]): any; - dxChart(methodName: "instance"): DevExpress.viz.charts.dxChart; + dxChart(methodName: "instance"): DevExpress.viz.dxChart; dxPieChart(options?: DevExpress.viz.charts.dxPieChartOptions): JQuery; dxPieChart(methodName: string, ...params: any[]): any; - dxPieChart(methodName: "instance"): DevExpress.viz.charts.dxPieChart; + dxPieChart(methodName: "instance"): DevExpress.viz.dxPieChart; dxPolarChart(options?: DevExpress.viz.charts.dxPolarChartOptions): JQuery; dxPolarChart(methodName: string, ...params: any[]): any; - dxPolarChart(methodName: "instance"): DevExpress.viz.charts.dxPolarChart; + dxPolarChart(methodName: "instance"): DevExpress.viz.dxPolarChart; } declare module DevExpress.viz.gauges { export interface BaseRangeContainer { @@ -6097,8 +6458,11 @@ declare module DevExpress.viz.gauges { /** Specifies font options for the text displayed in the scale labels of the gauge. */ font?: viz.core.Font; /** Specifies a format for the text displayed in scale labels. */ - format?: string; - /** Specifies a precision for the formatted value displayed in the scale labels. */ + format?: any; + /** + * Specifies a precision for the formatted value displayed in the scale labels. + * @deprecated Use the scale | label | format | precision option instead. + */ precision?: number; /** Specifies whether or not scale labels are visible on the gauge. */ visible?: boolean; @@ -6175,10 +6539,13 @@ declare module DevExpress.viz.gauges { customizeText?: (indicatedValue: { value: number; valueText: string }) => string; font?: viz.core.Font; /** Specifies a format for the text displayed in an indicator. */ - format?: string; + format?: any; /** Specifies the range bar's label indent in pixels. */ indent?: number; - /** Specifies a precision for the formatted value displayed by an indicator. */ + /** + * Specifies a precision for the formatted value displayed by an indicator. + * @deprecated Use the text | format | precision option instead. + */ precision?: number; }; offset?: number; @@ -6187,7 +6554,7 @@ declare module DevExpress.viz.gauges { /** Specifies the length of an arrow for the indicator of the textCloud type in pixels. */ arrowLength?: number; /** Sets the array of colors to be used for coloring subvalue indicators. */ - palette?: Array; + palette?: any; /** Specifies the distance between the needle and the center of a gauge for the indicator of a needle-like type. */ indentFromCenter?: number; /** Specifies the second color for the indicator of the twoColorNeedle type. */ @@ -6198,20 +6565,14 @@ declare module DevExpress.viz.gauges { spindleSize?: number; /** Specifies the inner diameter in pixels, so that the spindle has the shape of a ring. */ spindleGapSize?: number; - /** Specifies the orientation of the rangeBar indicator on a vertically oriented dxLinearGauge widget. */ + /** Specifies the orientation of the rangeBar indicator on a vertically oriented LinearGauge widget. */ horizontalOrientation?: string; - /** Specifies the orientation of the rangeBar indicator on a horizontally oriented dxLinearGauge widget. */ + /** Specifies the orientation of the rangeBar indicator on a horizontally oriented LinearGauge widget. */ verticalOrientation?: string; } - export interface SharedGaugeOptions { + export interface SharedGaugeOptions extends viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { /** Specifies animation options. */ animation?: viz.core.Animation; - /** Specifies the appearance of the loading indicator. */ - loadingIndicator?: viz.core.LoadingIndicator; - /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ - redrawOnResize?: boolean; - /** Specifies the size of the widget in pixels. */ - size?: viz.core.Size; /** * Specifies a subtitle for the widget. * @deprecated Use the title | subtitle option instead. @@ -6228,34 +6589,7 @@ declare module DevExpress.viz.gauges { */ text?: string; }; - /** Specifies a title for a gauge. */ - title?: { - /** Specifies font options for the title. */ - font?: viz.core.Font; - /** - * Specifies a title's position on the gauge. - * @deprecated Use the horizontalAlignment and verticalAlignment options instead. - */ - position?: string; - /** Specifies the distance between the title and surrounding gauge elements in pixels. */ - margin?: viz.core.Margins; - /** Specifies the height of the space reserved for the title. */ - placeholderSize?: number; - /** Specifies the gauge title's position in the vertical direction. */ - verticalAlignment?: string; - /** Specifies the gauge title's horizontal position. */ - horizontalAlignment?: string; - /** Specifies text for the title. */ - text?: string; - /** Specifies a subtitle for the widget. */ - subtitle?: { - /** Specifies font options for the subtitle. */ - font?: viz.core.Font; - /** Specifies text for the subtitle. */ - text?: string; - } - }; - /** Specifies options for gauge tooltips. */ + /** Configures tooltips. */ tooltip?: viz.core.Tooltip; /** A handler for the tooltipShown event. */ onTooltipShown?: (e: { @@ -6273,8 +6607,6 @@ declare module DevExpress.viz.gauges { export interface BaseGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { /** Specifies the color of the parent page element. */ containerBackgroundColor?: string; - /** Specifies the blank space in pixels between the widget's extreme elements and the boundaries of the area provided for the widget (see the size option). */ - margin?: viz.core.Margins; /** Specifies options of the gauge's range container. */ rangeContainer?: BaseRangeContainer; /** Specifies a gauge's scale options. */ @@ -6289,13 +6621,9 @@ declare module DevExpress.viz.gauges { valueIndicator?: BaseValueIndicator; } /** A gauge widget. */ - export class dxBaseGauge extends viz.core.BaseWidget { - /** Displays the loading indicator. */ + export class dxBaseGauge extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { showLoadingIndicator(): void; - /** Conceals the loading indicator. */ hideLoadingIndicator(): void; - /** Redraws a widget. */ - render(): void; /** Returns the main gauge value. */ value(): number; /** Updates a gauge value. */ @@ -6306,11 +6634,11 @@ declare module DevExpress.viz.gauges { subvalues(subvalues: Array): void; } export interface LinearRangeContainer extends BaseRangeContainer { - /** Specifies the orientation of the range container on a vertically oriented dxLinearGauge widget. */ + /** Specifies the orientation of the range container on a vertically oriented LinearGauge widget. */ horizontalOrientation?: string; - /** Specifies the orientation of a range container on a horizontally oriented dxLinearGauge widget. */ + /** Specifies the orientation of a range container on a horizontally oriented LinearGauge widget. */ verticalOrientation?: string; - /** Specifies the width of the range container's start and end boundaries in the dxLinearGauge widget. */ + /** Specifies the width of the range container's start and end boundaries in the LinearGauge widget. */ width?: any; /** Specifies an end width of a range container. */ end?: number; @@ -6322,29 +6650,24 @@ declare module DevExpress.viz.gauges { indentFromTick?: number; } export interface LinearScale extends BaseScale { - /** Specifies the orientation of scale ticks on a vertically oriented dxLinearGauge widget. */ + /** Specifies the orientation of scale ticks on a vertically oriented LinearGauge widget. */ horizontalOrientation?: string; label?: LinearScaleLabel; - /** Specifies the orientation of scale ticks on a horizontally oriented dxLinearGauge widget. */ + /** Specifies the orientation of scale ticks on a horizontally oriented LinearGauge widget. */ verticalOrientation?: string; } export interface dxLinearGaugeOptions extends BaseGaugeOptions { - /** Specifies the options required to set the geometry of the dxLinearGauge widget. */ + /** Specifies the options required to set the geometry of the LinearGauge widget. */ geometry?: { - /** Indicates whether to display the dxLinearGauge widget vertically or horizontally. */ + /** Indicates whether to display the LinearGauge widget vertically or horizontally. */ orientation?: string; }; /** Specifies gauge range container options. */ rangeContainer?: LinearRangeContainer; scale?: LinearScale; } - /** A widget that represents a gauge with a linear scale. */ - export class dxLinearGauge extends dxBaseGauge { - constructor(element: JQuery, options?: dxLinearGaugeOptions); - constructor(element: Element, options?: dxLinearGaugeOptions); - } export interface CircularRangeContainer extends BaseRangeContainer { - /** Specifies the orientation of the range container in the dxCircularGauge widget. */ + /** Specifies the orientation of the range container in the CircularGauge widget. */ orientation?: string; /** Specifies the range container's width in pixels. */ width?: number; @@ -6359,7 +6682,7 @@ declare module DevExpress.viz.gauges { orientation?: string; } export interface dxCircularGaugeOptions extends BaseGaugeOptions { - /** Specifies the options required to set the geometry of the dxCircularGauge widget. */ + /** Specifies the options required to set the geometry of the CircularGauge widget. */ geometry?: { /** Specifies the end angle of the circular gauge's arc. */ endAngle?: number; @@ -6370,11 +6693,6 @@ declare module DevExpress.viz.gauges { rangeContainer?: CircularRangeContainer; scale?: CircularScale; } - /** A widget that represents a gauge with a circular scale. */ - export class dxCircularGauge extends dxBaseGauge { - constructor(element: JQuery, options?: dxCircularGaugeOptions); - constructor(element: Element, options?: dxCircularGaugeOptions); - } export interface dxBarGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { /** Specifies a color for the remaining segment of the bar's track. */ backgroundColor?: string; @@ -6402,10 +6720,13 @@ declare module DevExpress.viz.gauges { /** Specifies font options for bar labels. */ font?: viz.core.Font; /** Specifies a format for bar labels. */ - format?: string; + format?: any; /** Specifies the distance between the upper bar and bar labels in pixels. */ indent?: number; - /** Specifies a precision for the formatted value displayed by labels. */ + /** + * Specifies a precision for the formatted value displayed by labels. + * @deprecated Use the label | format | precision option instead. + */ precision?: number; /** Specifies whether bar labels appear on a gauge or not. */ visible?: boolean; @@ -6419,16 +6740,24 @@ declare module DevExpress.viz.gauges { /** Specifies the array of values to be indicated on a bar gauge. */ values?: Array; } +} +declare module DevExpress.viz { + /** A widget that represents a gauge with a linear scale. */ + export class dxLinearGauge extends DevExpress.viz.gauges.dxBaseGauge { + constructor(element: JQuery, options?: DevExpress.viz.gauges.dxLinearGaugeOptions); + constructor(element: Element, options?: DevExpress.viz.gauges.dxLinearGaugeOptions); + } + /** A widget that represents a gauge with a circular scale. */ + export class dxCircularGauge extends DevExpress.viz.gauges.dxBaseGauge { + constructor(element: JQuery, options?: DevExpress.viz.gauges.dxCircularGaugeOptions); + constructor(element: Element, options?: DevExpress.viz.gauges.dxCircularGaugeOptions); + } /** A circular bar widget. */ - export class dxBarGauge extends viz.core.BaseWidget { - constructor(element: JQuery, options?: dxBarGaugeOptions); - constructor(element: Element, options?: dxBarGaugeOptions); - /** Displays the loading indicator. */ + export class dxBarGauge extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.gauges.dxBarGaugeOptions); + constructor(element: Element, options?: DevExpress.viz.gauges.dxBarGaugeOptions); showLoadingIndicator(): void; - /** Conceals the loading indicator. */ hideLoadingIndicator(): void; - /** Redraws the widget. */ - render(): void; /** Returns an array of gauge values. */ values(): Array; /** Updates the values displayed by a gauge. */ @@ -6438,19 +6767,19 @@ declare module DevExpress.viz.gauges { interface JQuery { dxLinearGauge(options?: DevExpress.viz.gauges.dxLinearGaugeOptions): JQuery; dxLinearGauge(methodName: string, ...params: any[]): any; - dxLinearGauge(methodName: "instance"): DevExpress.viz.gauges.dxLinearGauge; + dxLinearGauge(methodName: "instance"): DevExpress.viz.dxLinearGauge; dxCircularGauge(options?: DevExpress.viz.gauges.dxCircularGaugeOptions): JQuery; dxCircularGauge(methodName: string, ...params: any[]): any; - dxCircularGauge(methodName: "instance"): DevExpress.viz.gauges.dxCircularGauge; + dxCircularGauge(methodName: "instance"): DevExpress.viz.dxCircularGauge; dxBarGauge(options?: DevExpress.viz.gauges.dxBarGaugeOptions): JQuery; dxBarGauge(methodName: string, ...params: any[]): any; - dxBarGauge(methodName: "instance"): DevExpress.viz.gauges.dxBarGauge; + dxBarGauge(methodName: "instance"): DevExpress.viz.dxBarGauge; } declare module DevExpress.viz.rangeSelector { - export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions { + export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { /** Specifies the options for the range selector's background. */ background?: { - /** Specifies the background color for the dxRangeSelector. */ + /** Specifies the background color for the RangeSelector. */ color?: string; /** Specifies image options. */ image?: { @@ -6462,9 +6791,7 @@ declare module DevExpress.viz.rangeSelector { /** Indicates whether or not the background (background color and/or image) is visible. */ visible?: boolean; }; - /** Specifies a title for the range selector. */ - title?: viz.core.Title; - /** Specifies the dxRangeSelector's behavior options. */ + /** Specifies the RangeSelector's behavior options. */ behavior?: { /** Indicates whether or not you can swap sliders. */ allowSlidersSwap?: boolean; @@ -6510,7 +6837,7 @@ declare module DevExpress.viz.rangeSelector { topIndent?: number; /** Specifies whether or not to filter the series points depending on their quantity. */ useAggregation?: boolean; - /** Specifies options for the chart's value axis. */ + /** Configures the chart value axis. */ valueAxis?: { /** Indicates whether or not the chart's value axis must be inverted. */ inverted?: boolean; @@ -6532,12 +6859,6 @@ declare module DevExpress.viz.rangeSelector { dataSource?: any; /** Specifies the data source field that provides data for the scale. */ dataSourceField?: string; - /** Specifies the appearance of the loading indicator. */ - loadingIndicator?: viz.core.LoadingIndicator; - /** Specifies the blank space in pixels between the dxRangeSelector widget's extreme elements and the boundaries of the area provided for the widget (see size). */ - margin?: viz.core.Margins; - /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ - redrawOnResize?: boolean; /** Specifies options of the range selector's scale. */ scale?: { /** Specifies the scale's end value. */ @@ -6549,8 +6870,11 @@ declare module DevExpress.viz.rangeSelector { /** Specifies font options for the text displayed in the range selector's scale labels. */ font?: viz.core.Font; /** Specifies a format for the text displayed in scale labels. */ - format?: string; - /** Specifies a precision for the formatted value displayed in the scale labels. */ + format?: any; + /** + * Specifies a precision for the formatted value displayed in the scale labels. + * @deprecated Use the scale | label | format | precision option instead. + */ precision?: number; /** Specifies a spacing between scale labels and the background bottom edge. */ topIndent?: number; @@ -6573,7 +6897,7 @@ declare module DevExpress.viz.rangeSelector { /** Specifies a callback function that returns the text to be displayed in scale markers. */ customizeText?: (markerValue: { value: any; valueText: string }) => string; /** Specifies a format for the text displayed in scale markers. */ - format?: string; + format?: any; }; /** Specifies the height of the marker's separator. */ separatorHeight?: number; @@ -6636,11 +6960,11 @@ declare module DevExpress.viz.rangeSelector { /** Specifies the order of arguments on a discrete scale. */ categories?: Array; }; - /** Specifies the range to be selected when displaying the dxRangeSelector. */ + /** Specifies the range to be selected when displaying the RangeSelector. */ selectedRange?: { - /** Specifies the start value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + /** Specifies the start value of the range to be selected when displaying the RangeSelector widget on a page. */ startValue?: any; - /** Specifies the end value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + /** Specifies the end value of the range to be selected when displaying the RangeSelector widget on a page. */ endValue?: any; }; /** Specifies the color of the selected range. */ @@ -6666,8 +6990,6 @@ declare module DevExpress.viz.rangeSelector { /** Specifies the opacity of the color of shutters. */ opacity?: number; }; - /** Specifies in pixels the size of the dxRangeSelector widget. */ - size?: viz.core.Size; /** Specifies the appearance of the range selector's slider handles. */ sliderHandle?: { /** Specifies the color of the slider handles. */ @@ -6686,7 +7008,7 @@ declare module DevExpress.viz.rangeSelector { /** Specifies font options for the text displayed by the range selector slider markers. */ font?: viz.core.Font; /** Specifies a format for the text displayed in slider markers. */ - format?: string; + format?: any; /** Specifies the color used for the slider marker text when the currently selected range does not match the minRange and maxRange values. */ invalidRangeColor?: string; /** @@ -6715,19 +7037,22 @@ declare module DevExpress.viz.rangeSelector { right?: number; }; }; - /** Specifies a precision for the formatted value displayed in slider markers. */ + /** + * Specifies a precision for the formatted value displayed in slider markers. + * @deprecated Use the sliderMarker | format | precision option instead. + */ precision?: number; /** Indicates whether or not the slider markers are visible. */ visible?: boolean; }; } +} +declare module DevExpress.viz { /** A widget that allows end users to select a range of values on a scale. */ - export class dxRangeSelector extends viz.core.BaseWidget { - constructor(element: JQuery, options?: dxRangeSelectorOptions); - constructor(element: Element, options?: dxRangeSelectorOptions); - /** Displays the loading indicator. */ + export class dxRangeSelector extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions); + constructor(element: Element, options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions); showLoadingIndicator(): void; - /** Conceals the loading indicator. */ hideLoadingIndicator(): void; /** Redraws a widget. */ render(skipChartAnimation?: boolean): void; @@ -6740,7 +7065,7 @@ declare module DevExpress.viz.rangeSelector { interface JQuery { dxRangeSelector(options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; dxRangeSelector(methodName: string, ...params: any[]): any; - dxRangeSelector(methodName: "instance"): DevExpress.viz.rangeSelector.dxRangeSelector; + dxRangeSelector(methodName: "instance"): DevExpress.viz.dxRangeSelector; } declare module DevExpress.viz.map { /** This section describes the fields and methods that can be used in code to manipulate the Layer object. */ @@ -6919,7 +7244,7 @@ declare module DevExpress.viz.map { customize?: (eleemnts: Array) => void; /** Specifies marker label options. */ label?: { - /** The name of the dataSource attribute containing marker texts. */ + /** The name of the data source attribute containing marker texts. */ dataField?: string; /** Enables marker labels. */ enabled?: boolean; @@ -7158,7 +7483,7 @@ declare module DevExpress.viz.map { */ sizeGroupingField?: string; } - export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions { + export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { /** * An object specifying options for the map areas. * @deprecated Use the "area" type element of the layers array. @@ -7171,7 +7496,7 @@ declare module DevExpress.viz.map { /** Specifies a color for the background. */ color?: string; }; - /** Specifies options for dxVectorMap widget layers. */ + /** Specifies options for VectorMap widget layers. */ layers?: Array; /** Specifies the map projection. */ projection?: Object; @@ -7194,8 +7519,6 @@ declare module DevExpress.viz.map { /** Specifies the opacity of the control bar. */ opacity?: number; }; - /** Specifies the appearance of the loading indicator. */ - loadingIndicator?: viz.core.LoadingIndicator; /** * Specifies a data source for the map area. * @deprecated Use the layers | dataSource option instead. @@ -7211,11 +7534,7 @@ declare module DevExpress.viz.map { * @deprecated Use the "marker" type element of the layers array. */ markerSettings?: MarkerSettings; - /** Specifies the size of the dxVectorMap widget. */ - size?: viz.core.Size; - /** Specifies a title for the vector map. */ - title?: viz.core.Title; - /** Specifies tooltip options. */ + /** Configures tooltips. */ tooltip?: viz.core.Tooltip; /** Configures map legends. */ legends?: Array; @@ -7297,6 +7616,8 @@ declare module DevExpress.viz.map { export interface Legend extends viz.core.BaseLegend { /** Specifies the color of item markers in the legend. The specified color applied only when the legend uses 'size' source. */ markerColor?: string; + /** Specifies the shape of item markers. */ + markerShape?: string; /** Specifies text for legend items. */ customizeText?: (itemInfo: { start: number; end: number; index: number; color: string; size: number; }) => string; /** Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item. */ @@ -7309,16 +7630,27 @@ declare module DevExpress.viz.map { grouping?: string; } } + export var projection: ProjectionCreator; + export interface ProjectionCreator { + /** Creates a new projection. */ + (data: { + to?: (coordinates: Array) => Array; + from?: (coordinates: Array) => Array; + aspectRatio?: number; + }): Object; + /** Gets the default or custom projection from the projection storage. */ + get(name: string): Object; + /** Adds a new projection to the internal projections storage. */ + add(name: string, projection: Object): void; + } +} +declare module DevExpress.viz{ /** A vector map widget. */ - export class dxVectorMap extends viz.core.BaseWidget { - constructor(element: JQuery, options?: dxVectorMapOptions); - constructor(element: Element, options?: dxVectorMapOptions); - /** Displays the loading indicator. */ + export class dxVectorMap extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.map.dxVectorMapOptions); + constructor(element: Element, options?: DevExpress.viz.map.dxVectorMapOptions); showLoadingIndicator(): void; - /** Conceals the loading indicator. */ hideLoadingIndicator(): void; - /** Redraws a widget. */ - render(): void; /** Gets the current coordinates of the map center. */ center(): Array; /** Sets the coordinates of the map center. */ @@ -7338,21 +7670,21 @@ declare module DevExpress.viz.map { /** Converts client area coordinates into map coordinates. */ convertCoordinates(x: number, y: number): Array; /** Gets all map layers. */ - getLayers(): Array; + getLayers(): Array; /** Gets the layer by its index. */ - getLayerByIndex(index: number): MapLayer; + getLayerByIndex(index: number): DevExpress.viz.map.MapLayer; /** Gets the layer by its name. */ - getLayerByName(name: string): MapLayer; + getLayerByName(name: string): DevExpress.viz.map.MapLayer; /** * Returns an array with all the map areas. * @deprecated Use the layer's getElements() method instead. */ - getAreas(): Array; + getAreas(): Array; /** * Returns an array with all the map markers. * @deprecated Use the layer's getElements() method instead. */ - getMarkers(): Array; + getMarkers(): Array; /** Gets the current coordinates of the map viewport. */ viewport(): Array; /** Sets the coordinates of the map viewport. */ @@ -7362,24 +7694,11 @@ declare module DevExpress.viz.map { /** Sets the value of the map zoom factor. */ zoomFactor(zoomFactor: number): void; } - export var projection: ProjectionCreator; - export interface ProjectionCreator { - /** Creates a new projection. */ - (data: { - to?: (coordinates: Array) => Array; - from?: (coordinates: Array) => Array; - aspectRatio?: number; - }): Object; - /** Gets the default or custom projection from the projection storage. */ - get(name: string): Object; - /** Adds a new projection to the internal projections storage. */ - add(name: string, projection: Object): void; - } } interface JQuery { dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; dxVectorMap(methodName: string, ...params: any[]): any; - dxVectorMap(methodName: "instance"): DevExpress.viz.map.dxVectorMap; + dxVectorMap(methodName: "instance"): DevExpress.viz.dxVectorMap; } declare module DevExpress.viz.sparklines { export interface SparklineTooltip extends viz.core.Tooltip { @@ -7394,12 +7713,8 @@ declare module DevExpress.viz.sparklines { */ verticalAlignment?: string; } - export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions { - /** Specifies the blank space between the widget's extreme elements and the boundaries of the area provided for the widget in pixels. */ - margin?: viz.core.Margins; - /** Specifies the size of the widget. */ - size?: viz.core.Size; - /** Specifies tooltip options. */ + export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions, viz.core.MarginOptions { + /** Configures the tooltip. */ tooltip?: SparklineTooltip; /** A handler for the tooltipShown event. */ onTooltipShown?: (e: { @@ -7414,10 +7729,8 @@ declare module DevExpress.viz.sparklines { } /** Overridden by descriptions for particular widgets. */ export class BaseSparkline extends viz.core.BaseWidget { - /** Redraws a widget. */ - render(): void; } - export interface dxBulletOptions extends BaseSparkline { + export interface dxBulletOptions extends BaseSparklineOptions { /** Specifies a color for the bullet bar. */ color?: string; /** Specifies an end value for the invisible scale. */ @@ -7437,11 +7750,6 @@ declare module DevExpress.viz.sparklines { /** Specifies the primary value indicated by the bullet bar. */ value?: number; } - /** A bullet graph widget. */ - export class dxBullet extends BaseSparkline { - constructor(element: JQuery, options?: dxBulletOptions); - constructor(element: Element, options?: dxBulletOptions); - } export interface dxSparklineOptions extends BaseSparklineOptions { /** Specifies the data source field that provides arguments for a sparkline. */ argumentField?: string; @@ -7488,17 +7796,257 @@ declare module DevExpress.viz.sparklines { /** Specifies the maximum value of the sparkline's value axis. */ maxValue?: number; } +} +declare module DevExpress.viz { + /** A bullet graph widget. */ + export class dxBullet extends DevExpress.viz.sparklines.BaseSparkline { + constructor(element: JQuery, options?: DevExpress.viz.sparklines.dxBulletOptions); + constructor(element: Element, options?: DevExpress.viz.sparklines.dxBulletOptions); + } /** A sparkline widget. */ - export class dxSparkline extends BaseSparkline { - constructor(element: JQuery, options?: dxSparklineOptions); - constructor(element: Element, options?: dxSparklineOptions); + export class dxSparkline extends DevExpress.viz.sparklines.BaseSparkline { + constructor(element: JQuery, options?: DevExpress.viz.sparklines.dxSparklineOptions); + constructor(element: Element, options?: DevExpress.viz.sparklines.dxSparklineOptions); } } interface JQuery { dxBullet(options?: DevExpress.viz.sparklines.dxBulletOptions): JQuery; dxBullet(methodName: string, ...params: any[]): any; - dxBullet(methodName: "instance"): DevExpress.viz.sparklines.dxBullet; + dxBullet(methodName: "instance"): DevExpress.viz.dxBullet; dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery; dxSparkline(methodName: string, ...params: any[]): any; - dxSparkline(methodName: "instance"): DevExpress.viz.sparklines.dxSparkline; + dxSparkline(methodName: "instance"): DevExpress.viz.dxSparkline; +} +declare module DevExpress.viz.treeMap { + export interface dxTreeMapOptions extends viz.core.BaseWidgetOptions, viz.core.RedrawOnResizeOptions, viz.core.TitleOptions, viz.core.LoadingIndicatorOptions, viz.core.ExportOptions { + /** Specifies the origin of data for the widget. */ + dataSource?: any; + /** Specifies the name of the data source field that provides nested items for a group. Applies to hierarchical data sources only. */ + childrenField?: string; + /** Specifies the name of the data source field that provides values for tiles. */ + valueField?: string; + /** Specifies the name of the data source field that provides colors for tiles. */ + colorField?: string; + /** Specifies the name of the data source field that provides texts for tile and group labels. */ + labelField?: string; + /** Specifies the name of the data source field that provides IDs for items. Applies to flat data sources only. */ + idField?: string; + /** Specifies the name of the data source field that provides parent IDs for items. Applies to flat data sources only. */ + parentField?: string; + /** Specifies the layout algorithm. */ + layoutAlgorithm?: any; + /** Specifies the direction in which the items will be laid out. */ + layoutDirection?: string; + /** Configures tiles. */ + tile?: { + /** Configures the tile borders. */ + border?: { + /** Specifies the width of the tile borders in pixels. */ + width?: number; + /** Colors the tile borders. */ + color?: string; + }; + /** Specifies a single color for all tiles. */ + color?: string; + /** Specifies the appearance of tiles in the hover state. */ + hoverStyle?: { + /** Configures the appearance of the tile borders in the hover state. */ + border?: { + /** Specifies the width of the tile borders in pixels. Applies to a tile in the hover state. */ + width?: number; + /** Colors the tile borders in the hover state. */ + color?: string; + }; + /** Colors tiles in the hover state. */ + color?: string; + }; + /** Specifies the appearance of tiles in the selected state. */ + selectionStyle?: { + /** Configures the appearance of the tile borders in the selected state. */ + border?: { + /** Specifies the width of the tile borders in pixels. Applies to a tile in the selected state. */ + width?: number; + /** Colors the tile borders in the selected state. */ + color?: string; + }; + /** Colors tiles in the selected state. */ + color?: string; + }; + /** Configures the tile labels. */ + label?: { + /** Changes the visibility of the tile labels. */ + visible?: boolean; + /** Specifies the font settings of the tile labels. */ + font?: viz.core.Font; + }; + }; + /** Configures groups. */ + group?: { + /** Specifies the height of the group headers in pixels. */ + headerHeight?: number; + /** Configures the group borders. */ + border?: { + /** Specifies the width of the group borders in pixels. */ + width?: number; + /** Colors the group borders. */ + color?: string; + }; + /** Colors the group headers. */ + color?: string; + /** Specifies the appearance of groups in the hover state. */ + hoverStyle?: { + /** Configures the appearance of the group borders in the hover state. */ + border?: { + /** Specifies the width of the group borders in pixels. Applies to a group in the hover state. */ + width?: number; + /** Colors the group borders in the hover state. */ + color?: string; + }; + /** Colors the group headers in the hover state. */ + color?: string; + }; + /** Specifies the appearance of groups in the selected state. */ + selectionStyle?: { + /** Configures the appearance of the group borders in the selected state. */ + border?: { + /** Specifies the width of the group borders in pixels. Applies to a group in the selected state. */ + width?: number; + /** Colors the group borders in the selected state. */ + color?: string; + }; + /** Colors the group headers in the selected state. */ + color?: string; + }; + /** Configures the group labels. */ + label?: { + /** Changes the visibility of the group labels. */ + visible?: boolean; + /** Specifies the font settings of the group labels. */ + font?: viz.core.Font; + }; + }; + /** Manages the color settings. */ + colorizer?: { + /** Specifies the colorizing algorithm. */ + type?: string; + /** Sets the palette to be used for colorizing tiles. */ + palette?: any; + /** Specifies whether or not all tiles in a group must be colored uniformly. Applies only if the type option is "discrete". */ + colorizeGroups?: boolean; + /** Allows you to paint tiles with similar values uniformly. Applies only if the type option is "gradient" or "range". */ + range?: Array; + /** Specifies the name of the data source field whose values define the color of a tile. Applies only if the type option is "gradient" or "range". */ + colorCodeField?: string; + }; + /** Specifies whether tiles and groups change their style in the hover state. */ + hoverEnabled?: boolean; + /** Specifies whether a single or multiple nodes can be in the selected state simultaneously. */ + selectionMode?: string; + /** Specifies how many hierarchical levels must be visualized. */ + maxDepth?: number; + /** Specifies whether the user will interact with a single tile or its group. */ + interactWithGroup?: boolean; + tooltip?: viz.core.Tooltip; + /** A handler for the nodesInitialized event. */ + onNodesInitialized?: (e: { + component: dxTreeMap; + element: Element; + root: TreeMapNode + }) => void; + /** A handler for the nodesRendering event. */ + onNodesRendering?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode + }) => void; + /** A handler for the click event. */ + onClick?: any; + /** A handler for the hoverChanged event. */ + onHoverChanged?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode; + }) => void; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode; + }) => void; + /** A handler for the drill event. */ + onDrill?: (e: { + component: dxTreeMap; + element: Element; + node: TreeMapNode + }) => void; + } + /** This section describes fields and methods that can be used in code to manipulate a Node object. */ + export interface TreeMapNode { + /** The level that the current node occupies in the hierarchy of nodes. */ + level: number; + /** The index of the current node in the array of all nodes on the same level. */ + index: number; + /** The object from the data source visualized by the node. */ + data: Object; + /** Returns the parent node of the current node. */ + getParent(): TreeMapNode; + /** Indicates how many direct descendants the current node has. */ + getChildrenCount(): number; + /** Returns all nodes nested in the current node. */ + getAllChildren(): Array; + /** Returns all descendant nodes. */ + getAllNodes(): Array; + /** Gets a specific node from a collection of direct descendants. */ + getChild(index: number): TreeMapNode; + /** Gets the raw value of the node. */ + value(): number; + /** Returns the label of the node. */ + label(): string; + /** Sets the label to the node. */ + label(label: string): void; + /** Customizes the node. */ + customize(options: any): void; + /** Reverts the appearance of the node to the initial state. */ + resetCustomization(): void; + /** Indicates whether the node is in the hover state or not. */ + isHovered(): boolean; + /** Sets the selection state of a node. */ + select(state: boolean): void; + /** Indicates whether the node is selected or not. */ + isSelected(): boolean; + /** Indicates whether the node is visualized by a tile or a group of tiles. */ + isLeaf(): boolean; + /** Indicates whether the current node is active. */ + isActive(): boolean; + /** Shows the tooltip. */ + showTooltip(): void; + /** Drills down into the node. */ + drillDown(): void; + } +} +declare module DevExpress.viz { + /** A widget for displaying hierarchical data by using nested rectangles. */ + export class dxTreeMap extends viz.core.BaseWidget implements viz.core.LoadingIndicatorMethods { + constructor(element: JQuery, options?: DevExpress.viz.treeMap.dxTreeMapOptions); + constructor(element: Element, options?: DevExpress.viz.treeMap.dxTreeMapOptions); + /** Returns the root node. */ + getRootNode(): DevExpress.viz.treeMap.TreeMapNode; + /** Returns the current node. */ + getCurrentNode(): DevExpress.viz.treeMap.TreeMapNode; + /** Deselects all nodes in the widget. */ + clearSelection(): void; + /** Hides the tooltip. */ + hideTooltip(): void; + /** Drills one level up. */ + drillUp(): void; + /** Resets the drill down level. */ + resetDrillDown(): void; + showLoadingIndicator(): void; + hideLoadingIndicator(): void; + } +} +interface JQuery { + dxTreeMap(options?: DevExpress.viz.treeMap.dxTreeMapOptions): JQuery; + dxTreeMap(methodName: string, ...params: any[]): any; + dxTreeMap(methodName: "instance"): DevExpress.viz.dxTreeMap; } diff --git a/devextreme/tsconfig.json b/devextreme/tsconfig.json index 80c2a0807f..df219b86db 100644 --- a/devextreme/tsconfig.json +++ b/devextreme/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/devtools-detect/tsconfig.json b/devtools-detect/tsconfig.json index b720f7cee1..fc6a2e2501 100644 --- a/devtools-detect/tsconfig.json +++ b/devtools-detect/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dexie/dexie-tests.ts b/dexie/dexie-tests.ts deleted file mode 100644 index 7eb6a75dbb..0000000000 --- a/dexie/dexie-tests.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Dexie from "dexie"; - -interface IFriend { - id?: number, - name?: string, - age?: number -} - -class MyDB extends Dexie { - friends: Dexie.Table; - constructor() { - super("MyDB"); - this.version(1).stores({ - friends: "++id,name,age" - }); - } -} - -var db = new MyDB(); - -db.friends.add({name: "Kalle", age: 23}).then(()=>{ - db.friends.where('age').below(30).count(count => { - console.log("Num yound friends: " + count); - }); -}); diff --git a/dexie/index.d.ts b/dexie/index.d.ts deleted file mode 100644 index 720d38fb29..0000000000 --- a/dexie/index.d.ts +++ /dev/null @@ -1,323 +0,0 @@ -// Type definitions for Dexie v1.3.1 -// Project: https://github.com/dfahlander/Dexie.js -// Definitions by: David Fahlander -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface Thenable { - then(onFulfilled: (value: R) => Thenable, onRejected: (error: any) => Thenable): Thenable; - then(onFulfilled: (value: R) => Thenable, onRejected?: (error: any) => U): Thenable; - then(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable): Thenable; - then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Thenable; -} - -declare type IndexableType = string | number | Date | Array; - -declare class Dexie { - constructor(databaseName: string); - - constructor(databaseName: string, options: { addons: Array<(db: Dexie) => void> }); - - name: string; - tables: Dexie.Table[]; - verno: number; - - static addons: Array<(db: Dexie) => void>; - static version: number; - - static getDatabaseNames(): Dexie.Promise>; - - static getDatabaseNames(onFulfilled: (value: Array) => Thenable): Dexie.Promise; - - static getDatabaseNames(onFulfilled: (value: Array) => U): Dexie.Promise; - - static getByKeyPath(obj: Object, keyPath: string): any; - - static setByKeyPath(obj: Object, keyPath: string, value: any): void; - - static delByKeyPath(obj: Object, keyPath: string): void; - - static shallowClone(obj: Object): Object; - - static deepClone(obj: Object): Object; - - static delete(databaseName : string): Dexie.Promise; - - static exists(databaseName : string): Dexie.Promise; - - version(versionNumber: Number): Dexie.Version - - on: { - (eventName: string, subscriber: () => any): void; - (eventName: string, subscriber: () => any, bSticky: boolean): void; - ready: Dexie.DexieOnReadyEvent; - error: Dexie.DexieErrorEvent; - populate: Dexie.DexieEvent; - blocked: Dexie.DexieEvent; - versionchange: Dexie.DexieVersionChangeEvent; - } - - open(): Dexie.Promise; - - table(tableName: string): Dexie.Table; - - table(tableName: string): Dexie.Table; - - table(tableName: string): Dexie.Table; - - transaction(mode: string, table: Dexie.Table, scope: () => Thenable): Dexie.Promise; - - transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, scope: () => Thenable): Dexie.Promise; - - transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, table3: Dexie.Table, scope: () => Thenable): Dexie.Promise; - - transaction(mode: string, tables: Dexie.Table[], scope: () => Thenable): Dexie.Promise; - - transaction(mode: string, table: Dexie.Table, scope: () => U): Dexie.Promise; - - transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, scope: () => U): Dexie.Promise; - - transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, table3: Dexie.Table, scope: () => U): Dexie.Promise; - - transaction(mode: string, tables: Dexie.Table[], scope: () => U): Dexie.Promise; - - close(): void; - - delete(): Dexie.Promise; - - exists(name : string) : Dexie.Promise; - - isOpen(): boolean; - - hasFailed(): boolean; - - backendDB(): IDBDatabase; - - vip(scopeFunction: () => U): U; -} - -declare namespace Dexie { - - class Promise implements Thenable { - constructor(callback: (resolve: (value?: Thenable) => void, reject: (error?: any) => void) => void); - - constructor(callback: (resolve: (value?: R) => void, reject: (error?: any) => void) => void); - - then(onFulfilled: (value: R) => Thenable, onRejected: (error: any) => Thenable): Promise; - - then(onFulfilled: (value: R) => Thenable, onRejected?: (error: any) => U): Promise; - - then(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable): Promise; - - then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Promise; - - catch(onRejected: (error: any) => Thenable): Promise; - - catch(onRejected: (error: any) => U): Promise; - - catch(ExceptionType: Function, onRejected: (error: any) => Promise): Promise; - - catch(ExceptionType: Function, onRejected: (error: any) => U): Promise; - - catch(errorName: string, onRejected: (error: any) => Promise): Promise; - - catch(errorName: string, onRejected: (error: any) => U): Promise; - - finally(onFinally: () => any): Promise; - - onuncatched: () => any; - } - - namespace Promise { - function resolve(value?: Thenable): Promise; - - function resolve(value?: R): Promise; - - function reject(error: any): Promise; - - function all(promises: Thenable[]): Promise; - - function all(...promises: Thenable[]): Promise; - - function race(promises: Thenable[]): Promise; - - function newPSD(scope: () => R): R; - - var PSD: any; - - var on: { - (eventName: string, subscriber: (...args: any[]) => any): void; - error: DexieErrorEvent; - } - } - - - interface Version { - stores(schema: { [key: string]: string }): Version; - upgrade(fn: (trans: Transaction) => void): Version; - } - - interface Transaction { - active: boolean; - db: Dexie; - mode: string; - idbtrans: IDBTransaction; - tables: { [type: string]: Table }; - storeNames: Array; - on: { - (eventName: string, subscriber: () => any): void; - complete: DexieEvent; - abort: DexieEvent; - error: DexieEvent; - } - abort(): void; - table(tableName: string): Table; - table(tableName: string): Table; - table(tableName: string): Table; - } - - interface DexieEvent { - subscribe(fn: () => any): void; - unsubscribe(fn: () => any): void; - fire(): any; - } - - interface DexieErrorEvent { - subscribe(fn: (error: any) => any): void; - unsubscribe(fn: (error: any) => any): void; - fire(error: any): any; - } - - interface DexieVersionChangeEvent { - subscribe(fn: (event: IDBVersionChangeEvent) => any): void; - unsubscribe(fn: (event: IDBVersionChangeEvent) => any): void; - fire(event: IDBVersionChangeEvent): any; - } - - interface DexieOnReadyEvent { - subscribe(fn: () => any, bSticky: boolean): void; - unsubscribe(fn: () => any): void; - fire(): any; - } - - interface Table { - name: string; - schema: TableSchema; - hook: { - (eventName: string, subscriber: () => any): void; - creating: DexieEvent; - reading: DexieEvent; - updating: DexieEvent; - deleting: DexieEvent; - } - - get(key: Key): Promise; - where(index: string): WhereClause; - - filter(fn: (obj: T) => boolean): Collection; - - count(): Promise; - count(onFulfilled: (value: number) => Thenable): Promise; - count(onFulfilled: (value: number) => U): Promise; - - offset(n: number): Collection; - - limit(n: number): Collection; - - each(callback: (obj: T, cursor: IDBCursor) => any): Promise; - - toArray(): Promise>; - toArray(onFulfilled: (value: Array) => Thenable): Promise; - toArray(onFulfilled: (value: Array) => U): Promise; - - toCollection(): Collection; - orderBy(index: string): Collection; - reverse(): Collection; - mapToClass(constructor: Function): Function; - add(item: T, key?: Key): Promise; - update(key: Key, changes: { [keyPath: string]: any }): Promise; - put(item: T, key?: Key): Promise; - delete(key: Key): Promise; - clear(): Promise; - } - - interface WhereClause { - above(key: IndexableType): Collection; - aboveOrEqual(key: IndexableType): Collection; - anyOf(keys: IndexableType[]): Collection; - anyOf(...keys: IndexableType[]): Collection; - anyOfIgnoreCase(keys: string[]): Collection; - anyOfIgnoreCase(...keys: string[]): Collection; - below(key: IndexableType): Collection; - belowOrEqual(key: IndexableType): Collection; - between(lower: IndexableType, upper: IndexableType, includeLower?: boolean, includeUpper?: boolean): Collection; - equals(key: IndexableType): Collection; - equalsIgnoreCase(key: string): Collection; - inAnyRange(ranges: Array): Collection; - startsWith(key: string): Collection; - startsWithAnyOf(prefixes: string[]): Collection; - startsWithAnyOf(...prefixes: string[]): Collection; - startsWithIgnoreCase(key: string): Collection; - startsWithAnyOfIgnoreCase(prefixes: string[]): Collection; - startsWithAnyOfIgnoreCase(...prefixes: string[]): Collection; - noneOf(keys: Array): Collection; - notEqual(key: IndexableType): Collection; - } - - interface Collection { - and(filter: (x: T) => boolean): Collection; - count(): Promise; - count(onFulfilled: (value: number) => Thenable): Promise; - count(onFulfilled: (value: number) => U): Promise; - distinct(): Collection; - each(callback: (obj: T, cursor: IDBCursor) => any): Promise; - eachKey(callback: (key: Key, cursor: IDBCursor) => any): Promise; - eachUniqueKey(callback: (key: Key, cursor: IDBCursor) => any): Promise; - first(): Promise; - first(onFulfilled: (value: T) => Thenable): Promise; - first(onFulfilled: (value: T) => U): Promise; - keys(): Promise; - keys(onFulfilled: (value: Key[]) => Thenable): Promise; - keys(onFulfilled: (value: Key[]) => U): Promise; - last(): Promise; - last(onFulfilled: (value: T) => Thenable): Promise; - last(onFulfilled: (value: T) => U): Promise; - limit(n: number): Collection; - offset(n: number): Collection; - or(indexOrPrimayKey: string): WhereClause; - reverse(): Collection; - sortBy(keyPath: string): Promise; - sortBy(keyPath: string, onFulfilled: (value: T[]) => Thenable): Promise; - sortBy(keyPath: string, onFulfilled: (value: T[]) => U): Promise; - toArray(): Promise>; - toArray(onFulfilled: (value: Array) => Thenable): Promise; - toArray(onFulfilled: (value: Array) => U): Promise; - uniqueKeys(): Promise; - uniqueKeys(onFulfilled: (value: Key[]) => Thenable): Promise; - uniqueKeys(onFulfilled: (value: Key[]) => U): Promise; - until(filter: (value: T) => boolean, includeStopEntry?: boolean): Collection; - // WriteableCollection: - delete(): Promise; - modify(changes: { [keyPath: string]: any }): Promise; - modify(changeCallback: (obj: T) => void): Promise; - } - - interface TableSchema { - name: string; - primKey: IndexSpec; - indexes: IndexSpec[]; - mappedClass: Function; - } - - interface IndexSpec { - name: string; - keyPath: any; // string | Array - unique: boolean; - multi: boolean; - auto: boolean; - compound: boolean; - src: string; - } -} - -export default Dexie; - diff --git a/df-visible/df-visible-tests.ts b/df-visible/df-visible-tests.ts index c5a8f1bf2b..b4fe92fdf3 100644 --- a/df-visible/df-visible-tests.ts +++ b/df-visible/df-visible-tests.ts @@ -1,5 +1,3 @@ -/// - // https://github.com/customd/jquery-visible/blob/master/examples/demo-basic.html $(function(){ diff --git a/df-visible/df-visible.d.ts b/df-visible/index.d.ts similarity index 100% rename from df-visible/df-visible.d.ts rename to df-visible/index.d.ts diff --git a/df-visible/tsconfig.json b/df-visible/tsconfig.json index 49c372fd65..326a233349 100644 --- a/df-visible/tsconfig.json +++ b/df-visible/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "df-visible.d.ts", + "index.d.ts", "df-visible-tests.ts" ] } \ No newline at end of file diff --git a/dhtmlxgantt/dhtmlxgantt-tests.ts b/dhtmlxgantt/dhtmlxgantt-tests.ts index f20a92506d..6ea32b509d 100644 --- a/dhtmlxgantt/dhtmlxgantt-tests.ts +++ b/dhtmlxgantt/dhtmlxgantt-tests.ts @@ -3,6 +3,7 @@ //date operations var start: Date = gantt.date.week_start(new Date()); var next: Date = gantt.date.add(new Date(), 1, "week"); +var datePos: Date = gantt.dateFromPos(0); //hotkeys gantt.keys.edit_cancel = 13; @@ -33,4 +34,4 @@ gantt.attachEvent("onBeforeLightbox", function (id?: string) { }); //gantt enterprise var gantt2 = Gantt.getGanttInstance(); -gantt2.config.api_date = "format"; \ No newline at end of file +gantt2.config.api_date = "format"; diff --git a/dhtmlxgantt/index.d.ts b/dhtmlxgantt/index.d.ts index a9542cc00f..f94ba88a33 100644 --- a/dhtmlxgantt/index.d.ts +++ b/dhtmlxgantt/index.d.ts @@ -1,13 +1,13 @@ // Type definitions for dhtmlxGantt 4.0.0 // Project: http://dhtmlx.com/docs/products/dhtmlxGantt -// Definitions by: Maksim Kozhukh +// Definitions by: Maksim Kozhukh , Christophe Camicas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface GanttCallback { (...args: any[]) : any } -type GanttEventName ='onAfterAutoSchedule'|'onAfterBatchUpdate'|'onAfterLightbox'|'onAfterLinkAdd'|'onAfterLinkDelete'|'onAfterLinkUpdate'|'onAfterRedo'|'onAfterTaskAdd'|'onAfterTaskAutoSchedule'|'onAfterTaskDelete'|'onAfterTaskDrag'|'onAfterTaskMove'|'onAfterTaskUpdate'|'onAfterUndo'|'onAjaxError'|'onBeforeAutoSchedule'|'onBeforeBatchUpdate'|'onBeforeCollapse'|'onBeforeDataRender'|'onBeforeExpand'|'onBeforeGanttReady'|'onBeforeGanttRender'|'onBeforeLightbox'|'onBeforeLinkAdd'|'onBeforeLinkDelete'|'onBeforeLinkDisplay'|'onBeforeLinkUpdate'|'onBeforeParse'|'onBeforeRedo'|'onBeforeRowDragEnd'|'onBeforeTaskAdd'|'onBeforeTaskAutoSchedule'|'onBeforeTaskChanged'|'onBeforeTaskDelete'|'onBeforeTaskDisplay'|'onBeforeTaskDrag'|'onBeforeTaskMove'|'onBeforeTaskSelected'|'onBeforeTaskUpdate'|'onBeforeUndo'|'onCircularLinkError'|'onClear'|'onCollapse'|'onColumnResize'|'onColumnResizeEnd'|'onColumnResizeStart'|'onContextMenu'|'onDataRender'|'onEmptyClick'|'onError'|'onExpand'|'onGanttReady'|'onGanttRender'|'onGanttScroll'|'onGridHeaderClick'|'onGridResize'|'onGridResizeEnd'|'onGridResizeStart'|'onLightbox'|'onLightboxButton'|'onLightboxCancel'|'onLightboxChange'|'onLightboxDelete'|'onLightboxSave'|'onLinkClick'|'onLinkDblClick'|'onLinkIdChange'|'onLinkValidation'|'onLoadEnd'|'onLoadStart'|'onMouseMove'|'onOptionsLoad'|'onParse'|'onRowDragEnd'|'onRowDragStart'|'onScaleAdjusted'|'onScaleClick'|'onTaskClick'|'onTaskClosed'|'onTaskCreated'|'onTaskDblClick'|'onTaskDrag'|'onTaskIdChange'|'onTaskLoading'|'onTaskOpened'|'onTaskRowClick'|'onTaskSelected'|'onTaskUnselected'|'onTemplatesReady'; +type GanttCallback = (...args: any[]) => any; +type GanttEventName = 'onAfterAutoSchedule'|'onAfterBatchUpdate'|'onAfterLightbox'|'onAfterLinkAdd'|'onAfterLinkDelete'|'onAfterLinkUpdate'|'onAfterRedo'|'onAfterTaskAdd'|'onAfterTaskAutoSchedule'|'onAfterTaskDelete'|'onAfterTaskDrag'|'onAfterTaskMove'|'onAfterTaskUpdate'|'onAfterUndo'|'onAjaxError'|'onBeforeAutoSchedule'|'onBeforeBatchUpdate'|'onBeforeCollapse'|'onBeforeDataRender'|'onBeforeExpand'|'onBeforeGanttReady'|'onBeforeGanttRender'|'onBeforeLightbox'|'onBeforeLinkAdd'|'onBeforeLinkDelete'|'onBeforeLinkDisplay'|'onBeforeLinkUpdate'|'onBeforeParse'|'onBeforeRedo'|'onBeforeRowDragEnd'|'onBeforeTaskAdd'|'onBeforeTaskAutoSchedule'|'onBeforeTaskChanged'|'onBeforeTaskDelete'|'onBeforeTaskDisplay'|'onBeforeTaskDrag'|'onBeforeTaskMove'|'onBeforeTaskSelected'|'onBeforeTaskUpdate'|'onBeforeUndo'|'onCircularLinkError'|'onClear'|'onCollapse'|'onColumnResize'|'onColumnResizeEnd'|'onColumnResizeStart'|'onContextMenu'|'onDataRender'|'onEmptyClick'|'onError'|'onExpand'|'onGanttReady'|'onGanttRender'|'onGanttScroll'|'onGridHeaderClick'|'onGridResize'|'onGridResizeEnd'|'onGridResizeStart'|'onLightbox'|'onLightboxButton'|'onLightboxCancel'|'onLightboxChange'|'onLightboxDelete'|'onLightboxSave'|'onLinkClick'|'onLinkDblClick'|'onLinkIdChange'|'onLinkValidation'|'onLoadEnd'|'onLoadStart'|'onMouseMove'|'onOptionsLoad'|'onParse'|'onRowDragEnd'|'onRowDragStart'|'onScaleAdjusted'|'onScaleClick'|'onTaskClick'|'onTaskClosed'|'onTaskCreated'|'onTaskDblClick'|'onTaskDrag'|'onTaskIdChange'|'onTaskLoading'|'onTaskOpened'|'onTaskRowClick'|'onTaskSelected'|'onTaskUnselected'|'onTemplatesReady'; -interface GanttTemplates{ +interface GanttTemplates { /** * specifies the format of dates that are set by means of API methods. Used to parse incoming dates * @param date the date which needs formatting @@ -269,7 +269,7 @@ interface GanttTemplates{ } -interface GanttConfigOptions{ +interface GanttConfigOptions { /** * sets the date format for addTask() method to */ @@ -802,7 +802,7 @@ interface GanttConfigOptions{ } -interface GanttDateHelpers{ +interface GanttDateHelpers { add(origin: Date, count: number, unit: string): Date; copy(origin: Date): Date; @@ -823,21 +823,21 @@ interface GanttDateHelpers{ to_fixed(value: number): string; } -interface GanttHotkeys{ +interface GanttHotkeys { edit_save: number; edit_cancel: number; } -//Gantt.locale +//Gantt.locale -interface GanttLocaleDate{ +interface GanttLocaleDate { month_full: string[]; month_short: string[]; day_full: string[]; day_short: string[]; } -interface GanttLocaleLabels{ +interface GanttLocaleLabels { new_task: string; icon_save: string; icon_cancel: string; @@ -861,25 +861,25 @@ interface GanttLocaleLabels{ years: string; } -interface GanttLocale{ +interface GanttLocale { date: GanttLocaleDate; labels: GanttLocaleLabels; } -interface GanttEnterprise{ +interface GanttEnterprise { /** * Creates a new instance of Gantt */ getGanttInstance(): GanttStatic; } -interface GanttStatic{ +interface GanttStatic { templates: GanttTemplates; config: GanttConfigOptions; date: GanttDateHelpers; keys: GanttHotkeys; - skin: String; - version: String; + skin: string; + version: string; locale: GanttLocale; $click: any; @@ -1056,10 +1056,10 @@ interface GanttStatic{ dataProcessor(url: string): void; /** - * gets the date of the specified horizontal position in the chart area + * returns the date of the specified horizontal position in the chart area * @param pos the relative horizontal position you want to know the date of */ - dateFromPos(pos: number): void; + dateFromPos(pos: number): Date; /** * returns false if the provided argument is undefined, otherwise true @@ -1730,4 +1730,4 @@ interface GanttStatic{ declare var gantt: GanttStatic; -declare var Gantt: GanttEnterprise; \ No newline at end of file +declare var Gantt: GanttEnterprise; diff --git a/dhtmlxgantt/tsconfig.json b/dhtmlxgantt/tsconfig.json index 5b5bcffb23..14f1ed6db7 100644 --- a/dhtmlxgantt/tsconfig.json +++ b/dhtmlxgantt/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dhtmlxscheduler/tsconfig.json b/dhtmlxscheduler/tsconfig.json index 25fc4e28ad..e144f49017 100644 --- a/dhtmlxscheduler/tsconfig.json +++ b/dhtmlxscheduler/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/di-lite/tsconfig.json b/di-lite/tsconfig.json index 1d3e393981..8cee3262d0 100644 --- a/di-lite/tsconfig.json +++ b/di-lite/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/diff-match-patch/tsconfig.json b/diff-match-patch/tsconfig.json index 98aef683f0..b53e7b52bb 100644 --- a/diff-match-patch/tsconfig.json +++ b/diff-match-patch/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/diff/tsconfig.json b/diff/tsconfig.json index 9de849abbd..2fca3c638a 100644 --- a/diff/tsconfig.json +++ b/diff/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/diff2html/tsconfig.json b/diff2html/tsconfig.json index 7d1b72b613..c428b47abf 100644 --- a/diff2html/tsconfig.json +++ b/diff2html/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/discontinuous-range/discontinuous-range-tests.ts b/discontinuous-range/discontinuous-range-tests.ts new file mode 100644 index 0000000000..9f93b0a061 --- /dev/null +++ b/discontinuous-range/discontinuous-range-tests.ts @@ -0,0 +1,24 @@ +import DiscontinuousRange = require("discontinuous-range"); + +// constructors +const rangeOne: DiscontinuousRange = new DiscontinuousRange(3); +const rangeTwo: DiscontinuousRange = new DiscontinuousRange(3, 5); + +// add +const resultOne: DiscontinuousRange = rangeOne.add(6,10); +const resultTwo: DiscontinuousRange = rangeTwo.add(11); +const resultThree: DiscontinuousRange = rangeOne.add(rangeTwo); + +// subtract +const resultFour: DiscontinuousRange = rangeOne.subtract(7,8); +const resultFive: DiscontinuousRange = rangeTwo.subtract(11); +const resultSix: DiscontinuousRange = rangeOne.subtract(rangeTwo); + +// index +const entry: number | null = rangeOne.index(1); + +// toString +const stringified: string = rangeOne.toString(); + +// clone +const rangeThree: DiscontinuousRange = rangeOne.clone(); \ No newline at end of file diff --git a/discontinuous-range/index.d.ts b/discontinuous-range/index.d.ts new file mode 100644 index 0000000000..670379a57e --- /dev/null +++ b/discontinuous-range/index.d.ts @@ -0,0 +1,73 @@ +// Type definitions for discontinuous-range 1.0 +// Project: https://www.npmjs.com/package/discontinuous-range +// Definitions by: Victor Zhou +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Represents a discontinuous range of numbers. + */ +declare class DiscontinuousRange { + + /** + * Creates a discontinuous range at rangeStart, and ending at + * rangeEnd. If rangeEnd is not specified, a range containing + * only rangeStart is created. + * @param rangeStart The start of the range to create. + * @param rangeEnd The end of the range to create. Defaults to rangeStart. + */ + constructor(rangeStart: number, rangeEnd?: number); + + /** + * Adds the numbers from rangeStart to rangeEnd to the current range. + * If rangeEnd is not defined, only rangeStart is added to the current range. + * @param rangeStart The first number to add to the range. + * @param rangeEnd The last number to add to the range. Defaults to rangeStart. + * @returns The range on which add was called. It contains the numbers from rangeStart to rangeEnd. + */ + add(rangeStart: number, rangeEnd?: number): DiscontinuousRange; + + /** + * Adds a range to the current range. + * @param rangeToAdd The range to union with the current range. + * @returns The range on which add was called. It contains the numbers in rangeToAdd. + */ + add(rangeToAdd: DiscontinuousRange): DiscontinuousRange; + + /** + * Removes the numbers from rangeStart to rangeEnd to the current range. + * If rangeEnd is not defined, only rangeStart is removed from the current range. + * @param rangeStart The first number to remove from the range. + * @param rangeEnd The last number to remove from the range. Defaults to rangeStart. + * @returns The range on which subtract was called. It does not contain the numbers from rangeStart to rangeEnd. + */ + subtract(rangeStart: number, rangeEnd?: number): DiscontinuousRange; + + /** + * Removes rangeToRemove from the current range. + * @param rangeToRemove The range to exclude from the current range. + * @returns The range on which subtract was called. It contains the numbers in rangeToRemove. + */ + subtract(rangeToRemove: DiscontinuousRange): DiscontinuousRange; + + /** + * Returns the number in the discontinuous range at the specified index. + * @param index The index to lookup a number. + * @returns A number in the range. null if index is greater than the number of elements in the range. + */ + index(index: number): number | null; + + /** + * Returns a string representation of this discontinuous range in the format + * "[ rangeOneLow-rangeOneHigh, ... , rangeNLow-rangeNHigh ]" + * @returns A string representation of this discontinuous range. + */ + toString(): string; + + /** + * Returns a copy of this discontinuous range. + * @returns A deep clone of the current discontinuous range. + */ + clone(): DiscontinuousRange; +} + +export = DiscontinuousRange; \ No newline at end of file diff --git a/discontinuous-range/tsconfig.json b/discontinuous-range/tsconfig.json new file mode 100644 index 0000000000..dd387dbe67 --- /dev/null +++ b/discontinuous-range/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "discontinuous-range-tests.ts" + ] +} \ No newline at end of file diff --git a/discontinuous-range/tslint.json b/discontinuous-range/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/discontinuous-range/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/disposable-email-domains/tsconfig.json b/disposable-email-domains/tsconfig.json index f4dd783c0c..a0105efe77 100644 --- a/disposable-email-domains/tsconfig.json +++ b/disposable-email-domains/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/doccookies/index.d.ts b/doccookies/index.d.ts index c8f87bffb0..e2590a2def 100644 --- a/doccookies/index.d.ts +++ b/doccookies/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for docCookies +// Type definitions for docCookies // Project: https://developer.mozilla.org/en-US/docs/Web/API/document.cookie // Definitions by: Jon Egerton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/doccookies/tsconfig.json b/doccookies/tsconfig.json index db4b2d2974..c6572494b3 100644 --- a/doccookies/tsconfig.json +++ b/doccookies/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dock-spawn/tsconfig.json b/dock-spawn/tsconfig.json index 82fd06bbc3..08c19e709e 100644 --- a/dock-spawn/tsconfig.json +++ b/dock-spawn/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/docopt/index.d.ts b/docopt/index.d.ts index 05d0da4524..a40904bf76 100644 --- a/docopt/index.d.ts +++ b/docopt/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Docopt v0.6.2 +// Type definitions for Docopt v0.6.2 // Project: http://docopt.org/ // Definitions by: Giovanni Bassi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/docopt/tsconfig.json b/docopt/tsconfig.json index ad2e5b4281..a1863be81b 100644 --- a/docopt/tsconfig.json +++ b/docopt/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/doctrine/tsconfig.json b/doctrine/tsconfig.json index f27ad952eb..a92eaa2e4b 100644 --- a/doctrine/tsconfig.json +++ b/doctrine/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "index.d.ts", "doctrine-tests.ts" ] -} +} \ No newline at end of file diff --git a/documentdb-server/index.d.ts b/documentdb-server/index.d.ts index 4afc0da96e..907fbd3d8c 100644 --- a/documentdb-server/index.d.ts +++ b/documentdb-server/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for DocumentDB server side JavaScript SDK +// Type definitions for DocumentDB server side JavaScript SDK // Project: http://dl.windowsazure.com/documentDB/jsserverdocs // Definitions by: François Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/documentdb-server/tsconfig.json b/documentdb-server/tsconfig.json index 99abfa3c7e..3d19fcc5d5 100644 --- a/documentdb-server/tsconfig.json +++ b/documentdb-server/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/documentdb/tsconfig.json b/documentdb/tsconfig.json index 70a4a8683f..a27fd7803a 100644 --- a/documentdb/tsconfig.json +++ b/documentdb/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dojo/index.d.ts b/dojo/index.d.ts index 11f8a27fbb..b3af7dd779 100644 --- a/dojo/index.d.ts +++ b/dojo/index.d.ts @@ -3,9 +3,6 @@ // Definitions by: Michael Van Sickle // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function define(dependencies: String[], factory: Function): any; -declare function require(config?:Object, dependencies?: String[], callback?: Function): any; - declare namespace dojox.dtl { interface __StringArgs { } interface __ObjectArgs { } @@ -16124,8 +16121,12 @@ declare namespace dojo { */ interface instrumentation{(Deferred: any): void} + interface Thenable { + then(onFulfilled?: (value?: T) => Thenable | U, onRejected?: (error?: Error) => Thenable | U): Thenable; + } + interface Callback { - (arg: T): U|Promise; + (arg: T): U|Thenable; } /** @@ -16136,7 +16137,7 @@ declare namespace dojo { * instances of this class. * */ - interface Promise { + interface Promise extends Thenable { /** * Add a callback to be invoked when the promise is resolved * or rejected. @@ -28291,6 +28292,10 @@ declare module "dojo/promise/Promise" { interface Promise extends dojo.promise.Promise { } export = Promise; } +declare module "dojo/promise/Thenable" { + interface Thenable extends dojo.promise.Thenable { } + export = Thenable; +} declare module "dojo/rpc/JsonpService" { var exp: typeof dojo.rpc.JsonpService export=exp; diff --git a/dojo/tsconfig.json b/dojo/tsconfig.json index efcd51a49f..3ed256f27a 100644 --- a/dojo/tsconfig.json +++ b/dojo/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "index.d.ts", "dijit.d.ts" ] -} +} \ No newline at end of file diff --git a/dom4/tsconfig.json b/dom4/tsconfig.json index 08698c5dc1..4517784373 100644 --- a/dom4/tsconfig.json +++ b/dom4/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/domo/tsconfig.json b/domo/tsconfig.json index da3e9da055..5a55c0ca8e 100644 --- a/domo/tsconfig.json +++ b/domo/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dompurify/tsconfig.json b/dompurify/tsconfig.json index 8517d83958..93f7bde000 100644 --- a/dompurify/tsconfig.json +++ b/dompurify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/domready/tsconfig.json b/domready/tsconfig.json index 21a8b9d0ec..4a6ca208f5 100644 --- a/domready/tsconfig.json +++ b/domready/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/domurl/index.d.ts b/domurl/index.d.ts index 8c418c75cc..d0b7896d61 100644 --- a/domurl/index.d.ts +++ b/domurl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for domurl +// Type definitions for domurl // Project: https://github.com/Mikhus/domurl // Definitions by: Mikhus // Definitions: https://github.com/Mikhus/DefinitelyTyped diff --git a/domurl/tsconfig.json b/domurl/tsconfig.json index 9961b777c6..43d14370e2 100644 --- a/domurl/tsconfig.json +++ b/domurl/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/donna/tsconfig.json b/donna/tsconfig.json index 68e0beb4a7..2e45cf57af 100644 --- a/donna/tsconfig.json +++ b/donna/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dot-case/dot-case-tests.ts b/dot-case/dot-case-tests.ts deleted file mode 100644 index 391724317a..0000000000 --- a/dot-case/dot-case-tests.ts +++ /dev/null @@ -1,8 +0,0 @@ - -import dotCase = require('dot-case'); - -console.log(dotCase('string')); // => "string" -console.log(dotCase('camelCase')); // => "camel.case" -console.log(dotCase('sentence case')); // => "sentence.case" - -console.log(dotCase('MY STRING', 'tr')); // => "my.strıng" diff --git a/dot-case/index.d.ts b/dot-case/index.d.ts deleted file mode 100644 index 8f11ee3b3c..0000000000 --- a/dot-case/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for dot-case -// Project: https://github.com/blakeembrey/dot-case -// Definitions by: Sam Saint-Pettersen -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare function dotCase(string: string, locale?: string): string; -export = dotCase; diff --git a/dot-case/tsconfig.json b/dot-case/tsconfig.json deleted file mode 100644 index cd4b617235..0000000000 --- a/dot-case/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "dot-case-tests.ts" - ] -} \ No newline at end of file diff --git a/dot-object/tsconfig.json b/dot-object/tsconfig.json index 988380a473..2f3f99dd6a 100644 --- a/dot-object/tsconfig.json +++ b/dot-object/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dot-prop/tsconfig.json b/dot-prop/tsconfig.json index 1960e1e635..453d3fd81f 100644 --- a/dot-prop/tsconfig.json +++ b/dot-prop/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dot/index.d.ts b/dot/index.d.ts index 8e4f9afdb0..6bc646b771 100644 --- a/dot/index.d.ts +++ b/dot/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for doT v1.0.1 +// Type definitions for doT v1.0.1 // Project: https://github.com/olado/doT // Definitions by: ZombieHunter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/dot/tsconfig.json b/dot/tsconfig.json index b97c4bd580..b2e99e29d3 100644 --- a/dot/tsconfig.json +++ b/dot/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dotdotdot/tsconfig.json b/dotdotdot/tsconfig.json index 295fdea2f1..e471e49cd2 100644 --- a/dotdotdot/tsconfig.json +++ b/dotdotdot/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dotenv/dotenv-tests.ts b/dotenv/dotenv-tests.ts index ea54a99b6d..3d9af0f52e 100644 --- a/dotenv/dotenv-tests.ts +++ b/dotenv/dotenv-tests.ts @@ -1,15 +1,19 @@ - - import dotenv = require('dotenv'); -dotenv.config({ +// typically, result will be an Object +let env = dotenv.config({ silent: true }); +// ... but it might also be `false` +let result = dotenv.config({ + path: '.non-existing-env' +}); + dotenv.config({ path: '.env' -}) +}); dotenv.config({ encoding: 'utf8' -}) \ No newline at end of file +}); diff --git a/dotenv/index.d.ts b/dotenv/index.d.ts index 7391133781..a326ceaa58 100644 --- a/dotenv/index.d.ts +++ b/dotenv/index.d.ts @@ -1,12 +1,35 @@ // Type definitions for dotenv 2.0.0 // Project: https://github.com/motdotla/dotenv -// Definitions by: Jussi Kinnula -// Definitions: https://github.com/jussikinnula/DefinitelyTyped +// Definitions by: Jussi Kinnula , Borek Bernard +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export function config(options?: dotenvOptions): boolean; +/** + * Loads `.env` into `process.env`. + * + * @param options + * @return Object Object with the parsed keys and values, e.g., 'KEY=value' becomes { KEY: 'value' } + */ +export function config(options?: DotenvOptions): Object | false; -interface dotenvOptions { +export interface DotenvOptions { + /** + * Dotenv outputs a warning to your console if missing a .env file. Suppress this warning using silent. + * + * @default false + */ silent?: boolean; + + /** + * You can specify a custom path if your file containing environment variables is named or located differently. + * + * @default '.env' + */ path?: string; + + /** + * You may specify the encoding of your file containing environment variables using this option. + * + * @default 'utf8' + */ encoding?: string; } diff --git a/dotenv/tsconfig.json b/dotenv/tsconfig.json index bbd1c438e6..2fc29c83a9 100644 --- a/dotenv/tsconfig.json +++ b/dotenv/tsconfig.json @@ -3,7 +3,8 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/doublearray/tsconfig.json b/doublearray/tsconfig.json index bbc690d879..d300061db5 100644 --- a/doublearray/tsconfig.json +++ b/doublearray/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/doubleclick-gpt/doubleclick-gpt-tests.ts b/doubleclick-gpt/doubleclick-gpt-tests.ts new file mode 100644 index 0000000000..4bf01bf6e8 --- /dev/null +++ b/doubleclick-gpt/doubleclick-gpt-tests.ts @@ -0,0 +1,425 @@ +if (googletag && googletag.apiReady) { + // GPT API can be called safely. +} + +googletag.cmd.push(() => { + googletag + .defineSlot("/1234567/sports", [160, 600]) + .addService(googletag.pubads()); +}); + +googletag.defineOutOfPageSlot("/1234567/sports", "div-1"); + +googletag.defineSlot("/1234567/sports", [728, 90], "div-1"); + +// The calls to construct an ad and display contents. +let slot1 = + googletag.pubads().display("/1234567/sports", [728, 90], "div-1"); +let slot2 = + googletag.pubads().display("/1234567/news", [160, 600], "div-2"); +let slot3 = + googletag.pubads().display("/1234567/weather", [160, 600], "div-3"); + +// This call to destroy only slot1. +googletag.destroySlots([slot1]); + +// This call to destroy both slot1 and slot2. +googletag.destroySlots([slot1, slot2]); + +// This call to destroy all slots. +googletag.destroySlots(); + +googletag.cmd.push(() => { + googletag.display("div-1"); +}); + +// Calling with div id +googletag.openConsole("div-1"); + +// Calling without div id +googletag.openConsole(); + +googletag.setAdIframeTitle("title"); + +googletag.cmd.push(function() { + googletag.defineSlot("/1234567/sports", [160, 600]). + addService(googletag.pubads()); +}); + +googletag.companionAds().setRefreshUnfilledSlots(true); + +let slot = googletag.defineSlot("/1234567/sports", [728, 90], "div-1"). + addService(googletag.content()); +googletag.enableServices(); + +let content = ""; +googletag.content().setContent(slot, content); + +googletag.pubads().definePassback("/1234567/sports", [468, 60]).display(); + +googletag.pubads().definePassback("/1234567/sports", [468, 60]) + .setClickUrl("%%CLICK_URL_UNESC%%") + .display(); + +googletag.pubads().definePassback("/1234567/sports", [468, 60]) + .setForceSafeFrame(true) + .display(); + +googletag.pubads().definePassback("/1234567/sports", [468, 60]) + .setTagForChildDirectedTreatment(1) + .display(); + +googletag.pubads().definePassback("/1234567/sports", [468, 60]). + setTargeting("color", "red"). + setTargeting("sport", ["rugby", "rowing"]). + display(); + +googletag.pubads().definePassback("/1234567/sports", [160, 600]). + updateTargetingFromMap({"color": "red", + "interests": ["sports", "music", "movies"]}). + display(); + +// The calls to construct an ad and display contents. +slot1 = googletag.pubads().display("/1234567/sports", [728, 90], "div-1"); +slot2 = googletag.pubads().display("/1234567/news", [160, 600], "div-2"); +slot3 = googletag.pubads().display("/1234567/weather", [160, 600], "div-3"); + +// This call to clear only slot1. +googletag.pubads().clear([slot1]); + +// This call to clear both slot1 and slot2. +googletag.pubads().clear([slot1, slot2]); + +// This call to clear all slots. +googletag.pubads().clear(); + +// Set category exclusion to exclude ads with "AirlineAd" labels. +googletag.pubads().setCategoryExclusion("AirlineAd"); + +// Make ad requests. No ad with "AirlineAd" label will be returned. + +// Clear category exclusions so all ads can be returned. +googletag.pubads().clearCategoryExclusions(); + +// Mark ad requests as child-directed. +googletag.pubads().setTagForChildDirectedTreatment(1); + +// Clear child-directed setting and return to initial not-set value. +googletag.pubads().clearTagForChildDirectedTreatment(); + +googletag.pubads().setTargeting("interests", "sports"); +googletag.pubads().setTargeting("colors", "blue"); +googletag.pubads().setTargeting("fruits", "apple"); + +googletag.pubads().clearTargeting("interests"); +// Targeting "colors" and "fruits" are still present, while "interests" was +// cleared. + +googletag.pubads().clearTargeting(); +// All targeting has been cleared. + +googletag.pubads().defineOutOfPagePassback("/1234567/sports").display(); + +googletag.pubads().definePassback("/1234567/sports", [468, 60]).display(); + +googletag.pubads().display("/1234567/sports", [728, 90], "div-1"); + +googletag.pubads().set("adsense_background_color", "#FFFFFF"); +let color = googletag.pubads().get("adsense_background_color"); +// color == "#FFFFFF". + +googletag.pubads().set("adsense_background_color", "#FFFFFF"); +googletag.pubads().set("adsense_border_color", "#AABBCC"); +let keys = googletag.pubads().getAttributeKeys(); +// Keys are ["adsense_background_color", "adsense_border_color"]. + +googletag.pubads().setTargeting("interests", "sports"); + +let param = googletag.pubads().getTargeting("interests"); +// param is ["sports"] + +param = googletag.pubads().getTargeting("age"); +// param is [] (empty array) + +googletag.pubads().setTargeting("interests", "sports"); +googletag.pubads().setTargeting("colors", "blue"); + +keys = googletag.pubads().getTargetingKeys(); +// keys are ["interests", "colors"]. + +// The calls to construct slots and display contents. +slot1 = googletag.defineSlot("/1234567/sports", [728, 90], "div-1"); +slot2 = googletag.defineSlot("/1234567/news", "fluid", "div-2"); +slot3 = googletag.defineSlot("/1234567/weather", [160, 600], "div-3"); + +// This call to refresh fetches a new ad for slot1 only. +googletag.pubads().refresh([slot1]); + +// This call to refresh fetches a new ad for both slot1 and slot2. +googletag.pubads().refresh([slot1, slot2]); + +// This call to refresh fetches a new ad for each slot. +googletag.pubads().refresh(); + +// This call to refresh fetches a new ad for slot1, without changing the +// correlator. +googletag.pubads().refresh([slot1], {changeCorrelator: false}); + +// This call to refresh fetches a new ad for each slot, without changing +// the correlator. +googletag.pubads().refresh(undefined, {changeCorrelator: false}); + +// Label = AirlineAd. +googletag.pubads().setCategoryExclusion("AirlineAd"); + +// Make DFP ads centered. +googletag.pubads().setCentering(true); + +googletag.pubads().setCookieOptions(1); + +googletag.pubads().setForceSafeFrame(true); + +// The following slot will be opted-out of the page-level force +// safeframe instruction. +googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setForceSafeFrame(false). + addService(googletag.pubads()); + +// The following slot will have safeframe forced. +googletag.defineSlot("/1234567/news", [160, 600], "div-2"). + addService(googletag.pubads()); + +// Latitude, longitude: +googletag.pubads().setLocation(34, -45.12); + +// Latitude, longitude, and precision in millimeters: +googletag.pubads().setLocation(34, -45.12, 10000); + +// Postal code: +googletag.pubads().setLocation("10001,US"); + +googletag.pubads().setPublisherProvidedId("AB123456789"); + +googletag.pubads().setForceSafeFrame(true); + +let pageConfig = { + allowOverlayExpansion: true, + allowPushExpansion: true, + sandbox: true +}; + +let slotConfig = {allowOverlayExpansion: false}; + +googletag.pubads().setSafeFrameConfig(pageConfig); + +// The following slot will not allow for expansion by overlay. +googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setSafeFrameConfig(slotConfig). + addService(googletag.pubads()); + +// The following slot will inherit the page level settings, and hence +// would allow for expansion by overlay. +googletag.defineSlot("/1234567/news", [160, 600], "div-2"). + addService(googletag.pubads()); + +googletag.display(); + +googletag.pubads().setTagForChildDirectedTreatment(1); + +// Example with a single value for a key. +googletag.pubads().setTargeting("interests", "sports"); + +// Example with multiple values for a key inside in an array. +googletag.pubads().setTargeting("interests", ["sports", "music", "movies"]); + +// Assume that the correlator is currently 12345. All ad requests made by +// this page will currently use that value. + +// Replace the current correlator with a new correlator. +googletag.pubads().updateCorrelator(); + +// 1. Slot render ended listener. +// The listener will be called only when the pubads service renders a slot. +// To listen to companion ads, add a similar listener to +// googletag.companionAds(). +googletag.pubads().addEventListener("slotRenderEnded", function(event: googletag.events.SlotRenderEndedEvent) { + console.log("Slot has been rendered:"); + console.log(event); +}); + +// 2. Slot render ended listener, slot specific logic. +// Listeners operate at service level, which means that you cannot add a +// listener for a slotRenderEnded event for a specific slot only. You can, +// however, programmatically filter a listener to respond only to a certain +// ad slot, using this pattern: +let targetSlot = slot1; +googletag.pubads().addEventListener("slotRenderEnded", function(event: googletag.events.SlotRenderEndedEvent) { + if (event.slot === targetSlot) { + // Slot specific logic. + } +}); + +// 3. Impression viewable listener, slot specific logic. +// The listener will be called when the impression is considered viewable. +// This event also operates at service level, but, as above, you can filter +// to respond only to a certain ad slot by using this pattern: +googletag.pubads().addEventListener("impressionViewable", function(event: googletag.events.ImpressionViewableEvent) { + if (event.slot === targetSlot) { + // Slot specific logic. + } +}); + +let mapping1 = googletag.sizeMapping(). + addSize([1024, 768], [970, 250]). + addSize([980, 690], [728, 90]). + addSize([640, 480], "fluid"). + addSize([0, 0], [88, 31]). // Fits browsers of any size smaller than 640x480. + build(); +let mapping2 = googletag.sizeMapping(). + addSize([1024, 768], [970, 250]). + addSize([980, 690], []). + addSize([640, 480], [120, 60]). + addSize([0, 0], []). + build(); + +googletag.defineSlot("/1234567/sports", [160, 600]). + addService(googletag.pubads()); + +// Set category exclusion to exclude ads with "AirlineAd" labels. +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setCategoryExclusion("AirlineAd"). + addService(googletag.pubads()); + +// Make an ad request. No ad with "AirlineAd" label will be returned for the slot. + +// Clear category exclusions so all ads can be returned. +slot.clearCategoryExclusions(); + +// Make an ad request. Any ad can be returned for the slot. + + +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setTargeting("allow_expandable", "true"). + setTargeting("interests", ["sports", "music", "movies"]). + setTargeting("color", "red"). + addService(googletag.pubads()); + +slot.clearTargeting("color"); +// Targeting "allow_expandable" and "interests" are still present, while +// "color" was cleared. + +slot.clearTargeting(); +// All targeting has been cleared. + +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + addService(googletag.pubads()); +let mapping = googletag.sizeMapping(). + addSize([100, 100], [88, 31]). + addSize([320, 400], [[320, 50], [300, 50]]). + build(); +slot.defineSizeMapping(mapping); + +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + set("adsense_background_color", "#FFFFFF"). + addService(googletag.pubads()); + +color = googletag.pubads().get("adsense_background_color"); +// color == "#FFFFFF". + +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + addService(googletag.pubads()); + +let path = slot.getAdUnitPath(); +// path is "/1234567/sports" + +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + set("adsense_background_color", "#FFFFFF"). + set("adsense_border_color", "#AABBCC"). + addService(googletag.pubads()); + +keys = googletag.pubads().getAttributeKeys(); +// Keys are ["adsense_background_color", "adsense_border_color"]. + +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setCategoryExclusion("AirlineAd"). + setCategoryExclusion("TrainAd"). + addService(googletag.pubads()); + +let exclusions = slot.getCategoryExclusions(); +// exclusions are ["AirlineAd", "TrainAd"] + +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + addService(googletag.pubads()); + +let slotElementId = slot.getSlotElementId(); +// slotElementId is "div-1" + +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setTargeting("allow_expandable", "true"). + addService(googletag.pubads()); + +param = slot.getTargeting("allow_expandable"); +// param is ["true"] + +param = slot.getTargeting("age"); +// param is [] (empty array) + +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setTargeting("allow_expandable", "true"). + setTargeting("interests", ["sports", "music", "movies"]). + addService(googletag.pubads()); + +keys = slot.getTargetingKeys(); +// keys are ["interests", "allow_expandable"]. + +// Setting an attribute on a single ad slot. +googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + set("adsense_background_color", "#FFFFFF"). + addService(googletag.pubads()); + +// Label = AirlineAd +googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setCategoryExclusion("AirlineAd"). + addService(googletag.pubads()); + +googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setClickUrl("http://www.example.com"). + addService(googletag.pubads()); + +googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setCollapseEmptyDiv(true, true). + addService(googletag.pubads()); +// The above will cause the div for this slot to be collapsed +// when the page is loaded, before ads are requested. + +googletag.defineSlot("/1234567/sports", [160, 600], "div-2"). + setCollapseEmptyDiv(true). + addService(googletag.pubads()); +// The above will cause the div for this slot to be collapsed + // only after GPT detects that no ads are available for the slot. + +googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setForceSafeFrame(true). + addService(googletag.pubads()); + +googletag.pubads().setForceSafeFrame(true); + +// The following slot will have a sandboxed safeframe that only disallows +// top-level navigation. +googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + setSafeFrameConfig({sandbox: true}). + addService(googletag.pubads()); + +googletag.defineSlot("/1234567/news", [160, 600], "div-2"). + addService(googletag.pubads()); + +googletag.display(); + +slot = googletag.defineSlot("/1234567/sports", [160, 600], "div-1"). + addService(googletag.pubads()); + +// Example with a single value for a key. +slot.setTargeting("allow_expandable", "true"); + +// Example with multiple values for a key inside in an array. +slot.setTargeting("interests", ["sports", "music", "movies"]); diff --git a/doubleclick-gpt/index.d.ts b/doubleclick-gpt/index.d.ts new file mode 100644 index 0000000000..8f6a47ae12 --- /dev/null +++ b/doubleclick-gpt/index.d.ts @@ -0,0 +1,173 @@ +// Type definitions for Google Publisher Tag v104 +// Project: https://developers.google.com/doubleclick-gpt/reference +// Definitions by: John Wright +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace googletag { + export type SingleSizeArray = number[]; + + export type NamedSize = string; + + export type SingleSize = SingleSizeArray | NamedSize; + + export type MultiSize = SingleSize[]; + + export type GeneralSize = SingleSize | MultiSize; + + export type SizeMapping = GeneralSize[]; + + export type SizeMappingArray = SizeMapping[]; + + export interface CommandArray { + push(f: Function): number; + } + + export interface Service { + addEventListener( + eventType: string, + listener: (event: events.ImpressionViewableEvent | events.SlotOnloadEvent | events.SlotRenderEndedEvent | events.slotVisibilityChangedEvent) => void + ): void; + } + + export interface CompanionAdsService extends Service { + enableSyncLoading(): void; + setRefreshUnfilledSlots(value: boolean): void; + } + + export interface ContentService extends Service { + setContent(slot: Slot, content: String): void; + } + + export interface ResponseInformation { + advertiserId: string; + campaignId: string; + creativeId?: number; + labelIds: number[]; + lineItemId?: number; + } + + export interface SafeFrameConfig { + allowOverlayExpansion?: boolean; + allowPushExpansion?: boolean; + sandbox?: boolean; + } + + interface Googletag { + apiReady: boolean; + cmd: CommandArray; + companionAds(): CompanionAdsService; + content(): ContentService; + defineOutOfPageSlot(adUnitPath: string, opt_div?: string): Slot; + defineSlot(adUnitPath: string, size: GeneralSize, opt_div?: string): Slot; + destroySlots(opt_slots?: Slot[]): boolean; + disablePublisherConsole(): void; + display(div?: string): void; + enableServices(): void; + getVersion(): string; + openConsole(opt_div?: string): void; + pubads(): PubAdsService; + pubadsReady: boolean; + setAdIframeTitle(title: string): void; + sizeMapping(): SizeMappingBuilder; + } + + export interface Slot { + addService(service: Service): Slot; + clearCategoryExclusions(): Slot; + clearTargeting(opt_key?: string): Slot; + defineSizeMapping(sizeMapping: SizeMappingArray): Slot; + get(key: string): string | null; + getAdUnitPath(): string; + getAttributeKeys(): string[]; + getCategoryExclusions(): string[]; + getResponseInformation(): ResponseInformation; + getSlotElementId(): string; + getTargeting(key: string): string[]; + getTargetingKeys(): string[]; + set(key: string, value: string): Slot; + setCategoryExclusion(categoryExclusion: string): Slot; + setClickUrl(value: string): Slot; + setCollapseEmptyDiv(collapse: boolean, opt_collapseBeforeAdFetch?: boolean): Slot; + setForceSafeFrame(forceSafeFrame: boolean): Slot; + setSafeFrameConfig(config: SafeFrameConfig): Slot; + setTargeting(key: string, value: string | string[]): Slot; + } + + export interface PassbackSlot { + display(): void; + get(key: string): string; + set(key: string, value: string): PassbackSlot; + setClickUrl(url: string): PassbackSlot; + setForceSafeFrame(forceSafeFrame: boolean): PassbackSlot; + setTagForChildDirectedTreatment(value: number): PassbackSlot; + setTargeting(key: string, value: string | string[]): PassbackSlot; + updateTargetingFromMap(map: Object): PassbackSlot; + } + + export interface PubAdsService extends Service { + clear(opt_slots?: Slot[]): boolean; + clearCategoryExclusions(): PubAdsService; + clearTagForChildDirectedTreatment(): PubAdsService; + clearTargeting(opt_key?: string): PubAdsService; + collapseEmptyDivs(opt_collapseBeforeAdFetch?: boolean): boolean; + defineOutOfPagePassback(adUnitPath: string): PassbackSlot; + definePassback(adUnitPath: string, size: GeneralSize): PassbackSlot; + disableInitialLoad(): void; + display(adUnitPath: string, size: GeneralSize, opt_div?: string, opt_clickUrl?: string): Slot; + enableAsyncRendering(): boolean; + enableSingleRequest(): boolean; + enableSyncRendering(): boolean; + enableVideoAds(): void; + get(key: string): string | null; + getAttributeKeys(): string[]; + getTargeting(key: string): string[]; + getTargetingKeys(): string[]; + refresh(opt_slots?: Slot[], opt_options?: {changeCorrelator: boolean}): void; + set(key: string, value: string): PubAdsService; + setCategoryExclusion(categoryExclusion: string): PubAdsService; + setCentering(centerAds: boolean): void; + setCookieOptions(cookieOptions: number): PubAdsService; + setForceSafeFrame(forceSafeFrame: boolean): PubAdsService; + setLocation(latitudeOrAddress: string | number, opt_longitude?: number, opt_radius?: number): PubAdsService; + setPublisherProvidedId(ppid: string): PubAdsService; + setSafeFrameConfig(config: SafeFrameConfig): PubAdsService; + setTagForChildDirectedTreatment(value: number): PubAdsService; + setTargeting(key: string, value: string | string[]): PubAdsService; + setVideoContent(videoContentId: string, videoCmsId: string): void; + updateCorrelator(): PubAdsService; + } + + export interface SizeMappingBuilder { + addSize(viewportSize: SingleSizeArray, slotSize: GeneralSize): SizeMappingBuilder; + build(): SizeMappingArray; + } + + export namespace events { + export interface ImpressionViewableEvent { + serviceName: string; + slot: Slot; + } + + export interface SlotOnloadEvent { + serviceName: string; + slot: Slot; + } + + export interface SlotRenderEndedEvent { + creativeId?: number; + isEmpty: boolean; + lineItemId?: number; + serviceName: string; + size: number[] | string; + slot: Slot; + } + + export interface slotVisibilityChangedEvent { + inViewPercentage: number; + serviceName: string; + slot: Slot; + } + } +} + +declare let googletag: googletag.Googletag; diff --git a/doubleclick-gpt/tsconfig.json b/doubleclick-gpt/tsconfig.json new file mode 100644 index 0000000000..bee3262730 --- /dev/null +++ b/doubleclick-gpt/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "doubleclick-gpt-tests.ts" + ] +} \ No newline at end of file diff --git a/draft-js/tsconfig.json b/draft-js/tsconfig.json index f1ededb374..a984daf1a3 100644 --- a/draft-js/tsconfig.json +++ b/draft-js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "jsx": "react", diff --git a/dragula/tsconfig.json b/dragula/tsconfig.json index 6380ea6514..bcc3d80e81 100644 --- a/dragula/tsconfig.json +++ b/dragula/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dropboxjs/tsconfig.json b/dropboxjs/tsconfig.json index 11aba2993c..5399b6d59f 100644 --- a/dropboxjs/tsconfig.json +++ b/dropboxjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dropzone/tsconfig.json b/dropzone/tsconfig.json index 62b4740294..c190c8f602 100644 --- a/dropzone/tsconfig.json +++ b/dropzone/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dsv/index.d.ts b/dsv/index.d.ts index 2fac461110..975246f51d 100644 --- a/dsv/index.d.ts +++ b/dsv/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dsv +// Type definitions for dsv // Project: https://www.npmjs.com/package/dsv // Definitions by: Jason Swearingen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/dsv/tsconfig.json b/dsv/tsconfig.json index 097e118a5a..9d9965eba1 100644 --- a/dsv/tsconfig.json +++ b/dsv/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dts-bundle/tsconfig.json b/dts-bundle/tsconfig.json index d744edd883..1a97ecec63 100644 --- a/dts-bundle/tsconfig.json +++ b/dts-bundle/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/durandal/index.d.ts b/durandal/index.d.ts index c9ade9ee23..b95bcb1271 100644 --- a/durandal/index.d.ts +++ b/durandal/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Durandal 2.1.0 +// Type definitions for Durandal 2.1.0 // Project: http://durandaljs.com // Definitions by: Blue Spire // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/durandal/tsconfig.json b/durandal/tsconfig.json index a76d9cbdb5..5692e5627e 100644 --- a/durandal/tsconfig.json +++ b/durandal/tsconfig.json @@ -6,6 +6,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dustjs-linkedin/tsconfig.json b/dustjs-linkedin/tsconfig.json index 154963a5eb..9d59de2c9b 100644 --- a/dustjs-linkedin/tsconfig.json +++ b/dustjs-linkedin/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dva/dva.d.ts b/dva/index.d.ts similarity index 100% rename from dva/dva.d.ts rename to dva/index.d.ts diff --git a/dva/tsconfig.json b/dva/tsconfig.json index 8c73ec457e..fab9f2794b 100644 --- a/dva/tsconfig.json +++ b/dva/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -11,11 +12,10 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, - "jsx": "react" }, "files": [ - "dva.d.ts", + "index.d.ts", "dva-tests.tsx" ] } \ No newline at end of file diff --git a/dw-bxslider-4/tsconfig.json b/dw-bxslider-4/tsconfig.json index 541f62defd..51c1ad52dd 100644 --- a/dw-bxslider-4/tsconfig.json +++ b/dw-bxslider-4/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dygraphs/tsconfig.json b/dygraphs/tsconfig.json index ab2f60cc6c..a5e9f16f32 100644 --- a/dygraphs/tsconfig.json +++ b/dygraphs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dymo-label-framework/tsconfig.json b/dymo-label-framework/tsconfig.json index a10aab26f0..53b51da7d8 100644 --- a/dymo-label-framework/tsconfig.json +++ b/dymo-label-framework/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/dynatable/tsconfig.json b/dynatable/tsconfig.json index 40bc601aab..1a16c19697 100644 --- a/dynatable/tsconfig.json +++ b/dynatable/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/each/tsconfig.json b/each/tsconfig.json index 88c2188c0e..54e305417c 100644 --- a/each/tsconfig.json +++ b/each/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/easeljs/index.d.ts b/easeljs/index.d.ts index a0dc7b566f..a5916a56f2 100644 --- a/easeljs/index.d.ts +++ b/easeljs/index.d.ts @@ -623,6 +623,7 @@ declare namespace createjs { primary: boolean; rawX: number; rawY: number; + relatedTarget: DisplayObject; stageX: number; stageY: number; mouseMoveOutside: boolean; diff --git a/easeljs/tsconfig.json b/easeljs/tsconfig.json index 075d3bdd77..8706859837 100644 --- a/easeljs/tsconfig.json +++ b/easeljs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/easy-api-request/tsconfig.json b/easy-api-request/tsconfig.json index b8bd55a3c0..4001829009 100644 --- a/easy-api-request/tsconfig.json +++ b/easy-api-request/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/easy-jsend/tsconfig.json b/easy-jsend/tsconfig.json index 09dce68799..2ab6004773 100644 --- a/easy-jsend/tsconfig.json +++ b/easy-jsend/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/easy-session/tsconfig.json b/easy-session/tsconfig.json index d572e8cfc2..6242b8506f 100644 --- a/easy-session/tsconfig.json +++ b/easy-session/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/easy-table/tsconfig.json b/easy-table/tsconfig.json index 20141fb072..3587b33cdb 100644 --- a/easy-table/tsconfig.json +++ b/easy-table/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/easy-x-headers/tsconfig.json b/easy-x-headers/tsconfig.json index 992b70fbda..23c293a602 100644 --- a/easy-x-headers/tsconfig.json +++ b/easy-x-headers/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/easy-xapi-supertest/tsconfig.json b/easy-xapi-supertest/tsconfig.json index 941b58c685..3bb4e7ff3c 100644 --- a/easy-xapi-supertest/tsconfig.json +++ b/easy-xapi-supertest/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/easy-xapi-utils/tsconfig.json b/easy-xapi-utils/tsconfig.json index 0bc928551d..f70d71f3e3 100644 --- a/easy-xapi-utils/tsconfig.json +++ b/easy-xapi-utils/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/easy-xapi/tsconfig.json b/easy-xapi/tsconfig.json index 0c8f8ed331..222ea50b29 100644 --- a/easy-xapi/tsconfig.json +++ b/easy-xapi/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/easystarjs/tsconfig.json b/easystarjs/tsconfig.json index 2c29d193dc..6068b24c59 100644 --- a/easystarjs/tsconfig.json +++ b/easystarjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/echarts/tsconfig.json b/echarts/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/echarts/tsconfig.json +++ b/echarts/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ecmarkup/tsconfig.json b/ecmarkup/tsconfig.json index 976194101b..d3bef17b3a 100644 --- a/ecmarkup/tsconfig.json +++ b/ecmarkup/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/egg.js/tsconfig.json b/egg.js/tsconfig.json index 49a9264db3..c6b83b95fd 100644 --- a/egg.js/tsconfig.json +++ b/egg.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ej.web.all/ej.web.all-tests.ts b/ej.web.all/ej.web.all-tests.ts index 389d152c44..faf5a48e0f 100644 --- a/ej.web.all/ej.web.all-tests.ts +++ b/ej.web.all/ej.web.all-tests.ts @@ -2,7 +2,7 @@ /// - + module AccordionComponent { $(function () { var sample = new ej.Accordion($("#basicAccordion"), { @@ -247,63 +247,6 @@ module ChartComponent { - - -module circulargaugecomponent { - $(function () { - var circularsample = new ej.datavisualization.CircularGauge($("#CircularGauge"), { - enableAnimation: false, - isResponsive: true, - backgroundColor: "transparent", width: 500, - scales: [{ - showRanges: true, - startAngle: 122, sweepAngle: 296, radius: 130, showScaleBar: true, size: 1, maximum: 120, majorIntervalValue: 20, minorIntervalValue: 10, - border: { - width: 0.5, - }, - pointers: [{ - value: 60, - showBackNeedle: true, - backNeedleLength: 20, - length: 95, - width: 7, - pointerCap: { radius: 12 } - }], - ticks: [{ - type: "major", - distanceFromScale: 2, - height: 16, - width: 1, color: "#8c8c8c" - }, { type: "minor", height: 8, width: 1, distanceFromScale: 2, color: "#8c8c8c" }], - labels: [{ - color: "#8c8c8c" - }], - ranges: [{ - distanceFromScale: -30, - startValue: 0, - endValue: 70 - }, { - distanceFromScale: -30, - startValue: 70, - endValue: 110, - backgroundColor: "#fc0606", - border: { color: "#fc0606" } - }, - { - distanceFromScale: -30, - startValue: 110, - endValue: 120, - backgroundColor: "#f5b43f", - border: { color: "#f5b43f" } - }] - }] - }); - }); -} - - - - module ColorPickerComponent { $(function () { var colorSample = new ej.ColorPicker($("#colorpick"), { @@ -1027,357 +970,9 @@ module PDFViewerComponent { -module PivotChartOlap { - $(function () { - var sample = new ej.PivotChart($("#PivotChart"),{ - dataSource: { - data: "http://bi.syncfusion.com/olap/msmdpump.dll", - catalog: "Adventure Works DW 2008 SE", - cube: "Adventure Works", - rows: [ - { - fieldName: "[Date].[Fiscal]" - } - ], - columns: [ - { - fieldName: "[Customer].[Customer Geography]" - } - ], - values: [ - { - measures: [ - { - fieldName: "[Measures].[Internet Sales Amount]" - } - ], - axis: "columns" - } - ], - filters:[] - }, - isResponsive: true, - commonSeriesOptions: { - enableAnimation: true, - type: "column", tooltip: { visible: true } - }, - size: { height: "460px", width: "950px" }, - primaryXAxis: { title: { text: "Date - Fiscal" }, labelRotation: 0 }, - primaryYAxis: { title: { text: "Internet Sales Amount" } }, - legend: { visible: true, rowCount: 2 } - }); - }); -} -var pivot_dataset = [ - { Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" }, - { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" }, - { Amount: 300, Country: "Canada", Date: "FY 2007", Product: "Car", Quantity: 4, State: "Brunswick" }, - { Amount: 150, Country: "Canada", Date: "FY 2008", Product: "Bike", Quantity: 3, State: "Manitoba" }, - { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Car", Quantity: 4, State: "Ontario" }, - { Amount: 100, Country: "Canada", Date: "FY 2007", Product: "Van", Quantity: 1, State: "Quebec" }, - { Amount: 200, Country: "France", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Charente-Maritime" }, - { Amount: 250, Country: "France", Date: "FY 2006", Product: "Van", Quantity: 4, State: "Essonne" }, - { Amount: 300, Country: "France", Date: "FY 2007", Product: "Car", Quantity: 3, State: "Garonne (Haute)" }, - { Amount: 150, Country: "France", Date: "FY 2008", Product: "Van", Quantity: 2, State: "Gers" }, - { Amount: 200, Country: "Germany", Date: "FY 2006", Product: "Van", Quantity: 3, State: "Bayern" }, - { Amount: 250, Country: "Germany", Date: "FY 2007", Product: "Car", Quantity: 3, State: "Brandenburg" }, - { Amount: 150, Country: "Germany", Date: "FY 2008", Product: "Car", Quantity: 4, State: "Hamburg" }, - { Amount: 200, Country: "Germany", Date: "FY 2008", Product: "Bike", Quantity: 4, State: "Hessen" }, - { Amount: 150, Country: "Germany", Date: "FY 2007", Product: "Van", Quantity: 3, State: "Nordrhein-Westfalen" }, - { Amount: 100, Country: "Germany", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Saarland" }, - { Amount: 150, Country: "United Kingdom", Date: "FY 2008", Product: "Bike", Quantity: 5, State: "England" }, - { Amount: 250, Country: "United States", Date: "FY 2007", Product: "Car", Quantity: 4, State: "Alabama" }, - { Amount: 200, Country: "United States", Date: "FY 2005", Product: "Van", Quantity: 4, State: "California" }, - { Amount: 100, Country: "United States", Date: "FY 2006", Product: "Bike", Quantity: 2, State: "Colorado" }, - { Amount: 150, Country: "United States", Date: "FY 2008", Product: "Car", Quantity: 3, State: "New Mexico" }, - { Amount: 200, Country: "United States", Date: "FY 2005", Product: "Bike", Quantity: 4, State: "New York" }, - { Amount: 250, Country: "United States", Date: "FY 2008", Product: "Car", Quantity: 3, State: "North Carolina" }, - { Amount: 300, Country: "United States", Date: "FY 2007", Product: "Van", Quantity: 4, State: "South Carolina" } -] - -module PivotChartRelational { - - $(function () { - var sample = new ej.PivotChart($("#PivotChart"),{ - dataSource: { - data: pivot_dataset, - rows: [ - { - fieldName: "Country", - fieldCaption: "Country" - }, - { - fieldName: "State", - fieldCaption: "State" - }, - { - fieldName: "Date", - fieldCaption: "Date" - } - ], - columns: [ - { - fieldName: "Product", - fieldCaption: "Product" - } - ], - values: [ - { - fieldName: "Amount", - fieldCaption: "Amount" - } - ], - filters:[] - }, - isResponsive: true, - commonSeriesOptions: { - enableAnimation: true, - type: "column", tooltip: { visible: true } - }, - size: { height: "460px", width: "950px" }, - primaryYAxis: { title: { text: "Amount" } }, - legend: { visible: true } - }); - }); -} - - - -module PivotGaugeOlap { - - $(function () { - var sample = new ej.PivotGauge($("#PivotGauge"),{ - dataSource: { - data: "http://bi.syncfusion.com/olap/msmdpump.dll", - catalog: "Adventure Works DW 2008 SE", - cube: "Adventure Works", - rows: [ - { - fieldName: "[Date].[Fiscal]", - filterItems: { filterType: "include", values: ["[Date].[Fiscal].[Fiscal Year].&[2004]"] } - }, - ], - columns: [ - { - fieldName: "[Customer].[Customer Geography]" - } - ], - values: [ - { - measures: [ - { - fieldName: "[Measures].[Internet Sales Amount]" - }, - { - fieldName: "[Measures].[Internet Revenue Status]" - }, - { - fieldName: "[Measures].[Internet Revenue Trend]" - }, - { - fieldName: "[Measures].[Internet Revenue Goal]" - }, - ], - axis: "columns" - } - ], - filters:[] - }, - enableTooltip: true, isResponsive: true, - backgroundColor: "transparent", - labelFormatSettings: { decimalPlaces: 2 }, - scales: [{ - showRanges: true, - radius: 150, showScaleBar: true, size: 1, - border: { - width: 0.5 - }, - showIndicators: true, showLabels: true, - pointers: [{ - showBackNeedle: true, - backNeedleLength: 20, - length: 120, - width: 7 - }, - { - type: "marker", - markerType: "diamond", - distanceFromScale: 5, - placement: "center", - backgroundColor: "#29A4D9", - length: 25, - width: 15 - }], - ticks: [{ - type: "major", - distanceFromScale: 2, - height: 16, - width: 1, color: "#8c8c8c" - }, - { - type: "minor", - height: 6, - width: 1, - distanceFromScale: 2, - color: "#8c8c8c" - }], - labels: [{ - color: "#8c8c8c" - }], - ranges: [{ - distanceFromScale: -5, - backgroundColor: "#fc0606", - border: { color: "#fc0606" } - }, - { - distanceFromScale: -5 - }], - customLabels: [{ - position: { x: 180, y: 290 }, - font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }, - { - position: { x: 180, y: 320 }, - font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }, - { - position: { x: 180, y: 150 }, - font: { size: "12px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }] - }] - }); - }); -} - - - -var pivot_dataset = [ - { Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" }, - { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" }, - { Amount: 300, Country: "Canada", Date: "FY 2007", Product: "Car", Quantity: 4, State: "Brunswick" }, - { Amount: 150, Country: "Canada", Date: "FY 2008", Product: "Bike", Quantity: 3, State: "Manitoba" }, - { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Car", Quantity: 4, State: "Ontario" }, - { Amount: 100, Country: "Canada", Date: "FY 2007", Product: "Van", Quantity: 1, State: "Quebec" }, - { Amount: 200, Country: "France", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Charente-Maritime" }, - { Amount: 250, Country: "France", Date: "FY 2006", Product: "Van", Quantity: 4, State: "Essonne" }, - { Amount: 300, Country: "France", Date: "FY 2007", Product: "Car", Quantity: 3, State: "Garonne (Haute)" }, - { Amount: 150, Country: "France", Date: "FY 2008", Product: "Van", Quantity: 2, State: "Gers" }, - { Amount: 200, Country: "Germany", Date: "FY 2006", Product: "Van", Quantity: 3, State: "Bayern" }, - { Amount: 250, Country: "Germany", Date: "FY 2007", Product: "Car", Quantity: 3, State: "Brandenburg" }, - { Amount: 150, Country: "Germany", Date: "FY 2008", Product: "Car", Quantity: 4, State: "Hamburg" }, - { Amount: 200, Country: "Germany", Date: "FY 2008", Product: "Bike", Quantity: 4, State: "Hessen" }, - { Amount: 150, Country: "Germany", Date: "FY 2007", Product: "Van", Quantity: 3, State: "Nordrhein-Westfalen" }, - { Amount: 100, Country: "Germany", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Saarland" }, - { Amount: 150, Country: "United Kingdom", Date: "FY 2008", Product: "Bike", Quantity: 5, State: "England" }, - { Amount: 250, Country: "United States", Date: "FY 2007", Product: "Car", Quantity: 4, State: "Alabama" }, - { Amount: 200, Country: "United States", Date: "FY 2005", Product: "Van", Quantity: 4, State: "California" }, - { Amount: 100, Country: "United States", Date: "FY 2006", Product: "Bike", Quantity: 2, State: "Colorado" }, - { Amount: 150, Country: "United States", Date: "FY 2008", Product: "Car", Quantity: 3, State: "New Mexico" }, - { Amount: 200, Country: "United States", Date: "FY 2005", Product: "Bike", Quantity: 4, State: "New York" }, - { Amount: 250, Country: "United States", Date: "FY 2008", Product: "Car", Quantity: 3, State: "North Carolina" }, - { Amount: 300, Country: "United States", Date: "FY 2007", Product: "Van", Quantity: 4, State: "South Carolina" } -] - -module PivotGaugeRelational { - $(function () { - var sample = new ej.PivotGauge($("#PivotGauge"),{ - dataSource: { - data: pivot_dataset, - rows: [ - { - fieldName: "Country", - fieldCaption: "Country" - }, - { - fieldName: "State", - fieldCaption: "State" - } - ], - columns: [ - { - fieldName: "Product", - fieldCaption: "Product" - } - ], - values: [ - { - fieldName: "Amount", - fieldCaption: "Amount" - }, - { - fieldName: "Quantity", - fieldCaption: "Quantity" - } - ] - }, - enableTooltip: true, isResponsive: true, - backgroundColor: "transparent", - labelFormatSettings: { decimalPlaces: 2 }, - scales: [{ - showRanges: true, - radius: 150, showScaleBar: true, size: 1, - border: { - width: 0.5 - }, - showIndicators: true, showLabels: true, - pointers: [{ - showBackNeedle: true, - backNeedleLength: 20, - length: 120, - width: 7 - }, - { - type: "marker", - markerType: "diamond", - distanceFromScale: 5, - placement: "center", - backgroundColor: "#29A4D9", - length: 25, - width: 15 - }], - ticks: [{ - type: "major", - distanceFromScale: 2, - height: 16, - width: 1, color: "#8c8c8c" - }, - { - type: "minor", - height: 6, - width: 1, - distanceFromScale: 2, - color: "#8c8c8c" - }], - labels: [{ - color: "#8c8c8c" - }], - ranges: [{ - distanceFromScale: -5, - backgroundColor: "#fc0606", - border: { color: "#fc0606" } - }, - { - distanceFromScale: -5 - }], - customLabels: [{ - position: { x: 180, y: 290 }, - font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }, - { - position: { x: 180, y: 320 }, - font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }, - { - position: { x: 180, y: 150 }, - font: { size: "12px", fontFamily: "Segoe UI", fontStyle: "Normal" }, color: "#666666" - }] - }] - }); - }); -} diff --git a/ej.web.all/index.d.ts b/ej.web.all/index.d.ts index 85eb18fe46..1fb6a01302 100644 --- a/ej.web.all/index.d.ts +++ b/ej.web.all/index.d.ts @@ -1,21 +1,19 @@ -// Type definitions for ej.web.all v14.3.0.49 +// Type definitions for ej.web.all v14.4.0.15 // Project: http://help.syncfusion.com/js/typescript // Definitions by: Syncfusion // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - /*! * filename: ej.web.all.d.ts -* version : 14.3.0.49 +* version : 14.4.0.15 * Copyright Syncfusion Inc. 2001 - 2016. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under -* applicable laws. +* applicable laws. */ declare module ej { - + var dataUtil: dataUtil; function isMobile(): boolean; function isIOS(): boolean; @@ -34,7 +32,8 @@ declare module ej { function cancelEvent(): string; function copyObject(): string; function createObject(nameSpace: string, value: Object, initIn: any): JQuery; - function createObject(element : any , eventEmitter :any, model : any): any; + function createObject(element: any, eventEmitter: any, model: any): any; + function setCulture(culture: string): void; function getObject(element :string, model :any ): T; function defineClass(className: string, constructor:any, proto: Object, replace: boolean): Object; function destroyWidgets(element: Object): void; @@ -102,7 +101,7 @@ declare module ej { function select(jsonArray: any, fields: string): any; function setTransition(): boolean; function sum(json: string, fieldName: string): string; - function swap(array: any, x: string, y: string): any; + function swap(array: any, x: string, y: string): any; var cssUA: string; var serverTimezoneOffset: number; var transform: string; @@ -113,9 +112,10 @@ declare module ej { var transitionDuration: string; var transitionProperty: string; var transitionTimingFunction: string; + var template: any; var util: { valueFunction(val: string): any; - } + } export module device { function isAndroid(): boolean; function isIOS(): boolean; @@ -131,8 +131,8 @@ declare module ej { function destroyAll(elements: Element): void; function init(element: Element): void; function registerInstance(element: Element, pluginName: string, className: string, prototype: any):void; - } - + } + interface browserInfoOptions { name: string; version: string; @@ -148,7 +148,7 @@ declare module ej { _on(element: JQuery, eventType?: string, handler?: (eventObject: JQueryEventObject) => any): any; _on(element: JQuery, eventType ?: string, selector ?: string, handler ?: (eventObject: JQueryEventObject) => any): any; _off(element: JQuery, eventName: string, handler ?: (eventObject: JQueryEventObject) => any): any; - _off(element: JQuery, eventType ?: string, selector ?: string, handler ?: (eventObject: JQueryEventObject) => any): any; + _off(element: JQuery, eventType ?: string, selector ?: string, handler ?: (eventObject: JQueryEventObject) => any): any; persistState(): void; restoreState(silent: boolean): void; } @@ -158,17 +158,17 @@ declare module ej { static fn: Widget; static extend(widget: Widget): any; register(pluginName: string, className: string, prototype: any): void; - destroyAll(elements: Element): void; - model: any; + destroyAll(elements: Element): void; + model: any; } interface BaseEvent { cancel: boolean; - type: string; + type: string; } class DataManager { - constructor(dataSource?: any, query?: ej.Query, adaptor?: any); + constructor(dataSource?: any, query?: ej.Query, adaptor?: any); setDefaultQuery(query: ej.Query): void; executeQuery(query?: ej.Query, done?: any, fail?: any, always?: any): JQueryPromise; executeLocal(query?: ej.Query): ej.DataManager; @@ -176,7 +176,7 @@ declare module ej { insert(data: Object, tableName?: string): JQueryPromise; remove(keyField: string, value: any, tableName?: string): Object; update(keyField: string, value: any, tableName?: string): Object; - } + } class Query { constructor(); @@ -293,18 +293,28 @@ declare module ej { changeSetContent?: string; batchChangeSetContentType?: string; } + + class WebApiAdaptor extends ej.ODataAdaptor { + constructor(); + insert(dm: ej.DataManager, data: Object, tableName?: string): { url: string; type: string; data: Object; } + remove(dm: ej.DataManager, value: any, keyField?: string, tableName?: string): { url: string; type: string; data: Object; } + update(dm: ej.DataManager, value: any, keyField?: string, tableName?: string): { url: string; type: string; data: Object; accept: string; } + processResponse(data: Object, ds: Object, query: ej.Query, xhr: any, request: any, changes: Changes): { + result: Object; count: number + }; + } class ODataV4Adaptor extends ej.ODataAdaptor { constructor(); options: ODataAdaptorOptions; onCount(e: Object): string; onEachSearch(e: Object): void; - onSearch(e: Object): string; + onSearch(e: Object): string; beforeSend(dm: ej.DataManager, request: any, settings?: any): void; processResponse(data: Object, ds: Object, query: ej.Query, xhr:any, request: any, changes: Changes): { result: Object; count: number }; - + } interface ODataAdaptorOptions { requestType?: string; @@ -409,7 +419,7 @@ declare module ej { predicates: any; }; } - interface dataUtil { + interface dataUtil { swap(array: Array, x: number, y: number): void; mergeSort(jsonArray: Array, fieldName?: string, comparer?:any): Array; max(jsonArray: Array, fieldName?: string, comparer?: string): Array; @@ -479,7 +489,7 @@ declare module ej { row, tHead } - + enum filterType{ StartsWith, Contains, @@ -495,15 +505,20 @@ declare module ej { Fade, None, Slide - } + } enum Type{ Overlay, Slide } + enum SortOrder{ + Ascending, + Descending + } class Draggable extends ej.Widget { static fn: Draggable; constructor(element: JQuery, options?: Draggable.Model); constructor(element: Element, options?: Draggable.Model); + static Locale: any; model:Draggable.Model; defaults:Draggable.Model; @@ -662,6 +677,7 @@ class Droppable extends ej.Widget { static fn: Droppable; constructor(element: JQuery, options?: Droppable.Model); constructor(element: Element, options?: Droppable.Model); + static Locale: any; model:Droppable.Model; defaults:Droppable.Model; @@ -756,6 +772,7 @@ class Resizable extends ej.Widget { static fn: Resizable; constructor(element: JQuery, options?: Resizable.Model); constructor(element: Element, options?: Resizable.Model); + static Locale: any; model:Resizable.Model; defaults:Resizable.Model; @@ -857,10 +874,10 @@ export interface HelperEventArgs { function parseDate(value: string, format: string, culture ?: string): Date; function getLocalizedConstants(controlName: string, culture ?: string): any; -interface globalize { +interface globalize { addCulture(name: string, culture?: any): void; preferredCulture(culture?: string): culture; - format(value: any, format: string, culture?: string): string; + format(value: any, format: string, culture?: string): string; parseInt(value: string, radix?: any, culture?: string): number; parseFloat(value: string, radix?: any, culture?: string): number; parseDate(value: string, format: string, culture?: string): Date; @@ -925,11 +942,12 @@ interface globalize { M: string; Y: string; S: string; - } + } class Scroller extends ej.Widget { static fn: Scroller; constructor(element: JQuery, options?: Scroller.Model); constructor(element: Element, options?: Scroller.Model); + static Locale: any; model:Scroller.Model; defaults:Scroller.Model; @@ -963,15 +981,21 @@ class Scroller extends ej.Widget { */ refresh(): void; - /** Scroller moves to given pixel in X (left) position. We can also specify the animation speed,in which the scroller has to move while re-positioning it. + /** Horizontal scroller moves to given pixel from its origin position. We can also specify the animation speed,in which the scroller has to move while re-positioning it. + * @param {number|string} Horizontal scroller moves to the specified pixel. + * @param {boolean} Specifies to enable/disable the animation. + * @param {number} Specifies the animation speed when scrolling, if animation is enabled. * @returns {void} */ - scrollX(): void; + scrollX(pixel: number|string, disableAnimation: boolean, animationSpeed: number): void; - /** Scroller moves to given pixel in Y (top) position. We can also specify the animation speed,in which the scroller has to move while re-positioning it. + /** Vertical scroller moves to given pixel from its origin position. We can also specify the animation speed,in which the scroller has to move while re-positioning it. + * @param {number|string} Vertical scroller moves to the specified pixel. + * @param {boolean} Specifies to enable/disable the animation. + * @param {number} Specifies the animation speed when scrolling, if animation is enabled. * @returns {void} */ - scrollY(): void; + scrollY(pixel: number|string, disableAnimation: boolean, animationSpeed: number): void; } export module Scroller{ @@ -1053,12 +1077,21 @@ export interface Model { /** Fires when Scroller control is destroyed. */ destroy? (e: DestroyEventArgs): void; + /** Fires when a thumb point is moved along the touch surface. */ + thumbMove? (e: ThumbMoveEventArgs): void; + + /** Fires when a thumb point is placed on the touch surface. */ + thumbStart? (e: ThumbStartEventArgs): void; + + /** Fires when a thumb point is removed from the touch surface. */ + thumbEnd? (e: ThumbEndEventArgs): void; + + /** It fires whenever the mouse wheel is rotated either in upwards or downwards. */ + wheelMove? (e: WheelMoveEventArgs): void; + /** It will fire when mouse trackball has been start to wheel. */ wheelStart? (e: WheelStartEventArgs): void; - /** It fires whenever the mouse wheel is rotated either in upwards or downwards */ - wheelMove? (e: WheelMoveEventArgs): void; - /** It will fire when mouse trackball has been stop to wheel. */ wheelStop? (e: WheelStopEventArgs): void; } @@ -1089,7 +1122,53 @@ export interface DestroyEventArgs { type?: string; } -export interface WheelStartEventArgs { +export interface ThumbMoveEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** returns the scroller model + */ + model?: ej.Scroller.Model; + + /** returns the original event name and its event properties of the current event. + */ + originalEvent?: any; + + /** returns the current data related to the event. + */ + scrollData?: any; + + /** returns the name of the event. + */ + type?: string; +} + +export interface ThumbStartEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** returns the scroller model + */ + model?: ej.Scroller.Model; + + /** returns the original event name and its event properties of the current event. + */ + originalEvent?: any; + + /** returns the current data related to the event. + */ + scrollData?: any; + + /** returns the name of the event. + */ + type?: string; +} + +export interface ThumbEndEventArgs { /** if the event should be canceled; otherwise, false. */ @@ -1127,6 +1206,29 @@ export interface WheelMoveEventArgs { originalEvent?: any; } +export interface WheelStartEventArgs { + + /** if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** returns the scroller model + */ + model?: ej.Scroller.Model; + + /** returns the original event name and its event properties of the current event. + */ + originalEvent?: any; + + /** returns the current data related to the event. + */ + scrollData?: any; + + /** returns the name of the event. + */ + type?: string; +} + export interface WheelStopEventArgs { /** if the event should be canceled; otherwise, false. @@ -1151,6 +1253,7 @@ class Accordion extends ej.Widget { static fn: Accordion; constructor(element: JQuery, options?: Accordion.Model); constructor(element: Element, options?: Accordion.Model); + static Locale: any; model:Accordion.Model; defaults:Accordion.Model; @@ -1248,7 +1351,7 @@ export interface Model { /** Accordion headers can be expanded and collapsed on keyboard action. * @Default {true} */ - allowKeyboardNavigation?: boolean; + allowKeyboardNavigation?: Boolean; /** To set the Accordion headers Collapse Speed. * @Default {300} @@ -1262,7 +1365,7 @@ export interface Model { /** Sets the root CSS class for Accordion theme, which is used customize. */ - cssClass?: string; + cssClass?: String; /** Allows you to set the custom header Icon. It accepts two key values “header”, ”selectedHeader”. * @Default {{ header: e-collapse, selectedHeader: e-expand }} @@ -1277,12 +1380,12 @@ export interface Model { /** Specifies the animation behavior in accordion. * @Default {true} */ - enableAnimation?: boolean; + enableAnimation?: Boolean; /** With this enabled property, you can enable or disable the Accordion. * @Default {true} */ - enabled?: boolean; + enabled?: Boolean; /** Used to enable the disabled items in accordion. * @Default {[]} @@ -1292,22 +1395,22 @@ export interface Model { /** Multiple content panels to activate at a time. * @Default {false} */ - enableMultipleOpen?: boolean; + enableMultipleOpen?: Boolean; /** Save current model value to browser cookies for maintaining states. When refreshing the accordion control page, the model value is applied from browser cookies or HTML 5local storage. * @Default {false} */ - enablePersistence?: boolean; + enablePersistence?: Boolean; /** Display headers and panel text from right-to-left. * @Default {false} */ - enableRTL?: boolean; + enableRTL?: Boolean; /** The events API binds the action for activating the accordion header. Users can activate the header by using mouse actions such as mouse-over, mouse-up, mouse-down, and soon. * @Default {click} */ - events?: string; + events?: String; /** To set the Accordion headers Expand Speed. * @Default {300} @@ -1346,7 +1449,7 @@ export interface Model { /** Used to determines the close button visibility an each accordion items. This close button helps to remove the accordion item from the control. * @Default {false} */ - showCloseButton?: boolean; + showCloseButton?: Boolean; /** Displays rounded corner borders on the Accordion control's panels and headers. * @Default {false} @@ -1611,15 +1714,15 @@ export interface AjaxSettings { /** It specifies, whether to enable or disable asynchronous request. */ - async?: boolean; + async?: Boolean; /** It specifies the page will be cached in the web browser. */ - cache?: boolean; + cache?: Boolean; /** It specifies the type of data is send in the query string. */ - contentType?: string; + contentType?: String; /** It specifies the data as an object, will be passed in the query string. */ @@ -1627,22 +1730,22 @@ export interface AjaxSettings { /** It specifies the type of data that you're expecting back from the response. */ - dataType?: string; + dataType?: String; /** It specifies the HTTP request type. */ - type?: string; + type?: String; } export interface CustomIcon { /** This class name set to collapsing header. */ - header?: string; + header?: String; /** This class name set to expanded (active) header. */ - selectedHeader?: string; + selectedHeader?: String; } enum HeightAdjustMode{ @@ -1663,6 +1766,7 @@ class Autocomplete extends ej.Widget { static fn: Autocomplete; constructor(element: JQuery, options?: Autocomplete.Model); constructor(element: Element, options?: Autocomplete.Model); + static Locale: any; model:Autocomplete.Model; defaults:Autocomplete.Model; @@ -1730,17 +1834,17 @@ export interface Model { /** Customize "Add New" text (label) to be added in the autocomplete popup list for the entered text when there are no suggestions for it. * @Default {Add New} */ - addNewText?: boolean; + addNewText?: Boolean; /** Allows new values to be added to the autocomplete input other than the values in the suggestion list. Normally, when there are no suggestions it will display “No suggestions” label in the popup. * @Default {false} */ - allowAddNew?: boolean; + allowAddNew?: Boolean; /** Enables or disables the sorting of suggestion list item. The default sort order is ascending order. You customize sort order. * @Default {true} */ - allowSorting?: boolean; + allowSorting?: Boolean; /** Enables or disables selecting the animation style for the popup list. Animation types can be selected through either of the following options, * @Default {slide} @@ -1750,17 +1854,17 @@ export interface Model { /** To focus the items in the suggestion list when the popup is shown. By default first item will be focused. * @Default {false} */ - autoFocus?: boolean; + autoFocus?: Boolean; /** Enables or disables the case sensitive search. * @Default {false} */ - caseSensitiveSearch?: boolean; + caseSensitiveSearch?: Boolean; /** The root class for the Autocomplete textbox widget which helps in customizing its theme. * @Default {””} */ - cssClass?: string; + cssClass?: String; /** The data source contains the list of data for the suggestions list. It can be a string array or JSON array. * @Default {null} @@ -1770,42 +1874,42 @@ export interface Model { /** The time delay (in milliseconds) after which the suggestion popup will be shown. * @Default {200} */ - delaySuggestionTimeout?: number; + delaySuggestionTimeout?: Number; /** The special character which acts as a separator for the given words for multi-mode search i.e. the text after the delimiter are considered as a separate word or query for search operation. * @Default {’,’} */ - delimiterChar?: string; + delimiterChar?: String; /** The text to be displayed in the popup when there are no suggestions available for the entered text. * @Default {“No suggestions”} */ - emptyResultText?: string; + emptyResultText?: String; /** Fills the autocomplete textbox with the first matched item from the suggestion list automatically based on the entered text when enabled. * @Default {false} */ - enableAutoFill?: boolean; + enableAutoFill?: Boolean; /** Enables or disables the Autocomplete textbox widget. * @Default {true} */ - enabled?: boolean; + enabled?: Boolean; /** Enables or disables displaying the duplicate names present in the search result. * @Default {false} */ - enableDistinct?: boolean; + enableDistinct?: Boolean; /** Allows the current model values to be saved in local storage or browser cookies for state maintenance when it is set to true. While refreshing the page, it retains the model value from browser cookies or local storage. * @Default {false} */ - enablePersistence?: boolean; + enablePersistence?: Boolean; /** Displays the Autocomplete widget’s content from right to left when enabled. * @Default {false} */ - enableRTL?: boolean; + enableRTL?: Boolean; /** Mapping fields for the suggestion items of the Autocomplete textbox widget. * @Default {null} @@ -1815,27 +1919,27 @@ export interface Model { /** Specifies the search filter type. There are several types of search filter available such as ‘startswith’, ‘contains’, ‘endswith’, ‘lessthan’, ‘lessthanorequal’, ‘greaterthan’, ‘greaterthanorequal’, ‘equal’, ‘notequal’. * @Default {ej.filterType.StartsWith} */ - filterType?: string; + filterType?: String; /** The height of the Autocomplete textbox. * @Default {null} */ - height?: string; + height?: String; /** The search text can be highlighted in the AutoComplete suggestion list when enabled. * @Default {false} */ - highlightSearch?: boolean; + highlightSearch?: Boolean; /** Number of items to be displayed in the suggestion list. * @Default {0} */ - itemsCount?: number; + itemsCount?: Number; /** Minimum number of character to be entered in the Autocomplete textbox to show the suggestion list. * @Default {1} */ - minCharacter?: number; + minCharacter?: Number; /** An Autocomplete column collection can be defined and customized through the multiColumnSettings property.Column's header, field, and stringFormat can be define via multiColumnSettings properties. */ @@ -1849,12 +1953,12 @@ export interface Model { /** The height of the suggestion list. * @Default {“152px”} */ - popupHeight?: string; + popupHeight?: String; /** The width of the suggestion list. * @Default {“auto”} */ - popupWidth?: string; + popupWidth?: String; /** The query to retrieve the data from the data source. * @Default {null} @@ -1864,36 +1968,36 @@ export interface Model { /** Indicates that the autocomplete textbox values can only be readable. * @Default {false} */ - readOnly?: boolean; + readOnly?: Boolean; /** Sets the value for the Autocomplete textbox based on the given input key value. */ - selectValueByKey?: number; + selectValueByKey?: Number; /** Enables or disables showing the message when there are no suggestions for the entered text. * @Default {true} */ - showEmptyResultText?: boolean; + showEmptyResultText?: Boolean; /** Enables or disables the loading icon to intimate the searching operation. The loading icon is visible when there is a time delay to perform the search. * @Default {true} */ - showLoadingIcon?: boolean; + showLoadingIcon?: Boolean; /** Enables the showPopup button in autocomplete textbox. When the showPopup button is clicked, it displays all the available data from the data source. * @Default {false} */ - showPopupButton?: boolean; + showPopupButton?: Boolean; /** Enables or disables rounded corner. * @Default {false} */ - showRoundedCorner?: boolean; + showRoundedCorner?: Boolean; /** Enables or disables reset icon to clear the textbox values. * @Default {false} */ - showResetIcon?: boolean; + showResetIcon?: Boolean; /** Sort order specifies whether the suggestion list values has to be displayed in ascending or descending order. * @Default {ej.SortOrder.Ascending} @@ -1903,7 +2007,7 @@ export interface Model { /** The template to display the suggestion list items with customized appearance. * @Default {null} */ - template?: string; + template?: String; /** The jQuery validation error message to be displayed on form validation. * @Default {null} @@ -1918,22 +2022,22 @@ export interface Model { /** The value to be displayed in the autocomplete textbox. * @Default {null} */ - value?: string; + value?: String; /** Enables or disables the visibility of the autocomplete textbox. * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** The text to be displayed when the value of the autocomplete textbox is empty. * @Default {null} */ - watermarkText?: string; + watermarkText?: String; /** The width of the Autocomplete textbox. * @Default {null} */ - width?: string; + width?: String; /** Triggers when the AJAX requests Begins. */ actionBegin? (e: ActionBeginEventArgs): void; @@ -1988,7 +2092,7 @@ export interface ChangeEventArgs { /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Instance of the autocomplete model object. */ @@ -1996,11 +2100,11 @@ export interface ChangeEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Value of the autocomplete textbox. */ - value?: string; + value?: String; } export interface CloseEventArgs { @@ -2015,7 +2119,7 @@ export interface CloseEventArgs { /** Name of the event. */ - type?: string; + type?: String; } export interface CreateEventArgs { @@ -2163,7 +2267,7 @@ export interface MultiColumnSettingsColumn { /** Gets or sets a value that indicates to render the multicolumn with custom theme. */ - cssClass?: string; + cssClass?: String; /** Specifies the search data type. There are four types of data types available such as string, ‘number’, ‘boolean’ and ‘date’. * @Default {ej.Type.String} @@ -2245,6 +2349,7 @@ class Button extends ej.Widget { static fn: Button; constructor(element: JQuery, options?: Button.Model); constructor(element: Element, options?: Button.Model); + static Locale: any; model:Button.Model; defaults:Button.Model; @@ -2374,7 +2479,7 @@ export interface ClickEventArgs { */ status?: boolean; - /** return the event model for sever side processing. + /** return the event model for sever side processing. */ e?: any; } @@ -2441,16 +2546,16 @@ Normal, Mini, //Creates button with Built-in small size height, width specified Small, -//Creates button with Built-in medium size height, width specified +//Creates button with Built-in medium size height, width specified Medium, -//Creates button with Built-in large size height, width specified +//Creates button with Built-in large size height, width specified Large, } enum ButtonType { //Creates button with Built-in button type specified Button, -//Creates button with Built-in reset type specified +//Creates button with Built-in reset type specified Reset, //Creates button with Built-in submit type specified Submit, @@ -2460,6 +2565,7 @@ class Captcha extends ej.Widget { static fn: Captcha; constructor(element: JQuery, options?: Captcha.Model); constructor(element: Element, options?: Captcha.Model); + static Locale: any; model:Captcha.Model; defaults:Captcha.Model; } @@ -2690,6 +2796,7 @@ class ListBox extends ej.Widget { static fn: ListBox; constructor(element: JQuery, options?: ListBox.Model); constructor(element: Element, options?: ListBox.Model); + static Locale: any; model:ListBox.Model; defaults:ListBox.Model; @@ -2723,10 +2830,10 @@ class ListBox extends ej.Widget { disable(): void; /** Disables a list item by passing the item text as parameter. - * @param {string} Text of the listbox item to be disabled. + * @param {String} Text of the listbox item to be disabled. * @returns {void} */ - disableItem(text: string): void; + disableItem(text: String): void; /** Disables a list Item using its index value. * @param {number} Index of the listbox item to be disabled. @@ -2818,10 +2925,10 @@ class ListBox extends ej.Widget { moveUp(): void; /** Refreshes the ListBox widget. - * @param {boolean} Refreshes both the datasource and the dimensions of the ListBox widget when the parameter is passed as true, otherwise only the ListBox dimensions will be refreshed. + * @param {Boolean} Refreshes both the datasource and the dimensions of the ListBox widget when the parameter is passed as true, otherwise only the ListBox dimensions will be refreshed. * @returns {void} */ - refresh(refreshData: boolean): void; + refresh(refreshData: Boolean): void; /** Removes all the list items from listbox. * @returns {void} @@ -2834,7 +2941,7 @@ class ListBox extends ej.Widget { removeSelectedItems(): void; /** Removes a list item by using its text. - * @param {string} Text of the listbox item to be removed. + * @param {string} Text of the listbox item to be removed. * @returns {void} */ removeItemByText(text: string): void; @@ -2845,7 +2952,7 @@ class ListBox extends ej.Widget { */ removeItemByIndex(index: number): void; - /** + /** * @returns {void} */ selectAll(): void; @@ -2857,10 +2964,10 @@ class ListBox extends ej.Widget { selectItemByText(text: string): void; /** Selects list item using its value property. - * @param {string} Value of the listbox item to be selected. + * @param {String} Value of the listbox item to be selected. * @returns {void} */ - selectItemByValue(value: string): void; + selectItemByValue(value: String): void; /** Selects list item using its index value. * @param {number} Index of the listbox item to be selected. @@ -2891,7 +2998,7 @@ class ListBox extends ej.Widget { */ uncheckItemsByIndices(indices: number[]|string): void; - /** + /** * @returns {void} */ unselectAll(): void; @@ -2950,16 +3057,16 @@ class ListBox extends ej.Widget { hideItemsByValues(values: Array): void; /** Shows a hidden list item using its value. - * @param {string} Value of the listbox item to be shown. + * @param {String} Value of the listbox item to be shown. * @returns {void} */ - showItemByValue(value: string): void; + showItemByValue(value: String): void; /** Hide a list item using its value. - * @param {string} Value of the listbox item to be hidden. + * @param {String} Value of the listbox item to be hidden. * @returns {void} */ - hideItemByValue(value: string): void; + hideItemByValue(value: String): void; /** Shows a hidden list item using its index value. * @param {number} Index of the listbox item to be shown. @@ -2973,7 +3080,7 @@ class ListBox extends ej.Widget { */ hideItemByIndex(index: number): void; - /** + /** * @returns {void} */ show(): void; @@ -3216,7 +3323,7 @@ export interface ActionBeforeSuccessEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** List of actual object. */ @@ -3228,7 +3335,7 @@ export interface ActionBeforeSuccessEventArgs { /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** List of array object */ @@ -3247,7 +3354,7 @@ export interface ChangeEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** List item object. */ @@ -3259,31 +3366,31 @@ export interface ChangeEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface CheckChangeEventArgs { @@ -3294,7 +3401,7 @@ export interface CheckChangeEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** List item object. */ @@ -3306,31 +3413,31 @@ export interface CheckChangeEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface CreateEventArgs { @@ -3345,7 +3452,7 @@ export interface CreateEventArgs { /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; } export interface DestroyEventArgs { @@ -3356,11 +3463,11 @@ export interface DestroyEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; } export interface FocusInEventArgs { @@ -3371,11 +3478,11 @@ export interface FocusInEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; } export interface FocusOutEventArgs { @@ -3386,11 +3493,11 @@ export interface FocusOutEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; } export interface ItemDragEventArgs { @@ -3401,11 +3508,11 @@ export interface ItemDragEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** The Datasource of the listbox. */ @@ -3413,27 +3520,27 @@ export interface ItemDragEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on whether the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface ItemDragStartEventArgs { @@ -3444,11 +3551,11 @@ export interface ItemDragStartEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** The Datasource of the listbox. */ @@ -3456,27 +3563,27 @@ export interface ItemDragStartEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on whether the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface ItemDragStopEventArgs { @@ -3487,11 +3594,11 @@ export interface ItemDragStopEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** The Datasource of the listbox. */ @@ -3499,27 +3606,27 @@ export interface ItemDragStopEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on whether the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface ItemDropEventArgs { @@ -3530,11 +3637,11 @@ export interface ItemDropEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** The Datasource of the listbox. */ @@ -3542,27 +3649,27 @@ export interface ItemDropEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on whether the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface SelectEventArgs { @@ -3573,7 +3680,7 @@ export interface SelectEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** List item object. */ @@ -3585,31 +3692,31 @@ export interface SelectEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface UnselectEventArgs { @@ -3620,7 +3727,7 @@ export interface UnselectEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** List item object. */ @@ -3632,31 +3739,31 @@ export interface UnselectEventArgs { /** List item’s index. */ - index?: number; + index?: Number; /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Boolean value based on whether the list item is checked or not. */ - isChecked?: boolean; + isChecked?: Boolean; /** Boolean value based on whether the list item is selected or not. */ - isSelected?: boolean; + isSelected?: Boolean; /** Boolean value based on the list item is enabled or not. */ - isEnabled?: boolean; + isEnabled?: Boolean; /** List item’s text (label). */ - text?: string; + text?: String; /** List item’s value. */ - value?: string; + value?: String; } export interface Fields { @@ -3711,6 +3818,7 @@ class Calculate { static fn: Calculate; constructor(element: JQuery, options?: Calculate.Model); constructor(element: Element, options?: Calculate.Model); + static Locale: any; model:Calculate.Model; defaults:Calculate.Model; @@ -3773,6 +3881,7 @@ class CheckBox extends ej.Widget { static fn: CheckBox; constructor(element: JQuery, options?: CheckBox.Model); constructor(element: Element, options?: CheckBox.Model); + static Locale: any; model:CheckBox.Model; defaults:CheckBox.Model; @@ -3997,6 +4106,7 @@ class ColorPicker extends ej.Widget { static fn: ColorPicker; constructor(element: JQuery, options?: ColorPicker.Model); constructor(element: Element, options?: ColorPicker.Model); + static Locale: any; model:ColorPicker.Model; defaults:ColorPicker.Model; @@ -4098,6 +4208,11 @@ export interface Model { */ htmlAttributes?: any; + /** Defines the localized text values in button and tooltip. + * @Default {en-US} + */ + locale?: string; + /** Specifies the model type to be rendered initially in the color picker control. See below to get available ModelType * @Default {ej.ColorPicker.ModelType.Default} */ @@ -4421,7 +4536,7 @@ enum Presets{ } enum ButtonMode { -//Displays the button in split mode +//Displays the button in split mode Split, //Displays the button in Dropdown mode Dropdown, @@ -4431,6 +4546,7 @@ class FileExplorer extends ej.Widget { static fn: FileExplorer; constructor(element: JQuery, options?: FileExplorer.Model); constructor(element: Element, options?: FileExplorer.Model); + static Locale: any; model:FileExplorer.Model; defaults:FileExplorer.Model; @@ -4440,25 +4556,25 @@ class FileExplorer extends ej.Widget { adjustSize(): void; /** Disable the particular context menu item. - * @param {string|HTMLElement} Id of the menu item/ Menu element to be disabled + * @param {string|HTMLElement} Id of the menu item/ Menu element to be disabled * @returns {void} */ disableMenuItem(item: string|HTMLElement): void; /** Disable the particular toolbar item. - * @param {string|HTMLElement} Id of the toolbar item/ Tool item element to be disabled + * @param {string|HTMLElement} Id of the toolbar item/ Tool item element to be disabled * @returns {void} */ disableToolbarItem(item: string|HTMLElement): void; /** Enable the particular context menu item. - * @param {string|HTMLElement} Id of the menu item/ Menu element to be Enabled + * @param {string|HTMLElement} Id of the menu item/ Menu element to be Enabled * @returns {void} */ enableMenuItem(item: string|HTMLElement): void; /** Enable the particular toolbar item - * @param {string|HTMLElement} Id of the tool item/ Tool item element to be Enabled + * @param {string|HTMLElement} Id of the tool item/ Tool item element to be Enabled * @returns {void} */ enableToolbarItem(item: string|HTMLElement): void; @@ -4469,7 +4585,7 @@ class FileExplorer extends ej.Widget { refresh(): void; /** Remove the particular toolbar item. - * @param {string|HTMLElement} Id of the tool item/ tool item element to be removed + * @param {string|HTMLElement} Id of the tool item/ tool item element to be removed * @returns {void} */ removeToolbarItem(item: string|HTMLElement): void; @@ -4497,6 +4613,11 @@ export interface Model { */ allowDragAndDrop?: boolean; + /** Gets or sets a value that indicates whether to enable keyboard support for FileExplorer actions. + * @Default {true} + */ + allowKeyboardNavigation?: boolean; + /** The FileExplorer allows to select multiple files by enabling the allowMultiSelection property. You can perform multi selection by pressing the Ctrl key or Shift key. * @Default {true} */ @@ -4626,12 +4747,12 @@ export interface Model { showNavigationPane?: boolean; /** The tools property is used to configure and group required toolbar items in FileExplorer control. - * @Default {{ creation: [NewFolder], navigation: [Back, Forward, Upward], addressBar: [Addressbar], editing: [Refresh, Upload, Delete, Rename, Download], copyPaste: [Cut, Copy, Paste], getProperties: [Details], searchBar: [Searchbar], layout: [Layout]}} + * @Default {{ creation: [NewFolder], navigation: [Back, Forward, Upward], addressBar: [Addressbar], editing: [Refresh, Upload, Delete, Rename, Download], copyPaste: [Cut, Copy, Paste], getProperties: [Details], searchBar: [Searchbar], layout: [Layout], sortBy: [SortBy]}} */ tools?: any; /** The toolsList property is used to arrange the toolbar items in the FileExplorer control. - * @Default {[layout, creation, navigation, addressBar, editing, copyPaste, getProperties, searchBar]} + * @Default {[layout, creation, navigation, addressBar, editing, copyPaste, sortBy, getProperties, searchBar]} */ toolsList?: Array; @@ -4689,6 +4810,9 @@ export interface Model { /** Fires after loading the requested image from server. Using this event, you can get the details of loaded image. */ getImage? (e: GetImageEventArgs): void; + /** Fires when keydown in FileExplorer control. */ + keydown? (e: KeydownEventArgs): void; + /** Fires when the file view type is changed. */ layoutChange? (e: LayoutChangeEventArgs): void; } @@ -5078,6 +5202,41 @@ export interface GetImageEventArgs { type?: string; } +export interface KeydownEventArgs { + + /** Set to true when the event has to be canceled, else false. + */ + cancel?: boolean; + + /** returns the downed key keyCode value + */ + keyCode?: number; + + /** returns altKey value. + */ + altKey?: boolean; + + /** returns shiftKey value. + */ + shiftKey?: boolean; + + /** returns ctrlKey value. + */ + ctrlKey?: boolean; + + /** returns the event object. + */ + originalArgs?: any; + + /** returns the FileExplorer model. + */ + model?: ej.FileExplorer.Model; + + /** returns the name of the event. + */ + type?: string; +} + export interface LayoutChangeEventArgs { /** Set to true when the event has to be canceled, else false. @@ -5100,7 +5259,7 @@ export interface LayoutChangeEventArgs { export interface ContextMenuSettings { /** The items property is used to configure and group the required ContextMenu items in FileExplorer control. - * @Default {{% highlight javascript %}{navbar: [NewFolder, Upload, |, Delete, Rename, |, Cut, Copy, Paste, |, Getinfo],cwd: [Refresh, Paste,|, Sortby, |, NewFolder, Upload, |, Getinfo],files: [Open, Download, |, Upload, |, Delete, Rename, |, Cut, Copy, Paste, |, OpenFolderLocation, Getinfo]}{% endhighlight %}} + * @Default {{% highlight javascript %}{navbar: [NewFolder, Upload, |, Delete, Rename, |, Cut, Copy, Paste, |, Getinfo],cwd: [Refresh, Paste,|, SortBy, |, NewFolder, Upload, |, Getinfo],files: [Open, Download, |, Upload, |, Delete, Rename, |, Cut, Copy, Paste, |, OpenFolderLocation, Getinfo]}{% endhighlight %}} */ items?: any; @@ -5169,7 +5328,7 @@ enum layoutType{ ///Supports to display files in tile view Tile, - ///Supports to display files in grid view + ///Supports to display files in grid view Grid, ///Supports to display files as large icons @@ -5182,6 +5341,7 @@ class DatePicker extends ej.Widget { static fn: DatePicker; constructor(element: JQuery, options?: DatePicker.Model); constructor(element: Element, options?: DatePicker.Model); + static Locale: any; model:DatePicker.Model; defaults:DatePicker.Model; @@ -5780,10 +5940,10 @@ enum Level{ enum HighlightSection{ - ///Highlight the week of the currently selected date in DatePicker popup calendar + ///Highlight the week of the currently selected date in DatePicker popup calendar Week, - ///Highlight the workdays in a currently selected date's week in DatePicker popup calendar + ///Highlight the workdays in a currently selected date's week in DatePicker popup calendar WorkDays, ///Nothing will be highlighted, remove highlights from DatePicker popup calendar if already exists @@ -5796,6 +5956,7 @@ class DateTimePicker extends ej.Widget { static fn: DateTimePicker; constructor(element: JQuery, options?: DateTimePicker.Model); constructor(element: Element, options?: DateTimePicker.Model); + static Locale: any; model:DateTimePicker.Model; defaults:DateTimePicker.Model; @@ -6256,7 +6417,7 @@ enum popupPosition { //Opens the DateTimePicker popup below to the DateTimePicker input box Bottom, -//Opens the DateTimePicker popup above to the DateTimePicker input box +//Opens the DateTimePicker popup above to the DateTimePicker input box Top, } @@ -6264,6 +6425,7 @@ class Dialog extends ej.Widget { static fn: Dialog; constructor(element: JQuery, options?: Dialog.Model); constructor(element: Element, options?: Dialog.Model); + static Locale: any; model:Dialog.Model; defaults:Dialog.Model; @@ -6345,15 +6507,15 @@ export interface Model { /** Adds action buttons like close, minimize, pin, maximize in the dialog header. */ - actionButtons?: string[]; + actionButtons?: String[]; /** Enables or disables draggable. */ - allowDraggable?: boolean; + allowDraggable?: Boolean; /** Enables or disables keyboard interaction. */ - allowKeyboardNavigation?: boolean; + allowKeyboardNavigation?: Boolean; /** Customizes the Dialog widget animations. The Dialog widget can be animated while opening and closing the dialog. In order to customize animation effects, you need to set “enableAnimation” as true. It contains the following sub properties. */ @@ -6361,79 +6523,79 @@ export interface Model { /** Closes the dialog widget on pressing the ESC key when it is set to true. */ - closeOnEscape?: boolean; + closeOnEscape?: Boolean; /** The selector for the container element. If the property is set, then dialog will append to the selected element and it is restricted to move only within the specified container element. */ - containment?: string; + containment?: String; /** The content type to load the dialog content at run time. The possible values are null, AJAX, iframe and image. When it is null (default value), the content inside dialog element will be displayed as content and when it is not null, the content will be loaded from the URL specified in the contentUrl property. */ - contentType?: string; + contentType?: String; /** The URL to load the dialog content (such as AJAX, image, and iframe). In order to load content from URL, you need to set contentType as ‘ajax’ or ‘iframe’ or ‘image’. */ - contentUrl?: string; + contentUrl?: String; /** The root class for the Dialog widget to customize the existing theme. */ - cssClass?: string; + cssClass?: String; /** Enable or disables animation when the dialog is opened or closed. */ - enableAnimation?: boolean; + enableAnimation?: Boolean; /** Enables or disables the Dialog widget. */ - enabled?: boolean; + enabled?: Boolean; /** Enable or disables modal dialog. The modal dialog acts like a child window that is displayed on top of the main window/screen and disables the main window interaction until it is closed. */ - enableModal?: boolean; + enableModal?: Boolean; /** Allows the current model values to be saved in local storage or browser cookies for state maintenance when it is set to true. */ - enablePersistence?: boolean; + enablePersistence?: Boolean; /** Allows the dialog to be resized. The dialog cannot be resized less than the minimum height, width values and greater than the maximum height and width. */ - enableResize?: boolean; + enableResize?: Boolean; /** Displays dialog content from right to left when set to true. */ - enableRTL?: boolean; + enableRTL?: Boolean; /** The CSS class name to display the favicon in the dialog header. In order to display favicon, you need to set showHeader as true since the favicon will be displayed in the dialog header. */ - faviconCSS?: string; + faviconCSS?: String; /** Sets the height for the dialog widget. It accepts both string and integer values. For example, it can accepts values like “auto”, “100%”, “100px” as string type and “100”, “500” as integer type. */ - height?: string|number; + height?: String|Number; /** Enable or disables responsive behavior. */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Set the localization culture for Dialog Widget. */ - locale?: number; + locale?: Number; /** Sets the maximum height for the dialog widget. */ - maxHeight?: number; + maxHeight?: Number; /** Sets the maximum width for the dialog widget. */ - maxWidth?: number; + maxWidth?: Number; /** Sets the minimum height for the dialog widget. */ - minHeight?: number; + minHeight?: Number; /** Sets the minimum width for the dialog widget. */ - minWidth?: number; + minWidth?: Number; /** Displays the Dialog widget at the given X and Y position. */ @@ -6441,23 +6603,23 @@ export interface Model { /** Shows or hides the dialog header. */ - showHeader?: boolean; + showHeader?: Boolean; /** The Dialog widget can be opened by default i.e. on initialization, when it is set to true. */ - showOnInit?: boolean; + showOnInit?: Boolean; /** Enables or disables the rounder corner. */ - showRoundedCorner?: boolean; + showRoundedCorner?: Boolean; /** The selector for the container element. If this property is set, the dialog will be displayed (positioned) based on its container. */ - target?: string; + target?: String; /** The title text to be displayed in the dialog header. In order to set title, you need to set showHeader as true since the title will be displayed in the dialog header. */ - title?: string; + title?: String; /** Add or configure the tooltip text for actionButtons in the dialog header. */ @@ -6465,19 +6627,19 @@ export interface Model { /** Sets the height for the dialog widget. It accepts both string and integer values. For example, it can accepts values like “auto”, “100%”, “100px” as string type and “100”, “500” as integer type. */ - width?: string|number; + width?: String|Number; /** Sets the z-index value for the Dialog widget. */ - zIndex?: number; + zIndex?: Number; /** Sets the Footer for the Dialog widget. */ - showFooter?: boolean; + showFooter?: Boolean; /** Sets the FooterTemplate for the Dialog widget. */ - footerTemplateId?: string; + footerTemplateId?: String; /** This event is triggered before the dialog widgets gets open. */ beforeOpen? (e: BeforeOpenEventArgs): void; @@ -6546,7 +6708,7 @@ export interface BeforeOpenEventArgs { /** Name of the event */ - type?: string; + type?: String; } export interface AjaxErrorEventArgs { @@ -6638,7 +6800,7 @@ export interface CloseEventArgs { /** Name of the event */ - type?: string; + type?: String; } export interface ContentLoadEventArgs { @@ -6653,11 +6815,11 @@ export interface ContentLoadEventArgs { /** Name of the event. */ - type?: string; + type?: String; /** URL of the content. */ - URL?: string; + URL?: String; /** Content type */ @@ -6808,7 +6970,7 @@ export interface ResizeStopEventArgs { /** Set this option to true to cancel the event. */ - cancel?: boolean; + cancel?: Boolean; /** Instance of the dialog model object. */ @@ -6816,7 +6978,7 @@ export interface ResizeStopEventArgs { /** Name of the event */ - type?: string; + type?: String; /** Current event object. */ @@ -6877,10 +7039,154 @@ export interface ActionButtonClickEventArgs { } } +class DocumentEditor extends ej.Widget { + static fn: DocumentEditor; + constructor(element: JQuery, options?: DocumentEditor.Model); + constructor(element: Element, options?: DocumentEditor.Model); + static Locale: any; + model:DocumentEditor.Model; + defaults:DocumentEditor.Model; + + /** Loads the document from specified path using web API provided by importUrl. + * @param {String} Specifies the file path. + * @returns {void} + */ + load(Path: String): void; + + /** Gets the page number of current selection in the document. + * @returns {void} + */ + getCurrentPageNumber(): void; + + /** Gets the total number of pages in the document. + * @returns {void} + */ + getPageCount(): void; + + /** Gets the text of current selection in the document. + * @returns {void} + */ + getSelectedText(): void; + + /** Gets the current zoom factor value of the document container. + * @returns {void} + */ + getZoomFactor(): void; + + /** Scales the document container with the specified zoom factor. The range of zoom factor should be 0.10 to 5.00. + * @returns {void} + */ + setZoomFactor(): void; + + /** Prints the document content as page by page. + * @returns {void} + */ + print(): void; + + /** Finds the first occurrence of specified text from current selection and highlights the result. If the document end is reached, find operation will occur from the document start position. + * @param {String} Specifies the text to search in a document. + * @returns {void} + */ + find(Text: String): void; +} +export module DocumentEditor{ + +export interface Model { + + /** Gets or sets an object that indicates initialization of importing and exporting documents in document editor. + */ + importExportSettings?: ImportExportSettings; + + /** Triggers when the document changes. */ + onDocumentChange? (e: OnDocumentChangeEventArgs): void; + + /** Triggers when the selection changes. */ + onSelectionChange? (e: OnSelectionChangeEventArgs): void; + + /** Triggers when the zoom factor changes. */ + onZoomFactorChange? (e: OnZoomFactorChangeEventArgs): void; + + /** Triggers when the hyperlink is clicked. */ + onRequestNavigate? (e: OnRequestNavigateEventArgs): void; +} + +export interface OnDocumentChangeEventArgs { + + /** True, if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** Returns the document editor model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface OnSelectionChangeEventArgs { + + /** True, if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** Returns the document editor model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface OnZoomFactorChangeEventArgs { + + /** True, if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** Returns the document editor model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface OnRequestNavigateEventArgs { + + /** true, if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** Returns the document editor model. + */ + model?: any; + + /** Returns the link type and navigation link. + */ + hyperlink?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ImportExportSettings { + + /** Gets or sets URL of Web API that should be used to parse the document while loading. + */ + importUrl?: string; +} +} + class DropDownList extends ej.Widget { static fn: DropDownList; constructor(element: JQuery, options?: DropDownList.Model); constructor(element: Element, options?: DropDownList.Model); + static Locale: any; model:DropDownList.Model; defaults:DropDownList.Model; @@ -7178,7 +7484,7 @@ export interface Model { showRoundedCorner?: boolean; /** When the enableSorting property value is set to true, this property helps to sort the items either in ascending or descending order - * @Default {ej.sortOrder.Ascending} + * @Default {ej.SortOrder.Ascending} */ sortOrder?: ej.SortOrder|string; @@ -7320,11 +7626,11 @@ export interface ActionCompleteEventArgs { */ model?: any; - /** Returns the query for data retrieval + /** Returns the query for data retrieval */ query?: any; - /** Returns the query for data retrieval from the Database + /** Returns the query for data retrieval from the Database */ request?: any; @@ -7355,7 +7661,7 @@ export interface ActionFailureEventArgs { */ model?: any; - /** Returns the query for data retrieval + /** Returns the query for data retrieval */ query?: any; @@ -7378,11 +7684,11 @@ export interface ActionSuccessEventArgs { */ model?: any; - /** Returns the query for data retrieval + /** Returns the query for data retrieval */ query?: any; - /** Returns the query for data retrieval from the Database + /** Returns the query for data retrieval from the Database */ request?: any; @@ -7831,27 +8137,20 @@ export interface Fields { } enum FilterType { -//filter the data wherever contains search key +//filter the data wherever contains search key Contains, //filter the data based on search key present at start position StartsWith, } enum MultiSelectMode { -// can select only single item in DropDownList +// can select only single item in DropDownList None, //can select multiple items and it's separated by delimiterChar Delimiter, // can select multiple items and it's show's like visual box in textbox VisualMode, } -enum SortOrder -{ -// Sort the data in ascending order -Ascending, -//Sort the data in descending order -Descending, -} enum VirtualScrollMode { // The data is loaded only to the corresponding page (display items). When scrolling some other position, it enables the load on demand with the DropDownList. @@ -7864,6 +8163,7 @@ class Tooltip extends ej.Widget { static fn: Tooltip; constructor(element: JQuery, options?: Tooltip.Model); constructor(element: Element, options?: Tooltip.Model); + static Locale: any; model:Tooltip.Model; defaults:Tooltip.Model; @@ -8319,6 +8619,7 @@ class Editor extends ej.Widget { static fn: Editor; constructor(element: JQuery, options?: Editor.Model); constructor(element: Element, options?: Editor.Model); + static Locale: any; model:Editor.Model; defaults:Editor.Model; @@ -8390,14 +8691,14 @@ export interface Model { groupSize?: string; /** It provides the options to get the customized character to separate the digits. If not set, the separator defined by the current culture. - * @Default {null} + * @Default {Based on the culture} */ groupSeparator?: string; /** Specifies the height of the editor. * @Default {30} */ - height?: number|string; + height?: string; /** It allows to define the characteristics of the Editors control. It will helps to extend the capability of an HTML element. * @Default {{}} @@ -8475,13 +8776,14 @@ export interface Model { value?: number|string; /** Specifies the watermark text to editor. + * @Default {Based on the culture.} */ watermarkText?: string; /** Specifies the width of the editor. * @Default {143} */ - width?: number|string; + width?: string; /** Fires after Editor control value is changed. */ change? (e: ChangeEventArgs): void; @@ -8595,6 +8897,7 @@ class ListView extends ej.Widget { static fn: ListView; constructor(element: JQuery, options?: ListView.Model); constructor(element: Element, options?: ListView.Model); + static Locale: any; model:ListView.Model; defaults:ListView.Model; @@ -8805,7 +9108,7 @@ export interface Model { /** Specifies the height. * @Default {null} */ - height?: string|number; + height?: String|Number; /** Specifies whether to retain the selection of the item. * @Default {false} @@ -8845,7 +9148,7 @@ export interface Model { /** Specifies the width. * @Default {null} */ - width?: string|number; + width?: String|Number; /** Event triggers before the AJAX request happens. */ ajaxBeforeLoad? (e: AjaxBeforeLoadEventArgs): void; @@ -8869,7 +9172,7 @@ export interface Model { mouseDown? (e: MouseDownEventArgs): void; /** Event triggers when mouse up happens on the item. */ - mouseUP? (e: MouseUPEventArgs): void; + mouseUp? (e: MouseUpEventArgs): void; } export interface AjaxBeforeLoadEventArgs { @@ -9049,7 +9352,7 @@ export interface MouseDownEventArgs { checkedItemsText?: string; } -export interface MouseUPEventArgs { +export interface MouseUpEventArgs { /** returns true if the event should be canceled; otherwise, false. */ @@ -9097,6 +9400,7 @@ class MaskEdit extends ej.Widget { static fn: MaskEdit; constructor(element: JQuery, options?: MaskEdit.Model); constructor(element: Element, options?: MaskEdit.Model); + static Locale: any; model:MaskEdit.Model; defaults:MaskEdit.Model; @@ -9253,10 +9557,10 @@ export interface Model { keyup? (e: KeyupEventArgs): void; /** Fires when mouse out in mask edit textbox control. */ - mouseout? (e: MouseoutEventArgs): void; + mouseOut? (e: MouseOutEventArgs): void; /** Fires when mouse over in mask edit textbox control. */ - mouseover? (e: MouseoverEventArgs): void; + mouseOver? (e: MouseOverEventArgs): void; } export interface ChangeEventArgs { @@ -9427,7 +9731,7 @@ export interface KeyupEventArgs { unmaskedValue?: string; } -export interface MouseoutEventArgs { +export interface MouseOutEventArgs { /** if the event should be canceled; otherwise, false. */ @@ -9450,7 +9754,7 @@ export interface MouseoutEventArgs { unmaskedValue?: string; } -export interface MouseoverEventArgs { +export interface MouseOverEventArgs { /** if the event should be canceled; otherwise, false. */ @@ -9496,6 +9800,7 @@ class Menu extends ej.Widget { static fn: Menu; constructor(element: JQuery, options?: Menu.Model); constructor(element: Element, options?: Menu.Model); + static Locale: any; model:Menu.Model; defaults:Menu.Model; @@ -9970,6 +10275,7 @@ class Pager extends ej.Widget { static fn: Pager; constructor(element: JQuery, options?: Pager.Model); constructor(element: Element, options?: Pager.Model); + static Locale: any; model:Pager.Model; defaults:Pager.Model; @@ -9990,61 +10296,61 @@ export interface Model { /** Gets or sets a value that indicates whether to display the custom text message in Pager. */ - customText?: string; + customText?: String; /** Gets or sets a value that indicates whether to define which page to display currently in pager. * @Default {1} */ - currentPage?: number; + currentPage?: Number; /** Gets or sets a value that indicates whether to display the external Message in Pager. * @Default {false} */ - enableExternalMessage?: boolean; + enableExternalMessage?: Boolean; /** Gets or sets a value that indicates whether to pass the current page information as a query string along with the URL while navigating to other page. * @Default {false} */ - enableQueryString?: boolean; + enableQueryString?: Boolean; /** Align content in the pager control from right to left by setting the property as true. * @Default {false} */ - enableRTL?: boolean; + enableRTL?: Boolean; /** Gets or sets a value that indicates whether to display the external Message in Pager. */ - externalMessage?: string; + externalMessage?: String; /** Gets or sets a value that indicates whether to customizing the user interface (UI) as locale-specific in order to display regional data i.e. in a language and culture specific to a particular country or region. * @Default {en-US} */ - locale?: string; + locale?: String; /** Gets or sets a value that indicates whether to define the number of pages displayed in the pager for navigation. * @Default {10} */ - pageCount?: number; + pageCount?: Number; /** Gets or sets a value that indicates whether to define the number of records displayed per page. * @Default {12} */ - pageSize?: number; + pageSize?: Number; /** Get or sets a value of total number of pages in the pager. The totalPages value is calculated based on page size and total records. * @Default {null} */ - totalPages?: number; + totalPages?: Number; /** Get the value of total number of records which is bound to a data item. * @Default {null} */ - totalRecordsCount?: number; + totalRecordsCount?: Number; /** Shows or hides the current page information in pager footer. * @Default {true} */ - showPageInfo?: boolean; + showPageInfo?: Boolean; /** Triggered when pager numeric item is clicked in pager control. */ click? (e: ClickEventArgs): void; @@ -10078,6 +10384,7 @@ class ProgressBar extends ej.Widget { static fn: ProgressBar; constructor(element: JQuery, options?: ProgressBar.Model); constructor(element: Element, options?: ProgressBar.Model); + static Locale: any; model:ProgressBar.Model; defaults:ProgressBar.Model; @@ -10295,6 +10602,7 @@ class RadioButton extends ej.Widget { static fn: RadioButton; constructor(element: JQuery, options?: RadioButton.Model); constructor(element: Element, options?: RadioButton.Model); + static Locale: any; model:RadioButton.Model; defaults:RadioButton.Model; @@ -10481,6 +10789,7 @@ class Rating extends ej.Widget { static fn: Rating; constructor(element: JQuery, options?: Rating.Model); constructor(element: Element, options?: Rating.Model); + static Locale: any; model:Rating.Model; defaults:Rating.Model; @@ -10771,6 +11080,7 @@ class Ribbon extends ej.Widget { static fn: Ribbon; constructor(element: JQuery, options?: Ribbon.Model); constructor(element: Element, options?: Ribbon.Model); + static Locale: any; model:Ribbon.Model; defaults:Ribbon.Model; @@ -10836,9 +11146,9 @@ class Ribbon extends ej.Widget { /** Gets text of the given index tab in the ribbon control. * @param {number} index of the tab item. - * @returns {string} + * @returns {String} */ - getTabText(index: number): string; + getTabText(index: number): String; /** Hides the given text tab in the ribbon control. * @param {string} text of the tab item. @@ -10848,15 +11158,15 @@ class Ribbon extends ej.Widget { /** Checks whether the given text tab in the ribbon control is enabled or not. * @param {string} text of the tab item. - * @returns {boolean} + * @returns {Boolean} */ - isEnable(text: string): boolean; + isEnable(text: string): Boolean; /** Checks whether the given text tab in the ribbon control is visible or not. * @param {string} text of the tab item. - * @returns {boolean} + * @returns {Boolean} */ - isVisible(text: string): boolean; + isVisible(text: string): Boolean; /** Removes the given index tab item from the ribbon control. * @param {number} index of tab item. @@ -10899,11 +11209,11 @@ class Ribbon extends ej.Widget { /** To customize whole content from Tab Group. * @param {number} ribbon tab index. - * @param {string} ribbon group index. + * @param {string} ribbon group text. * @param {number} sub group index in the ribbon group, * @returns {void} */ - removeTabGroupContent(tabIndex: number, groupIndex: string, subGroupIndex?: number): void; + removeTabGroupContent(tabIndex: number, groupText: string, subGroupIndex?: number): void; /** Remove option from Backstage. * @param {number} index to the backstage item @@ -10925,11 +11235,6 @@ export interface Model { */ isResponsive?: boolean; - /** When isMobileOnly is true,its shows in mobile toolbar. - * @Default {false} - */ - isMobileOnly?: boolean; - /** Specifies the height, width, enableRTL, showRoundedCorner,enabled,cssClass property to the controls in the ribbon commonly andit will work only when those properties are not defined in buttonSettings and content defaults. * @Default {object} */ @@ -10945,6 +11250,16 @@ export interface Model { */ collapsePinSettings?: CollapsePinSettings; + /** Set enableOnDemand as true to load ribbon tab and backstage contents while corresponding item clicked. + * @Default {false} + */ + enableOnDemand?: boolean; + + /** Set collapsible property as true to render ribbon in initially collapsed state. + * @Default {false} + */ + collapsible?: boolean; + /** Align content in the ribbon control from right to left by setting the property as true. * @Default {false} */ @@ -11621,6 +11936,11 @@ export interface TabsGroupsContentGroupsGalleryItem { export interface TabsGroupsContentGroup { + /** When isMobileOnly is true,its shows in mobile toolbar.isResponsive should be true for using this property. + * @Default {false} + */ + isMobileOnly?: boolean; + /** Specifies the Syncfusion button members, events by using this buttonSettings. * @Default {object} */ @@ -11851,7 +12171,7 @@ enum CustomItemType{ enum QuickAccessMode{ - ///Controls are hidden in Quick Access toolbar + ///Controls are hidden in Quick Access toolbar None, ///Add controls in toolBar @@ -11889,6 +12209,7 @@ class Kanban extends ej.Widget { static fn: Kanban; constructor(element: JQuery, options?: Kanban.Model); constructor(element: Element, options?: Kanban.Model); + static Locale: any; model:Kanban.Model; defaults:Kanban.Model; @@ -11918,7 +12239,7 @@ class Kanban extends ej.Widget { toggleColumn(headerText: any): void; /** Expand or collapse the card based on the state of target "div" - * @param {string|number} Pass the id of card to be toggle + * @param {string|number} Pass the id of card to be toggle * @returns {void} */ toggleCard(key: string|number): void; @@ -11935,14 +12256,14 @@ class Kanban extends ej.Widget { /** Get the column details based on the given header text in Kanban. * @param {string} Pass the header text of the column to get the corresponding column object - * @returns {string} + * @returns {String} */ - getColumnByHeaderText(headerText: string): string; + getColumnByHeaderText(headerText: string): String; /** Get the table details based on the given header table in Kanban. - * @returns {string} + * @returns {String} */ - getHeaderTable(): string; + getHeaderTable(): String; /** Hide columns from the Kanban based on the header text * @param {Array|string} you can pass either array of header text of various columns or a header text of a column to hide @@ -12168,7 +12489,7 @@ export interface Model { /** To perform kanban functionalities with touch interaction. * @Default {true} */ - enableTouch?: boolean; + enableTouch?: Boolean; /** Align content in the Kanban control align from right to left by setting the property as true. * @Default {false} @@ -12252,7 +12573,7 @@ export interface Model { /** Gets or sets a value that indicates whether to customizing the user interface (UI) as locale-specific in order to display regional data i.e. in a language and culture specific to a particular country or region. * @Default {en-US} */ - locale?: string; + locale?: String; /** Triggered for every Kanban action before its starts. */ actionBegin? (e: ActionBeginEventArgs): void; @@ -12292,6 +12613,42 @@ export interface Model { /** Triggered when card is double clicked. */ cardDoubleClick? (e: CardDoubleClickEventArgs): void; + + /** Triggered before the card is selected. */ + cardSelecting? (e: CardSelectingEventArgs): void; + + /** Triggered when the Kanban is rendered completely */ + create? (e: CreateEventArgs): void; + + /** Triggers after the cell is clicked. */ + cellClick? (e: CellClickEventArgs): void; + + /** Triggered the Kanban is bound with data during initial rendering. */ + dataBound? (e: DataBoundEventArgs): void; + + /** Triggered when Kanban going to destroy. */ + destroy? (e: DestroyEventArgs): void; + + /** Triggered after the card is deleted. */ + endDelete? (e: EndDeleteEventArgs): void; + + /** Triggered after the card is edited. */ + endEdit? (e: EndEditEventArgs): void; + + /** Triggers after the header is clicked. */ + headerClick? (e: HeaderClickEventArgs): void; + + /** Triggered initial load. */ + load? (e: LoadEventArgs): void; + + /** Triggered when toolbar item is clicked in Kanban. */ + toolbarClick? (e: ToolbarClickEventArgs): void; + + /** Triggered every time a single card rendered request is made to access particular card information. */ + queryCellInfo? (e: QueryCellInfoEventArgs): void; + + /** Triggered before the context menu is opened. */ + contextOpen? (e: ContextOpenEventArgs): void; } export interface ActionBeginEventArgs { @@ -12716,11 +13073,328 @@ export interface CardDoubleClickEventArgs { */ data?: any; + /** Returns the Kanban model. + */ + model?: any; + /** Returns the name of the event. */ type?: string; } +export interface CardSelectingEventArgs { + + /** Returns the selecting cell index value. + */ + cellIndex?: number; + + /** Returns the selecting card index value. + */ + cardIndex?: number; + + /** Returns the selecting cell element + */ + currentCell?: any; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the previously selecting the card element + */ + previousCard?: any; + + /** Returns the previously rowcell is selecting card indexes + */ + previousRowcellindex?: Array; + + /** Returns the current item. + */ + currentTarget?: any; + + /** Returns the Kanban model. + */ + model?: any; + + /** Returns added data. + */ + data?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface CreateEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the kanban model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface CellClickEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the kanban model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; + + /** Returns the select cell index value. + */ + cellIndex?: number; + + /** Returns the edited row index. + */ + rowIndex?: number; +} + +export interface DataBoundEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the Kanban model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface DestroyEventArgs { + + /** Returns the kanban model. + */ + model?: any; + + /** Returns deleted data. + */ + data?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface EndDeleteEventArgs { + + /** Returns the Kanban model. + */ + model?: any; + + /** Returns request type. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns deleted data. + */ + data?: any; + + /** Returns the name of the event. + */ + type?: string; + + /** Current action name + */ + action?: string; +} + +export interface EndEditEventArgs { + + /** Returns the Kanban model. + */ + model?: any; + + /** Returns request type. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns modified data. + */ + data?: any; + + /** Returns the name of the event. + */ + type?: string; + + /** Current Action name + */ + action?: string; +} + +export interface HeaderClickEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the kanban model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; + + /** Returns the select cell index value. + */ + cellIndex?: number; + + /** Returns the column object. + */ + columnData?: any; +} + +export interface LoadEventArgs { + + /** Returns the kanban model. + */ + model?: any; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ToolbarClickEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the current item. + */ + currentTarget?: any; + + /** Returns the item id of that current element. + */ + itemId?: string; + + /** Returns the item index of that current element. + */ + itemIndex?: number; + + /** Returns the item name of that current element. + */ + itemName?: string; + + /** Returns the item text of that current element. + */ + itemText?: string; + + /** Returns the Kanban model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; + + /** Returns the toolbar object of the Kanban. + */ + toolbarData?: any; +} + +export interface QueryCellInfoEventArgs { + + /** Returns Kanban card. + */ + card?: any; + + /** Returns Kanban card. + */ + cell?: any; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns current row record object (JSON). + */ + data?: any; + + /** Returns the column object. + */ + column?: any; + + /** Returns the Kanban model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ContextOpenEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the Kanban model. + */ + model?: any; + + /** Returns the name of the event. + */ + type?: string; + + /** Returns the current item. + */ + currentTarget?: any; + + /** Returns the status of contextmenu item which denotes its enabled state. + */ + status?: boolean; + + /** Returns the target item. + */ + target?: any; +} + +export interface SwimlaneSettingsUnassignedGroup { + + /** To enable or disable unassigned category change with swim lane key values. + * @Default {true} + */ + enable?: boolean; + + /** To set the user defined values which are need to categorized as unassigned category swim lane groups. + * @Default {[null,undefined,]} + */ + keys?: boolean; +} + export interface SwimlaneSettings { /** To enable or disable items count in swim lane. @@ -12732,6 +13406,11 @@ export interface SwimlaneSettings { * @Default {false} */ allowDragAndDrop?: boolean; + + /** Customize the settings for unassigned category of swim lane. + * @Default {Object} + */ + unassignedGroup?: SwimlaneSettingsUnassignedGroup; } export interface ContextMenuSettingsCustomMenuItem { @@ -12749,7 +13428,7 @@ export interface ContextMenuSettingsCustomMenuItem { /** Gets the template to render custom context menu item. * @Default {null} */ - template?: string; + template?: String; } export interface ContextMenuSettings { @@ -12915,7 +13594,7 @@ export interface EditSettings { /** This specifies the id of the template which is require to be edited using the Dialog Box. * @Default {null} */ - dialogTemplate?: string; + dialogTemplate?: String; /** Get or sets an object that indicates whether to customize the editMode of the Kanban. * @Default {ej.Kanban.EditMode.Dialog} @@ -12930,7 +13609,7 @@ export interface EditSettings { /** This specifies the id of the template which is require to be edited using the External edit form. * @Default {null} */ - externalFormTemplate?: string; + externalFormTemplate?: String; /** This specifies to set the position of an External edit form either in the right or bottom of the Kanban. * @Default {ej.Kanban.FormPosition.Bottom} @@ -13123,7 +13802,7 @@ enum EditingType{ ///Allows to set edit type as string edit type String, - ///Allows to set edit type as numeric edit type + ///Allows to set edit type as numeric edit type Numeric, ///Allows to set edit type as drop down edit type @@ -13168,6 +13847,7 @@ class Rotator extends ej.Widget { static fn: Rotator; constructor(element: JQuery, options?: Rotator.Model); constructor(element: Element, options?: Rotator.Model); + static Locale: any; model:Rotator.Model; defaults:Rotator.Model; @@ -13359,6 +14039,11 @@ export interface Model { */ template?: string; + /** The templateId enables to bind multiple customized template items in Rotator. + * @Default {null} + */ + templateId?: Array; + /** Specifies the source for thumbnail elements. * @Default {null} */ @@ -13585,6 +14270,7 @@ class RTE extends ej.Widget { static fn: RTE; constructor(element: JQuery, options?: RTE.Model); constructor(element: Element, options?: RTE.Model); + static Locale: any; model:RTE.Model; defaults:RTE.Model; @@ -14356,6 +15042,7 @@ class Slider extends ej.Widget { static fn: Slider; constructor(element: JQuery, options?: Slider.Model); constructor(element: Element, options?: Slider.Model); + static Locale: any; model:Slider.Model; defaults:Slider.Model; @@ -14374,7 +15061,7 @@ class Slider extends ej.Widget { */ getValue(): number; - /** To set value to slider handle.By defaut animation is false while set the value. If you want to enable the animation, pass the enableAnimation as true to this method. + /** To set value to slider handle.By default animation is false while set the value. If you want to enable the animation, pass the enableAnimation as true to this method. * @returns {void} */ setValue(): void; @@ -14550,7 +15237,7 @@ export interface ChangeEventArgs { */ value?: number; - /** returns true if event triggered by interaction else returns false. + /** returns true if event triggered by interaction else returns false. */ isInteraction?: boolean; } @@ -14686,6 +15373,7 @@ class SplitButton extends ej.Widget { static fn: SplitButton; constructor(element: JQuery, options?: SplitButton.Model); constructor(element: Element, options?: SplitButton.Model); + static Locale: any; model:SplitButton.Model; defaults:SplitButton.Model; @@ -14931,11 +15619,11 @@ export interface ItemMouseOutEvent { /** return the menu item id */ - ID?: string; + ID?: String; /** return the clicked menu item text */ - Text?: string; + Text?: String; } export interface ItemMouseOverEventArgs { @@ -14965,11 +15653,11 @@ export interface ItemMouseOverEvent { /** return the menu item id */ - ID?: string; + ID?: String; /** return the clicked menu item text */ - Text?: string; + Text?: String; } export interface ItemSelectedEventArgs { @@ -14996,11 +15684,11 @@ export interface ItemSelectedEventArgs { /** return the menu id */ - menuId?: string; + menuId?: String; /** return the clicked menu item text */ - menuText?: string; + menuText?: String; } export interface OpenEventArgs { @@ -15034,6 +15722,7 @@ class Splitter extends ej.Widget { static fn: Splitter; constructor(element: JQuery, options?: Splitter.Model); constructor(element: Element, options?: Splitter.Model); + static Locale: any; model:Splitter.Model; defaults:Splitter.Model; @@ -15259,6 +15948,7 @@ class Tab extends ej.Widget { static fn: Tab; constructor(element: JQuery, options?: Tab.Model); constructor(element: Element, options?: Tab.Model); + static Locale: any; model:Tab.Model; defaults:Tab.Model; @@ -15798,7 +16488,7 @@ enum Position{ ///Tab headers display to top position Top, - ///Tab headers display to bottom position + ///Tab headers display to bottom position Bottom, ///Tab headers display to left position. @@ -15830,6 +16520,7 @@ class TagCloud extends ej.Widget { static fn: TagCloud; constructor(element: JQuery, options?: TagCloud.Model); constructor(element: Element, options?: TagCloud.Model); + static Locale: any; model:TagCloud.Model; defaults:TagCloud.Model; @@ -16067,6 +16758,7 @@ class TimePicker extends ej.Widget { static fn: TimePicker; constructor(element: JQuery, options?: TimePicker.Model); constructor(element: Element, options?: TimePicker.Model); + static Locale: any; model:TimePicker.Model; defaults:TimePicker.Model; @@ -16471,6 +17163,7 @@ class ToggleButton extends ej.Widget { static fn: ToggleButton; constructor(element: JQuery, options?: ToggleButton.Model); constructor(element: Element, options?: ToggleButton.Model); + static Locale: any; model:ToggleButton.Model; defaults:ToggleButton.Model; @@ -16678,6 +17371,7 @@ class Toolbar extends ej.Widget { static fn: Toolbar; constructor(element: JQuery, options?: Toolbar.Model); constructor(element: Element, options?: Toolbar.Model); + static Locale: any; model:Toolbar.Model; defaults:Toolbar.Model; @@ -16779,11 +17473,21 @@ export interface Model { */ dataSource?: any; + /** Disables an Item or set of Items that are enabled in the Toolbar + * @Default {[]} + */ + disabledItemIndices?: Array; + /** Specifies the Toolbar control state. * @Default {true} */ enabled?: boolean; + /** Enables an Item or set of Items that are disabled in the Toolbar + * @Default {[]} + */ + enabledItemIndices?: Array; + /** Specifies enableRTL property to align the Toolbar control from right to left direction. * @Default {false} */ @@ -17023,6 +17727,7 @@ class TreeView extends ej.Widget { static fn: TreeView; constructor(element: JQuery, options?: TreeView.Model); constructor(element: Element, options?: TreeView.Model); + static Locale: any; model:TreeView.Model; defaults:TreeView.Model; @@ -17051,11 +17756,12 @@ class TreeView extends ej.Widget { */ checkNode(element: string|any): void; - /** This method is used to collapse all nodes in TreeView control. If you want to collapse all nodes up to the specific level in TreeView control then we need to pass level as argument to this method. + /** This method is used to collapse all nodes in TreeView control. If you want to collapse all nodes up to the specific level in TreeView control then we need to pass levelUntil as argument to this method. * @param {number} TreeView nodes will collapse until the given level + * @param {boolean} Weather exclude the hidden nodes of TreeView while collapse all nodes * @returns {void} */ - collapseAll(levelUntil?: number): void; + collapseAll(levelUntil?: number, excludeHiddenNodes?: boolean): void; /** To collapse a particular node in TreeView. * @param {string|any} ID of TreeView node|object of TreeView node @@ -17081,11 +17787,12 @@ class TreeView extends ej.Widget { */ ensureVisible(element: string|any): boolean; - /** This method is used to expand all nodes in TreeView control. If you want to expand all nodes up to the specific level in TreeView control then we need to pass level as argument to this method. + /** This method is used to expand all nodes in TreeView control. If you want to expand all nodes up to the specific level in TreeView control then we need to pass levelUntil as argument to this method. * @param {number} TreeView nodes will expand until the given level + * @param {boolean} Weather exclude the hidden nodes of TreeView while expand all nodes * @returns {void} */ - expandAll(levelUntil?: number): void; + expandAll(levelUntil?: number, excludeHiddenNodes?: boolean): void; /** To expandNode particular node in TreeView. * @param {string|any} ID of TreeView node/object of TreeView node @@ -17439,6 +18146,11 @@ export interface Model { */ fields?: Fields; + /** Gets or sets a value that indicates whether to enable full row selection support for TreeView. + * @Default {false} + */ + fullRowSelect?: boolean; + /** Defines the height of the TreeView. * @Default {Null} */ @@ -17641,7 +18353,7 @@ export interface BeforeCollapseEventArgs { */ parentId?: string; - /** returns the format asynchronous or synchronous + /** returns the format asynchronous or synchronous */ async?: boolean; } @@ -17769,7 +18481,7 @@ export interface BeforeExpandEventArgs { */ parentId?: string; - /** returns the format asynchronous or synchronous + /** returns the format asynchronous or synchronous */ async?: boolean; } @@ -17941,6 +18653,14 @@ export interface KeyPressEventArgs { /** it returns when the current node is in expanded state; otherwise, false. */ isExpanded?: boolean; + + /** returns the id of current TreeView node + */ + id?: string; + + /** returns the parentId of current TreeView node + */ + parentId?: string; } export interface LoadErrorEventArgs { @@ -18089,11 +18809,11 @@ export interface NodeClickEventArgs { */ currentElement?: any; - /** returns the id of current element + /** returns the id of currently clicked TreeView node */ id?: string; - /** returns the parentId of current element + /** returns the parentId of currently clicked TreeView node */ parentId?: string; } @@ -18132,7 +18852,7 @@ export interface NodeCollapseEventArgs { */ isChildLoaded?: boolean; - /** returns the format asynchronous or synchronous + /** returns the format asynchronous or synchronous */ async?: boolean; } @@ -18436,7 +19156,7 @@ export interface NodeExpandEventArgs { */ parentId?: string; - /** returns the format asynchronous or synchronous + /** returns the format asynchronous or synchronous */ async?: boolean; } @@ -18616,11 +19336,11 @@ export interface Fields { /** Specifies the node to be in expanded state. */ - expanded?: boolean; + expanded?: string; /** Its allow us to indicate whether the node has child or not in load on demand */ - hasChild?: boolean; + hasChild?: string; /** Specifies the HTML Attributes to "li" item list. */ @@ -18640,7 +19360,7 @@ export interface Fields { /** If its true Checkbox node will be checked when rendered with checkbox. */ - isChecked?: boolean; + isChecked?: string; /** Specifies the link attribute to “a” tag in item list. */ @@ -18656,7 +19376,7 @@ export interface Fields { /** Allow us to specify the node to be in selected state */ - selected?: boolean; + selected?: string; /** Specifies the sprite CSS class to "li" item list. */ @@ -18696,6 +19416,7 @@ class Uploadbox extends ej.Widget { static fn: Uploadbox; constructor(element: JQuery, options?: Uploadbox.Model); constructor(element: Element, options?: Uploadbox.Model); + static Locale: any; model:Uploadbox.Model; defaults:Uploadbox.Model; @@ -18874,7 +19595,7 @@ export interface Model { /** Fires when the file upload progress is completed. */ complete? (e: CompleteEventArgs): void; - /** Fires when the file upload progress is successed. */ + /** Fires when the file upload progress is succeeded. */ success? (e: SuccessEventArgs): void; /** Fires when the Uploadbox control is created. */ @@ -19198,6 +19919,7 @@ class WaitingPopup extends ej.Widget { static fn: WaitingPopup; constructor(element: JQuery, options?: WaitingPopup.Model); constructor(element: Element, options?: WaitingPopup.Model); + static Locale: any; model:WaitingPopup.Model; defaults:WaitingPopup.Model; @@ -19302,11 +20024,12 @@ class Grid extends ej.Widget { static fn: Grid; constructor(element: JQuery, options?: Grid.Model); constructor(element: Element, options?: Grid.Model); + static Locale: any; model:Grid.Model; defaults:Grid.Model; /** Adds a grid model property which is to be ignored upon exporting. - * @param {Array} Pass the array of parameters which need to be ignored on exporting + * @param {Array} Pass the array of parameters which need to be ignored on exporting * @returns {void} */ addIgnoreOnExport(propertyNames: Array): void; @@ -19344,22 +20067,22 @@ class Grid extends ej.Widget { cancelEditCell(): void; /** It is used to clear all the cell selection. - * @returns {boolean} + * @returns {Boolean} */ - clearCellSelection(): boolean; + clearCellSelection(): Boolean; /** It is used to clear specified cell selection based on the rowIndex and columnIndex provided. * @param {number} It is used to pass the row index of the cell * @param {number} It is used to pass the column index of the cell. - * @returns {boolean} + * @returns {Boolean} */ - clearCellSelection(rowIndex: number, columnIndex: number): boolean; + clearCellSelection(rowIndex: number, columnIndex: number): Boolean; /** It is used to clear all the row selection or at specific row selection based on the index provided. * @param {number} optional If index of the column is specified then it will remove the selection from the particular column else it will clears all of the column selection - * @returns {boolean} + * @returns {Boolean} */ - clearColumnSelection(index?: number): boolean; + clearColumnSelection(index?: number): Boolean; /** It is used to clear all the filtering done. * @param {string} If field of the column is specified then it will clear the particular filtering column @@ -19374,9 +20097,9 @@ class Grid extends ej.Widget { /** Clear all the row selection or at specific row selection based on the index provided * @param {number} optional If index of the row is specified then it will remove the selection from the particular row else it will clears all of the row selection - * @returns {boolean} + * @returns {Boolean} */ - clearSelection(index?: number): boolean; + clearSelection(index?: number): Boolean; /** Clear the sorting from columns in the grid * @returns {void} @@ -19516,9 +20239,9 @@ class Grid extends ej.Widget { /** Get the column index of the given field in grid. * @param {string} Pass the field name of the column to get the corresponding column index - * @returns {number} + * @returns {Number} */ - getColumnIndexByField(fieldName: string): number; + getColumnIndexByField(fieldName: string): Number; /** Get the content div element of grid. * @returns {HTMLElement} @@ -19526,9 +20249,9 @@ class Grid extends ej.Widget { getContent(): HTMLElement; /** Get the content table element of grid - * @returns {HTMLElement} + * @returns {Array} */ - getContentTable(): HTMLElement; + getContentTable(): Array; /** Get the data of currently edited cell value in "batch" edit mode * @returns {any} @@ -19536,9 +20259,9 @@ class Grid extends ej.Widget { getCurrentEditCellData(): any; /** Get the current page index in grid pager. - * @returns {number} + * @returns {Number} */ - getCurrentIndex(): number; + getCurrentIndex(): Number; /** Get the current page data source of grid. * @returns {Array} @@ -19547,9 +20270,9 @@ class Grid extends ej.Widget { /** Get the column field name from the given header text in grid. * @param {string} Pass header text of the column to get its corresponding field name - * @returns {string} + * @returns {String} */ - getFieldNameByHeaderText(headerText: string): string; + getFieldNameByHeaderText(headerText: string): String; /** Get the filter bar of grid * @returns {HTMLElement} @@ -19583,9 +20306,9 @@ class Grid extends ej.Widget { /** Get the column header text from the given field name in grid. * @param {string} Pass field name of the column to get its corresponding header text - * @returns {string} + * @returns {String} */ - getHeaderTextByFieldName(field: string): string; + getHeaderTextByFieldName(field: string): String; /** Get the names of all the hidden column collections in grid. * @returns {Array} @@ -19594,9 +20317,9 @@ class Grid extends ej.Widget { /** Get the row index based on the given tr element in grid. * @param {JQuery} Pass the tr element in grid content to get its row index - * @returns {number} + * @returns {Number} */ - getIndexByRow($tr: JQuery): number; + getIndexByRow($tr: JQuery): Number; /** Get the pager of grid. * @returns {HTMLElement} @@ -19616,9 +20339,9 @@ class Grid extends ej.Widget { getRowByIndex(from: number, to: number): HTMLElement; /** Get the row height of grid. - * @returns {number} + * @returns {Number} */ - getRowHeight(): number; + getRowHeight(): Number; /** Get the rows(tr element)of grid which is displayed in the current page. * @returns {HTMLElement} @@ -19626,21 +20349,21 @@ class Grid extends ej.Widget { getRows(): HTMLElement; /** Get the scroller object of grid. - * @returns {any} + * @returns {ej.Scroller} */ - getScrollObject(): any; + getScrollObject(): ej.Scroller; /** Get the selected records details in grid. - * @returns {void} + * @returns {Array} */ - getSelectedRecords(): void; + getSelectedRecords(): Array; /** Get the calculated summary values of JSON data passed to it * @param {any} Pass Summary Column details * @param {any} Pass JSON Array for which its field values to be calculated - * @returns {number} + * @returns {Number} */ - getSummaryValues(summaryCol: any, summaryData: any): number; + getSummaryValues(summaryCol: any, summaryData: any): Number; /** Get the names of all the visible column collections in grid * @returns {Array} @@ -19727,12 +20450,12 @@ class Grid extends ej.Widget { rowHeightRefresh(): void; /** Save the particular edited cell in grid. - * @returns {boolean} + * @returns {Boolean} */ - saveCell(): boolean; + saveCell(): Boolean; /** We can prevent the client side cellSave event triggering by passing the preventSaveEvent argument as true. - * @param {boolean} optionalIf we pass preventSaveEvent as true, it prevents the client side cellSave event triggering + * @param {boolean} optionalIf we pass preventSaveEvent as true, it prevents the client side cellSave event triggering * @returns {void} */ saveCell(preventSaveEvent: boolean): void; @@ -19770,9 +20493,9 @@ class Grid extends ej.Widget { /** Select the specified columns in grid based on Index provided. * @param {number} It is used to set the starting index of column for selecting columns. * @param {number} optionalIt is used to set the ending index of column for selecting columns. - * @returns {boolean} + * @returns {Boolean} */ - selectColumns(columnIndex: number, toIndex?: number): boolean; + selectColumns(columnIndex: number, toIndex?: number): Boolean; /** Select rows in grid. * @param {number} It is used to set the starting index of row for selecting rows. @@ -19808,6 +20531,12 @@ class Grid extends ej.Widget { */ setCellValue(Index: number, fieldName: string, value: any): void; + /** The grid rows has to be rendered as detail view in mobile mode based on given value. + * @param {number} It is used to render grid rows as details view in mobile mode. + * @returns {void} + */ + setPhoneModeMaxWidth(Index: number): void; + /** Set validation to a field during editing. * @param {string} Specify the field name of the column to set validation rules * @param {any} Specify the validation rules for the field @@ -19859,86 +20588,86 @@ export interface Model { /** Gets or sets a value that indicates whether to customizing cell based on our needs. * @Default {false} */ - allowCellMerging?: boolean; + allowCellMerging?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic grouping behavior. Grouping can be done by drag on drop desired columns to grid’s GroupDropArea. This can be further customized through “groupSettings” property. * @Default {false} */ - allowGrouping?: boolean; + allowGrouping?: Boolean; /** Gets or sets a value that indicates whether to enable keyboard support for performing grid actions. selectionType – Gets or sets a value that indicates whether to enable single row or multiple rows selection behavior in grid. Multiple selection can be done through by holding CTRL and clicking the grid rows * @Default {true} */ - allowKeyboardNavigation?: boolean; + allowKeyboardNavigation?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic filtering behavior on grid. Filtering can be used to limit the records displayed using required criteria and this can be further customized through “filterSettings” property * @Default {false} */ - allowFiltering?: boolean; + allowFiltering?: Boolean; /** Gets or sets a value that indicates whether to enable the dynamic sorting behavior on grid data. Sorting can be done through clicking on particular column header. * @Default {false} */ - allowSorting?: boolean; + allowSorting?: Boolean; /** Gets or sets a value that indicates whether to enable multi columns sorting behavior in grid. Sort multiple columns by holding CTRL and click on the corresponding column header. * @Default {false} */ - allowMultiSorting?: boolean; + allowMultiSorting?: Boolean; /** This specifies the grid to show the paginated data. Also enables pager control at the bottom of grid for dynamic navigation through data source. Paging can be further customized through “pageSettings” property. * @Default {false} */ - allowPaging?: boolean; + allowPaging?: Boolean; /** Gets or sets a value that indicates whether to enable the columns reordering behavior in the grid. Reordering can be done through by drag and drop the particular column from one index to another index within the grid. * @Default {false} */ - allowReordering?: boolean; + allowReordering?: Boolean; /** Gets or sets a value that indicates whether the column is non resizable. Column width is set automatically based on the content or header text which is large. * @Default {false} */ - allowResizeToFit?: boolean; + allowResizeToFit?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic resizable of columns. Resize the width of the columns by simply click and move the particular column header line * @Default {false} */ - allowResizing?: boolean; + allowResizing?: Boolean; /** Gets or sets a value that indicates whether to enable the rows reordering in Grid and drag & drop rows between multiple Grid. * @Default {false} */ - allowRowDragAndDrop?: boolean; + allowRowDragAndDrop?: Boolean; /** Gets or sets a value that indicates whether to enable the scrollbar in the grid and view the records by scroll through the grid manually * @Default {false} */ - allowScrolling?: boolean; + allowScrolling?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic searching behavior in grid. Currently search box can be enabled through “toolbarSettings” * @Default {false} */ - allowSearching?: boolean; + allowSearching?: Boolean; /** Gets or sets a value that indicates whether user can select rows on grid. On enabling feature, selected row will be highlighted. * @Default {true} */ - allowSelection?: boolean; + allowSelection?: Boolean; /** Gets or sets a value that indicates whether the Content will wrap to the next line if the content exceeds the boundary of the Column Cells. * @Default {false} */ - allowTextWrap?: boolean; + allowTextWrap?: Boolean; /** Gets or sets a value that indicates whether to enable the multiple exporting behavior on grid data. * @Default {false} */ - allowMultipleExporting?: boolean; + allowMultipleExporting?: Boolean; /** Gets or sets a value that indicates to define common width for all the columns in the grid. */ - commonWidth?: number; + commonWidth?: Number; /** Gets or sets a value that indicates to enable the visibility of the grid lines. * @Default {ej.Grid.GridLines.Both} @@ -19966,7 +20695,7 @@ export interface Model { /** Gets or sets a value that indicates to render the grid with custom theme. */ - cssClass?: string; + cssClass?: String; /** Gets or sets the data to render the grid with records * @Default {null} @@ -19976,7 +20705,7 @@ export interface Model { /** This specifies the grid to add the details row for the corresponding master row * @Default {null} */ - detailsTemplate?: string; + detailsTemplate?: String; /** Gets or sets an object that indicates whether to customize the editing behavior of the grid. */ @@ -19985,42 +20714,42 @@ export interface Model { /** Gets or sets a value that indicates whether to enable the alternative rows differentiation in the grid records based on corresponding theme. * @Default {true} */ - enableAltRow?: boolean; + enableAltRow?: Boolean; /** Gets or sets a value that indicates whether to enable the save action in the grid through row selection * @Default {true} */ - enableAutoSaveOnSelectionChange?: boolean; + enableAutoSaveOnSelectionChange?: Boolean; /** Gets or sets a value that indicates whether to enable mouse over effect on the corresponding column header cell of the grid * @Default {false} */ - enableHeaderHover?: boolean; + enableHeaderHover?: Boolean; /** Gets or sets a value that indicates whether to persist the grid model state in page using applicable medium i.e., HTML5 localStorage or cookies * @Default {false} */ - enablePersistence?: boolean; + enablePersistence?: Boolean; /** Gets or sets a value that indicates whether the grid rows has to be rendered as detail view in mobile mode * @Default {false} */ - enableResponsiveRow?: boolean; + enableResponsiveRow?: Boolean; /** Gets or sets a value that indicates whether to enable mouse over effect on corresponding grid row. * @Default {true} */ - enableRowHover?: boolean; + enableRowHover?: Boolean; /** Align content in the grid control from right to left by setting the property as true. * @Default {false} */ - enableRTL?: boolean; + enableRTL?: Boolean; /** To Disable the mouse swipe property as false. * @Default {true} */ - enableTouch?: boolean; + enableTouch?: Boolean; /** Gets or sets an object that indicates whether to customize the filtering behavior of the grid */ @@ -20033,7 +20762,7 @@ export interface Model { /** Gets or sets a value that indicates whether the grid design has be to made responsive. * @Default {false} */ - isResponsive?: boolean; + isResponsive?: Boolean; /** This specifies to change the key in keyboard interaction to grid control * @Default {null} @@ -20043,12 +20772,12 @@ export interface Model { /** Gets or sets a value that indicates whether to customizing the user interface (UI) as locale-specific in order to display regional data i.e. in a language and culture specific to a particular country or region. * @Default {en-US} */ - locale?: string; + locale?: String; /** Gets or sets a value that indicates whether to set the minimum width of the responsive grid while isResponsive property is true and enableResponsiveRow property is set as false. * @Default {0} */ - minWidth?: number; + minWidth?: Number; /** Gets or sets an object that indicates whether to modify the pager default configuration. */ @@ -20059,14 +20788,14 @@ export interface Model { */ query?: any; - /** Gets or sets an object that indicates whether to modify the resizing behaviour. + /** Gets or sets an object that indicates whether to modify the resizing behavior. */ resizeSettings?: ResizeSettings; /** Gets or sets a value that indicates to render the grid with template rows. The template row must be a table row. That table row must have the JavaScript render binding format ({{:columnName}}) then the grid data source binds the data to the corresponding table row of the template. * @Default {null} */ - rowTemplate?: string; + rowTemplate?: String; /** Gets or sets an object that indicates whether to customize the drag and drop behavior of the grid rows */ @@ -20084,7 +20813,12 @@ export interface Model { /** Gets or sets a value that indicates to select the row while initializing the grid * @Default {-1} */ - selectedRowIndex?: number; + selectedRowIndex?: Number; + + /** Gets or sets a value that indicates the selected rows in grid + * @Default {[]} + */ + selectedRowIndices?: Array; /** This property is used to configure the selection behavior of the grid. */ @@ -20102,17 +20836,17 @@ export interface Model { /** Gets or sets a value that indicates whether to enable column chooser on grid. On enabling feature able to show/hide grid columns * @Default {false} */ - showColumnChooser?: boolean; + showColumnChooser?: Boolean; /** Gets or sets a value that indicates stacked header should be shown on grid layout when the property “stackedHeaderRows” is set. * @Default {false} */ - showStackedHeader?: boolean; + showStackedHeader?: Boolean; /** Gets or sets a value that indicates summary rows should be shown on grid layout when the property “summaryRows” is set * @Default {false} */ - showSummary?: boolean; + showSummary?: Boolean; /** Gets or sets a value that indicates whether to customize the sorting behavior of the grid. */ @@ -20272,7 +21006,7 @@ export interface Model { templateRefresh? (e: TemplateRefreshEventArgs): void; /** Triggered when toolbar item is clicked in grid. */ - toolBarClick? (e: ToolBarClickEventArgs): void; + toolbarClick? (e: ToolbarClickEventArgs): void; } export interface ActionBeginEventArgs { @@ -21886,7 +22620,7 @@ export interface TemplateRefreshEventArgs { type?: string; } -export interface ToolBarClickEventArgs { +export interface ToolbarClickEventArgs { /** Returns the cancel option value. */ @@ -21954,27 +22688,27 @@ export interface Column { /** Gets or sets a value that indicates whether to enable editing behavior for particular column. * @Default {true} */ - allowEditing?: boolean; + allowEditing?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic filtering behavior for particular column. * @Default {true} */ - allowFiltering?: boolean; + allowFiltering?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic grouping behavior for particular column. * @Default {true} */ - allowGrouping?: boolean; + allowGrouping?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic sorting behavior for particular column. * @Default {true} */ - allowSorting?: boolean; + allowSorting?: Boolean; /** Gets or sets a value that indicates whether to enable dynamic resizable for particular column. * @Default {true} */ - allowResizing?: boolean; + allowResizing?: Boolean; /** Gets or sets an object that indicates to define a command column in the grid. * @Default {[]} @@ -21983,7 +22717,7 @@ export interface Column { /** Gets or sets a value that indicates to provide custom CSS for an individual column. */ - cssClass?: string; + cssClass?: String; /** Gets or sets a value that indicates the attribute values to the td element of a particular column */ @@ -21996,17 +22730,17 @@ export interface Column { /** Gets or sets a value that indicates to display the specified default value while adding a new record to the grid */ - defaultValue?: string|number|boolean|Date; + defaultValue?: String|Number|Boolean|Date; /** Gets or sets a value that indicates to render the grid content and header with an HTML elements * @Default {false} */ - disableHtmlEncode?: boolean; + disableHtmlEncode?: Boolean; /** Gets or sets a value that indicates to display a column value as checkbox or string * @Default {true} */ - displayAsCheckBox?: boolean; + displayAsCheckBox?: Boolean; /** Gets or sets a value that indicates to customize ejNumericTextbox of an editable column. See editingType */ @@ -22022,67 +22756,72 @@ export interface Column { */ editType?: ej.Grid.EditingType|string; + /** Gets or sets a value that indicates to groups the column based on its column format. + * @Default {false} + */ + enableGroupByFormat?: Boolean; + /** Gets or sets a value that indicates to display the columns in the grid mapping with column name of the dataSource. */ - field?: string; + field?: String; /** Gets or sets a value that indicates to define foreign key field name of the grid datasource. * @Default {null} */ - foreignKeyField?: string; + foreignKeyField?: String; /** Gets or sets a value that indicates to bind the field which is in foreign column datasource based on the foreignKeyField * @Default {null} */ - foreignKeyValue?: string; + foreignKeyValue?: String; /** Gets or sets a value that indicates the format for the text applied on the column */ - format?: string; + format?: String; /** Gets or sets a value that indicates to add the template within the header element of the particular column. * @Default {null} */ - headerTemplateID?: string; + headerTemplateID?: String; /** Gets or sets a value that indicates to display the title of that particular column. */ - headerText?: string; + headerText?: String; /** This defines the text alignment of a particular column header cell value. See headerTextAlign - * @Default {ej.TextAlign.Left} + * @Default {null} */ headerTextAlign?: ej.TextAlign|string; /** You can use this property to freeze selected columns in grid at the time of scrolling. * @Default {false} */ - isFrozen?: boolean; + isFrozen?: Boolean; /** Gets or sets a value that indicates the column has an identity in the database. * @Default {false} */ - isIdentity?: boolean; + isIdentity?: Boolean; /** Gets or sets a value that indicates the column is act as a primary key(read-only) of the grid. The editing is performed based on the primary key column * @Default {false} */ - isPrimaryKey?: boolean; + isPrimaryKey?: Boolean; /** Gets or sets a value that indicates the order of Column that are to be hidden or visible when Grid element is in responsive mode and could not occupy all columns. * @Default {null} */ - priority?: number; + priority?: Number; /** Used to hide the particular column in column chooser by giving value as false. * @Default {true} */ - showInColumnChooser?: boolean; + showInColumnChooser?: Boolean; /** Gets or sets a value that indicates whether to enables column template for a particular column. * @Default {false} */ - template?: boolean|string; + template?: Boolean|String; /** Gets or sets a value that indicates to align the text within the column. See textAlign * @Default {ej.TextAlign.Left} @@ -22095,7 +22834,7 @@ export interface Column { /** Gets or sets a value that indicates to specify the data type of the specified columns. */ - type?: string; + type?: String; /** Gets or sets a value that indicates to define constraints for saving data to the database. */ @@ -22104,11 +22843,11 @@ export interface Column { /** Gets or sets a value that indicates whether this column is visible in the grid. * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** Gets or sets a value that indicates to define the width for a particular column in the grid. */ - width?: number; + width?: Number; } export interface ContextMenuSettingsSubContextMenu { @@ -22139,7 +22878,7 @@ export interface ContextMenuSettings { /** Gets or sets a value that indicates whether to enable the context menu action in the grid. * @Default {false} */ - enableContextMenu?: boolean; + enableContextMenu?: Boolean; /** Used to get or set the subMenu to the corresponding custom context menu item. */ @@ -22148,7 +22887,7 @@ export interface ContextMenuSettings { /** Gets or sets a value that indicates whether to disable the default context menu items in the grid. * @Default {false} */ - disableDefaultItems?: boolean; + disableDefaultItems?: Boolean; } export interface EditSettings { @@ -22156,27 +22895,27 @@ export interface EditSettings { /** Gets or sets a value that indicates whether to enable insert action in the editing mode. * @Default {false} */ - allowAdding?: boolean; + allowAdding?: Boolean; /** Gets or sets a value that indicates whether to enable the delete action in the editing mode. * @Default {false} */ - allowDeleting?: boolean; + allowDeleting?: Boolean; /** Gets or sets a value that indicates whether to enable the edit action in the editing mode. * @Default {false} */ - allowEditing?: boolean; + allowEditing?: Boolean; /** Gets or sets a value that indicates whether to enable the editing action while double click on the record * @Default {true} */ - allowEditOnDblClick?: boolean; + allowEditOnDblClick?: Boolean; /** This specifies the id of the template. This template can be used to display the data that you require to be edited using the Dialog Box * @Default {null} */ - dialogEditorTemplateID?: string; + dialogEditorTemplateID?: String; /** Gets or sets a value that indicates whether to define the mode of editing See editMode * @Default {ej.Grid.EditMode.Normal} @@ -22186,7 +22925,7 @@ export interface EditSettings { /** This specifies the id of the template. This template can be used to display the data that you require to be edited using the External edit form * @Default {null} */ - externalFormTemplateID?: string; + externalFormTemplateID?: String; /** This specifies to set the position of an External edit form either in the top-right or bottom-left of the grid * @Default {ej.Grid.FormPosition.BottomLeft} @@ -22196,7 +22935,7 @@ export interface EditSettings { /** This specifies the id of the template. This template can be used to display the data that you require to be edited using the Inline edit form * @Default {null} */ - inlineFormTemplateID?: string; + inlineFormTemplateID?: String; /** This specifies to set the position of an adding new row either in the top or bottom of the grid * @Default {ej.Grid.RowPosition.Top} @@ -22206,22 +22945,22 @@ export interface EditSettings { /** Gets or sets a value that indicates whether the confirm dialog has to be shown while saving or discarding the batch changes * @Default {true} */ - showConfirmDialog?: boolean; + showConfirmDialog?: Boolean; /** Gets or sets a value that indicates whether the confirm dialog has to be shown while deleting record * @Default {false} */ - showDeleteConfirmDialog?: boolean; + showDeleteConfirmDialog?: Boolean; /** Gets or sets a value that indicates whether the title for edit form is different from the primarykey column. * @Default {null} */ - titleColumn?: string; + titleColumn?: String; /** Gets or sets a value that indicates whether to display the add new form by default in the grid. * @Default {false} */ - showAddNewRow?: boolean; + showAddNewRow?: Boolean; } export interface FilterSettingsFilteredColumn { @@ -22248,7 +22987,7 @@ export interface FilterSettings { /** Gets or sets a value that indicates to perform the filter operation with case sensitive in excel styled filter menu mode * @Default {false} */ - enableCaseSensitivity?: boolean; + enableCaseSensitivity?: Boolean; /** This specifies the grid to starts the filter action while typing in the filterBar or after pressing the enter key. based on the filterBarMode. See filterBarMode * @Default {ej.Grid.FilterBarMode.Immediate} @@ -22268,17 +23007,17 @@ export interface FilterSettings { /** Gets or sets a value that indicates the maximum number of filter choices that can be showed in the excel styled filter menu. * @Default {1000} */ - maxFilterChoices?: number; + maxFilterChoices?: Number; /** This specifies the grid to show the filter text within the grid pager itself. * @Default {true} */ - showFilterBarMessage?: boolean; + showFilterBarMessage?: Boolean; /** Gets or sets a value that indicates whether to enable the predicate options in the filtering menu * @Default {false} */ - showPredicate?: boolean; + showPredicate?: Boolean; } export interface GroupSettings { @@ -22286,12 +23025,12 @@ export interface GroupSettings { /** Gets or sets a value that customize the group caption format. * @Default {null} */ - captionFormat?: string; + captionFormat?: String; /** Gets or sets a value that indicates whether to enable animation button option in the group drop area of the grid. * @Default {false} */ - enableDropAreaAutoSizing?: boolean; + enableDropAreaAutoSizing?: Boolean; /** Gets or sets a value that indicates whether to add grouped columns programmatically at initial load * @Default {[]} @@ -22301,22 +23040,22 @@ export interface GroupSettings { /** Gets or sets a value that indicates whether to show the group drop area just above the column header. It can be used to avoid ungrouping the already grouped column using groupSettings. * @Default {true} */ - showDropArea?: boolean; + showDropArea?: Boolean; /** Gets or sets a value that indicates whether to hide the grouped columns from the grid * @Default {false} */ - showGroupedColumn?: boolean; + showGroupedColumn?: Boolean; /** Gets or sets a value that indicates whether to show the group button image(toggle button)in the column header and also in the grouped column in the group drop area . It can be used to group/ungroup the columns by click on the toggle button. * @Default {false} */ - showToggleButton?: boolean; + showToggleButton?: Boolean; /** Gets or sets a value that indicates whether to enable the close button in the grouped column which is in the group drop area to ungroup the grouped column * @Default {false} */ - showUngroupButton?: boolean; + showUngroupButton?: Boolean; } export interface PageSettings { @@ -22324,47 +23063,47 @@ export interface PageSettings { /** Gets or sets a value that indicates whether to define which page to display currently in the grid * @Default {1} */ - currentPage?: number; + currentPage?: Number; /** Gets or sets a value that indicates whether to pass the current page information as a query string along with the URL while navigating to other page. * @Default {false} */ - enableQueryString?: boolean; + enableQueryString?: Boolean; /** Gets or sets a value that indicates whether to enables pager template for the grid. * @Default {false} */ - enableTemplates?: boolean; + enableTemplates?: Boolean; /** Gets or sets a value that indicates whether to define the number of pages displayed in the pager for navigation * @Default {8} */ - pageCount?: number; + pageCount?: Number; /** Gets or sets a value that indicates whether to define the number of records displayed per page * @Default {12} */ - pageSize?: number; + pageSize?: Number; /** Gets or sets a value that indicates whether to enables default pager for the grid. * @Default {false} */ - showDefaults?: boolean; + showDefaults?: Boolean; /** Gets or sets a value that indicates to add the template as a pager template for grid. * @Default {null} */ - template?: string; + template?: String; /** Get the value of total number of pages in the grid. The totalPages value is calculated based on page size and total records of grid * @Default {null} */ - totalPages?: number; + totalPages?: Number; /** Get the value of total number of records which is bound to the grid. The totalRecordsCount value is calculated based on dataSource bound to the grid. * @Default {null} */ - totalRecordsCount?: number; + totalRecordsCount?: Number; /** Gets or sets a value that indicates whether to define the number of pages to print * @Default {ej.Grid.PrintMode.AllPages} @@ -22374,7 +23113,7 @@ export interface PageSettings { export interface ResizeSettings { - /** Gets or sets a value that indicates whether to define the mode of resizing.Accepting types are "normal", "nextcolumn" and "control". + /** Gets or sets a value that indicates whether to define the mode of resizing. * @Default {ej.Grid.ResizeMode.Normal} */ resizeMode?: ej.Grid.ResizeMode|string; @@ -22425,7 +23164,7 @@ export interface SelectionSettings { /** Gets or sets a value that indicates whether to enable the toggle selection behavior for row, cell and column. * @Default {false} */ - enableToggle?: boolean; + enableToggle?: Boolean; /** Gets or sets a value that indicates whether to add the default selection actions as a selection mode.See selectionMode * @Default {[row]} @@ -22438,27 +23177,27 @@ export interface ScrollSettings { /** This specify the grid to to view data that you require without buffering the entire load of a huge database * @Default {false} */ - allowVirtualScrolling?: boolean; + allowVirtualScrolling?: Boolean; /** This specify the grid to enable/disable touch control for scrolling. * @Default {true} */ - enableTouchScroll?: boolean; + enableTouchScroll?: Boolean; /** This specify the grid to freeze particular columns at the time of scrolling. * @Default {0} */ - frozenColumns?: number; + frozenColumns?: Number; /** This specify the grid to freeze particular rows at the time of scrolling. * @Default {0} */ - frozenRows?: number; + frozenRows?: Number; /** This specify the grid to show the vertical scroll bar, to scroll and view the grid contents. * @Default {0} */ - height?: string|number; + height?: String|Number; /** This is used to define the mode of virtual scrolling in grid. See virtualScrollMode * @Default {ej.Grid.VirtualScrollMode.Normal} @@ -22468,28 +23207,28 @@ export interface ScrollSettings { /** This is used to enable the enhanced virtual scrolling in Grid. * @Default {false} */ - enableVirtualization?: boolean; + enableVirtualization?: Boolean; /** This specify the grid to show the horizontal scroll bar, to scroll and view the grid contents * @Default {250} */ - width?: string|number; + width?: String|Number; /** This specify the scroll down pixel of mouse wheel, to scroll mouse wheel and view the grid contents. * @Default {57} */ - scrollOneStepBy?: number; + scrollOneStepBy?: Number; } export interface SortSettingsSortedColumn { /** Gets or sets a value that indicates whether to define the direction to sort the column. */ - direction?: string; + direction?: String; /** Gets or sets a value that indicates whether to define the field name of the column to be sort */ - field?: string; + field?: String; } export interface SortSettings { @@ -22509,17 +23248,17 @@ export interface StackedHeaderRowsStackedHeaderColumn { /** Gets or sets a value that indicates class to the corresponding stackedHeaderColumn. * @Default {null} */ - cssClass?: string; + cssClass?: String; /** Gets or sets a value that indicates the header text for the particular stacked header column. * @Default {null} */ - headerText?: string; + headerText?: String; /** Gets or sets a value that indicates the text alignment of the corresponding headerText. * @Default {ej.TextAlign.Left} */ - textAlign?: string; + textAlign?: String; } export interface StackedHeaderRow { @@ -22535,32 +23274,32 @@ export interface SummaryRowsSummaryColumn { /** Gets or sets a value that indicates the text displayed in the summary column as a value * @Default {null} */ - customSummaryValue?: string; + customSummaryValue?: String; /** This specifies summary column used to perform the summary calculation * @Default {null} */ - dataMember?: string; + dataMember?: String; /** Gets or sets a value that indicates to define the target column at which to display the summary. * @Default {null} */ - displayColumn?: string; + displayColumn?: String; /** Gets or sets a value that indicates the format for the text applied on the column * @Default {null} */ - format?: string; + format?: String; /** Gets or sets a value that indicates the text displayed before the summary column value * @Default {null} */ - prefix?: string; + prefix?: String; /** Gets or sets a value that indicates the text displayed after the summary column value * @Default {null} */ - suffix?: string; + suffix?: String; /** Gets or sets a value that indicates the type of calculations to be performed for the corresponding summary column * @Default {[]} @@ -22570,7 +23309,7 @@ export interface SummaryRowsSummaryColumn { /** Gets or sets a value that indicates to add the template for the summary value of dataMember given. * @Default {null} */ - template?: string; + template?: String; } export interface SummaryRow { @@ -22578,17 +23317,17 @@ export interface SummaryRow { /** Gets or sets a value that indicates whether to show the summary value within the group caption area for the corresponding summary column while grouping the column * @Default {false} */ - showCaptionSummary?: boolean; + showCaptionSummary?: Boolean; /** Gets or sets a value that indicates whether to show the group summary value for the corresponding summary column while grouping a column * @Default {false} */ - showGroupSummary?: boolean; + showGroupSummary?: Boolean; /** Gets or sets a value that indicates whether to show the total summary value the for the corresponding summary column. The summary row is added after the grid content. * @Default {true} */ - showTotalSummary?: boolean; + showTotalSummary?: Boolean; /** Gets or sets a value that indicates whether to add summary columns into the summary rows. * @Default {[]} @@ -22597,12 +23336,12 @@ export interface SummaryRow { /** This specifies the grid to show the title for the summary rows. */ - title?: string; + title?: String; /** This specifies the grid to show the title of summary row in the specified column. * @Default {null} */ - titleColumn?: string; + titleColumn?: String; } export interface TextWrapSettings { @@ -22623,7 +23362,7 @@ export interface ToolbarSettings { /** Gets or sets a value that indicates whether to enable toolbar in the grid. * @Default {false} */ - showToolbar?: boolean; + showToolbar?: Boolean; /** Gets or sets a value that indicates whether to add the default editing actions as a toolbar items * @Default {[]} @@ -22868,6 +23607,7 @@ class Sparkline extends ej.Widget { static fn: Sparkline; constructor(element: JQuery, options?: Sparkline.Model); constructor(element: Element, options?: Sparkline.Model); + static Locale: any; model:Sparkline.Model; defaults:Sparkline.Model; @@ -23055,7 +23795,7 @@ export interface LoadedEventArgs { export interface TooltipInitializeEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -23179,7 +23919,7 @@ export interface PointRegionMouseClickEventArgs { export interface SparklineMouseMoveEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -23194,7 +23934,7 @@ export interface SparklineMouseMoveEventArgs { export interface SparklineMouseLeaveEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -23464,20 +24204,21 @@ class PivotGrid extends ej.Widget { static fn: PivotGrid; constructor(element: JQuery, options?: PivotGrid.Model); constructor(element: Element, options?: PivotGrid.Model); + static Locale: any; model:PivotGrid.Model; defaults:PivotGrid.Model; - /** Perform an asynchronous HTTP (AJAX) request. + /** Performs an asynchronous HTTP (AJAX) request. * @returns {void} */ doAjaxPost(): void; - /** Perform an asynchronous HTTP (FullPost) submit. + /** Performs an asynchronous HTTP (FullPost) submit. * @returns {void} */ doPostBack(): void; - /** Exports the PivotGrid to an appropriate format based on the parameter passed. + /** Exports the PivotGrid to the specified format. * @returns {void} */ exportPivotGrid(): void; @@ -23487,11 +24228,61 @@ class PivotGrid extends ej.Widget { */ refreshPagedPivotGrid(): void; - /** This function is helps to update or refresh the PivotGrid with modified data source in client-mode. + /** This function refreshes the PivotGrid with modified data input in client-mode. * @returns {void} */ refreshPivotGrid(): void; + /** This function re-renders the control with the report available at that instant. + * @returns {void} + */ + refreshControl(): void; + + /** This function returns the height of all rows and width each and every column. + * @returns {void} + */ + calculateCellWidths(): void; + + /** This function creates the conditional formatting dialog to apply conditional formatting for PivotGrid control. + * @returns {void} + */ + createConditionalDialog(): void; + + /** This function saves the current report to the database/local storage. + * @returns {void} + */ + saveReport(): void; + + /** This function loads the specified report from the database/local storage. + * @returns {void} + */ + loadReport(): void; + + /** This function reconstructs the JSON data formed for rendering PivotGrid in excel-like layout format. + * @returns {void} + */ + excelLikeLayout(): void; + + /** Returns the OlapReport string maintained along with the axis elements information. + * @returns {void} + */ + getOlapReport(): void; + + /** Sets the OlapReport string along with the axis information. + * @returns {void} + */ + setOlapReport(): void; + + /** Returns the JSON records formed to render the control. + * @returns {void} + */ + getJSONRecords(): void; + + /** Sets the JSON records formed to render the control. + * @returns {void} + */ + setJSONRecords(): void; + /** This function allows user to change the caption of the Pivot Item (name displayed in UI) on-demand for relational datasource in client-mode. * @returns {void} */ @@ -23507,51 +24298,56 @@ export module PivotGrid{ export interface Model { /** Sets the mode for the PivotGrid widget for binding either OLAP or relational data source. - * @Default {ej.PivotGrid.AnalysisMode.Olap} + * @Default {ej.Pivot.AnalysisMode.Pivot} */ - analysisMode?: ej.PivotGrid.AnalysisMode|string; + analysisMode?: ej.Pivot.AnalysisMode|string; /** Specifies the CSS class to PivotGrid to achieve custom theme. * @Default {“”} */ cssClass?: string; - /** Contains the serialized OlapReport at that instant. + /** Connects the PivotSchemaDesigner with the specified ID to the PivotGrid Control. * @Default {“”} */ - currentReport?: string; + pivotTableFieldListID?: string; /** Initializes the data source for the PivotGrid widget, when it functions completely on client-side. * @Default {{}} */ dataSource?: DataSource; - /** Used to bind the drilled members by default through report. - * @Default {[]} + /** Object that holds the settings of frozen headers. + * @Default {{}} */ - drilledItems?: Array; + frozenHeaderSettings?: FrozenHeaderSettings; - /** Object utilized to pass additional information between client-end and service-end. + /** Object utilized to pass additional information between client-end and service-end on operating the control in server mode. * @Default {null} */ customObject?: any; + /** Allows the user to collapsed the specified members in each field by default. + * @Default {null} + */ + collapsedMembers?: any; + /** Allows the user to access each cell on mouse right-click. * @Default {false} */ enableCellContext?: boolean; - /** Enables the cell selection for a specified range of value cells. And, the individual row/column cells can be selected by clicking its headers. + /** Enables the cell selection for a specific range of value cells. * @Default {false} */ enableCellSelection?: boolean; - /** Enables the Drill-Through feature which retrieves the raw items that are used to create a specified cell in PivotGrid. This is only applicable in server mode component. + /** Enables the Drill-Through feature which retrieves the raw items that are used to create the specific cell in PivotGrid. This is only applicable in server mode component. * @Default {false} */ enableDrillThrough?: boolean; - /** Allows user to get the cell details in JSON format when double clicking the cell. + /** Allows user to get the cell details in JSON format on double clicking the cell. * @Default {false} */ enableCellDoubleClick?: boolean; @@ -23561,12 +24357,12 @@ export interface Model { */ enableCellEditing?: boolean; - /** Collapses the Pivot Items along rows and columns by default. It works only for relational data source. + /** Collapses the Pivot items along rows and columns by default. It works only for relational data source. * @Default {false} */ enableCollapseByDefault?: boolean; - /** Enables the display of grand total for all the columns. + /** Enables/Disables the display of grand total for all the columns. * @Default {true} */ enableColumnGrandTotal?: boolean; @@ -23581,12 +24377,12 @@ export interface Model { */ enableDeferUpdate?: boolean; - /** Enables the display of GroupingBar allowing you to filter, sort and remove fields obtained from relational datasource. + /** Enables the display of GroupingBar allowing you to filter, sort and remove fields obtained from datasource. * @Default {false} */ enableGroupingBar?: boolean; - /** Enables the display of grand total for rows and columns. + /** Enables/Disables the display of grand total for rows and columns. * @Default {true} */ enableGrandTotal?: boolean; @@ -23596,7 +24392,7 @@ export interface Model { */ enableJSONRendering?: boolean; - /** Enables rendering of PivotGrid widget along with the PivotTable Field List, which allows UI operation. + /** Enables rendering of PivotGrid widget along with the PivotTable Field List, which allows UI operations. * @Default {true} */ enablePivotFieldList?: boolean; @@ -23621,32 +24417,36 @@ export interface Model { */ enableToolTipAnimation?: boolean; + /** Allows the user to adjust the width of the columns dynamically. + * @Default {false} + */ + enableColumnResizing?: boolean; + /** Allows the user to view large amount of data through virtual scrolling. * @Default {false} */ enableVirtualScrolling?: boolean; + /** Allows the user to view large amount of data by applying paging. + * @Default {false} + */ + enablePaging?: boolean; + /** Allows the user to configure hyperlink settings of PivotGrid control. * @Default {{}} */ hyperlinkSettings?: HyperlinkSettings; - /** This is used for identifying whether the member is Named Set or not. - * @Default {false} - */ - isNamedSets?: boolean; - /** Allows the user to enable PivotGrid’s responsiveness in the browser layout. * @Default {false} */ isResponsive?: boolean; /** Contains the serialized JSON string which renders PivotGrid. - * @Default {“”} */ jsonRecords?: string; - /** Sets the summary layout for PivotGrid. Following are the ways in which summary can be positioned: normal summary (bottom), top summary, no summary and excel-like summary. + /** Sets the summary layout for PivotGrid.Following are the ways in which summary can be positioned: normal summary (bottom), top summary, no summary and excel-like summary. * @Default {ej.PivotGrid.Layout.Normal} */ layout?: ej.PivotGrid.Layout|string; @@ -23657,9 +24457,9 @@ export interface Model { locale?: string; /** Sets the mode for the PivotGrid widget for binding data source either in server-side or client-side. - * @Default {ej.PivotGrid.OperationalMode.ClientMode} + * @Default {ej.Pivot.OperationalMode.ClientMode} */ - operationalMode?: ej.PivotGrid.OperationalMode|string; + operationalMode?: ej.Pivot.OperationalMode|string; /** Allows the user to set custom name for the methods at service-end, communicated during AJAX post. * @Default {{}} @@ -23718,114 +24518,74 @@ export interface Model { /** Triggers when the hyperlink of value cell is clicked. */ valueCellHyperlinkClick? (e: ValueCellHyperlinkClickEventArgs): void; + + /** Triggers before saving the current report to database. */ + saveReport? (e: SaveReportEventArgs): void; + + /** Triggers before loading a report from database. */ + loadReport? (e: LoadReportEventArgs): void; + + /** Triggers before performing exporting in pivot grid. */ + beforeExport? (e: BeforeExportEventArgs): void; + + /** Triggers before editing the cells. */ + cellEdit? (e: CellEditEventArgs): void; } export interface AfterServiceInvokeEventArgs { - /** return the current action of PivotGrid control. + /** returns the current action of PivotGrid control. */ action?: string; - /** return the custom object bounds with PivotGrid control. + /** returns the custom object bound with PivotGrid control. */ customObject?: any; - /** return the outer HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface BeforeServiceInvokeEventArgs { - /** return the current action of PivotGrid control. + /** returns the current action of PivotGrid control. */ action?: string; - /** return the custom object bounds with PivotGrid control. + /** returns the custom object bound with PivotGrid control. */ customObject?: any; - /** return the outer HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface BeforePivotEnginePopulateEventArgs { /** returns the PivotGrid object */ - pivotObject?: any; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the name of the event - */ - type?: string; + pivotGridObject?: any; } export interface CellDoubleClickEventArgs { - /** return the JSON details of the double clicked cell. + /** returns the JSON details of the double clicked cell. */ - selectedData?: any; + selectedData?: Array; - /** return the custom object bounds with PivotGrid widget. + /** returns the custom object bound with PivotGrid control. */ customObject?: any; - /** return the outer HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface CellContextEventArgs { - /** returns the original event args. - */ - args?: any; - /** returns the cell position (row index and column index) in table. */ cellPosition?: string; @@ -23834,78 +24594,66 @@ export interface CellContextEventArgs { */ cellType?: string; - /** returns the serialized data of the header cells. + /** returns the content of the cell. */ - rowData?: string; + cellValue?: string; /** returns the unique name of levels/members. */ uniqueName?: string; + + /** returns the role of the cell in PivotGrid. + */ + role?: string; + + /** returns JSON record corresponding to the selected cell. + */ + rawdata?: any; + + /** returns the original event object. + */ + args?: any; } export interface CellSelectionEventArgs { - /** returns the original event args. + /** returns the JSON records of the selected range of cells. */ - args?: any; + JSONRecords?: any; - /** Returns the selected cell values. + /** Returns the row headers corresponding to the selected value cells. */ - cellvalue?: any; + rowheader?: any; - /** Returns the selected value cells row headers. + /** Returns the column headers corresponding to the selected value cells. */ - rowheaders?: any; + columnheader?: any; - /** Returns the selected value cells column headers. + /** Returns the information about the measure associated with the selected cell. */ - colheaders?: any; - - /** Returns the selected value cells measure. - */ - measure?: any; - - /** Return the row and column measure count. - */ - measureValue?: any; + measureCount?: string; } export interface ColumnHeaderHyperlinkClickEventArgs { - /** returns the original event args. + /** returns the information about the clicked cell */ args?: any; - /** returns the cell position (row index and column index) in table. + /** returns the HTML element of the control. */ - cellPosition?: string; + element?: any; - /** returns the type of the cell. + /** returns the custom object bound to the control. */ - cellType?: string; - - /** returns the serialized data of the header cells. - */ - rowData?: string; - - /** returns the unique name of levels/members. - */ - uniqueName?: string; + customObject?: any; } export interface DrillSuccessEventArgs { - /** if the event should be canceled; otherwise, false. + /** returns the HTML element of the control. */ - cancel?: boolean; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event - */ - type?: string; + args?: any; } export interface DrillThroughEventArgs { @@ -23914,241 +24662,192 @@ export interface DrillThroughEventArgs { */ data?: any; - /** return the outer HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface LoadEventArgs { - /** returns the original event args. - */ - args?: any; - - /** returns the current action of PivotGrid control. - */ - action?: string; - - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; - /** returns the HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model. - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RenderCompleteEventArgs { - /** returns the original event args. - */ - args?: any; - /** returns the current action of PivotGrid control. */ action?: string; - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; - /** returns the HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model. - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RenderFailureEventArgs { - /** returns the original event args. - */ - args?: any; - /** returns the current action of PivotGrid control. */ action?: string; - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; - /** returns the HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; + element?: any; /** returns the error message with error code. */ - message?: any; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model. - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event. - */ - type?: string; + message?: string; } export interface RenderSuccessEventArgs { - /** returns the original event args. - */ - args?: any; - /** returns the current action of PivotGrid control. */ action?: string; - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; - /** returns the HTML of PivotGrid control. + /** returns the HTML element of PivotGrid control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGrid model. - */ - model?: ej.PivotGrid.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RowHeaderHyperlinkClickEventArgs { - /** returns the original event args. + /** returns the information about the clicked cell */ args?: any; - /** returns the cell position (row index and column index) in table. + /** returns the HTML element of the control. */ - cellPosition?: string; + element?: any; - /** returns the type of the cell. + /** returns the custom object bound to the control. */ - cellType?: string; - - /** returns the serialized data of the header cells. - */ - rowData?: string; - - /** returns the unique name of levels/members. - */ - uniqueName?: string; + customObject?: any; } export interface SummaryCellHyperlinkClickEventArgs { - /** returns the original event args. + /** returns the information about the clicked cell */ args?: any; - /** returns the cell position (row index and column index) in table. + /** returns the HTML element of the control. */ - cellPosition?: string; + element?: any; - /** returns the type of the cell. + /** returns the custom object bound to the control. */ - cellType?: string; - - /** returns the serialized data of the header cells. - */ - rowData?: string; - - /** returns the unique name of levels/members. - */ - uniqueName?: string; + customObject?: any; } export interface ValueCellHyperlinkClickEventArgs { - /** returns the original event args. + /** returns the information about the clicked cell */ args?: any; - /** returns the cell position (row index and column index) in table. + /** returns the HTML element of the control. */ - cellPosition?: string; + element?: any; - /** returns the type of the cell. + /** returns the custom object bound to the control. */ - cellType?: string; + customObject?: any; +} - /** returns the serialized data of the header cells. - */ - rowData?: string; +export interface SaveReportEventArgs { - /** returns the unique name of levels/members. + /** returns the report to be stored in database. */ - uniqueName?: string; + report?: any; +} + +export interface LoadReportEventArgs { + + /** returns the PivotGrid object. + */ + targetControl?: any; + + /** returns whether the control is bound with OLAP or Relational data source. + */ + dataModel?: string; +} + +export interface BeforeExportEventArgs { + + /** contains the url of the service responsible for exporting. + */ + url?: string; + + /** contains the name of the exporting file. + */ + fileName?: string; +} + +export interface CellEditEventArgs { + + /** contains the array of cells selected for editing. + */ + editCellsInfo?: Array; } export interface DataSourceColumnsAdvancedFilter { - /** Allows the user to provide level unique name to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to provide level unique name to perform advanced filtering. */ name?: string; - /** Allows the user to set the operator for label filtering to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the operator to perform Label Filtering. + * @Default {none} */ labelFilterOperator?: string; - /** Allows the user to set the operator for value filtering to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the operator to perform Value Filtering. + * @Default {none} */ valueFilterOperator?: string; - /** Allows the user to set the filtering type while doing advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the filtering type while performing advanced filtering. */ advancedFilterType?: string; - /** Allows the user to holds the filter value in advanced filtering (excel-like) option for OLAP data source in client-mode. + /** In case of value filtering, this property contains the measure name to which the filter is applied. */ - values?: string; + measure?: string; + + /** Allows the user to hold the filter operand values in advanced filtering. + */ + values?: Array; +} + +export interface DataSourceColumnsFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceColumn { @@ -24157,7 +24856,7 @@ export interface DataSourceColumn { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item. */ fieldCaption?: string; @@ -24166,33 +24865,72 @@ export interface DataSourceColumn { */ advancedFilter?: Array; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Shows/Hides the sub-total of the field in PivotGrid. + * @Default {true} + */ + showSubTotal?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Contains the list of members need to be drilled down by default in the field. + * @Default {[]} + */ + drilledItems?: Array; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceColumnsFilterItems; } export interface DataSourceRowsAdvancedFilter { - /** Allows the user to provide level unique name to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to provide level unique name to perform advanced filtering. */ name?: string; - /** Allows the user to set the operator for label filtering to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the operator to perform Label Filtering. + * @Default {none} */ labelFilterOperator?: string; - /** Allows the user to set the operator for value filtering to do advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the operator to perform Value Filtering. + * @Default {none} */ valueFilterOperator?: string; - /** Allows the user to set the filtering type while doing advanced filtering (excel-like) for OLAP data source in client-mode. + /** Allows the user to set the filtering type while performing advanced filtering. */ advancedFilterType?: string; - /** Allows the user to holds the filter value in advanced filtering (excel-like) option for OLAP data source in client-mode. + /** In case of value filtering, this property contains the measure name to which the filter is applied. */ - values?: string; + measure?: string; + + /** Allows the user to hold the filter operand values in advanced filtering. + */ + values?: Array; +} + +export interface DataSourceRowsFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceRow { @@ -24201,7 +24939,7 @@ export interface DataSourceRow { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item. */ fieldCaption?: string; @@ -24210,42 +24948,95 @@ export interface DataSourceRow { */ advancedFilter?: Array; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Shows/Hides the sub-total of the field. + * @Default {true} + */ + showSubTotal?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Contains the list of members need to be drilled down by default in the field. + * @Default {[]} + */ + drilledItems?: Array; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceRowsFilterItems; +} + +export interface DataSourceValuesMeasure { + + /** Allows the user to bind the measure from OLAP datasource by using its unique name as field name. + */ + fieldName?: string; } export interface DataSourceValue { - /** This holds the measures unique name to bind them from the Cube. - * @Default {[]} - */ - measures?: Array; - - /** Allows to set the axis name to place the measures items. - * @Default {“”} - */ - axis?: string; - - /** Allows the user to bind the item by using its unique name as field name. + /** Allows the user to bind the item by using its unique name as field name for Relational datasource. */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item for Relational datasource. */ fieldCaption?: string; - /** Allows the user to create new fields by enabling the calculated field option for relational data source at client-side. + /** This holds the list of unique names of measures to bind them from the OLAP cube. + * @Default {[]} + */ + measures?: Array; + + /** Allows to set the axis name to place the measures items. + * @Default {rows} + */ + axis?: string; + + /** Indicates whether the field is a calculated field or not with Relational datasource. * @Default {false} */ isCalculatedField?: boolean; - /** Allows the user to apply the formula as an expression in-order to create new field using calculated field option (in code-behind) for relational data source at client-side. + /** Allows to set the type of PivotGrid summary calculation for the value field with Relational datasource. + * @Default {ej.PivotAnalysis.SummaryType.Sum} + */ + summaryType?: ej.PivotAnalysis.SummaryType|string; + + /** Allows to set the format of the values. + */ + format?: string; + + /** This property sets type of display of date. + */ + formatString?: string; + + /** Allows to set the formula for calculation of values for calculated members in Relational datasource. */ formula?: string; } +export interface DataSourceFiltersFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; +} + export interface DataSourceFilter { /** Allows the user to bind the item by using its unique name as field name. @@ -24256,35 +25047,43 @@ export interface DataSourceFilter { */ fieldCaption?: string; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} + /** Applies filter to the field members. + * @Default {null} */ - isNamedSets?: boolean; + filterItems?: DataSourceFiltersFilterItems; +} + +export interface DataSourcePagerOptions { + + /** Allows to set the number of categorical columns to be displayed in each page on applying paging. + * @Default {0} + */ + categoricalPageSize?: number; + + /** Allows to set the number of series rows to be displayed in each page on applying paging. + * @Default {0} + */ + seriesPageSize?: number; + + /** Allows to set the page number in categorical axis to be loaded by default. + * @Default {1} + */ + categoricalCurrentPage?: number; + + /** Allows to set the page number in series axis to be loaded by default. + * @Default {1} + */ + seriesCurrentPage?: number; } export interface DataSource { - /** Contains the database name as string type to fetch the data from the given connection string. - * @Default {“”} - */ - catalog?: string; - - /** Lists out the items to be arranged in column section of PivotGrid. + /** Lists out the items to be arranged in columns section of PivotGrid. * @Default {[]} */ columns?: Array; - /** Contains the respective Cube name from database as string type. - * @Default {“”} - */ - cube?: string; - - /** Provides the raw data source for the PivotGrid. - * @Default {null} - */ - data?: any; - - /** Lists out the items to be arranged in row section of PivotGrid. + /** Lists out the items to be arranged in rows section of PivotGrid. * @Default {[]} */ rows?: Array; @@ -24294,15 +25093,57 @@ export interface DataSource { */ values?: Array; - /** Allows user to filter the members (by its name and values) by enable the advanced filtering (excel-like) option for OLAP data source in client-mode. + /** Lists out the items which supports filtering of values without displaying the members in UI in PivotGrid. + * @Default {[]} + */ + filters?: Array; + + /** Contains the respective cube name from OLAP database as string type. + * @Default {“”} + */ + cube?: string; + + /** Provides the raw data source for the PivotGrid. + * @Default {null} + */ + data?: any; + + /** In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string. + * @Default {“”} + */ + catalog?: string; + + /** Allows user to filter the members (by its name and values) through advanced filtering (excel-like) option for OLAP data source in client-mode. * @Default {false} */ enableAdvancedFilter?: boolean; - /** Lists out the items which supports filtering of values in PivotGrid. - * @Default {[]} + /** Sets a name to the report bound to the control. */ - filters?: Array; + reportName?: string; + + /** Allows to set the page size and current page number for each axis on applying paging. + * @Default {{}} + */ + pagerOptions?: DataSourcePagerOptions; +} + +export interface FrozenHeaderSettings { + + /** Allows the user to freeze the row headers alone on scrolling the horizontal scroll bar. + * @Default {false} + */ + enableFrozenRowHeaders?: boolean; + + /** Allows the user to freeze the column headers alone on scrolling the vertical scroll bar. + * @Default {false} + */ + enableFrozenColumnHeaders?: boolean; + + /** Allows the user to freeze both the row headers and column headers on scrolling. + * @Default {false} + */ + enableFrozenHeaders?: boolean; } export interface HyperlinkSettings { @@ -24330,77 +25171,97 @@ export interface HyperlinkSettings { export interface ServiceMethodSettings { - /** Allows the user to set the custom name for the service method that's responsible for drill up/down operation in PivotGrid. + /** Allows the user to set the custom name for the service method responsible for drill up/down operation in PivotGrid. * @Default {DrillGrid} */ drillDown?: string; - /** Allows the user to set the custom name for the service method that’s responsible for exporting. + /** Allows the user to set the custom name for the service method responsible for exporting. * @Default {Export} */ exportPivotGrid?: string; - /** Allows the user to set the custom name for the service method that’s responsible for performing server-side actions on defer update. + /** Allows the user to set the custom name for the service method responsible for performing server-side actions on defer update. * @Default {DeferUpdate} */ deferUpdate?: string; - /** Allows the user to set the custom name for the service method that’s responsible to getting the values for the tree-view inside filter dialog. + /** Allows the user to set the custom name for the service method responsible for getting the values for the tree-view inside filter dialog. * @Default {FetchMembers} */ fetchMembers?: string; - /** Allows the user to set the custom name for the service method that's responsible for filtering operation in PivotGrid. + /** Allows the user to set the custom name for the service method responsible for filtering operation in PivotGrid. * @Default {Filtering} */ filtering?: string; - /** Allows the user to set the custom name for the service method that's responsible for initializing PivotGrid. + /** Allows the user to set the custom name for the service method responsible for initializing PivotGrid. * @Default {InitializeGrid} */ initialize?: string; - /** Allows the user to set the custom name for the service method that's responsible for the server-side action, on dropping a node into Field List. + /** Allows the user to set the custom name for the service method responsible for the server-side action, on dropping a node from Field List. * @Default {NodeDropped} */ nodeDropped?: string; - /** Allows the user to set the custom name for the service method that’s responsible for the server-side action on changing the checked state of a node in Field List. + /** Allows the user to set the custom name for the service method responsible for the server-side action on changing the checked state of a node in Field List. * @Default {NodeStateModified} */ nodeStateModified?: string; - /** Allows the user to set the custom name for the service method that's responsible for performing paging operation in PivotGrid. + /** Allows the user to set the custom name for the service method responsible for performing paging operation in PivotGrid. * @Default {Paging} */ paging?: string; - /** Allows the user to set the custom name for the service method that's responsible for sorting operation in PivotGrid. + /** Allows the user to set the custom name for the service method responsible for sorting operation in PivotGrid. * @Default {Sorting} */ sorting?: string; - /** Allows the user to set the custom name for the service method that’s responsible for expanding members inside member editor. + /** Allows the user to set the custom name for the service method responsible for expanding members inside member editor. * @Default {MemberExpanded} */ memberExpand?: string; - /** Allows the user to set the custom name for the service method that’s responsible for write-back operation in OLAP Cube. This is only applicable in server-side component. + /** Allows the user to set the custom name for the service method responsible for editing the cells. + * @Default {CellEditing} + */ + cellEditing?: string; + + /** Allows the user to set the custom name for the service method responsible for saving the current report to database. + * @Default {SaveReport} + */ + saveReport?: string; + + /** Allows the user to set the custom name for the service method responsible for loading a report from database. + * @Default {LoadReportFromDB} + */ + loadReport?: string; + + /** Allows the user to set the custom name for the service method responsible for adding a calculated field to the report. + * @Default {CalculatedField} + */ + calculatedField?: string; + + /** Allows the user to set the custom name for the service method responsible for performing drill through operation. + * @Default {DrillThroughHierarchies} + */ + drillThroughHierarchies?: string; + + /** Allows the user to set the custom name for the service method responsible for performing drill through operation in data table. + * @Default {DrillThroughDataTable} + */ + drillThroughDataTable?: string; + + /** Allows the user to set the custom name for the service method responsible for write-back operation in OLAP Cube. This is only applicable in server-side component. * @Default {WriteBack} */ writeBack?: string; } -enum AnalysisMode{ - - ///To bind an OLAP data source to PivotGrid. - OLAP, - - ///To bind a relational data source to PivotGrid. - Relational -} - - enum Layout{ ///To set normal summary layout in PivotGrid. @@ -24416,29 +25277,83 @@ enum Layout{ ExcelLikeLayout } - -enum OperationalMode{ - - ///To bind data source completely from client-side. - ClientMode, - - ///To bind data source completely from server-side. - ServerMode } - +module Pivot +{ +enum AnalysisMode +{ +//To bind an OLAP data source to PivotGrid. +OLAP, +//To bind a relational data source to PivotGrid. +Pivot, +} +} +module PivotAnalysis +{ +enum SortOrder +{ +//Sorts the members of the field in ascending order. +Ascending, +//Sorts the members of the field in descending order. +Descending, +//Displays the members without sorting in any order. +None, +} +} +module PivotAnalysis +{ +enum FilterType +{ +//Excludes the specified values among the members of the field. +Exclude, +//Includes the specified values alone among the members of the field. +Include, +} +} +module PivotAnalysis +{ +enum SummaryType +{ +//Calculates the summary as the total of all values. +Sum, +//Displays the average of all values as the summaries. +Average, +//Displays the count of items in summaries. +Count, +//Displays the minimum value of all the items in the summary. +Min, +//Displays the maximum value of all the items in the summary. +Max, +} +} +module Pivot +{ +enum OperationalMode +{ +//To bind data source completely from client-side. +ClientMode, +//To bind data source completely from server-side. +ServerMode, +} } class PivotSchemaDesigner extends ej.Widget { static fn: PivotSchemaDesigner; constructor(element: JQuery, options?: PivotSchemaDesigner.Model); constructor(element: Element, options?: PivotSchemaDesigner.Model); + static Locale: any; model:PivotSchemaDesigner.Model; defaults:PivotSchemaDesigner.Model; - /** Perform an asynchronous HTTP (AJAX) request. + /** Performs an asynchronous HTTP (AJAX) request. * @returns {void} */ doAjaxPost(): void; + + /** Re-renders the control with the data source bound to the pivot control at that instant. + * @returns {void} + */ + refreshControl(): void; } export module PivotSchemaDesigner{ @@ -24454,7 +25369,7 @@ export interface Model { */ customObject?: any; - /** For ASP.NET and MVC Wrapper, Pivots Schema Designer will be initialized and rendered empty initially. Once PivotGrid widget is rendered completely, Pivots Schema Designer will just be populated with data source by setting this property to “true”. + /** For ASP.NET and MVC Wrapper, PivotSchemaDesigner will be initialized and rendered empty initially. Once the connected pivot control widget is rendered completely, PivotSchemaDesigner will just be populated with data source by setting this property to “true”. * @Default {false} */ enableWrapper?: boolean; @@ -24464,26 +25379,16 @@ export interface Model { */ enableRTL?: boolean; - /** Allows the user to view the KPI elements in tree-view inside PivotTable Field List. This is only applicable for OLAP datasource. - * @Default {false} + /** Sets the visibility of OLAP elements in PivotTable Field List. This is only applicable for OLAP datasource. + * @Default {null} */ - showKPI?: boolean; + olap?: Olap; - /** Allows the user to view the named sets in tree-view inside PivotTable Field List. This is only applicable for OLAP datasource. - * @Default {false} - */ - showNamedSets?: boolean; - - /** Allows the user to restrict drag and drop operation within the PivotTable Field List. + /** Allows the user to enable/disable drag and drop operations within the PivotTable Field List. * @Default {true} */ enableDragDrop?: boolean; - /** Allows the user to set the list of filters in filter section. - * @Default {newArray()} - */ - filters?: Array; - /** Sets the height for PivotSchemaDesigner. * @Default {“”} */ @@ -24494,31 +25399,11 @@ export interface Model { */ locale?: string; - /** Allows the user to set list of PivotCalculations in values section. - * @Default {newArray()} - */ - pivotCalculations?: Array; - - /** Allows the user to set the list of PivotItems in column section. - * @Default {newArray()} - */ - pivotColumns?: Array; - /** Sets the Pivot control bound with this PivotSchemaDesigner. * @Default {null} */ pivotControl?: any; - /** Allows the user to set the list of PivotItems in row section. - * @Default {newArray()} - */ - pivotRows?: Array; - - /** Allows the user to arrange the fields inside Field List of PivotSchemaDesigner. - * @Default {newArray()} - */ - pivotTableFields?: Array; - /** Allows the user to set custom name for the methods at service-end, communicated during AJAX post. * @Default {{}} */ @@ -24534,6 +25419,11 @@ export interface Model { */ width?: string; + /** Sets the layout for PivotSchemaDesigner. + * @Default {ej.PivotSchemaDesigner.Layouts.Excel} + */ + layout?: ej.PivotSchemaDesigner.Layouts|string; + /** Triggers when it reaches client-side after any AJAX request. */ afterServiceInvoke? (e: AfterServiceInvokeEventArgs): void; @@ -24546,61 +25436,37 @@ export interface Model { export interface AfterServiceInvokeEventArgs { - /** return the current action of PivotSchemaDesigner control. + /** returns the current action of PivotSchemaDesigner control. */ action?: string; - /** return the custom object bounds with PivotSchemaDesigner control. + /** returns the custom object bound with PivotSchemaDesigner control. */ customObject?: any; - /** return the outer HTML of PivotSchemaDesigner control. + /** returns the HTML element of PivotSchemaDesigner control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotSchemaDesigner model - */ - model?: ej.PivotSchemaDesigner.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface BeforeServiceInvokeEventArgs { - /** return the current action of PivotSchemaDesigner control. + /** returns the current action of PivotSchemaDesigner control. */ action?: string; - /** return the custom object bounds with PivotSchemaDesigner control. + /** returns the custom object bound with PivotSchemaDesigner control. */ customObject?: any; - /** return the outer HTML of PivotSchemaDesigner control. + /** returns the HTML element of PivotSchemaDesigner control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotSchemaDesigner model - */ - model?: ej.PivotSchemaDesigner.Model; - - /** returns the name of the event - */ - type?: string; + element?: any; } export interface DragMoveEventArgs { - /** return the HTML of the dragged field from PivotSchemaDesigner. + /** returns the HTML element of the dragged field from PivotSchemaDesigner. */ dragTarget?: any; @@ -24614,47 +25480,74 @@ export interface DragMoveEventArgs { /** returns the PivotSchemaDesigner model */ - model?: ej.PivotSchemaDesigner.Model; + model?: any; +} + +export interface Olap { + + /** Allows the user to view the KPI elements in tree-view inside PivotTable Field List. This is only applicable for OLAP datasource. + * @Default {false} + */ + showKPI?: boolean; + + /** Allows the user to view the named sets in tree-view inside PivotTable Field List. This is only applicable for OLAP datasource. + * @Default {false} + */ + showNamedSets?: boolean; } export interface ServiceMethod { - /** Allows the user to set the custom name for the service method that’s responsible for getting the values for the tree-view inside filter dialog. + /** Allows the user to set the custom name for the service method responsible for getting the values for the tree-view inside filter dialog. * @Default {FetchMembers} */ fetchMembers?: string; - /** Allows the user to set the custom name for the service method that’s responsible for filtering operation in Field List. + /** Allows the user to set the custom name for the service method responsible for filtering operation in Field List. * @Default {Filtering} */ filtering?: string; - /** Allows the user to set the custom name for the service method that’s responsible for the server-side action, on expanding members in Field List. + /** Allows the user to set the custom name for the service method responsible for the server-side action, on expanding members in Field List. * @Default {MemberExpanded} */ memberExpand?: string; - /** Allows the user to set the custom name for the service method that’s responsible for the server-side action, on dropping a node into Field List. + /** Allows the user to set the custom name for the service method responsible for the server-side action, on dropping a node into Field List. * @Default {NodeDropped} */ nodeDropped?: string; - /** Allows the user to set the custom name for the service method that’s responsible for the server-side action on changing the checked state of a node in Field List. + /** Allows the user to set the custom name for the service method responsible for the server-side action on changing the checked state of a node in Field List. * @Default {NodeStateModified} */ nodeStateModified?: string; - /** Allows the user to set the custom name for the service method that’s responsible for remove operation in Field List. + /** Allows the user to set the custom name for the service method responsible for button removing operation in Field List. * @Default {RemoveButton} */ removeButton?: string; } + +enum Layouts{ + + ///To set the layout as same in the Excel. + Excel, + + ///To set normal layout for Field List. + Normal, + + ///To set layout with the axes one above the other. + OneByOne +} + } class PivotPager extends ej.Widget { static fn: PivotPager; constructor(element: JQuery, options?: PivotPager.Model); constructor(element: Element, options?: PivotPager.Model); + static Locale: any; model:PivotPager.Model; defaults:PivotPager.Model; @@ -24721,10 +25614,11 @@ class PivotChart extends ej.Widget { static fn: PivotChart; constructor(element: JQuery, options?: PivotChart.Model); constructor(element: Element, options?: PivotChart.Model); + static Locale: any; model:PivotChart.Model; defaults:PivotChart.Model; - /** Perform an asynchronous HTTP (AJAX) request. + /** Performs an asynchronous HTTP (AJAX) request. * @returns {void} */ doAjaxPost(): void; @@ -24734,12 +25628,12 @@ class PivotChart extends ej.Widget { */ doPostBack(): void; - /** Exports the PivotChart to an appropriate format based on the parameter passed. + /** Exports the PivotChart to the format specified in the parameter. * @returns {void} */ exportPivotChart(): void; - /** This function receives the JSON formatted datasource to render the PivotChart control. + /** This function renders the PivotChart control with the JSON formatted datasource. * @returns {void} */ renderChartFromJSON(): void; @@ -24748,15 +25642,60 @@ class PivotChart extends ej.Widget { * @returns {void} */ renderControlSuccess(): void; + + /** Returns the OlapReport string maintained along with the axis elements information. + * @returns {void} + */ + getOlapReport(): void; + + /** Sets the OlapReport string along with the axis information and maintains it in a property. + * @returns {void} + */ + setOlapReport(): void; + + /** Returns the JSON records formed to render the control. + * @returns {void} + */ + getJSONRecords(): void; + + /** Sets the JSON records to render the control. + * @returns {void} + */ + setJSONRecords(): void; + + /** Returns the PivotEngine formed to render the control. + * @returns {void} + */ + getPivotEngine(): void; + + /** Sets the PivotEngine required to render the control. + * @returns {void} + */ + setPivotEngine(): void; + + /** Re-renders the control with the data source at the instant. + * @returns {void} + */ + refreshControl(): void; + + /** Renders the control with the pivot engine obtained from olap cube. + * @returns {void} + */ + generateJSON(): void; + + /** Navigates to the specified page number in specified axis. + * @returns {void} + */ + refreshPagedPivotChart(): void; } export module PivotChart{ export interface Model { /** Sets the mode for the PivotChart widget for binding either OLAP or Relational data source. - * @Default {ej.PivotChart.AnalysisMode.Olap} + * @Default {ej.Pivot.AnalysisMode.Pivot} */ - analysisMode?: any; + analysisMode?: ej.Pivot.AnalysisMode|string; /** Specifies the CSS class to PivotChart to achieve custom theme. * @Default {“”} @@ -24766,19 +25705,14 @@ export interface Model { /** Options available to configure the properties of entire series. You can also override the options for specific series by using series collection. * @Default {{}} */ - commonSeriesOptions?: any; - - /** Contains the serialized OlapReport at that instant, that is, current OlapReport. - * @Default {“”} - */ - currentReport?: string; + commonSeriesOptions?: CommonSeriesOptions; /** Initializes the data source for the PivotChart widget, when it functions completely on client-side. * @Default {{}} */ dataSource?: DataSource; - /** Object utilized to pass additional information between client-end and service-end. + /** Object utilized to pass additional information between client-end and service-end on operating the control in server mode. * @Default {{}} */ customObject?: any; @@ -24798,7 +25732,7 @@ export interface Model { */ isResponsive?: boolean; - /** Options available to customize the legend items and its title. + /** Lets the user to customize the legend items and their labels. * @Default {{}} */ legend?: any; @@ -24809,9 +25743,9 @@ export interface Model { locale?: string; /** Sets the mode for the PivotChart widget for binding data source either in server-side or client-side. - * @Default {ej.PivotChart.OperationalMode.ClientMode} + * @Default {ej.Pivot.OperationalMode.ClientMode} */ - operationalMode?: any; + operationalMode?: ej.Pivot.OperationalMode|string; /** This is a horizontal axis that contains options to configure axis and it is the primary x axis for all the series in series array. To override x axis for particular series, create an axis object by providing unique name by using name property and add it to axes array. Then, assign the name to the series’s xAxisName property to link both axis and series. * @Default {{}} @@ -24833,12 +25767,12 @@ export interface Model { */ serviceMethodSettings?: ServiceMethodSettings; - /** Options to customize the Chart size. + /** Options to customize the size of the PivotChart control. * @Default {{}} */ size?: any; - /** Connects the service using the specified URL for any server updates. + /** Connects the service using the specified URL for any server updates on operating the control in server mode. * @Default {“”} */ url?: string; @@ -24852,7 +25786,7 @@ export interface Model { /** Triggers before any AJAX request is passed from PivotChart to service methods. */ beforeServiceInvoke? (e: BeforeServiceInvokeEventArgs): void; - /** Triggers when drill up/down happens in PivotChart control. */ + /** Triggers on performing drill up/down in PivotChart control. */ drillSuccess? (e: DrillSuccessEventArgs): void; /** Triggers when PivotChart widget completes all operations at client-side after any AJAX request. */ @@ -24867,183 +25801,128 @@ export interface Model { export interface LoadEventArgs { - /** return the current action of PivotChart control. + /** returns the current action of PivotChart control. */ action?: string; - /** return the custom object bounds with PivotChart control. + /** returns the custom object bound with PivotChart control. */ customObject?: any; - /** return the outer HTML of PivotChart control. + /** returns the HTML element of PivotChart control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotChart.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface AfterServiceInvokeEventArgs { - /** return the current action of PivotChart control. + /** returns the current action of PivotChart control. */ action?: string; - /** return the custom object bounds with PivotChart control. + /** returns the custom object bound with PivotChart control. */ customObject?: any; - /** return the outer HTML of PivotChart control. + /** returns the HTML element of PivotChart control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotChart.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface BeforeServiceInvokeEventArgs { - /** return the current action of PivotChart control. + /** returns the current action of PivotChart control. */ action?: string; - /** return the custom object bounds with PivotChart control. + /** returns the custom object bound with PivotChart control. */ customObject?: any; - /** return the outer HTML of PivotChart control. + /** returns the HTML element of PivotChart control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotChart.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface DrillSuccessEventArgs { - /** if the event should be canceled; otherwise, false. + /** returns the current instance of PivotChart. */ - cancel?: boolean; + chartObj?: any; - /** returns the PivotChart model. + /** returns the drill action of PivotChart. */ - model?: ej.PivotChart.Model; + drillAction?: string; - /** returns the name of the event. + /** contains the name of the member drilled. */ - type?: string; + drilledMember?: string; + + /** returns the event object. + */ + event?: any; } export interface RenderCompleteEventArgs { - /** return the current action of PivotChart control. + /** returns the current action of PivotChart control. */ action?: string; - /** return the custom object bounds with PivotChart control. + /** returns the custom object bound with PivotChart control. */ customObject?: any; - /** return the outer HTML of PivotChart control. + /** returns the HTML element of PivotChart control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotChart.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RenderFailureEventArgs { - /** return the current action of PivotChart control. + /** returns the current action of PivotChart control. */ action?: string; - /** return the custom object bounds with PivotChart control. + /** returns the custom object bound with PivotChart control. */ customObject?: any; - /** return the error stack trace of the original exception. + /** returns the HTML element of PivotChart control. */ - message?: any; + element?: any; - /** return the outer HTML of PivotChart control. + /** returns the error stack trace of the original exception. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotChart.Model; - - /** returns the name of the event. - */ - type?: string; + message?: string; } export interface RenderSuccessEventArgs { - /** return the current action of PivotChart control. + /** returns the current instance of PivotChart. */ - action?: string; + args?: any; +} - /** return the custom object bounds with PivotChart control. - */ - customObject?: any; +export interface CommonSeriesOptions { - /** return the outer HTML of PivotChart control. + /** Allows the user to set the specific chart type for PivotChart widget. + * @Default {ej.PivotChart.ChartTypes.Column} */ - element?: string; + type?: ej.PivotChart.ChartTypes|string; +} - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; +export interface DataSourceColumnsFilterItems { - /** returns the PivotChart model. + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} */ - model?: ej.PivotChart.Model; + filterType?: ej.PivotAnalysis.FilterType|string; - /** returns the name of the event. + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} */ - type?: string; + values?: Array; } export interface DataSourceColumn { @@ -25052,14 +25931,37 @@ export interface DataSourceColumn { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item. */ fieldCaption?: string; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceColumnsFilterItems; +} + +export interface DataSourceRowsFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceRow { @@ -25068,35 +25970,792 @@ export interface DataSourceRow { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item. */ fieldCaption?: string; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceRowsFilterItems; +} + +export interface DataSourceValuesMeasure { + + /** Allows the user to bind the measure from OLAP datasource by using its unique name as field name. + */ + fieldName?: string; } export interface DataSourceValue { - /** This holds the measures unique name to bind them from the Cube. + /** Allows the user to bind the item by using its unique name as field name for Relational datasource. + */ + fieldName?: string; + + /** Allows the user to set the display caption for an item for Relational datasource. + */ + fieldCaption?: string; + + /** This holds the list of unique names of measures to bind them from the OLAP cube. * @Default {[]} */ - measures?: Array; + measures?: Array; /** Allows to set the axis name to place the measures items. - * @Default {“”} + * @Default {rows} */ axis?: string; + /** Indicates whether the field is a calculated field or not with Relational datasource. + * @Default {false} + */ + isCalculatedField?: boolean; + + /** Allows to set the formula for calculation of values for calculated members in Relational datasource. + */ + formula?: string; +} + +export interface DataSourceFiltersFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; +} + +export interface DataSourceFilter { + /** Allows the user to bind the item by using its unique name as field name. */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceFiltersFilterItems; +} + +export interface DataSource { + + /** Contains the respective cube name from OLAP database as string type. + * @Default {“”} + */ + cube?: string; + + /** Provides the raw data source for the PivotChart. + * @Default {null} + */ + data?: any; + + /** In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string. + * @Default {“”} + */ + catalog?: string; + + /** Lists out the items to be displayed as series of PivotChart. + * @Default {[]} + */ + columns?: Array; + + /** Lists out the items to be displayed as segments of PivotChart. + * @Default {[]} + */ + rows?: Array; + + /** Lists out the items supports calculation in PivotChart. + * @Default {[]} + */ + values?: Array; + + /** Lists out the items which supports filtering of values without displaying the members in UI in PivotChart. + * @Default {[]} + */ + filters?: Array; +} + +export interface ServiceMethodSettings { + + /** Allows the user to set the custom name for the service method responsible for drilling up/down operation in PivotChart. + * @Default {DrillChart} + */ + drillDown?: string; + + /** Allows the user to set the custom name for the service method responsible for exporting. + * @Default {Export} + */ + exportPivotChart?: string; + + /** Allows the user to set the custom name for the service method responsible for initializing PivotChart. + * @Default {InitializeChart} + */ + initialize?: string; + + /** Allows the user to set the custom name for the service method responsible for navigating between pages in paged PivotChart. + * @Default {Paging} + */ + paging?: string; +} + +enum ChartTypes{ + + ///To render a Line type PivotChart. + Line, + + ///To render a Spline type PivotChart. + Spline, + + ///To render a Column type PivotChart. + Column, + + ///To render an Area type PivotChart. + Area, + + ///To render a SplineArea type PivotChart. + SplineArea, + + ///To render a StepLine type PivotChart. + StepLine, + + ///To render a StepArea type PivotChart. + StepArea, + + ///To render a Pie type PivotChart. + Pie, + + ///To render a Bar type PivotChart. + Bar, + + ///To render a StackingArea type PivotChart. + StackingArea, + + ///To render a StackingColumn type PivotChart. + StackingColumn, + + ///To render a StackingBar type PivotChart. + StackingBar, + + ///To render a Pyramid type PivotChart. + Pyramid, + + ///To render a Funnel type PivotChart. + Funnel, + + ///To render a Doughnut type PivotChart. + Doughnut, + + ///To render a Scatter type PivotChart. + Scatter, + + ///To render a Bubble type PivotChart. + Bubble +} + +} + +class PivotClient extends ej.Widget { + static fn: PivotClient; + constructor(element: JQuery, options?: PivotClient.Model); + constructor(element: Element, options?: PivotClient.Model); + static Locale: any; + model:PivotClient.Model; + defaults:PivotClient.Model; + + /** Performs an asynchronous HTTP (AJAX) request. + * @returns {void} + */ + doAjaxPost(): void; + + /** Performs an asynchronous HTTP (FullPost) submit. + * @returns {void} + */ + doPostBack(): void; + + /** Navigates to the specified page in specified axis. + * @returns {void} + */ + refreshPagedPivotClient(): void; + + /** Updates the PivotClient component with the JSON data fetched from the service on navigating between pages. + * @returns {void} + */ + refreshPagedPivotClientSuccess(): void; + + /** Renders the PivotChart and PivotGrid with the JSON data provided. + * @returns {void} + */ + generateJSON(): void; + + /** Re-renders the control with the report at that instant. + * @returns {void} + */ + refreshControl(): void; + + /** Returns the OlapReport string maintained along with the axis elements information. + * @returns {void} + */ + getOlapReport(): void; + + /** Sets the OlapReport string along with the axis information and maintains it in a property. + * @returns {void} + */ + setOlapReport(): void; + + /** Returns the JSON records formed to render the control. + * @returns {void} + */ + getJSONRecords(): void; + + /** Sets the JSON records formed to render the control to a property. + * @returns {void} + */ + setJSONRecords(): void; +} +export module PivotClient{ + +export interface Model { + + /** Sets the mode for the PivotClient widget for binding either OLAP or Relational data source. + * @Default {ej.Pivot.AnalysisMode.Pivot} + */ + analysisMode?: ej.Pivot.AnalysisMode|string; + + /** Allows the user to set the specific chart type for PivotChart inside PivotClient widget. + * @Default {ej.PivotChart.ChartTypes.Column} + */ + chartType?: ej.PivotChart.ChartTypes|string; + + /** Allows the user to set the content on exporting the PivotClient widget. + * @Default {ej.PivotClient.ClientExportMode.ChartAndGrid} + */ + clientExportMode?: ej.PivotClient.ClientExportMode|string; + + /** Specifies the CSS class to PivotClient to achieve custom theme. + * @Default {“”} + */ + cssClass?: string; + + /** Object utilized to pass additional information between client-end and service-end when the control functions in server-mode. + * @Default {{}} + */ + customObject?: any; + + /** Initializes the data source for the PivotClient widget, when it functions completely on client-side. + * @Default {{}} + */ + dataSource?: DataSource; + + /** Allows the user to customize the widget's layout and appearance. + * @Default {{}} + */ + displaySettings?: DisplaySettings; + + /** Enables the advanced filtering options Value Filtering, Label Filtering and Sorting for each dimensions on binding OLAP data in server mode. + * @Default {false} + */ + enableAdvancedFilter?: boolean; + + /** Allows the user to refresh the control on-demand and not during every UI operation. + * @Default {false} + */ + enableDeferUpdate?: boolean; + + /** Lets the user to save and load reports in a customized way with the help of events. + * @Default {false} + */ + enableLocalStorage?: boolean; + + /** Allows the user to enable paging for both the PivotChart and PivotGrid components for the ease of viewing large data. + * @Default {false} + */ + enablePaging?: boolean; + + /** Allows the user to include the PivotTreeMap component as one of the chart types. + * @Default {false} + */ + enablePivotTreeMap?: boolean; + + /** Allows the user to view the layout of PivotClient from right to left. + * @Default {false} + */ + enableRTL?: boolean; + + /** Enables/disables the visibility of measure group selector drop-down in Cube Browser. + * @Default {false} + */ + enableMeasureGroups?: boolean; + + /** Allows the user to enable virtual scrolling for both the PivotChart and PivotGrid components for the ease of viewing large data. + * @Default {false} + */ + enableVirtualScrolling?: boolean; + + /** Enables/Disables paging in Member Editor for viewing the large count of members in pages. + * @Default {false} + */ + enableMemberEditorPaging?: boolean; + + /** Allows the user to set the number of members to be displayed in each page of Member Editor on applying paging in it. + * @Default {100} + */ + memberEditorPageSize?: number; + + /** Sets the summary layout for PivotGrid. Following are the ways in which summary can be positioned: normal summary (bottom), top summary, no summary and excel-like summary. + * @Default {ej.PivotGrid.Layout.Normal} + */ + gridLayout?: ej.PivotGrid.Layout|string; + + /** Allows the user to set the localized language for the widget. + * @Default {en-US} + */ + locale?: string; + + /** Sets the mode for the PivotClient widget for binding data source either in server-side or client-side. + * @Default {ej.Pivot.OperationalMode.ClientMode} + */ + operationalMode?: ej.Pivot.OperationalMode|string; + + /** Allows the user to set custom name for the methods at service-end, communicated during AJAX post. + * @Default {{}} + */ + serviceMethodSettings?: ServiceMethodSettings; + + /** Sets the title for PivotClient widget. + */ + title?: string; + + /** Connects the service using the specified URL for any server updates. + */ + url?: string; + + /** Triggers when it reaches client-side after any AJAX request. */ + afterServiceInvoke? (e: AfterServiceInvokeEventArgs): void; + + /** Triggers before any AJAX request is passed from client-side to service methods. */ + beforeServiceInvoke? (e: BeforeServiceInvokeEventArgs): void; + + /** Triggers before saving the current collection of reports. */ + saveReport? (e: SaveReportEventArgs): void; + + /** Triggers before loading a saved collection of reports. */ + loadReport? (e: LoadReportEventArgs): void; + + /** Triggers before fetching the report collection from storage. */ + fetchReport? (e: FetchReportEventArgs): void; + + /** Triggers before exporting the control. */ + beforeExport? (e: BeforeExportEventArgs): void; + + /** Triggers before rendering the PivotChart. */ + chartLoad? (e: ChartLoadEventArgs): void; + + /** Triggers before rendering the PivotTreeMap. */ + treeMapLoad? (e: TreeMapLoadEventArgs): void; + + /** Triggers while we initiate loading of the widget. */ + load? (e: LoadEventArgs): void; + + /** Triggers when PivotClient widget completes all operations at client-end after any AJAX request. */ + renderComplete? (e: RenderCompleteEventArgs): void; + + /** Triggers when any error occurred during AJAX request. */ + renderFailure? (e: RenderFailureEventArgs): void; + + /** Triggers when PivotClient successfully completes rendering. */ + renderSuccess? (e: RenderSuccessEventArgs): void; +} + +export interface AfterServiceInvokeEventArgs { + + /** returns the current action of PivotClient control. + */ + action?: string; + + /** returns the custom object bounds with PivotClient control. + */ + customObject?: any; + + /** returns the HTML element of PivotClient control. + */ + element?: any; +} + +export interface BeforeServiceInvokeEventArgs { + + /** returns the current action of PivotClient control. + */ + action?: string; + + /** returns the custom object bounds with PivotClient control. + */ + customObject?: any; + + /** returns the HTML element of PivotClient control. + */ + element?: any; +} + +export interface SaveReportEventArgs { + + /** returns the current instance of PivotClient control. + */ + targetControl?: any; + + /** returns the object which holds the necessary parameters required for saving the report collection. + */ + saveReportSetting?: any; +} + +export interface LoadReportEventArgs { + + /** returns the current instance of PivotClient control. + */ + targetControl?: any; + + /** returns the object which holds the necessary parameters required for loading a report collection from database. + */ + loadReportSetting?: any; +} + +export interface FetchReportEventArgs { + + /** returns the current instance of PivotClient control. + */ + targetControl?: any; + + /** returns the object which holds the necessary parameters required for fetching the report names stored in database. + */ + fetchReportSetting?: any; +} + +export interface BeforeExportEventArgs { + + /** holds the url of the service method responsible for exporting the PivotClient control. + */ + url?: string; + + /** holds the name of the file to be exported. + */ + fileName?: string; +} + +export interface ChartLoadEventArgs { + + /** returns the current action of PivotChart control. + */ + action?: string; + + /** returns the custom object bound with PivotChart control. + */ + customObject?: any; + + /** returns the HTML element of PivotChart control. + */ + element?: any; +} + +export interface TreeMapLoadEventArgs { + + /** returns the current action of PivotTreeMap control. + */ + action?: string; + + /** returns the custom object bound with PivotTreeMap control. + */ + customObject?: any; + + /** returns the HTML element of PivotTreeMap control. + */ + element?: any; +} + +export interface LoadEventArgs { + + /** returns the HTML element of PivotClient component. + */ + element?: any; + + /** returns the custom object bound with PivotTreeMap control. + */ + customObject?: any; +} + +export interface RenderCompleteEventArgs { + + /** returns the HTML element of PivotClient component. + */ + element?: any; + + /** returns the custom object bound with PivotTreeMap control. + */ + customObject?: any; +} + +export interface RenderFailureEventArgs { + + /** returns the custom object bound with the control. + */ + customObject?: any; + + /** returns the HTML element of PivotClient control. + */ + element?: any; + + /** returns the error message with error code. + */ + message?: string; +} + +export interface RenderSuccessEventArgs { + + /** returns the object of PivotClient control at that instant. + */ + args?: any; +} + +export interface DataSourceColumnsAdvancedFilter { + + /** Allows the user to provide level unique name to perform advanced filtering. + */ + name?: string; + + /** Allows the user to set the operator to perform Label Filtering. + * @Default {none} + */ + labelFilterOperator?: string; + + /** Allows the user to set the operator to perform Value Filtering. + * @Default {none} + */ + valueFilterOperator?: string; + + /** Allows the user to set the filtering type while performing advanced filtering. + */ + advancedFilterType?: string; + + /** In case of value filtering, this property contains the measure name to which the filter is applied. + */ + measure?: string; + + /** Allows the user to hold the filter operand values in advanced filtering. + */ + values?: Array; +} + +export interface DataSourceColumnsFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; +} + +export interface DataSourceColumn { + + /** Allows the user to bind the item by using its unique name as field name. + */ + fieldName?: string; + + /** Allows the user to set the display caption for an item. */ fieldCaption?: string; + + /** Allows the user to filter the report by default using advanced filtering (excel-like) option for OLAP data source in client-mode. + * @Default {[]} + */ + advancedFilter?: Array; + + /** Allows the user to indicate whether the added item is a named set or not. + * @Default {false} + */ + isNamedSets?: boolean; + + /** Shows/Hides the sub-total of the field in PivotGrid. + * @Default {true} + */ + showSubTotal?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Contains the list of members need to be drilled down by default in the field. + * @Default {[]} + */ + drilledItems?: Array; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceColumnsFilterItems; +} + +export interface DataSourceRowsAdvancedFilter { + + /** Allows the user to provide level unique name to perform advanced filtering. + */ + name?: string; + + /** Allows the user to set the operator to perform Label Filtering. + * @Default {none} + */ + labelFilterOperator?: string; + + /** Allows the user to set the operator to perform Value Filtering. + * @Default {none} + */ + valueFilterOperator?: string; + + /** Allows the user to set the filtering type while performing advanced filtering. + */ + advancedFilterType?: string; + + /** In case of value filtering, this property contains the measure name to which the filter is applied. + */ + measure?: string; + + /** Allows the user to hold the filter operand values in advanced filtering. + */ + values?: Array; +} + +export interface DataSourceRowsFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; +} + +export interface DataSourceRow { + + /** Allows the user to bind the item by using its unique name as field name. + */ + fieldName?: string; + + /** Allows the user to set the display caption for an item. + */ + fieldCaption?: string; + + /** Allows the user to filter the report by default using advanced filtering (excel-like) option for OLAP data source in client-mode. + * @Default {[]} + */ + advancedFilter?: Array; + + /** Allows the user to indicate whether the added item is a named set or not. + * @Default {false} + */ + isNamedSets?: boolean; + + /** Shows/Hides the sub-total of the field. + * @Default {true} + */ + showSubTotal?: boolean; + + /** Allows the user to set the sorting order of the members of the field. + * @Default {ej.PivotAnalysis.SortOrder.Ascending} + */ + sortOrder?: ej.PivotAnalysis.SortOrder|string; + + /** Contains the list of members need to be drilled down by default in the field. + * @Default {[]} + */ + drilledItems?: Array; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceRowsFilterItems; +} + +export interface DataSourceValuesMeasure { + + /** Allows the user to bind the measure from OLAP datasource by using its unique name as field name. + */ + fieldName?: string; +} + +export interface DataSourceValue { + + /** Allows the user to bind the item by using its unique name as field name for Relational datasource. + */ + fieldName?: string; + + /** Allows the user to set the display caption for an item for Relational datasource. + */ + fieldCaption?: string; + + /** This holds the list of unique names of measures to bind them from the OLAP cube. + * @Default {[]} + */ + measures?: Array; + + /** Allows to set the axis name to place the measures items. + * @Default {rows} + */ + axis?: string; + + /** Indicates whether the field is a calculated field or not with Relational datasource. + * @Default {false} + */ + isCalculatedField?: boolean; + + /** Allows to set the type of PivotGrid summary calculation for the value field with Relational datasource. + * @Default {ej.PivotAnalysis.SummaryType.Sum} + */ + summaryType?: ej.PivotAnalysis.SummaryType|string; + + /** Allows to set the format of the values. + */ + format?: string; + + /** This property sets type of display of date. + */ + formatString?: string; + + /** Allows to set the formula for calculation of values for calculated members in Relational datasource. + */ + formula?: string; +} + +export interface DataSourceFiltersFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceFilter { @@ -25109,368 +26768,105 @@ export interface DataSourceFilter { */ fieldCaption?: string; - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} + /** Applies filter to the field members. + * @Default {null} */ - isNamedSets?: boolean; + filterItems?: DataSourceFiltersFilterItems; +} + +export interface DataSourcePagerOptions { + + /** Allows to set the number of categorical columns to be displayed in each page on applying paging. + * @Default {0} + */ + categoricalPageSize?: number; + + /** Allows to set the number of series rows to be displayed in each page on applying paging. + * @Default {0} + */ + seriesPageSize?: number; + + /** Allows to set the page number in categorical axis to be loaded by default. + * @Default {1} + */ + categoricalCurrentPage?: number; + + /** Allows to set the page number in series axis to be loaded by default. + * @Default {1} + */ + seriesCurrentPage?: number; } export interface DataSource { - /** Contains the database name as string type to fetch the data from the given connection string. - * @Default {“”} - */ - catalog?: string; - - /** Lists out the items to be arranged in column section of PivotChart. + /** Lists out the items to be arranged in columns section of PivotClient. * @Default {[]} */ columns?: Array; - /** Contains the respective Cube name from database as string type. - * @Default {“”} - */ - cube?: string; - - /** Provides the raw data source for the PivotChart. - * @Default {null} - */ - data?: any; - - /** Lists out the items to be arranged in row section of PivotChart. + /** Lists out the items to be arranged in rows section of PivotClient. * @Default {[]} */ rows?: Array; - /** Lists out the items which supports calculation in PivotChart. + /** Lists out the items which supports calculation in PivotClient. * @Default {[]} */ values?: Array; - /** Lists out the items which supports filtering of values in PivotChart. + /** Lists out the items which supports filtering of values without displaying the members in UI in PivotClient. * @Default {[]} */ filters?: Array; -} -export interface ServiceMethodSettings { - - /** Allows the user to set the custom name for the service method that’s responsible for drilling up/down operation in PivotChart. - * @Default {DrillChart} - */ - drillDown?: string; - - /** Allows the user to set the custom name for the service method that’s responsible for exporting. - * @Default {Export} - */ - exportPivotChart?: string; - - /** Allows the user to set the custom name for the service method that’s responsible for initializing PivotChart. - * @Default {InitializeChart} - */ - initialize?: string; -} -} - -class PivotClient extends ej.Widget { - static fn: PivotClient; - constructor(element: JQuery, options?: PivotClient.Model); - constructor(element: Element, options?: PivotClient.Model); - model:PivotClient.Model; - defaults:PivotClient.Model; - - /** Perform an asynchronous HTTP (AJAX) request. - * @returns {void} - */ - doAjaxPost(): void; - - /** Perform an asynchronous HTTP (FullPost) submit. - * @returns {void} - */ - doPostBack(): void; -} -export module PivotClient{ - -export interface Model { - - /** Allows the user to set the specific chart type for PivotChart. - * @Default {ej.PivotChart.ChartTypes.Column} - */ - chartType?: ej.PivotChart.ChartTypes|string; - - /** Sets the mode to export the OLAP visualization components such as PivotChart and PivotGrid in PivotClient. Based on the option, either Chart or Grid or both gets exported. - * @Default {ej.PivotClient.ClientExportMode.ChartAndGrid} - */ - clientExportMode?: string; - - /** Specifies the CSS class to PivotClient to achieve custom theme. + /** Contains the respective cube name from OLAP database as string type. * @Default {“”} */ - cssClass?: string; + cube?: string; - /** Object utilized to pass additional information between client-end and service-end. - * @Default {{}} - */ - customObject?: any; - - /** Allows the user to customize the widgets layout and appearance. - * @Default {{}} - */ - displaySettings?: DisplaySettings; - - /** Allows the user to refresh the control on-demand and not during every UI operation. - * @Default {false} - */ - enableDeferUpdate?: boolean; - - /** Allows the user to view the layout of PivotClient from right to left. - * @Default {false} - */ - enableRTL?: boolean; - - /** Enables/disables the visibility of measure group selector drop-down in Cube Browser. - * @Default {false} - */ - enableMeasureGroups?: boolean; - - /** Sets the summary layout for PivotGrid. Following are the ways in which summary can be positioned: normal summary (bottom), top summary, no summary and excel-like summary. - * @Default {ej.PivotGrid.Layout.Normal} - */ - gridLayout?: ej.PivotGrid.Layout|string; - - /** Allows the user to set the localized language for the widget. - * @Default {en-US} - */ - locale?: string; - - /** Allows the user to set custom name for the methods at service-end, communicated during AJAX post. - * @Default {{}} - */ - serviceMethodSettings?: ServiceMethodSettings; - - /** Sets the title for PivotClient widget. + /** Provides the raw data source for the PivotClient. * @Default {null} */ - title?: string; + data?: any; - /** Connects the service using the specified URL for any server updates. - * @Default {null} + /** In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string. + * @Default {“”} */ - url?: string; + catalog?: string; - /** Triggers when it reaches client-side after any AJAX request. */ - afterServiceInvoke? (e: AfterServiceInvokeEventArgs): void; - - /** Triggers before any AJAX request is passed from PivotClient to service methods. */ - beforeServiceInvoke? (e: BeforeServiceInvokeEventArgs): void; - - /** Triggers before rendering the PivotChart. */ - chartLoad? (e: ChartLoadEventArgs): void; - - /** Triggers while we initiate loading of the widget. */ - load? (e: LoadEventArgs): void; - - /** Triggers when PivotClient widget completes all operations at client-end after any AJAX request. */ - renderComplete? (e: RenderCompleteEventArgs): void; - - /** Triggers when any error occurred during AJAX request. */ - renderFailure? (e: RenderFailureEventArgs): void; - - /** Triggers when PivotClient successfully reaches client-side after any AJAX request. */ - renderSuccess? (e: RenderSuccessEventArgs): void; -} - -export interface AfterServiceInvokeEventArgs { - - /** return the current action of PivotClient control. + /** Allows user to filter the members (by its name and values) through advanced filtering (excel-like) option for OLAP data source in client-mode. + * @Default {false} */ - action?: string; + enableAdvancedFilter?: boolean; - /** return the custom object bounds with PivotClient control. + /** Sets a name to the report bound to the control. */ - customObject?: any; + reportName?: string; - /** return the outer HTML of PivotClient control. + /** Allows to set the page size and current page number for each axis on applying paging. + * @Default {{}} */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface BeforeServiceInvokeEventArgs { - - /** return the current action of PivotClient control. - */ - action?: string; - - /** return the custom object bounds with PivotClient control. - */ - customObject?: any; - - /** return the outer HTML of PivotClient control. - */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface ChartLoadEventArgs { - - /** return the current action of PivotChart control. - */ - action?: string; - - /** return the custom object bounds with PivotChart control. - */ - customObject?: any; - - /** return the outer HTML of PivotChart control. - */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotChart model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface LoadEventArgs { - - /** returns the outer HTML of PivotClient component. - */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface RenderCompleteEventArgs { - - /** returns the custom object bounded with the control. - */ - customObject?: any; - - /** returns the outer HTML of PivotClient control. - */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface RenderFailureEventArgs { - - /** returns the custom object bounded with the control. - */ - customObject?: any; - - /** returns the outer HTML of PivotClient control. - */ - element?: string; - - /** returns the error message with error code. - */ - message?: any; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; -} - -export interface RenderSuccessEventArgs { - - /** returns the custom object bounded with the control. - */ - customObject?: any; - - /** returns the outer HTML of PivotClient control. - */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotClient model. - */ - model?: ej.PivotClient.Model; - - /** returns the name of the event. - */ - type?: string; + pagerOptions?: DataSourcePagerOptions; } export interface DisplaySettings { - /** Let’s the user to customize the display of PivotChart and PivotGrid widgets, either in tab view or in tile view. + /** Lets the user to customize the display of PivotChart and PivotGrid widgets, either in tabs or tiles. * @Default {ej.PivotClient.ControlPlacement.Tab} */ controlPlacement?: ej.PivotClient.ControlPlacement|string; - /** Let’s the user to set either Chart or Grid as the start-up widget. + /** Lets the user to set either Chart or Grid as the start-up widget. * @Default {ej.PivotClient.DefaultView.Grid} */ defaultView?: ej.PivotClient.DefaultView|string; - /** Enables/disables the full screen view of PivotChart and PivotGrid in PivotClient. + /** Lets the user to have an option for switching to full screen view of PivotChart and PivotGrid from default view in PivotClient. * @Default {false} */ enableFullScreen?: boolean; - /** Enhances the space for PivotGrid and PivotChart, by hiding Cube Browser and Axis Element Builder. + /** Enables an option to enhance the space for PivotGrid and PivotChart by hiding Cube Browser and Axis Element Builder. * @Default {false} */ enableTogglePanel?: boolean; @@ -25488,103 +26884,121 @@ export interface DisplaySettings { export interface ServiceMethodSettings { - /** Allows the user to set the custom name for the service method that’s responsible for updating the entire report and widget, while changing the Cube. + /** Allows the user to set the custom name for the service method responsible for updating the entire report and widget, while changing the Cube. * @Default {CubeChanged} */ cubeChanged?: string; - /** Allows the user to set the custom name for the service method that’s responsible for exporting. + /** Allows the user to set the custom name for the service method responsible for exporting. * @Default {Export} */ exportPivotClient?: string; - /** Allows the user to set the custom name for the service method that’s responsible to get the members, for the tree-view inside member-editor dialog. + /** Allows the user to set the custom name for the service method responsible to get the members for the tree-view, inside member-editor dialog. * @Default {FetchMemberTreeNodes} */ fetchMemberTreeNodes?: string; - /** Allows the user to set the custom name for the service method that’s responsible for fetching the report names from the database. + /** Allows the user to set the custom name for the service method responsible for fetching the report names from the database. * @Default {FetchReportListFromDB} */ fetchReportList?: string; - /** Allows the user to set the custom name for the service method that’s responsible for updating report while filtering members. + /** Allows the user to set the custom name for the service method responsible for updating report while filtering members. * @Default {FilterElement} */ filterElement?: string; - /** Allows the user to set the custom name for the service method that’s responsible for initializing PivotClient. + /** Allows the user to set the custom name for the service method responsible for initializing PivotClient. * @Default {InitializeClient} */ initialize?: string; - /** Allows the user to set the custom name for the service method that’s responsible for loading the report collection from the database. + /** Allows the user to set the custom name for the service method responsible for loading a report collection from the database. * @Default {LoadReportFromDB} */ loadReport?: string; - /** Allows the user to set the custom name for the service method that’s responsible for retrieving the MDX query for the current report. + /** Allows the user to set the custom name for the service method responsible for retrieving the MDX query for the current report. * @Default {GetMDXQuery} */ mdxQuery?: string; - /** Allows the user to set the custom name for the service method that’s responsible for updating the tree-view inside Cube Browser, while changing the measure group. + /** Allows the user to set the custom name for the service method responsible for updating the tree-view inside Cube Browser, while changing the measure group. * @Default {MeasureGroupChanged} */ measureGroupChanged?: string; - /** Allows the user to set the custom name for the service method that’s responsible to get the child members, on tree-view node expansion. + /** Allows the user to set the custom name for the service method responsible to get the child members, on tree-view node expansion. * @Default {MemberExpanded} */ memberExpand?: string; - /** Allows the user to set the custom name for the service method that’s responsible for updating report while dropping a node/SplitButton inside Axis Element Builder. + /** Allows the user to set the custom name for the service method responsible for updating report while dropping a node/SplitButton inside Axis Element Builder. * @Default {NodeDropped} */ nodeDropped?: string; - /** Allows the user to set the custom name for the service method that’s responsible for updating report while removing SplitButton from Axis Element Builder. + /** Allows the user to set the custom name for the service method responsible for updating report while removing SplitButton from Axis Element Builder. * @Default {RemoveSplitButton} */ removeSplitButton?: string; - /** Allows the user to set the custom name for the service method that’s responsible for saving the report collection to database. + /** Allows the user to set the custom name for the service method responsible for saving the report collection to database. * @Default {SaveReportToDB} */ saveReport?: string; - /** Allows the user to set the custom name for the service method that’s responsible for toggling the elements in row and column axes. + /** Allows the user to set the custom name for the service method responsible for toggling the elements in row and column axes. * @Default {ToggleAxis} */ toggleAxis?: string; - /** Allows the user to set the custom name for the service method that’s responsible for any toolbar operation. + /** Allows the user to set the custom name for the service method responsible for all the toolbar operations. * @Default {ToolbarOperations} */ toolbarServices?: string; - /** Allows the user to set the custom name for the service method that’s responsible for updating report collection. + /** Allows the user to set the custom name for the service method responsible for updating report collection. * @Default {UpdateReport} */ updateReport?: string; + + /** Allows the user to set the custom name for the service method responsible on navigating between pages in paged PivotClient. + * @Default {Paging} + */ + paging?: string; } +enum ClientExportMode{ + + ///Exports both the PivotChart and PivotGrid on exporting. + ChartAndGrid, + + ///Exports the PivotChart control alone on exporting. + ChartOnly, + + ///Exports the PivotGrid control alone on exporting. + GridOnly +} + + enum ControlPlacement{ - ///To display PivotChart and PivotGrid widgets in tab view. + ///Displays PivotChart and PivotGrid widgets in separate tabs. Tab, - ///To display PivotChart and PivotGrid widgets within the same view, one below the other. + ///Displays PivotChart and PivotGrid widgets one above the other. Tile } enum DefaultView{ - ///To set PivotChart as a default control in view when the PivotClient widget is loaded for the first time. + ///To set PivotChart as a default control in view. Chart, - ///To set PivotGrid as a default control in view when the PivotClient widget is loaded for the first time. + ///To set PivotGrid as a default control in view. Grid } @@ -25601,56 +27015,17 @@ enum DisplayMode{ ChartAndGrid } -} -module PivotChart -{ -enum ChartTypes -{ -//To render a Line type for PivotChart. -Line, -//To render a Spline type for PivotChart. -Spline, -//To render a Column type for PivotChart. -Column, -//To render a Area type for PivotChart. -Area, -//To render a SplineArea type for PivotChart. -SplineArea, -//To render a StepLine type for PivotChart. -StepLine, -//To render a StepArea type for PivotChart. -StepArea, -//To render a Pie type for PivotChart. -Pie, -//To render a Bar type for PivotChart. -Bar, -//To render a StackingArea type for PivotChart. -StackingArea, -//To render a StackingColumn type for PivotChart. -StackingColumn, -//To render a StackingBar type for PivotChart. -StackingBar, -//To render a Pyramid type for PivotChart. -Pyramid, -//To render a Funnel type for PivotChart. -Funnel, -//To render a Doughnut type for PivotChart. -Doughnut, -//To render a Scatter type for PivotChart. -Scatter, -//To render a Bubble type for PivotChart. -Bubble, -} } class PivotGauge extends ej.Widget { static fn: PivotGauge; constructor(element: JQuery, options?: PivotGauge.Model); constructor(element: Element, options?: PivotGauge.Model); + static Locale: any; model:PivotGauge.Model; defaults:PivotGauge.Model; - /** Perform an asynchronous HTTP (AJAX) request. + /** Performs an asynchronous HTTP (AJAX) request. * @returns {void} */ doAjaxPost(): void; @@ -25660,36 +27035,56 @@ class PivotGauge extends ej.Widget { */ refresh(): void; - /** This function removes the KPI related images from PivotGauge. + /** This function removes the KPI related images from PivotGauge on binding OLAP datasource. * @returns {void} */ removeImg(): void; - /** This function receives the JSON formatted datasource to render the PivotGauge control. + /** This function receives the JSON formatted datasource and renders the PivotGauge control. * @returns {void} */ renderControlFromJSON(): void; + + /** Returns the OlapReport string maintained along with the axis elements information. + * @returns {void} + */ + getOlapReport(): void; + + /** Sets the OlapReport string along with the axis information and maintains it in a property. + * @returns {void} + */ + setOlapReport(): void; + + /** Returns the JSON records formed to render the control. + * @returns {void} + */ + getJSONRecords(): void; + + /** Sets the JSON records to render the control. + * @returns {void} + */ + setJSONRecords(): void; + + /** Returns the JSON records required to render the PivotGauge on performing any action with OLAP data source. + * @returns {void} + */ + getJSONData(): void; } export module PivotGauge{ export interface Model { - /** Specifies the background color of pivot gauge. - * @Default {null} - */ - backgroundColor?: string; - - /** Sets the number of column count to arrange the PivotGauge's. + /** Sets the number of columns to arrange the Pivot Gauges. * @Default {0} */ columnsCount?: number; - /** Specify the CSS class to PivotGauge to achieve custom theme. + /** Specifies the CSS class to PivotGauge to achieve custom theme. * @Default {“”} */ cssClass?: string; - /** Object utilized to pass additional information between client-end and service-end. + /** Object utilized to pass additional information between client-end and service-end on operating in server mode. * @Default {{}} */ customObject?: any; @@ -25699,6 +27094,11 @@ export interface Model { */ dataSource?: DataSource; + /** Enables/disables the animation of pointer in PivotGauge. + * @Default {false} + */ + enableAnimation?: boolean; + /** Enables/disables tooltip visibility in PivotGauge. * @Default {false} */ @@ -25724,7 +27124,7 @@ export interface Model { */ locale?: string; - /** Sets the number of row count to arrange the PivotGauge's. + /** Sets the number of rows to arrange the Pivot Gauges. * @Default {0} */ rowsCount?: number; @@ -25744,17 +27144,30 @@ export interface Model { */ showHeaderLabel?: boolean; - /** Connects the service using the specified URL for any server updates. + /** Connects the service using the specified URL for any server updates on server mode operation. * @Default {“”} */ url?: string; + /** Sets the mode for the PivotGauge widget for binding either OLAP or Relational data source. + * @Default {ej.Pivot.AnalysisMode.Pivot} + */ + analysisMode?: ej.Pivot.AnalysisMode|string; + + /** Sets the mode for the PivotGauge widget for binding data source either in server-side or client-side. + * @Default {ej.Pivot.OperationalMode.ClientMode} + */ + operationalMode?: ej.Pivot.OperationalMode|string; + /** Triggers when it reaches client-side after any AJAX request. */ afterServiceInvoke? (e: AfterServiceInvokeEventArgs): void; /** Triggers before any AJAX request is passed from PivotGauge to service methods. */ beforeServiceInvoke? (e: BeforeServiceInvokeEventArgs): void; + /** Triggers before populating the pivot engine on operating in client mode. */ + beforePivotEnginePopulate? (e: BeforePivotEnginePopulateEventArgs): void; + /** Triggers when PivotGauge started loading at client-side. */ load? (e: LoadEventArgs): void; @@ -25770,148 +27183,100 @@ export interface Model { export interface AfterServiceInvokeEventArgs { - /** return the current action of PivotGauge control. - */ - action?: string; - - /** return the custom object bounds with PivotGauge control. + /** returns the custom object bound with PivotGauge control. */ customObject?: any; - /** return the outer HTML of PivotGauge control. + /** returns the HTML element of PivotGauge control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGauge model. - */ - model?: ej.PivotGauge.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface BeforeServiceInvokeEventArgs { - /** return the current action of PivotGauge control. - */ - action?: string; - - /** return the custom object bounds with PivotGauge control. + /** returns the custom object bound with PivotGauge control. */ customObject?: any; - /** return the outer HTML of PivotGauge control. + /** returns the HTML element of PivotGauge control. */ - element?: string; + element?: any; +} - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; +export interface BeforePivotEnginePopulateEventArgs { - /** returns the PivotGauge model. + /** returns the current instance of PivotGauge control. */ - model?: ej.PivotGauge.Model; - - /** returns the name of the event. - */ - type?: string; + gaugeObject?: any; } export interface LoadEventArgs { - /** if the event should be canceled; otherwise, false. + /** returns the current action of PivotGauge control. */ - cancel?: boolean; + action?: string; - /** returns the PivotGauge model. + /** returns the model of PivotGauge control. */ - model?: ej.PivotGauge.Model; + model?: any; - /** returns the name of the event. + /** returns the HTML element of the widget. */ - type?: string; + element?: any; + + /** returns the custom object bound to the control. + */ + customObject?: any; } export interface RenderCompleteEventArgs { - /** returns the outer HTML of PivotGauge control. - */ - element?: string; - - /** returns the custom object bounded with the control. + /** returns the custom object bound with PivotGauge control. */ customObject?: any; - /** if the event should be canceled; otherwise, false. + /** returns the HTML element of PivotGauge control. */ - cancel?: boolean; - - /** returns the PivotGauge model. - */ - model?: ej.PivotGauge.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RenderFailureEventArgs { - /** returns the outer HTML of PivotGauge control. + /** returns the HTML element of PivotGauge control. */ - element?: string; + element?: any; - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; /** returns the error message with error code. */ - message?: any; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotGauge model. - */ - model?: ej.PivotGauge.Model; - - /** returns the name of the event. - */ - type?: string; - - /** returns the JSON formatted response while error occurs. - */ - responseJSON?: any; + message?: string; } export interface RenderSuccessEventArgs { - /** returns the outer HTML of PivotGauge control. + /** returns the HTML element of PivotGauge control. */ - element?: string; + element?: any; - /** returns the custom object bounded with the control. + /** returns the custom object bound with the control. */ customObject?: any; +} - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; +export interface DataSourceColumnsFilterItems { - /** returns the PivotGauge model. + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} */ - model?: ej.PivotGauge.Model; + filterType?: ej.PivotAnalysis.FilterType|string; - /** returns the name of the event. + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} */ - type?: string; + values?: Array; } export interface DataSourceColumn { @@ -25920,24 +27285,20 @@ export interface DataSourceColumn { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Applies filter to the field members. + * @Default {null} */ - fieldCaption?: string; - - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} - */ - isNamedSets?: boolean; + filterItems?: DataSourceColumnsFilterItems; } export interface DataSourceRowsFilterItems { - /** Allows the user to set the type of filtering for an item. - * @Default {exclude} + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} */ - filterType?: string; + filterType?: ej.PivotAnalysis.FilterType|string; - /** Allows the user to set the values for filtering an item. + /** Contains the collection of items to be included/excluded among the field members. * @Default {[]} */ values?: Array; @@ -25949,40 +27310,60 @@ export interface DataSourceRow { */ fieldName?: string; - /** Allows the user to set the display name for an item. - */ - fieldCaption?: string; - - /** Allows the user to set the filtering values name for an item. + /** Applies filter to the field members. * @Default {null} */ filterItems?: DataSourceRowsFilterItems; +} - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} +export interface DataSourceValuesMeasure { + + /** Allows the user to bind the measure from OLAP datasource by using its unique name as field name. */ - isNamedSets?: boolean; + fieldName?: string; } export interface DataSourceValue { - /** This holds the measures unique name to bind them from the Cube. - * @Default {[]} - */ - measures?: Array; - - /** Allows to set the axis name to place the measures items. - * @Default {“”} - */ - axis?: string; - - /** Allows the user to bind the item by using its unique name as field name. + /** Allows the user to bind the item by using its unique name as field name for Relational datasource. */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Allows the user to set the display caption for an item for Relational datasource. */ fieldCaption?: string; + + /** This holds the list of unique names of measures to bind them from the OLAP cube. + * @Default {[]} + */ + measures?: Array; + + /** Allows to set the axis name to place the measures items. + * @Default {rows} + */ + axis?: string; + + /** Indicates whether the field is a calculated field or not with Relational datasource. + * @Default {false} + */ + isCalculatedField?: boolean; + + /** Allows to set the formula for calculation of values for calculated members in Relational datasource. + */ + formula?: string; +} + +export interface DataSourceFiltersFilterItems { + + /** Sets the type of filter whether to include/exclude the mentioned values. + * @Default {ej.PivotAnalysis.FilterType.Exclude} + */ + filterType?: ej.PivotAnalysis.FilterType|string; + + /** Contains the collection of items to be included/excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceFilter { @@ -25991,29 +27372,15 @@ export interface DataSourceFilter { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Applies filter to the field members. + * @Default {null} */ - fieldCaption?: string; - - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} - */ - isNamedSets?: boolean; + filterItems?: DataSourceFiltersFilterItems; } export interface DataSource { - /** Contains the database name as string type to fetch the data from the given connection string. - * @Default {“”} - */ - catalog?: string; - - /** Lists out the items to be arranged in column section of PivotGauge. - * @Default {[]} - */ - columns?: Array; - - /** Contains the respective Cube name from database as string type. + /** Contains the respective cube name from OLAP database as string type. * @Default {“”} */ cube?: string; @@ -26023,17 +27390,27 @@ export interface DataSource { */ data?: any; - /** Lists out the items to be arranged in row section of PivotGauge. + /** In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string. + * @Default {“”} + */ + catalog?: string; + + /** Lists out the items to bind in columns section. + * @Default {[]} + */ + columns?: Array; + + /** Lists out the items to bind in rows section. * @Default {[]} */ rows?: Array; - /** Lists out the items which supports calculation in PivotGauge. + /** Lists out the items supports calculation in PivotGauge. * @Default {[]} */ values?: Array; - /** Lists out the items which supports filtering of values in PivotGauge. + /** Lists out the items which supports filtering of values without displaying the members in UI in PivotGauge. * @Default {[]} */ filters?: Array; @@ -26046,7 +27423,7 @@ export interface LabelFormatSettings { */ numberFormat?: ej.PivotGauge.NumberFormat|string; - /** Allows you to change the position of a digit on the right-hand side of the decimal point for label value. + /** Allows you to set the number of digits displayed after decimal point. * @Default {5} */ decimalPlaces?: number; @@ -26062,7 +27439,7 @@ export interface LabelFormatSettings { export interface ServiceMethodSettings { - /** Allows the user to set the custom name for the service method that’s responsible for initializing PivotGauge. + /** Allows the user to set the custom name for the service method responsible for initializing PivotGauge. * @Default {InitializeGauge} */ initialize?: string; @@ -26098,18 +27475,39 @@ class PivotTreeMap extends ej.Widget { static fn: PivotTreeMap; constructor(element: JQuery, options?: PivotTreeMap.Model); constructor(element: Element, options?: PivotTreeMap.Model); + static Locale: any; model:PivotTreeMap.Model; defaults:PivotTreeMap.Model; - /** Perform an asynchronous HTTP (AJAX) request. + /** Performs an asynchronous HTTP (AJAX) request. * @returns {void} */ doAjaxPost(): void; - /** Perform an asynchronous HTTP (FullPost) submit. + /** Returns the OlapReport string maintained along with the axis elements information. * @returns {void} */ - doPostBack(): void; + getOlapReport(): void; + + /** Sets the OlapReport string along with the axis information and maintains it in a property. + * @returns {void} + */ + setOlapReport(): void; + + /** Returns the JSON records formed to render the control. + * @returns {void} + */ + getJSONRecords(): void; + + /** Sets the JSON records to render the control. + * @returns {void} + */ + setJSONRecords(): void; + + /** Renders the control with the pivot engine obtained from OLAP cube. + * @returns {void} + */ + generateJSON(): void; /** This function receives the JSON formatted datasource to render the PivotTreeMap control. * @returns {void} @@ -26130,11 +27528,6 @@ export interface Model { */ cssClass?: string; - /** Contains the serialized Report at that instant, that is, current Report. - * @Default {“”} - */ - currentReport?: string; - /** Initializes the data source for the PivotTreeMap widget, when it functions completely on client-side. * @Default {{}} */ @@ -26145,11 +27538,6 @@ export interface Model { */ customObject?: any; - /** Allows the user to view the layout of PivotTreeMap from right to left. - * @Default {false} - */ - enableRTL?: boolean; - /** Allows the user to enable PivotTreeMap’s responsiveness in the browser layout. * @Default {false} */ @@ -26161,9 +27549,9 @@ export interface Model { locale?: string; /** Sets the mode for the PivotTreeMap widget for binding data source either in server-side or client-side. - * @Default {ej.PivotTreeMap.OperationalMode.ClientMode} + * @Default {ej.Pivot.OperationalMode.ClientMode} */ - operationalMode?: any; + operationalMode?: ej.Pivot.OperationalMode|string; /** Allows the user to set custom name for the methods at service-end, communicated on AJAX post. * @Default {{}} @@ -26181,6 +27569,12 @@ export interface Model { /** Triggers before any AJAX request is passed from PivotTreeMap to service methods. */ beforeServiceInvoke? (e: BeforeServiceInvokeEventArgs): void; + /** Triggers when PivotTreeMap starts to render. */ + load? (e: LoadEventArgs): void; + + /** Triggers before populating the pivot engine from datasource. */ + beforePivotEnginePopulate? (e: BeforePivotEnginePopulateEventArgs): void; + /** Triggers when drill up/down happens in PivotTreeMap control. And it returns the outer HTML of PivotTreeMap control. */ drillSuccess? (e: DrillSuccessEventArgs): void; @@ -26196,144 +27590,118 @@ export interface Model { export interface AfterServiceInvokeEventArgs { - /** return the current action of PivotTreeMap control. + /** returns the current action of PivotTreeMap control. */ action?: string; - /** return the custom object bounds with PivotTreeMap control. + /** returns the custom object bound with PivotTreeMap control. */ customObject?: any; - /** return the outer HTML of PivotTreeMap control. + /** returns the HTML element of PivotTreeMap control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotTreeMap model. - */ - model?: ej.PivotTreeMap.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface BeforeServiceInvokeEventArgs { - /** return the current action of PivotTreeMap control. + /** returns the current action of PivotTreeMap control. */ action?: string; - /** return the custom object bounds with PivotTreeMap control. + /** returns the custom object bound with PivotTreeMap control. */ customObject?: any; - /** return the outer HTML of PivotTreeMap control. + /** returns the HTML element of PivotTreeMap control. */ - element?: string; + element?: any; +} - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; +export interface LoadEventArgs { - /** returns the PivotTreeMap model. + /** returns the current action of PivotTreeMap control. */ - model?: ej.PivotTreeMap.Model; + action?: string; - /** returns the name of the event. + /** returns the custom object bound with PivotTreeMap control. */ - type?: string; + customObject?: any; + + /** returns the HTML element of PivotTreeMap control. + */ + element?: any; +} + +export interface BeforePivotEnginePopulateEventArgs { + + /** returns the current instance of PivotTreeMap control. + */ + treeMapObject?: any; } export interface DrillSuccessEventArgs { + + /** return the HTML element of PivotTreeMap control. + */ + element?: any; } export interface RenderCompleteEventArgs { - /** return the current action of PivotTreeMap control. + /** returns the current action of PivotTreeMap control. */ action?: string; - /** return the custom object bounds with PivotTreeMap control. + /** returns the custom object bound with PivotTreeMap control. */ customObject?: any; - /** return the outer HTML of PivotTreeMap control. + /** returns the HTML element of PivotTreeMap control. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotTreeMap model. - */ - model?: ej.PivotTreeMap.Model; - - /** returns the name of the event. - */ - type?: string; + element?: any; } export interface RenderFailureEventArgs { - /** return the current action of PivotTreeMap control. + /** returns the current action of PivotTreeMap control. */ action?: string; - /** return the custom object bounds with PivotTreeMap control. + /** returns the custom object bound with PivotTreeMap control. */ customObject?: any; - /** return the error stack trace of the original exception. + /** returns the HTML element of PivotTreeMap control. */ - message?: any; + element?: any; - /** return the outer HTML of PivotTreeMap control. + /** returns the error stack trace of the original exception. */ - element?: string; - - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; - - /** returns the PivotTreeMap model. - */ - model?: ej.PivotTreeMap.Model; - - /** returns the name of the event. - */ - type?: string; + message?: string; } export interface RenderSuccessEventArgs { - /** return the current action of PivotTreeMap control. + /** returns the current action of PivotTreeMap control. */ action?: string; - /** return the custom object bounds with PivotTreeMap control. + /** returns the custom object bound with PivotTreeMap control. */ customObject?: any; - /** return the outer HTML of PivotTreeMap control. + /** returns the HTML element of PivotTreeMap control. */ - element?: string; + element?: any; +} - /** if the event should be canceled; otherwise, false. - */ - cancel?: boolean; +export interface DataSourceColumnsFilterItems { - /** returns the PivotTreeMap model. + /** Contains the collection of items to be excluded among the field members. + * @Default {[]} */ - model?: ej.PivotTreeMap.Model; - - /** returns the name of the event. - */ - type?: string; + values?: Array; } export interface DataSourceColumn { @@ -26342,14 +27710,23 @@ export interface DataSourceColumn { */ fieldName?: string; - /** Allows the user to set the display name for an item. - */ - fieldCaption?: string; - - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceColumnsFilterItems; +} + +export interface DataSourceRowsFilterItems { + + /** Contains the collection of items to be excluded among the field members. + * @Default {[]} + */ + values?: Array; } export interface DataSourceRow { @@ -26358,35 +27735,43 @@ export interface DataSourceRow { */ fieldName?: string; - /** Allows the user to set the display name for an item. - */ - fieldCaption?: string; - - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. + /** Allows the user to indicate whether the added item is a named set or not. * @Default {false} */ isNamedSets?: boolean; + + /** Applies filter to the field members. + * @Default {null} + */ + filterItems?: DataSourceRowsFilterItems; +} + +export interface DataSourceValuesMeasure { + + /** Allows the user to bind the measure from OLAP datasource by using its unique name as field name. + */ + fieldName?: string; } export interface DataSourceValue { - /** This holds the measures unique name to bind them from the Cube. + /** This holds the list of unique names of measures to bind them from the OLAP cube. * @Default {[]} */ - measures?: Array; + measures?: Array; /** Allows to set the axis name to place the measures items. - * @Default {“”} + * @Default {rows} */ axis?: string; +} - /** Allows the user to bind the item by using its unique name as field name. - */ - fieldName?: string; +export interface DataSourceFiltersFilterItems { - /** Allows the user to set the display name for an item. + /** Contains the collection of items to be excluded among the field members. + * @Default {[]} */ - fieldCaption?: string; + values?: Array; } export interface DataSourceFilter { @@ -26395,49 +27780,45 @@ export interface DataSourceFilter { */ fieldName?: string; - /** Allows the user to set the display name for an item. + /** Applies filter to the field members. + * @Default {null} */ - fieldCaption?: string; - - /** Allows the user to enable the usage of named set items in respective axis. This is only applicable for OLAP datasource. - * @Default {false} - */ - isNamedSets?: boolean; + filterItems?: DataSourceFiltersFilterItems; } export interface DataSource { - /** Contains the database name as string type to fetch the data from the given connection string. - * @Default {“”} - */ - catalog?: string; - - /** Lists out the items to be arranged in column section of PivotTreeMap. - * @Default {[]} - */ - columns?: Array; - - /** Contains the respective Cube name from database as string type. - * @Default {“”} - */ - cube?: string; - /** Provides the raw data source for the PivotTreeMap. * @Default {null} */ data?: any; - /** Lists out the items to be arranged in row section of PivotTreeMap. + /** Contains the respective cube name from OLAP database as string type. + * @Default {“”} + */ + cube?: string; + + /** In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string. + * @Default {“”} + */ + catalog?: string; + + /** Lists out the items to be displayed as series of PivotTreeMap. + * @Default {[]} + */ + columns?: Array; + + /** Lists out the items to be displayed as segments of PivotTreeMap. * @Default {[]} */ rows?: Array; - /** Lists out the items which supports calculation in PivotTreeMap. + /** Lists out the items supports calculation in PivotTreeMap. * @Default {[]} */ values?: Array; - /** Lists out the items which supports filtering of values in PivotTreeMap. + /** Lists out the items which supports filtering of values without displaying the members in UI in PivotTreeMap. * @Default {[]} */ filters?: Array; @@ -26445,12 +27826,12 @@ export interface DataSource { export interface ServiceMethodSettings { - /** Allows the user to set the custom name for the service method that’s responsible for initializing PivotTreeMap. + /** Allows the user to set the custom name for the service method responsible for initializing PivotTreeMap. * @Default {InitializeTreemap} */ initialize?: string; - /** Allows the user to set the custom name for the service method that’s responsible for drilling up/down operation in PivotTreeMap. + /** Allows the user to set the custom name for the service method responsible for drilling up/down operation in PivotTreeMap. * @Default {DrillTreeMap} */ drillDown?: string; @@ -26461,6 +27842,7 @@ class Schedule extends ej.Widget { static fn: Schedule; constructor(element: JQuery, options?: Schedule.Model); constructor(element: Element, options?: Schedule.Model); + static Locale: any; model:Schedule.Model; defaults:Schedule.Model; @@ -26540,6 +27922,11 @@ class Schedule extends ej.Widget { * @returns {void} */ refreshAppointments(): void; + + /** Passes the server-side action and data to the client-side for rendering the modified appointment list on the Schedule control. + * @returns {void} + */ + notifyChanges(): void; } export module Schedule{ @@ -27553,7 +28940,7 @@ export interface ResizeStopEventArgs { export interface OverflowButtonClickEventArgs { - /** Returns the object consisting of start time, end time and resource value of the underlying cell on which the clicked overflow button is present. + /** Returns the object consisting of start time, end time and resource value of the underlying cell on which the clicked overflow button is present. */ object?: any; @@ -27576,7 +28963,7 @@ export interface OverflowButtonClickEventArgs { export interface OverflowButtonHoverEventArgs { - /** Returns the object consisting of start time, end time and resource value of the underlying cell on which the overflow button is currently hovered. + /** Returns the object consisting of start time, end time and resource value of the underlying cell on which the overflow button is currently hovered. */ object?: any; @@ -28176,6 +29563,7 @@ class RecurrenceEditor extends ej.Widget { static fn: RecurrenceEditor; constructor(element: JQuery, options?: RecurrenceEditor.Model); constructor(element: Element, options?: RecurrenceEditor.Model); + static Locale: any; model:RecurrenceEditor.Model; defaults:RecurrenceEditor.Model; @@ -28283,6 +29671,7 @@ class Gantt extends ej.Widget { static fn: Gantt; constructor(element: JQuery, options?: Gantt.Model); constructor(element: Element, options?: Gantt.Model); + static Locale: any; model:Gantt.Model; defaults:Gantt.Model; @@ -28301,10 +29690,10 @@ class Gantt extends ej.Widget { selectCells(Indexes: Array, preservePreviousSelectedCell: boolean): void; /** Positions the splitter by the specified column index. - * @param {number} Set the splitter position based on column index. + * @param {Number} Set the splitter position based on column index. * @returns {void} */ - setSplitterIndex(index: number): void; + setSplitterIndex(index: Number): void; /** To cancel the edited state of an item in Gantt * @returns {void} @@ -28332,10 +29721,10 @@ class Gantt extends ej.Widget { expandAllItems(): void; /** To expand and collapse an item in Gantt using item's ID - * @param {number} Expand or Collapse a record based on task id. + * @param {Number} Expand or Collapse a record based on task id. * @returns {void} */ - expandCollapseRecord(taskId: number): void; + expandCollapseRecord(taskId: Number): void; /** To hide the column by using header text * @param {string} you can pass a header text of a column to hide @@ -28415,6 +29804,11 @@ export interface Model { */ allowMultiSorting?: boolean; + /** Enables or disables the option for multiple exporting + * @Default {false} + */ + allowMultipleExporting?: boolean; + /** Enables or disables the interactive selection of a row. * @Default {true} */ @@ -28619,6 +30013,21 @@ export interface Model { */ parentTaskbarTemplate?: string; + /** Specifies the nature of a task for caluculating the work, and it can fixed duration, fixed work and fixed resource unit + * @Default {ej.Gantt.TaskType.FixedUnit} + */ + taskType?: ej.Gantt.TaskType|string; + + /** Specifies the unit for the work involved in a task and it can be day, hour or minute + * @Default {ej.Gantt.WorkUnit.Hour} + */ + workUnit?: ej.Gantt.WorkUnit|string; + + /** Specifies the task scheduling mode for a project and this will be set to all the tasks available in the project + * @Default {ej.Gantt.TaskSchedulingMode.Auto} + */ + taskSchedulingMode?: ej.Gantt.TaskSchedulingMode|string; + /** Specifies the row selection type. * @Default {ej.Gantt.SelectionType.Single} */ @@ -28628,6 +30037,23 @@ export interface Model { */ parentProgressbarBackground?: string; + /** Specifies the mapping property path for resource's percent effort involved in a task in datasource + */ + resourceUnitMapping?: string; + + /** Specifies the mapping property path for the task description in datasource + */ + notesMapping?: string; + + /** Specifies the mapping property path for the task scheuling mode for a task in datasource + * @Default {auto} + */ + taskSchedulingModeMapping?: string; + + /** Specifies the mapping property path for task duration unit in datasoruce + */ + durationUnitMapping?: string; + /** Specifies the background of parent taskbar in Gantt */ parentTaskbarBackground?: string; @@ -28673,6 +30099,11 @@ export interface Model { */ renderBaseline?: boolean; + /** Enables or disables the schedule date validation while connecting a manually scheduled task with predecessor + * @Default {false} + */ + validateManaulTasksOnLinking?: boolean; + /** Specifies the mapping property name for resource ID in resource Collection in Gantt */ resourceIdMapping?: string; @@ -28909,6 +30340,9 @@ export interface Model { /** Triggered while editing the Gantt chart (dragging, resizing the taskbar ) */ taskbarEditing? (e: TaskbarEditingEventArgs): void; + /** Triggered when taskbar item is clicked in Gantt. */ + taskbarClick? (e: TaskbarClickEventArgs): void; + /** Triggered when toolbar item is clicked in Gantt. */ toolbarClick? (e: ToolbarClickEventArgs): void; } @@ -29205,7 +30639,7 @@ export interface CollapsedEventArgs { /** Returns the row index of collapsed record. */ - recordIndex?: number; + recordIndex?: Number; /** Returns the data of collapsed record. */ @@ -29228,7 +30662,7 @@ export interface CollapsingEventArgs { /** Returns the row index of collapsing record. */ - recordIndex?: number; + recordIndex?: Number; /** Returns the data of edited cell record.. */ @@ -29546,6 +30980,33 @@ export interface TaskbarEditingEventArgs { type?: string; } +export interface TaskbarClickEventArgs { + + /** Returns currently clicked row data + */ + data?: any; + + /** Returns the current item index. + */ + index?: number; + + /** Returns the Gantt model. + */ + model?: any; + + /** Returns the clicked row element + */ + taskbarElement?: any; + + /** Returns the target element. + */ + target?: any; + + /** Returns the name of the event. + */ + type?: string; +} + export interface ToolbarClickEventArgs { /** Returns the cancel option value. @@ -29753,6 +31214,45 @@ enum BeginEditAction{ } +enum TaskType{ + + ///Resource unit reamins constant while editing the work and duration values. + FixedUnit, + + ///Work value of a task remains constant while editing duration and resoruce unit values. + FixedWork, + + ///Duration value remains constant while editing work and resoruce unit values. + FixedDuration +} + + +enum WorkUnit{ + + ///Dislays the work involved in a task in days. + Day, + + ///Dislays the work involved in a task in hours. + Hour, + + ///Dislays the work involved in a task in minutes + Minute +} + + +enum TaskSchedulingMode{ + + ///All the tasks in the project will be displayed in auto scheduled mode, where the tasks are scheduled automatically over non-working days and holidays. + Auto, + + ///All the tasks in the project will be displayed in manually scheduled mode. + Manual, + + ///Project consists of tasks with both auto and manually scheduled modes, based on the datasource values + Custom +} + + enum SelectionType{ ///you can select a single row. @@ -29842,6 +31342,7 @@ class ReportViewer extends ej.Widget { static fn: ReportViewer; constructor(element: JQuery, options?: ReportViewer.Model); constructor(element: Element, options?: ReportViewer.Model); + static Locale: any; model:ReportViewer.Model; defaults:ReportViewer.Model; @@ -29927,7 +31428,7 @@ export interface Model { /** Enables or disables the page cache of report. * @Default {false} */ - enablePageCache?: boolean; + enablePageCache?: Boolean; /** Specifies the export settings. */ @@ -29936,12 +31437,12 @@ export interface Model { /** When set to true, adapts the report layout to fit the screen size of devices on which it renders. * @Default {true} */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Specifies the locale for report viewer. * @Default {en-US} */ - locale?: string; + locale?: String; /** Specifies the page settings. */ @@ -29955,7 +31456,7 @@ export interface Model { /** Enables and disables the print mode. * @Default {false} */ - printMode?: boolean; + printMode?: Boolean; /** Specifies the print option of the report. * @Default {ej.ReportViewer.PrintOptions.Default} @@ -29975,17 +31476,17 @@ export interface Model { /** Gets or sets the path of the report file. * @Default {empty} */ - reportPath?: string; + reportPath?: String; /** Gets or sets the reports server URL. * @Default {empty} */ - reportServerUrl?: string; + reportServerUrl?: String; /** Specifies the report Web API service URL. * @Default {empty} */ - reportServiceUrl?: string; + reportServiceUrl?: String; /** Specifies the toolbar settings. */ @@ -29994,7 +31495,7 @@ export interface Model { /** Gets or sets the zoom factor for report viewer. * @Default {1} */ - zoomFactor?: number; + zoomFactor?: Number; /** Fires when the report viewer is destroyed successfully.If you want to perform any operation after destroying the reportviewer control,you can make use of the destroy event. */ destroy? (e: DestroyEventArgs): void; @@ -30162,7 +31663,7 @@ export interface DataSource { /** Gets or sets the name of the data source. * @Default {empty} */ - name?: string; + name?: String; /** Gets or sets the values of data source. * @Default {[]} @@ -30211,17 +31712,17 @@ export interface Parameter { /** Gets or sets the name of the parameter. * @Default {empty} */ - name?: string; + name?: String; /** Gets or sets whether the parameter allows nullable value or not. * @Default {false} */ - nullable?: boolean; + nullable?: Boolean; /** Gets or sets the prompt message associated with the specified parameter. * @Default {empty} */ - prompt?: string; + prompt?: String; /** Gets or sets the parameter values. * @Default {[]} @@ -30234,7 +31735,7 @@ export interface ToolbarSettings { /** Fires when user click on toolbar item in the toolbar. * @Default {empty} */ - click?: string; + click?: String; /** Specifies the toolbar items. * @Default {ej.ReportViewer.ToolbarItems.All} @@ -30244,17 +31745,17 @@ export interface ToolbarSettings { /** Shows or hides the toolbar. * @Default {true} */ - showToolbar?: boolean; + showToolbar?: Boolean; /** Shows or hides the tooltip of toolbar items. * @Default {true} */ - showTooltip?: boolean; + showTooltip?: Boolean; /** Specifies the toolbar template ID. * @Default {empty} */ - templateId?: string; + templateId?: String; } enum ExportOptions{ @@ -30478,6 +31979,7 @@ class TreeGrid extends ej.Widget { static fn: TreeGrid; constructor(element: JQuery, options?: TreeGrid.Model); constructor(element: Element, options?: TreeGrid.Model); + static Locale: any; model:TreeGrid.Model; defaults:TreeGrid.Model; @@ -30503,7 +32005,7 @@ class TreeGrid extends ej.Widget { /** To rename a column with the specified name * @param {number} Index of the column to be renamed - * @param {string} Header text of the column + * @param {string} Header text of the column * @returns {void} */ renameColumn(columnIndex: number, name: string): void; @@ -30580,6 +32082,13 @@ class TreeGrid extends ej.Widget { * @returns {void} */ sortColumn(columnName: string, columnSortDirection: string): void; + + /** To reorder the column with field name and target index values + * @param {string} you can pass a name of column to reorder. + * @param {string} you can pass a target column index to be inserted. + * @returns {void} + */ + reorderColumn(fieldName: string, targetIndex: string): void; } export module TreeGrid{ @@ -30590,6 +32099,11 @@ export interface Model { */ allowColumnResize?: boolean; + /** Enables or disables the option for column reordering + * @Default {false} + */ + allowColumnReordering?: boolean; + /** Enables or disables the ability to drag and drop the row interactively to reorder the rows. * @Default {false} */ @@ -30688,6 +32202,10 @@ export interface Model { */ enableVirtualization?: boolean; + /** Specifies the settings for column resize + */ + columnResizeSettings?: ColumnResizeSettings; + /** Options for filtering and customizing filter actions. */ filterSettings?: FilterSettings; @@ -30706,7 +32224,7 @@ export interface Model { */ isResponsive?: boolean; - /** Specifies the name of the field in the dataSource, which contains the parent’s id. This is necessary to form a parent-child hierarchy, if the dataSource contains self-referential data. + /** Specifies the name of the field in the dataSource, which contains the parent's id. This is necessary to form a parent-child hierarchy, if the dataSource contains self-referential data. */ parentIdMapping?: string; @@ -30738,22 +32256,16 @@ export interface Model { */ selectedRowIndex?: number; - /** Specifies the type of selection whether to select row or cell. - * @Default {ej.TreeGrid.SelectionMode.Row} + /** Specifies the settings for row and cell selection. */ - selectionMode?: ej.TreeGrid.SelectionMode|string; - - /** Specifies the type of selection whether to select single row or multiple rows. - * @Default {ej.TreeGrid.SelectionType.Single} - */ - selectionType?: ej.TreeGrid.SelectionType|string; + selectionSettings?: SelectionSettings; /** Enables/disables the options for inserting , deleting and renaming columns. * @Default {false} */ showColumnOptions?: boolean; - /** Controls the visibility of the menu button, which is displayed on the column header. Clicking on this button will show a popup menu. When you choose “Columns” item from this popup, a list box with column names will be shown, from which you can select/deselect a column name to control the visibility of the respective columns. + /** Controls the visibility of the menu button, which is displayed on the column header. Clicking on this button will show a popup menu. When you choose Columns item from this popup, a list box with column names will be shown, from which you can select/deselect a column name to control the visibility of the respective columns. * @Default {false} */ showColumnChooser?: boolean; @@ -30834,6 +32346,15 @@ export interface Model { /** Triggered while collapsing the TreeGrid record */ collapsing? (e: CollapsingEventArgs): void; + /** Triggered when you start to drag a column */ + columnDragStart? (e: ColumnDragStartEventArgs): void; + + /** Triggered while dragging a column */ + columnDrag? (e: ColumnDragEventArgs): void; + + /** Triggered when a column is dropped */ + columnDrop? (e: ColumnDropEventArgs): void; + /** Triggered after a column resized */ columnResized? (e: ColumnResizedEventArgs): void; @@ -31039,6 +32560,95 @@ export interface CollapsingEventArgs { expanded?: boolean; } +export interface ColumnDragStartEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the control model values. + */ + model?: any; + + /** Returns the event Type. + */ + type?: string; + + /** Returns the column data which is dragged + */ + draggedColumn?: any; + + /** Returns the index of the column being dragged + */ + draggedColumnIndex?: number; +} + +export interface ColumnDragEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the control model values. + */ + model?: any; + + /** Returns the event Type. + */ + type?: string; + + /** Returns the column data which is dragged + */ + draggedColumn?: any; + + /** Returns the index of the column being dragged + */ + draggedColumnIndex?: number; + + /** Returns the target column data + */ + targetColumn?: any; + + /** Returns the index of the target column + */ + targetColumnIndex?: number; + + /** Returns that we can drop over the column or not. + */ + canDrop?: boolean; +} + +export interface ColumnDropEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the control model values. + */ + model?: any; + + /** Returns the event Type. + */ + type?: string; + + /** Returns the column data which is dragged + */ + draggedColumn?: any; + + /** Returns the index of the column being dragged + */ + draggedColumnIndex?: number; + + /** Returns the target column data + */ + targetColumn?: any; + + /** Returns the index of the target column + */ + targetColumnIndex?: number; +} + export interface ColumnResizedEventArgs { /** Returns the cancel option value. @@ -31604,6 +33214,11 @@ export interface Column { */ headerText?: string; + /** Enables or disables the checkbox visibility in a column to make it as a checkbox column + * @Default {false} + */ + showCheckbox?: boolean; + /** Controls the visibility of the column. * @Default {true} */ @@ -31611,7 +33226,7 @@ export interface Column { /** Specifies the header template value for the column header */ - headerTemplateID?: string; + headerTemplateID?: String; /** Specifies the display format of a column * @Default {null} @@ -31640,7 +33255,7 @@ export interface Column { /** Specifies the template for the TreeGrid column */ - templateID?: string; + templateID?: String; /** Enables or disables the ability to edit a row or cell. * @Default {false} @@ -31717,6 +33332,14 @@ export interface EditSettings { rowPosition?: ej.TreeGrid.RowPosition|string; } +export interface ColumnResizeSettings { + + /** Specifies the mode for column resizing + * @Default {normal} + */ + columnResizeMode?: string; +} + export interface FilterSettings { /** Specifies the mode on which column filtering should start @@ -31724,6 +33347,11 @@ export interface FilterSettings { */ filterBarMode?: string; + /** Specifies the type of column filtering. + * @Default {filterbar} + */ + filterType?: string; + /** Specifies the column collection for filtering the TreeGrid content on initial load * @Default {[]} */ @@ -31763,6 +33391,29 @@ export interface PageSettings { template?: string; } +export interface SelectionSettings { + + /** Specifies the type of selection whether to select row or cell. + * @Default {ej.TreeGrid.SelectionMode.Row} + */ + selectionMode?: ej.TreeGrid.SelectionMode|string; + + /** Specifies the type of selection whether single, multiple or checkbox. + * @Default {ej.TreeGrid.SelectionType.Single} + */ + selectionType?: ej.TreeGrid.SelectionType|string; + + /** Enables or disables the selection by hierarchy in check box selection + * @Default {true} + */ + enableHierarchySelection?: boolean; + + /** Toggles the visibility of the checkbox in column header, using which all the check boxes can be selected or unselected. + * @Default {true} + */ + enableSelectAll?: boolean; +} + export interface SizeSettings { /** Height of the TreeGrid. @@ -31887,7 +33538,10 @@ enum SelectionType{ Single, ///you can select a multiple row. - Multiple + Multiple, + + ///you can select rows using checkbox. + Checkbox } } @@ -31896,6 +33550,7 @@ class GroupButton extends ej.Widget { static fn: GroupButton; constructor(element: JQuery, options?: GroupButton.Model); constructor(element: Element, options?: GroupButton.Model); + static Locale: any; model:GroupButton.Model; defaults:GroupButton.Model; @@ -31956,14 +33611,14 @@ class GroupButton extends ej.Widget { hideItem(element: JQuery): void; /** Returns the disabled state of the specified element button element in GroupButton as Boolean. - * @returns {boolean} + * @returns {Boolean} */ - isDisabled(): boolean; + isDisabled(): Boolean; /** Returns the state of the specified button element as Boolean. - * @returns {boolean} + * @returns {Boolean} */ - isSelected(): boolean; + isSelected(): Boolean; /** Public method used to select the specified button element from the ejGroupButton control. * @param {JQuery} Specific button element @@ -32217,11 +33872,11 @@ export interface SelectEventArgs { status?: boolean; } } -enum GroupButtonMode +enum GroupButtonMode { -//Sets the GroupButton to work as checkbox mode +//Sets the GroupButton to work as checkbox mode CheckBox, -//Sets the RadioButton to work as radio button mode +//Sets the RadioButton to work as radio button mode RadioButton, } @@ -32229,6 +33884,7 @@ class NavigationDrawer extends ej.Widget { static fn: NavigationDrawer; constructor(element: JQuery, options?: NavigationDrawer.Model); constructor(element: Element, options?: NavigationDrawer.Model); + static Locale: any; model:NavigationDrawer.Model; defaults:NavigationDrawer.Model; @@ -32298,6 +33954,11 @@ export interface Model { */ width?: number; + /** Navigation pane opened initially when isPaneOpen property is true. + * @Default {false} + */ + isPaneOpen?: boolean; + /** Event triggers before the control gets closed. */ beforeClose? (e: BeforeCloseEventArgs): void; @@ -32358,6 +34019,7 @@ class RadialMenu extends ej.Widget { static fn: RadialMenu; constructor(element: JQuery, options?: RadialMenu.Model); constructor(element: Element, options?: RadialMenu.Model); + static Locale: any; model:RadialMenu.Model; defaults:RadialMenu.Model; @@ -32382,59 +34044,71 @@ class RadialMenu extends ej.Widget { showMenu(): void; /** To enable menu item using index + * @param {number} Index of the Radialmenu to be enabled. * @returns {void} */ - enableItemByIndex(): void; + enableItemByIndex(itemIndex: number): void; /** To enable menu items using indices + * @param {Array} Index of the Radialmenu to be enabled. * @returns {void} */ - enableItemsByIndices(): void; + enableItemsByIndices(itemIndices: Array): void; /** To disable menu item using index + * @param {number} Index of the Radialmenu to be disabled. * @returns {void} */ - disableItemByIndex(): void; + disableItemByIndex(itemIndex: number): void; /** To disable menu items using indices + * @param {Array} items of the Radialmenu to disable. * @returns {void} */ - disableItemsByIndices(): void; + disableItemsByIndices(itemIndices: Array): void; /** To enable menu item using item text + * @param {String} item of the Radialmenu item to enable. * @returns {void} */ - enableItem(): void; + enableItem(item: String): void; /** To disable menu item using item text + * @param {String} item of the Radialmenu item to disable. * @returns {void} */ - disableItem(): void; + disableItem(item: String): void; /** To enable menu items using item texts + * @param {Array} items of the Radialmenu item to enable. * @returns {void} */ - enableItems(): void; + enableItems(items: Array): void; /** To disable menu items using item texts + * @param {Array} items of the Radialmenu item to disable. * @returns {void} */ - disableItems(): void; + disableItems(items: Array): void; /** To update menu item badge value + * @param {number} The index value to add the given items at the specified index. If index is not specified, the given value will not be updated. + * @param {number} The Value to be updated in the badge. It will be updated based on the given index * @returns {void} */ - updateBadgeValue(): void; + updateBadgeValue(index: number, value: number): void; /** To show menu item badge + * @param {number} Index of the Radialmenu item to be shown badge. * @returns {void} */ - showBadge(): void; + showBadge(index: number): void; /** To hide menu item badge + * @param {number} Index of the Radialmenu item to hide the badge. * @returns {void} */ - hideBadge(): void; + hideBadge(index: number): void; } export module RadialMenu{ @@ -32506,7 +34180,7 @@ export interface ClickEventArgs { /** returns the name of item */ - itemName?: string; + itemName?: String; } export interface OpenEventArgs { @@ -32605,6 +34279,7 @@ class Tile extends ej.Widget { static fn: Tile; constructor(element: JQuery, options?: Tile.Model); constructor(element: Element, options?: Tile.Model); + static Locale: any; model:Tile.Model; defaults:Tile.Model; @@ -32715,7 +34390,7 @@ export interface MouseDownEventArgs { */ text?: string; - /** returns the index of current tile item + /** returns the index of current tile item */ index?: number; } @@ -32738,7 +34413,7 @@ export interface MouseUpEventArgs { */ text?: boolean; - /** returns the index of current tile item + /** returns the index of current tile item */ index?: number; } @@ -32945,10 +34620,227 @@ enum TileSize{ } +class Signature extends ej.Widget { + static fn: Signature; + constructor(element: JQuery, options?: Signature.Model); + constructor(element: Element, options?: Signature.Model); + static Locale: any; + model:Signature.Model; + defaults:Signature.Model; + + /** Clears the strokes in the signature. + * @returns {void} + */ + clear(): void; + + /** Destroys the signature widget. + * @returns {void} + */ + destroy(): void; + + /** Disables the signature widget. + * @returns {void} + */ + disable(): void; + + /** Enables the signature widget. + * @returns {void} + */ + enable(): void; + + /** Hides the signature widget. + * @returns {void} + */ + hide(): void; + + /** redo the last drawn stroke of the signature + * @returns {void} + */ + redo(): void; + + /** used to save the drawn image. + * @returns {void} + */ + save(): void; + + /** Used to Show the signature widget, if it is already hided. + * @returns {void} + */ + show(): void; + + /** undo the last drawn stroke of the signature. + * @returns {void} + */ + undo(): void; +} +export module Signature{ + +export interface Model { + + /** This property is used to set the background color for the signature. + * @Default {#ffffff} + */ + backgroundColor?: string; + + /** This property is used to set the background image for the signature. + */ + backgroundImage?: string; + + /** Enables or disables the Signature textbox widget. + * @Default {true} + */ + enabled?: Boolean; + + /** Sets the height of the Signature control. + * @Default {100%} + */ + height?: string; + + /** Enables/disables responsive support for the signature control (i.e) maintain the signature drawing during the window resizing time. + * @Default {false} + */ + isResponsive?: Boolean; + + /** Allows the type of the image format to be saved when the signature image is saved. + */ + saveImageFormat?: ej.Signature.SaveImageFormat|string; + + /** Allows the signature image to be saved along with its background. + * @Default {false} + */ + saveWithBackground?: Boolean; + + /** Enables or disables rounded corner. + * @Default {true} + */ + showRoundedCorner?: Boolean; + + /** Sets the stroke color for the stroke of the signature. + * @Default {#000000} + */ + strokeColor?: string; + + /** Sets the stroke width for the stroke of the signature. + * @Default {2} + */ + strokeWidth?: Number; + + /** Sets the width of the Signature control. + * @Default {100%} + */ + width?: string; + + /** Triggers when the stroke is changed. */ + change? (e: ChangeEventArgs): void; + + /** Triggered when the pointer is clicked or touched in the signature canvas. */ + mouseDown? (e: MouseDownEventArgs): void; + + /** Triggered when the pointer is moved in the signature canvas. */ + mouseMove? (e: MouseMoveEventArgs): void; + + /** Triggered when the pointer is released after click or touch in the signature canvas. */ + mouseUp? (e: MouseUpEventArgs): void; +} + +export interface ChangeEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: Boolean; + + /** Instance of the signature model object. + */ + model?: any; + + /** Name of the event. + */ + type?: String; + + /** Gives the last stored image + */ + lastImage?: String; +} + +export interface MouseDownEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: Boolean; + + /** Instance of the signature model object. + */ + model?: any; + + /** Name of the event. + */ + type?: String; + + /** returns all the event values + */ + value?: any; +} + +export interface MouseMoveEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: Boolean; + + /** Instance of the signature model object. + */ + model?: any; + + /** Name of the event. + */ + type?: String; + + /** returns all the event values + */ + value?: any; +} + +export interface MouseUpEventArgs { + + /** Set this option to true to cancel the event. + */ + cancel?: Boolean; + + /** Instance of the signature model object. + */ + model?: any; + + /** Name of the event. + */ + type?: String; + + /** returns all the event values + */ + value?: any; +} + +enum SaveImageFormat{ + + ///To save the signature image with PNG format only. + PNG, + + ///To save the signature image with JPG format only. + JPG, + + ///To save the signature image with BMP format only. + BMP, + + ///To save the signature image with TIFF format only. + TIFF +} + +} + class RadialSlider extends ej.Widget { static fn: RadialSlider; constructor(element: JQuery, options?: RadialSlider.Model); constructor(element: Element, options?: RadialSlider.Model); + static Locale: any; model:RadialSlider.Model; defaults:RadialSlider.Model; @@ -32969,66 +34861,66 @@ export interface Model { /** To show the RadialSlider in initial render. * @Default {false} */ - autoOpen?: boolean; + autoOpen?: Boolean; /** Sets the root class for RadialSlider theme. This cssClass API helps to use custom skinning option for RadialSlider control. By defining the root class using this API, we need to include this root class in CSS. */ - cssClass?: string; + cssClass?: String; /** To enable Animation for Radial Slider. * @Default {true} */ - enableAnimation?: boolean; + enableAnimation?: Boolean; /** Enable/Disable the Roundoff property of RadialSlider * @Default {true} */ - enableRoundOff?: boolean; + enableRoundOff?: Boolean; /** Specifies the endAngle value for radial slider circle. * @Default {360} */ - endAngle?: number; + endAngle?: Number; /** Specifies the inline for label show or not on given radius. * @Default {false} */ - inline?: boolean; + inline?: Boolean; /** Specifies innerCircleImageClass, using this property we can give images for center radial circle through CSS classes. * @Default {null} */ - innerCircleImageClass?: string; + innerCircleImageClass?: String; /** Specifies the file name of center circle icon * @Default {null} */ - innerCircleImageUrl?: string; + innerCircleImageUrl?: String; /** Specifies the Space between the radial slider element and the label. * @Default {30} */ - labelSpace?: number; + labelSpace?: Number; /** Specifies the radius of radial slider * @Default {200} */ - radius?: number; + radius?: Number; /** To show the RadialSlider inner circle. * @Default {true} */ - showInnerCircle?: boolean; + showInnerCircle?: Boolean; /** Specifies the endAngle value for radial slider circle. * @Default {0} */ - startAngle?: number; + startAngle?: Number; /** Specifies the strokeWidth for customize the needle, outer circle and inner circle. * @Default {2} */ - strokeWidth?: number; + strokeWidth?: Number; /** Specifies the ticks value of radial slider */ @@ -33037,7 +34929,7 @@ export interface Model { /** Specifies the value of radial slider * @Default {10} */ - value?: number; + value?: Number; /** Event triggers when the change occurs. */ change? (e: ChangeEventArgs): void; @@ -33060,30 +34952,30 @@ export interface Model { export interface ChangeEventArgs { - /** returns the Radialslider model + /** returns the Radialslider model */ model?: any; - /** if the event should be canceled; otherwise, false. + /** if the event should be canceled; otherwise, false. */ cancel?: boolean; - /** returns the initial value of Radial slider + /** returns the initial value of Radial slider */ - oldValue?: number; + oldValue?: Number; - /** returns the name of the event + /** returns the name of the event */ type?: string; - /** returns the current value of the Radial slider + /** returns the current value of the Radial slider */ - value?: number; + value?: Number; } export interface CreateEventArgs { - /** if the event should be canceled; otherwise, false. + /** if the event should be canceled; otherwise, false. */ cancel?: boolean; @@ -33091,93 +34983,93 @@ export interface CreateEventArgs { */ model?: any; - /** returns the name of the event + /** returns the name of the event */ type?: string; } export interface MouseoverEventArgs { - /** if the event should be canceled; otherwise, false. + /** if the event should be canceled; otherwise, false. */ cancel?: boolean; - /** returns the Radialslider model + /** returns the Radialslider model */ model?: any; - /** returns the value selected + /** returns the value selected */ - selectedValue?: number; + selectedValue?: Number; - /** returns the name of the event + /** returns the name of the event */ type?: string; - /** returns the current value selected in Radial slider + /** returns the current value selected in Radial slider */ - value?: number; + value?: Number; } export interface SlideEventArgs { - /** if the event should be canceled; otherwise, false. + /** if the event should be canceled; otherwise, false. */ cancel?: boolean; - /** returns the Radialslider model + /** returns the Radialslider model */ model?: any; - /** returns the value selected in Radial slider + /** returns the value selected in Radial slider */ - selectedValue?: number; + selectedValue?: Number; - /** returns the name of the event + /** returns the name of the event */ type?: string; - /** returns the currently selected value + /** returns the currently selected value */ - value?: number; + value?: Number; } export interface StartEventArgs { - /** if the event should be canceled; otherwise, false. + /** if the event should be canceled; otherwise, false. */ cancel?: boolean; - /** returns the Radialslider model + /** returns the Radialslider model */ model?: any; - /** returns the name of the event + /** returns the name of the event */ type?: string; - /** returns the current value selected in Radial slider + /** returns the current value selected in Radial slider */ - value?: number; + value?: Number; } export interface StopEventArgs { - /** if the event should be canceled; otherwise, false. + /** if the event should be canceled; otherwise, false. */ cancel?: boolean; - /** returns the Radialslider model + /** returns the Radialslider model */ model?: any; - /** returns the name of the event + /** returns the name of the event */ type?: string; - /** returns the current value selected in Radial slider + /** returns the current value selected in Radial slider */ - value?: number; + value?: Number; } } @@ -33185,15 +35077,16 @@ class Spreadsheet extends ej.Widget { static fn: Spreadsheet; constructor(element: JQuery, options?: Spreadsheet.Model); constructor(element: Element, options?: Spreadsheet.Model); + static Locale: any; model:Spreadsheet.Model; defaults:Spreadsheet.Model; /** This method is used to add custom formulas in Spreadsheet. - * @param {string} Pass the name of the formula. - * @param {string} Pass the name of the function. + * @param {String} Pass the name of the formula. + * @param {String} Pass the name of the function. * @returns {void} */ - addCustomFormula(formulaName: string, functionName: string): void; + addCustomFormula(formulaName: String, functionName: String): void; /** This method is used to add a new sheet in the last position of the sheet container. * @returns {void} @@ -33201,13 +35094,13 @@ class Spreadsheet extends ej.Widget { addNewSheet(): void; /** It is used to clear all the data and format in the specified range of cells in Spreadsheet. - * @param {string} Optional. If range is specified, then it will clear all content in the specified range else it will use the current selected range. + * @param {string} Optional. If range is specified, then it will clear all content in the specified range else it will use the current selected range. * @returns {void} */ clearAll(range?: string): void; /** This property is used to clear all the formats applied in the specified range in Spreadsheet. - * @param {string} Optional. If range is specified, then it will clear all format in the specified range else it will use the current selected range. + * @param {string} Optional. If range is specified, then it will clear all format in the specified range else it will use the current selected range. * @returns {void} */ clearAllFormat(range?: string): void; @@ -33219,7 +35112,7 @@ class Spreadsheet extends ej.Widget { clearBorder(range?: string): void; /** This property is used to clear the contents in the specified range in Spreadsheet. - * @param {string} Optional. If the range is specified, then it will clear the content in the specified range else it will use the current selected range. + * @param {string} Optional. If the range is specified, then it will clear the content in the specified range else it will use the current selected range. * @returns {void} */ clearContents(range?: string): void; @@ -33231,10 +35124,10 @@ class Spreadsheet extends ej.Widget { clearRange(rangeName: string): void; /** It is used to remove data in the specified range of cells based on the defined property. - * @param {Array|string} Optional. If range is specified, it will clear data for the specified range else it will use the current selected range. - * @param {string} Optional. If property is specified, it will remove the specified property in the range else it will remove default properties - * @param {any} Optional. - * @param {boolean} Optional. If pass true, if you want to skip the hidden rows + * @param {Array|string} Optional. If range is specified, it will clear data for the specified range else it will use the current selected range. + * @param {string} Optional. If property is specified, it will remove the specified property in the range else it will remove default properties + * @param {any} Optional. + * @param {boolean} Optional. If pass true, if you want to skip the hidden rows * @param {any} Optional. Pass the status to perform undo and redo operation. * @param {any} Optional. It specifies whether to skip element processing or not. * @returns {void} @@ -33308,9 +35201,9 @@ class Spreadsheet extends ej.Widget { getActiveCellElem(sheetIdx?: number): HTMLElement; /** This method is used to get the current active sheet index in Spreadsheet. - * @returns {number} + * @returns {Number} */ - getActiveSheetIndex(): number; + getActiveSheetIndex(): Number; /** This method is used to get the auto fill element in Spreadsheet. * @returns {HTMLElement} @@ -33327,21 +35220,21 @@ class Spreadsheet extends ej.Widget { /** This method is used to get the data settings in the Spreadsheet. * @param {number} Pass the sheet index. - * @returns {number} + * @returns {Number} */ - getDataSettings(sheetIdx: number): number; + getDataSettings(sheetIdx: number): Number; /** This method is used to get the frozen columns index in the Spreadsheet. * @param {number} Pass the sheet index. - * @returns {number} + * @returns {Number} */ - getFrozenColumns(sheetIdx: number): number; + getFrozenColumns(sheetIdx: number): Number; /** This method is used to get the frozen row index in Spreadsheet. * @param {number} Pass the sheet index. - * @returns {number} + * @returns {Number} */ - getFrozenRows(sheetIdx: number): number; + getFrozenRows(sheetIdx: number): Number; /** This method is used to get the hyperlink data as object from the specified cell in Spreadsheet. * @param {HTMLElement} Pass the DOM element to get hyperlink @@ -33360,7 +35253,7 @@ class Spreadsheet extends ej.Widget { getRange(startRIndex: number, startCIndex: number, endRIndex: number, endCIndex: number, sheetIdx: number): HTMLElement; /** This method is used to get the data in specified range in Spreadsheet. - * @param {any} Optional. Pass the range, property, sheetIdx, valueOnly in options. + * @param {any} Optional. Pass the range, property, sheetIdx, valueOnly in options. * @returns {Array} */ getRangeData(options?: any): Array; @@ -33498,11 +35391,11 @@ class Spreadsheet extends ej.Widget { refreshSpreadsheet(): void; /** This method is used to remove custom formulae in Spreadsheet. - * @param {string} Pass the name of the formula. - * @param {string} Pass the name of the function. + * @param {String} Pass the name of the formula. + * @param {String} Pass the name of the function. * @returns {void} */ - removeCustomFormula(formulaName: string, functionName: string): void; + removeCustomFormula(formulaName: String, functionName: String): void; /** This method is used to remove the hyperlink from selected cells of current sheet. * @param {string} Hyperlink remove from the specified range. @@ -33644,7 +35537,7 @@ class Spreadsheet extends ej.Widget { /** This method is used to update the data for the specified range of cells in the Spreadsheet. * @param {any} Pass the cells data that you want to update. - * @param {Array} Optional. If range is specified, it will update data for the specified range else it will use the current selected range. + * @param {Array} Optional. If range is specified, it will update data for the specified range else it will use the current selected range. * @returns {void} */ updateData(data: any, range?: Array): void; @@ -33803,7 +35696,7 @@ export interface XLClipboard { export interface XLComment { /** This method is used to delete the comment in the specified range in Spreadsheet. - * @param {Array|string} Optional. If range is specified, it will delete comments for the specified range else it will use the current selected range. + * @param {Array|string} Optional. If range is specified, it will delete comments for the specified range else it will use the current selected range. * @param {number} Optional. If sheetIdx is specified, it will delete comment in specified sheet else it will use active sheet. * @param {boolean} Optional. Pass true, if you want to skip the hidden rows data. * @returns {void} @@ -33811,20 +35704,20 @@ export interface XLComment { deleteComment(range: Array|string,sheetIdx: number,skipHiddenRow: boolean): void; /** This method is used to edit the comment in the target Cell in Spreadsheet. - * @param {any} Optional. Pass the row index and column index of the cell which contains comment. + * @param {any} Optional. Pass the row index and column index of the cell which contains comment. * @returns {void} */ editComment(targetCell: any): void; /** This method is used to find the next comment from the active cell in Spreadsheet. - * @returns {boolean} + * @returns {Boolean} */ - findNextComment(): boolean; + findNextComment(): Boolean; /** This method is used to find the previous comment from the active cell in Spreadsheet. - * @returns {boolean} + * @returns {Boolean} */ - findPrevComment(): boolean; + findPrevComment(): Boolean; /** This method is used to get comment data for the specified cell. * @param {HTMLElement} Pass the DOM element to get comment data as object. @@ -33833,9 +35726,9 @@ export interface XLComment { getComment(cell: HTMLElement): any; /** This method is used to set new comment in Spreadsheet. - * @param {string|Array} Optional. If we pass the range comment will set in the range otherwise it will set with selected cells. + * @param {string|Array} Optional. If we pass the range comment will set in the range otherwise it will set with selected cells. * @param {string} Optional. Pass the comment data. - * @param {boolean} Optional. Pass true to show comment in edit mode + * @param {boolean} Optional. Pass true to show comment in edit mode * @returns {void} */ setComment(range: string|Array,data: string,showEditPanel: boolean): void; @@ -33908,9 +35801,9 @@ export interface XLEdit { * @param {number} Pass the column index to get the property value. * @param {string} Optional. Pass the property name that you want("value", "value2", "type", "cFormatRule", "range", "thousandSeparator", "rule", "format", "border", "picture", "chart", "calcValue", "align", "hyperlink", "formats", "borders", "tformats", "tborders", "isFilterHeader", "filterState", "tableName", "comment", "formatStr", "decimalPlaces", "cellType"). * @param {number} Optional. Pass the index of the sheet. - * @returns {any|string|Array} + * @returns {any|String|Array} */ - getPropertyValue(rowIdx: number,colIdx: number,prop: string,sheetIdx: number): any|string|Array; + getPropertyValue(rowIdx: number,colIdx: number,prop: string,sheetIdx: number): any|String|Array; /** This method is used to get the property value in specified cell in Spreadsheet. * @param {HTMLElement} Pass the cell element to get property value. @@ -33935,7 +35828,7 @@ export interface XLEdit { /** This method is used to update a particular cell value and its format in the Spreadsheet. * @param {any} Pass row index and column index of the cell. * @param {string|number} Pass the cell value. - * @param {string} Pass the class name to update format. + * @param {string} Pass the class name to update format. * @param {number} Pass sheet index. * @returns {void} */ @@ -33945,7 +35838,7 @@ export interface XLEdit { export interface XLExport { /** This method is used to save the sheet data as Excel or CSV document (.xls, .xlsx and .csv) in Spreadsheet. - * @param {string} Pass the export type that you want. + * @param {string} Pass the export type that you want. * @returns {void} */ export(type: string): void; @@ -33974,7 +35867,7 @@ export interface XLFormat { /** This method is used to create a table for the selected range of cells in the Spreadsheet. * @param {any} Pass the table object. - * @param {string} Optional. If the range is specified, then it will create table in the specified range else it will use the current selected range. + * @param {string} Optional. If the range is specified, then it will create table in the specified range else it will use the current selected range. * @returns {void} */ createTable(tableObject: any,range: string): void; @@ -34008,7 +35901,7 @@ export interface XLFormat { /** This method is used to update the format for the selected range of cells in the Spreadsheet. * @param {any} Pass the format object that you want to update. - * @param {Array} Optional. If the range is specified, then it will update format in the specified range else it will use the current selected range. + * @param {Array} Optional. If the range is specified, then it will update format in the specified range else it will use the current selected range. * @returns {void} */ updateFormat(formatObj: any,range: Array): void; @@ -34055,7 +35948,7 @@ export interface XLFreeze { export interface XLPivot { /** This property is used to clear the pivot table list in Spreadsheet. - * @param {string} Pass the name of the pivot table. + * @param {string} Pass the name of the pivot table. * @returns {void} */ clearPivotFieldList(pivotName: string): void; @@ -34071,10 +35964,10 @@ export interface XLPivot { createPivotTable(range: string,location: string,name: string,settings: any,pvt: any): void; /** This method is used to delete the pivot table which is selected. - * @param {string} Pass the name of the pivot table. + * @param {String} Pass the name of the pivot table. * @returns {void} */ - deletePivotTable(pivotName: string): void; + deletePivotTable(pivotName: String): void; /** This method is used to refresh data in pivot table. * @param {string} Optional. Pass the name of the pivot table. @@ -34101,15 +35994,15 @@ export interface XLResize { /** This method is used to get the column width of the specified column index in the Spreadsheet. * @param {number} Pass the column index. - * @returns {number} + * @returns {Number} */ - getColWidth(colIdx: number): number; + getColWidth(colIdx: number): Number; /** This method is used to get the row height of the specified row index in the Spreadsheet. * @param {number} Pass the row index which you want to find its height. - * @returns {number} + * @returns {Number} */ - getRowHeight(rowIdx: number): number; + getRowHeight(rowIdx: number): Number; /** This method is used to set the column width of the specified column index in the Spreadsheet. * @param {number} Pass the column index. @@ -34251,7 +36144,7 @@ export interface XLSort { export interface XLValidate { /** This method is used to apply data validation rules in a selected range of cells based on the defined condition in the Spreadsheet. - * @param {string} If range is specified, it will apply rules for the specified range else it will use the current selected range. + * @param {string} If range is specified, it will apply rules for the specified range else it will use the current selected range. * @param {Array} Pass the validation condition, value1 and value2. * @param {string} Pass the data type. * @param {boolean} Pass 'true' if you ignore blank values. @@ -34261,7 +36154,7 @@ export interface XLValidate { applyDVRules(range: string,values: Array,type: string,required: boolean,showErrorAlert: boolean): void; /** This method is used to clear the applied validation rules in a specified range of cells in the Spreadsheet. - * @param {string} Optional. If range is specified, it will clear rules for the specified range else it will use the current selected range. + * @param {string} Optional. If range is specified, it will clear rules for the specified range else it will use the current selected range. * @returns {void} */ clearDV(range: string): void; @@ -34278,162 +36171,162 @@ export interface Model { /** Gets or sets an active sheet index in the Spreadsheet. By defining this value, you can specify which sheet should be active in workbook. * @Default {1} */ - activeSheetIndex?: number; + activeSheetIndex?: Number; /** Gets or sets a value that indicates whether to enable or disable auto rendering of cell type in the Spreadsheet. * @Default {false} */ - allowAutoCellType?: boolean; + allowAutoCellType?: Boolean; /** Gets or sets a value that indicates whether to enable or disable auto fill feature in the Spreadsheet. * @Default {true} */ - allowAutoFill?: boolean; + allowAutoFill?: Boolean; /** Gets or sets a value that indicates whether to enable or disable auto sum feature in the Spreadsheet. * @Default {true} */ - allowAutoSum?: boolean; + allowAutoSum?: Boolean; /** Gets or sets a value that indicates whether to enable or disable cell format feature in the Spreadsheet. By enabling this, you can customize styles and number formats. * @Default {true} */ - allowCellFormatting?: boolean; + allowCellFormatting?: Boolean; /** Gets or sets a value that indicates whether to enable or disable cell type feature in the Spreadsheet. * @Default {false} */ - allowCellType?: boolean; + allowCellType?: Boolean; /** Gets or sets a value that indicates whether to enable or disable chart feature in the Spreadsheet. By enabling this feature, you can create and customize charts in Spreadsheet. * @Default {true} */ - allowCharts?: boolean; + allowCharts?: Boolean; /** Gets or sets a value that indicates whether to enable or disable clipboard feature in the Spreadsheet. By enabling this feature, you can perform cut/copy and paste operations in Spreadsheet. * @Default {true} */ - allowClipboard?: boolean; + allowClipboard?: Boolean; /** Gets or sets a value that indicates whether to enable or disable comment feature in the Spreadsheet. By enabling this, you can add/delete/modify comments in Spreadsheet. * @Default {true} */ - allowComments?: boolean; + allowComments?: Boolean; /** Gets or sets a value that indicates whether to enable or disable Conditional Format feature in the Spreadsheet. By enabling this, you can apply formatting to the selected range of cells based on the provided conditions (Greater than, Less than, Equal, Between, Contains, etc.). * @Default {true} */ - allowConditionalFormats?: boolean; + allowConditionalFormats?: Boolean; /** Gets or sets a value that indicates whether to enable or disable data validation feature in the Spreadsheet. * @Default {true} */ - allowDataValidation?: boolean; + allowDataValidation?: Boolean; /** Gets or sets a value that indicates whether to enable or disable the delete action in the Spreadsheet. By enabling this feature, you can delete existing rows, columns, cells and sheet. * @Default {true} */ - allowDelete?: boolean; + allowDelete?: Boolean; /** Gets or sets a value that indicates whether to enable or disable drag and drop feature in the Spreadsheet. * @Default {true} */ - allowDragAndDrop?: boolean; + allowDragAndDrop?: Boolean; /** Gets or sets a value that indicates whether to enable or disable the edit action in the Spreadsheet. * @Default {true} */ - allowEditing?: boolean; + allowEditing?: Boolean; /** Gets or sets a value that indicates whether to enable or disable filtering feature in the Spreadsheet. Filtering can be used to limit the data displayed using required criteria. * @Default {true} */ - allowFiltering?: boolean; + allowFiltering?: Boolean; /** Gets or sets a value that indicates whether to enable or disable table feature in the Spreadsheet. By enabling this, you can render table in selected range. * @Default {true} */ - allowFormatAsTable?: boolean; + allowFormatAsTable?: Boolean; /** Get or sets a value that indicates whether to enable or disable format painter feature in the Spreadsheet. By enabling this feature, you can copy the format from the selected range and apply it to another range. * @Default {true} */ - allowFormatPainter?: boolean; + allowFormatPainter?: Boolean; /** Gets or sets a value that indicates whether to enable or disable formula bar in the Spreadsheet. * @Default {true} */ - allowFormulaBar?: boolean; + allowFormulaBar?: Boolean; /** Gets or sets a value that indicates whether to enable or disable freeze pane support in Spreadsheet. After enabling this feature, you can use freeze top row, freeze first column and freeze panes options. * @Default {true} */ - allowFreezing?: boolean; + allowFreezing?: Boolean; /** Gets or sets a value that indicates whether to enable or disable hyperlink feature in the Spreadsheet. By enabling this feature, you can add hyperlink which is used to easily navigate to the cell reference from one sheet to another or a web page. * @Default {true} */ - allowHyperlink?: boolean; + allowHyperlink?: Boolean; /** Gets or sets a value that indicates whether to enable or disable import feature in the Spreadsheet. By enabling this feature, you can open existing Spreadsheet documents. * @Default {true} */ - allowImport?: boolean; + allowImport?: Boolean; /** Gets or sets a value that indicates whether to enable or disable the insert action in the Spreadsheet. By enabling this feature, you can insert new rows, columns, cells and sheet. * @Default {true} */ - allowInsert?: boolean; + allowInsert?: Boolean; /** Gets or sets a value that indicates whether to enable or disable keyboard navigation feature in the Spreadsheet. * @Default {true} */ - allowKeyboardNavigation?: boolean; + allowKeyboardNavigation?: Boolean; /** Gets or sets a value that indicates whether to enable or disable lock cell feature in the Spreadsheet. * @Default {true} */ - allowLockCell?: boolean; + allowLockCell?: Boolean; /** Gets or sets a value that indicates whether to enable or disable merge feature in the Spreadsheet. * @Default {true} */ - allowMerging?: boolean; + allowMerging?: Boolean; /** Gets or sets a value that indicates whether to enable or disable resizing feature in the Spreadsheet. By enabling this feature, you can change the column width and row height by dragging its header boundaries. * @Default {true} */ - allowResizing?: boolean; + allowResizing?: Boolean; /** Gets or sets a value that indicates whether to enable or disable find and replace feature in the Spreadsheet. By enabling this, you can easily find and replace a specific value in the sheet or workbook. By using goto behavior, you can select and highlight all cells that contains specific data or data types. * @Default {true} */ - allowSearching?: boolean; + allowSearching?: Boolean; /** Gets or sets a value that indicates whether to enable or disable selection in the Spreadsheet. By enabling this feature, selected items will be highlighted. * @Default {true} */ - allowSelection?: boolean; + allowSelection?: Boolean; /** Gets or sets a value that indicates whether to enable the sorting feature in the Spreadsheet. * @Default {true} */ - allowSorting?: boolean; + allowSorting?: Boolean; /** Gets or sets a value that indicates whether to enable or disable undo and redo feature in the Spreadsheet. * @Default {true} */ - allowUndoRedo?: boolean; + allowUndoRedo?: Boolean; /** Gets or sets a value that indicates whether to enable or disable wrap text feature in the Spreadsheet. By enabling this, cell content can wrap to the next line, if the cell content exceeds the boundary of the cell. * @Default {true} */ - allowWrap?: boolean; + allowWrap?: Boolean; /** Gets or sets a value that indicates to define the width of the activation panel in Spreadsheet. * @Default {300} */ - apWidth?: number; + apWidth?: Number; /** Gets or sets an object that indicates to customize the auto fill behavior in the Spreadsheet. */ @@ -34446,16 +36339,16 @@ export interface Model { /** Gets or sets a value that defines the number of columns displayed in the sheet. * @Default {21} */ - columnCount?: number; + columnCount?: Number; /** Gets or sets a value that indicates to define the common width for each column in the Spreadsheet. * @Default {64} */ - columnWidth?: number; + columnWidth?: Number; - /** Gets or sets a value to add root css class for customizing Spreadsheet skins. + /** Gets or sets a value to add root CSS class for customizing Spreadsheet skins. */ - cssClass?: string; + cssClass?: String; /** Gets or sets a value that indicates custom formulas in Spreadsheet. * @Default {[]} @@ -34465,17 +36358,17 @@ export interface Model { /** Gets or sets a value that indicates whether to enable or disable context menu in the Spreadsheet. * @Default {true} */ - enableContextMenu?: boolean; + enableContextMenu?: Boolean; /** Gets or sets a value that indicates whether to enable or disable pivot table in the Spreadsheet. * @Default {false} */ - enablePivotTable?: boolean; + enablePivotTable?: Boolean; /** Gets or sets a value that indicates whether to enable or disable touch support in the Spreadsheet. * @Default {true} */ - enableTouch?: boolean; + enableTouch?: Boolean; /** Gets or sets an object that indicates to customize the exporting behavior in Spreadsheet. */ @@ -34492,7 +36385,7 @@ export interface Model { /** Gets or sets a value that indicates whether to customizing the user interface (UI) as locale-specific in order to display regional data (i.e.) in a language and culture specific to a particular country or region. * @Default {en-US} */ - locale?: string; + locale?: String; /** Gets or sets an object that indicates to customize the picture behavior in the Spreadsheet. */ @@ -34509,12 +36402,12 @@ export interface Model { /** Gets or sets a value that indicates whether to define the number of rows to be displayed in the sheet. * @Default {20} */ - rowCount?: number; + rowCount?: Number; /** Gets or sets a value that indicates to define the common height for each row in the sheet. * @Default {20} */ - rowHeight?: number; + rowHeight?: Number; /** Gets or sets an object that indicates to customize the scroll options in the Spreadsheet. */ @@ -34527,7 +36420,7 @@ export interface Model { /** Gets or sets a value that indicates to define the number of sheets to be created at the initial load. * @Default {1} */ - sheetCount?: number; + sheetCount?: Number; /** Gets or sets an object that indicates to customize the sheet behavior in Spreadsheet. */ @@ -34536,22 +36429,22 @@ export interface Model { /** Gets or sets a value that indicates whether to show or hide pager in the Spreadsheet. * @Default {true} */ - showPager?: boolean; + showPager?: Boolean; /** Gets or sets a value that indicates whether to show or hide ribbon in the Spreadsheet. * @Default {true} */ - showRibbon?: boolean; + showRibbon?: Boolean; /** This is used to set the number of undo-redo steps in the Spreadsheet. * @Default {20} */ - undoRedoStep?: number; + undoRedoStep?: Number; /** Define the username for the Spreadsheet which is displayed in comment. * @Default {User Name} */ - userName?: string; + userName?: String; /** Triggered for every action before its starts. */ actionBegin? (e: ActionBeginEventArgs): void; @@ -34794,7 +36687,7 @@ export interface BeforeBatchSaveEventArgs { /** Returns the sheet index. */ - sheetIdx?: number; + sheetIdx?: Number; /** Returns the query, primary key,batch changes for the data Source. */ @@ -35024,7 +36917,7 @@ export interface CellFormattingEventArgs { */ Cell?: number; - /** Returns the name of the css theme. + /** Returns the name of the CSS theme. */ cssClass?: string; @@ -35076,11 +36969,11 @@ export interface CellSaveEventArgs { /** Returns the index of the row. */ - rowIndex?: number; + rowIndex?: Number; /** Returns the index of the column. */ - colIndex?: number; + colIndex?: Number; /** Returns the Spreadsheet model. */ @@ -35111,7 +37004,7 @@ export interface CellSelectedEventArgs { /** Returns the active sheet index. */ - sheetIdx?: number; + sheetIdx?: Number; /** Returns the selected range. */ @@ -35596,7 +37489,7 @@ export interface AutoFillSettings { /** Gets or sets a value that indicates to enable or disable auto fill options in the Spreadsheet. * @Default {true} */ - showFillOptions?: boolean; + showFillOptions?: Boolean; } export interface ChartSettings { @@ -35604,12 +37497,12 @@ export interface ChartSettings { /** Gets or sets a value that defines the chart height in Spreadsheet. * @Default {220} */ - height?: number; + height?: Number; /** Gets or sets a value that defines the chart width in the Spreadsheet. * @Default {440} */ - width?: number; + width?: Number; } export interface ExportSettings { @@ -35617,27 +37510,27 @@ export interface ExportSettings { /** Gets or sets a value that indicates whether to enable or disable save feature in Spreadsheet. By enabling this feature, you can save existing Spreadsheet. * @Default {true} */ - allowExporting?: boolean; + allowExporting?: Boolean; /** Gets or sets a value that indicates to define csvUrl for export to CSV format. * @Default {null} */ - csvUrl?: string; + csvUrl?: String; /** Gets or sets a value that indicates to define excelUrl for export to excel format. * @Default {null} */ - excelUrl?: string; + excelUrl?: String; /** Gets or sets a value that indicates to define password while export to excel format. * @Default {null} */ - password?: string; + password?: String; - /** Gets or sets a value that indicates to define pdfUrl for export to pdf format. + /** Gets or sets a value that indicates to define pdfUrl for export to PDF format. * @Default {null} */ - pdfUrl?: string; + pdfUrl?: String; } export interface FormatSettings { @@ -35645,37 +37538,37 @@ export interface FormatSettings { /** Gets or sets a value that indicates whether to enable or disable cell border feature in the Spreadsheet. * @Default {true} */ - allowCellBorder?: boolean; + allowCellBorder?: Boolean; /** Gets or sets a value that indicates whether to enable or disable decimal places in the Spreadsheet. * @Default {true} */ - allowDecimalPlaces?: boolean; + allowDecimalPlaces?: Boolean; /** Gets or sets a value that indicates whether to enable or disable font family feature in Spreadsheet. * @Default {true} */ - allowFontFamily?: boolean; + allowFontFamily?: Boolean; } export interface ImportSettings { /** Sets import mapper to perform import feature in Spreadsheet. */ - importMapper?: string; + importMapper?: String; /** Gets or sets a value that indicates whether to enable or disable import while initial loading. * @Default {false} */ - importOnLoad?: boolean; + importOnLoad?: Boolean; /** Sets import URL to access the online files in the Spreadsheet. */ - importUrl?: string; + importUrl?: String; /** Gets or sets a value that indicates to define password while importing in the Spreadsheet. */ - password?: string; + password?: String; } export interface PictureSettings { @@ -35683,17 +37576,17 @@ export interface PictureSettings { /** Gets or sets a value that indicates whether to enable or disable picture feature in Spreadsheet. By enabling this, you can add pictures in Spreadsheet. * @Default {true} */ - allowPictures?: boolean; + allowPictures?: Boolean; /** Gets or sets a value that indicates to define height to picture in the Spreadsheet. * @Default {220} */ - height?: number; + height?: Number; /** Gets or sets a value that indicates to define width to picture in the Spreadsheet. * @Default {440} */ - width?: number; + width?: Number; } export interface PrintSettings { @@ -35701,17 +37594,17 @@ export interface PrintSettings { /** Gets or sets a value that indicates whether to enable or disable page setup support for printing in Spreadsheet. * @Default {true} */ - allowPageSetup?: boolean; + allowPageSetup?: Boolean; /** Gets or sets a value that indicates whether to enable or disable page size support for printing in Spreadsheet. * @Default {false} */ - allowPageSize?: boolean; + allowPageSize?: Boolean; /** Gets or sets a value that indicates whether to enable or disable print feature in the Spreadsheet. * @Default {true} */ - allowPrinting?: boolean; + allowPrinting?: Boolean; } export interface RibbonSettingsApplicationTabMenuSettings { @@ -35719,9 +37612,9 @@ export interface RibbonSettingsApplicationTabMenuSettings { /** Gets or sets a value that indicates whether to enable or disable isAppend property in ribbon settings. * @Default {false} */ - isAppend?: boolean; + isAppend?: Boolean; - /** Specifies the data source to append in applicationtab. + /** Specifies the data source to append in application tab. * @Default {[]} */ dataSource?: Array; @@ -35751,27 +37644,27 @@ export interface ScrollSettings { /** Gets or sets a value that indicates whether to enable or disable scrolling in Spreadsheet. * @Default {true} */ - allowScrolling?: boolean; + allowScrolling?: Boolean; /** Gets or sets a value that indicates whether to enable or disable sheet on demand. By enabling this, it render only the active sheet element while paging remaining sheets are created one by one. * @Default {false} */ - allowSheetOnDemand?: boolean; + allowSheetOnDemand?: Boolean; /** Gets or sets a value that indicates whether to enable or disable virtual scrolling feature in the Spreadsheet. * @Default {true} */ - allowVirtualScrolling?: boolean; + allowVirtualScrolling?: Boolean; /** Gets or sets the value that indicates to define the height of spreadsheet. * @Default {100%} */ - height?: number|string; + height?: Number|String; /** Gets or sets the value that indicates whether to enable or disable responsive mode in the Spreadsheet. * @Default {true} */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Gets or sets a value that indicates to set scroll mode in Spreadsheet. It has two scroll modes, Normal and Infinite. * @Default {ej.Spreadsheet.scrollMode.Infinite} @@ -35781,24 +37674,24 @@ export interface ScrollSettings { /** Gets or sets the value that indicates to define the height of the spreadsheet. * @Default {100%} */ - width?: number|string; + width?: Number|String; } export interface SelectionSettings { /** Gets or sets a value that indicates to define active cell in spreadsheet. */ - activeCell?: string; + activeCell?: String; /** Gets or sets a value that indicates to define animation time while selection in the Spreadsheet. * @Default {0.001} */ - animationTime?: number; + animationTime?: Number; /** Gets or sets a value that indicates to enable or disable animation while selection. * @Default {false} */ - enableAnimation?: boolean; + enableAnimation?: Boolean; /** Gets or sets a value that indicates to set selection type in Spreadsheet. It has three types which are Column, Row and Default. * @Default {ej.Spreadsheet.SelectionType.Default} @@ -35813,17 +37706,17 @@ export interface SelectionSettings { export interface SheetsBorder { - /** + /** */ type?: ej.Spreadsheet.BorderType|string; /** Specifies border color for range of cells in Spreadsheet. */ - color?: string; + color?: String; /** To apply border for the specified range of cell. */ - range?: string; + range?: String; } export interface SheetsCFormatRule { @@ -35843,7 +37736,7 @@ export interface SheetsCFormatRule { /** Specifies the range for conditional formatting in Spreadsheet. */ - range?: string; + range?: String; } export interface SheetsRangeSetting { @@ -35860,7 +37753,7 @@ export interface SheetsRangeSetting { /** Specifies the primary key for the datasource in Spreadsheet. */ - primaryKey?: string; + primaryKey?: String; /** Specifies the query for the datasource in Spreadsheet. * @Default {null} @@ -35870,12 +37763,12 @@ export interface SheetsRangeSetting { /** Gets or sets a value that indicates whether to enable or disable the datasource header in Spreadsheet. * @Default {false} */ - showHeader?: boolean; + showHeader?: Boolean; /** Specifies the start cell for the datasource range in Spreadsheet. * @Default {A1} */ - startCell?: string; + startCell?: String; } export interface SheetsRowsCellsComment { @@ -35883,49 +37776,49 @@ export interface SheetsRowsCellsComment { /** Get or sets the value that indicates whether to show or hide comments in Spreadsheet. * @Default {false} */ - isVisible?: boolean; + isVisible?: Boolean; /** Specifies the value for the comment in Spreadsheet. */ - value?: string; + value?: String; } export interface SheetsRowsCellsFormat { /** Specifies the type of the format in Spreadsheet. */ - type?: string; + type?: String; } export interface SheetsRowsCellsHyperlink { /** Specifies the web address for the hyperlink of a cell. */ - webAddr?: string; + webAddr?: String; /** Specifies the cell address for the hyperlink of a cell. */ - cellAddr?: string; + cellAddr?: String; /** Specifies the sheet index to which the cell is referred. * @Default {1} */ - sheetIndex?: number; + sheetIndex?: Number; } export interface SheetsRowsCellsStyle { /** Specifies the background color of a cell in the Spreadsheet. */ - backgroundColor?: string; + backgroundColor?: String; /** Specifies the font color of a cell in the Spreadsheet. */ - color?: string; + color?: String; /** Specifies the font weight of a cell in the Spreadsheet. */ - fontWeight?: string; + fontWeight?: String; } export interface SheetsRowsCell { @@ -35948,7 +37841,7 @@ export interface SheetsRowsCell { /** Specifies the index of a cell in Spreadsheet. * @Default {0} */ - index?: number; + index?: Number; /** Specifies the styles of a cell in Spreadsheet. * @Default {null} @@ -35957,7 +37850,7 @@ export interface SheetsRowsCell { /** Specifies the value for a cell in Spreadsheet. */ - value?: string; + value?: String; } export interface SheetsRow { @@ -35965,7 +37858,7 @@ export interface SheetsRow { /** Gets or sets the height of a row in Spreadsheet. * @Default {20} */ - height?: number; + height?: Number; /** Specifies the cells of a row in Spreadsheet. * @Default {[]} @@ -35975,7 +37868,7 @@ export interface SheetsRow { /** Gets or sets the index of a row in Spreadsheet. * @Default {0} */ - index?: number; + index?: Number; } export interface Sheet { @@ -35993,12 +37886,12 @@ export interface Sheet { /** Gets or sets a value that indicates to define column count in the Spreadsheet. * @Default {21} */ - colCount?: number; + colCount?: Number; /** Gets or sets a value that indicates to define column width in the Spreadsheet. * @Default {64} */ - columnWidth?: number; + columnWidth?: Number; /** Gets or sets the data to render the Spreadsheet. * @Default {null} @@ -36008,7 +37901,7 @@ export interface Sheet { /** Gets or sets a value that indicates whether to enable or disable field as column header in the Spreadsheet. * @Default {false} */ - fieldAsColumnHeader?: boolean; + fieldAsColumnHeader?: Boolean; /** Specifies the header styles for the headers in datasource range. * @Default {null} @@ -36032,7 +37925,7 @@ export interface Sheet { /** Specifies the primary key for the datasource in Spreadsheet. */ - primaryKey?: string; + primaryKey?: String; /** Specifies the query for the dataSource in Spreadsheet. * @Default {null} @@ -36047,7 +37940,7 @@ export interface Sheet { /** Gets or sets a value that indicates to define row count in the Spreadsheet. * @Default {20} */ - rowCount?: number; + rowCount?: Number; /** Specifies the rows for a sheet in Spreadsheet. * @Default {[]} @@ -36057,22 +37950,22 @@ export interface Sheet { /** Gets or sets a value that indicates whether to show or hide grid lines in the Spreadsheet. * @Default {true} */ - showGridlines?: boolean; + showGridlines?: Boolean; /** Gets or sets a value that indicates whether to enable or disable the datasource header in Spreadsheet. * @Default {false} */ - showHeader?: boolean; + showHeader?: Boolean; /** Gets or sets a value that indicates whether to show or hide headings in the Spreadsheet. * @Default {true} */ - showHeadings?: boolean; + showHeadings?: Boolean; /** Specifies the start cell for the datasource range in Spreadsheet. * @Default {A1} */ - startCell?: string; + startCell?: String; } enum AutoFillOptions{ @@ -36210,6 +38103,7 @@ class PdfViewer extends ej.Widget { static fn: PdfViewer; constructor(element: JQuery, options?: PdfViewer.Model); constructor(element: Element, options?: PdfViewer.Model); + static Locale: any; model:PdfViewer.Model; defaults:PdfViewer.Model; @@ -36228,6 +38122,26 @@ class PdfViewer extends ej.Widget { */ print(): void; + /** Abort the printing function and restores the PDF Viewer. + * @returns {void} + */ + abortPrint(): void; + + /** Shows/hides the print icon in the tool bar. + * @returns {void} + */ + showPrintTools(): void; + + /** Downloads the PDF document being loaded in the ejPdfViewer control. + * @returns {void} + */ + download(): void; + + /** Shows/hides the download tool in the tool bar. + * @returns {void} + */ + showDownloadTool(): void; + /** Shows/hides the page navigation tools in the toolbar * @returns {void} */ @@ -36294,7 +38208,7 @@ export interface Model { /** Specifies the locale information of the PDF viewer. */ - locale?: string; + locale?: String; /** Specifies the toolbar settings. */ @@ -36306,19 +38220,19 @@ export interface Model { /** Sets the PDF Web API service URL */ - serviceUrl?: string; + serviceUrl?: String; /** Gets the total number of pages in PDF document. */ - pageCount?: number; + pageCount?: Number; /** Gets the number of the page being displayed in the PDF Viewer. */ - currentPageNumber?: number; + currentPageNumber?: Number; /** Gets the current zoom percentage of the PDF document in viewer. */ - zoomPercentage?: number; + zoomPercentage?: Number; /** Specifies the location of the supporting PDF service */ @@ -36330,7 +38244,7 @@ export interface Model { /** Enables or disables the responsive support for PDF Viewer control during the window resizing time. */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Gets the name of the PDF document which loaded in the ejPdfViewer control for downloading. */ @@ -36354,6 +38268,9 @@ export interface Model { /** Triggers after the printing is completed. */ afterPrint? (e: AfterPrintEventArgs): void; + /** Triggers when the mouse click is performed over the page of the PDF document. */ + pageClick? (e: PageClickEventArgs): void; + /** Triggers when PDF viewer control is destroyed successfully. */ destroy? (e: DestroyEventArgs): void; } @@ -36464,6 +38381,29 @@ export interface AfterPrintEventArgs { type?: string; } +export interface PageClickEventArgs { + + /** True, if the event should be canceled; otherwise, false. + */ + cancel?: boolean; + + /** Returns the PDF viewer model + */ + model?: any; + + /** Returns the name of the event + */ + type?: string; + + /** Returns the current X position + */ + offsetX?: number; + + /** Returns the current Y position + */ + offsetY?: number; +} + export interface DestroyEventArgs { /** True, if the event should be canceled; otherwise, false. @@ -36483,7 +38423,7 @@ export interface ToolbarSettings { /** Shows or hides the tooltip of the toolbar items. */ - showToolTip?: boolean; + showToolTip?: Boolean; } enum ToolbarItems{ @@ -36517,7 +38457,7 @@ enum PdfService{ enum LinkTarget{ - ///Opens the hyperlink in the same tab of the browser. + ///Opens the hyperlink in the same tab of the browser. Default, ///Opens the hyperlink in a new tab of the browser. @@ -36529,13 +38469,498 @@ enum LinkTarget{ } +class SpellCheck extends ej.Widget { + static fn: SpellCheck; + constructor(element: JQuery, options?: SpellCheck.Model); + constructor(element: Element, options?: SpellCheck.Model); + static Locale: any; + model:SpellCheck.Model; + defaults:SpellCheck.Model; + + /** Open the dialog to correct the spelling of the target content. + * @returns {void} + */ + showInDialog(): void; + + /** Highlighting the error word in the target area itself and correct the spelling using the context menu. + * @returns {void} + */ + validate(): void; + + /** To get the error word highlighted string by passing the given input sentence. + * @param {string} Content to be spell check + * @param {string} Class name that contains style value to highlight the error word + * @returns {void} + */ + spellCheck(targetSentence: string, misspellWordCss: string): void; + + /** To ignore all the error word occurrences from the given input sentence. + * @param {string} Error word to ignore from the target content + * @param {string} Content to perform the ignore all operation + * @returns {void} + */ + ignoreAll(word: string, targetSentence: string): void; + + /** To ignore the error word once from the given input sentence. + * @param {string} Error word to ignore from the target content + * @param {string} Content to perform the ignore operation + * @param {number} Index of the error word present in the target content + * @returns {void} + */ + ignore(word: string, targetSentence: string, index: number): void; + + /** To change the error word once from the given input sentence. + * @param {string} Error word to change from the target content + * @param {string} Content to perform the change operation + * @param {string} Word to replace with the error word + * @param {number} Index of the error word present in the target content + * @returns {void} + */ + change(word: string, targetSentence: string, changeWord: string, index: number): void; + + /** To change all the error word occurrences from the given input sentence. + * @param {string} Error word to change from the target content + * @param {string} Content to perform the change all operation + * @param {string} Word to replace with the error word + * @returns {void} + */ + changeAll(word: string, targetSentence: string, changeWord: string): void; + + /** To add the words into the custom dictionary. + * @param {string} Word to add into the dictionary file + * @returns {void} + */ + addToDictionary(customWord: string): void; +} +export module SpellCheck{ + +export interface Model { + + /** It includes the service method path to find the error words and its suggestions also adding the custom word into the custom dictionary. + */ + dictionarySettings?: DictionarySettings; + + /** To display the error word in a customized style. + * @Default {e-errorword} + */ + misspellWordCss?: string; + + /** Sets the specific culture to the SpellCheck. + * @Default {en-US} + */ + locale?: string; + + /** To set the maximum suggestion display count. + * @Default {6} + */ + maxSuggestionCount?: number; + + /** To ignore the words from the error word consideration. + * @Default {[]} + */ + ignoreWords?: Array; + + /** Holds all options related to the context menu settings of SpellCheck. + */ + contextMenuSettings?: ContextMenuSettings; + + /** It helps to ignore the uppercase, mixed case words, alpha numeric words, file path and email addresses based on the property values. + */ + ignoreSettings?: IgnoreSettings; + + /** Triggers on the success of AJAX call request. */ + actionSuccess? (e: ActionSuccessEventArgs): void; + + /** Triggers on the AJAX call request beginning. */ + actionBegin? (e: ActionBeginEventArgs): void; + + /** Triggers when the AJAX call request failure. */ + actionFailure? (e: ActionFailureEventArgs): void; + + /** Triggers when the dialog mode spell check starting. */ + start? (e: StartEventArgs): void; + + /** Triggers when the spell check operations completed through dialog mode. */ + complete? (e: CompleteEventArgs): void; + + /** Triggers before context menu opening. */ + contextOpen? (e: ContextOpenEventArgs): void; + + /** Triggers when the context menu item clicked. */ + contextClick? (e: ContextClickEventArgs): void; + + /** Triggers before the spell check dialog opens. */ + dialogBeforeOpen? (e: DialogBeforeOpenEventArgs): void; + + /** Triggers after the spell check dialog opens. */ + dialogOpen? (e: DialogOpenEventArgs): void; + + /** Triggers when the spell check dialog closed. */ + dialogClose? (e: DialogCloseEventArgs): void; + + /** Triggers when the spell check control performing the spell check operations such as ignore, ignoreAll, change, changeAll and addToDictionary. */ + validating? (e: ValidatingEventArgs): void; +} + +export interface ActionSuccessEventArgs { + + /** Returns the error word highlighted string. + */ + resultHTML?: string; + + /** Returns the error word details of the given input. + */ + errorWordDetails?: any; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ActionBeginEventArgs { + + /** Returns the input string. + */ + targetSentence?: string; + + /** Returns the misspellWordCss class name. + */ + misspellWordCss?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ActionFailureEventArgs { + + /** Returns AJAX request failure error message. + */ + errorMessage?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface StartEventArgs { + + /** Returns the input string. + */ + targetSentence?: string; + + /** Returns the error words details. + */ + errorWords?: any; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface CompleteEventArgs { + + /** Returns the error word highlighted string. + */ + resultHTML?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ContextOpenEventArgs { + + /** Returns the selected error word. + */ + selectedErrorWord?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ContextClickEventArgs { + + /** Returns the selected error word. + */ + selectedValue?: string; + + /** Returns the selected option in the context menu. + */ + selectedOption?: string; + + /** Returns the input string. + */ + targetContent?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface DialogBeforeOpenEventArgs { + + /** Returns the spell check window details. + */ + spellCheckDialog?: any; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface DialogOpenEventArgs { + + /** Returns the target input. + */ + targetText?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface DialogCloseEventArgs { + + /** Returns the error corrected string. + */ + updatedText?: string; + + /** Returns the request type value. + */ + requestType?: string; + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the name of the event. + */ + type?: string; +} + +export interface ValidatingEventArgs { + + /** Returns the cancel option value. + */ + cancel?: boolean; + + /** Returns the error word to ignore. + */ + ignoreWord?: string; + + /** Returns the target content. + */ + targetContent?: string; + + /** Returns the index of an error word. + */ + index?: number; + + /** Returns the SpellCheck model. + */ + model?: ej.SpellCheck.Model; + + /** Returns the validating request type. + */ + requestType?: string; + + /** Returns the name of the event. + */ + type?: string; + + /** Returns the error word to change. + */ + changeableWord?: string; + + /** Returns the change word to replace the error word. + */ + changeWord?: string; + + /** Returns the custom word to add into dictionary file. + */ + customWord?: string; +} + +export interface DictionarySettings { + + /** The dictionaryUrl option accepts string, which is the method path to find the error words and get the suggestions to correct the errors. + */ + dictionaryUrl?: string; + + /** The customDictionaryUrl option accepts string, which is the method path to add the error word into the custom dictionary. + */ + customDictionaryUrl?: string; +} + +export interface ContextMenuSettings { + + /** When set to true, enables the context menu options available for the SpellCheck. + * @Default {true} + */ + enable?: boolean; + + /** Contains all the default context menu options that are applicable for SpellCheck. It also supports adding custom menu items. All the SpellCheck related context menu items are grouped under this menu collection. + * @Default {{% highlight javascript %}[{ id: IgnoreAll, text: Ignore All },{ id: AddToDictionary, text: Add To Dictionary }]{% endhighlight %}} + */ + menuItems?: Array; +} + +export interface IgnoreSettings { + + /** When set to true, ignoring the alphanumeric words from the error word consideration. + * @Default {true} + */ + ignoreAlphaNumericWords?: string; + + /** When set to true, ignoring the Email address from the error word consideration. + * @Default {true} + */ + ignoreEmailAddress?: boolean; + + /** When set to true, ignoring the MixedCase words from the error word consideration. + * @Default {true} + */ + ignoreMixedCaseWords?: boolean; + + /** When set to true, ignoring the UpperCase words from the error word consideration. + * @Default {true} + */ + ignoreUpperCase?: boolean; + + /** When set to true, ignoring the Url from the error word consideration. + * @Default {true} + */ + ignoreUrl?: boolean; + + /** When set to true, ignoring the file address path from the error word consideration. + * @Default {true} + */ + ignoreFileNames?: boolean; +} +} + } declare module ej.datavisualization { - + class SymbolPalette extends ej.Widget { static fn: SymbolPalette; constructor(element: JQuery, options?: SymbolPalette.Model); constructor(element: Element, options?: SymbolPalette.Model); + static Locale: any; model:SymbolPalette.Model; defaults:SymbolPalette.Model; } @@ -36546,12 +38971,12 @@ export interface Model { /** Defines whether the symbols can be dragged from palette or not * @Default {true} */ - allowDrag?: boolean; + allowDrag?: Boolean; /** Customizes the style of the symbol palette * @Default {e-symbolpalette} */ - cssClass?: string; + cssClass?: String; /** Defines the default properties of nodes and connectors */ @@ -36560,27 +38985,27 @@ export interface Model { /** Sets the Id of the diagram, over which the symbols will be dropped * @Default {null} */ - diagramId?: string; + diagramId?: String; /** Sets the height of the palette headers * @Default {30} */ - headerHeight?: number; + headerHeight?: Number; /** Defines the height of the symbol palette * @Default {400} */ - height?: number; + height?: Number; /** Defines the height of the palette items * @Default {50} */ - paletteItemHeight?: number; + paletteItemHeight?: Number; /** Defines the width of the palette items * @Default {50} */ - paletteItemWidth?: number; + paletteItemWidth?: Number; /** An array of JSON objects, where each object represents a node/connector * @Default {[]} @@ -36590,7 +39015,7 @@ export interface Model { /** Defines the preview height of the symbols * @Default {100} */ - previewHeight?: number; + previewHeight?: Number; /** Defines the offset value to be left between the mouse cursor and symbol previews * @Default {(110, 110)} @@ -36600,17 +39025,17 @@ export interface Model { /** Defines the width of the symbol previews * @Default {100} */ - previewWidth?: number; + previewWidth?: Number; /** Enable or disable the palette item text * @Default {true} */ - showPaletteItemText?: boolean; + showPaletteItemText?: Boolean; /** The width of the palette * @Default {250} */ - width?: number; + width?: Number; /** Triggers when a palette item is selected or unselected */ selectionChange? (e: SelectionChangeEventArgs): void; @@ -36620,7 +39045,7 @@ export interface SelectionChangeEventArgs { /** returns whether an element is selected or unselected */ - changeType?: string; + changeType?: String; /** returns the node or connector that is selected or unselected */ @@ -36663,6 +39088,7 @@ class LinearGauge extends ej.Widget { static fn: LinearGauge; constructor(element: JQuery, options?: LinearGauge.Model); constructor(element: Element, options?: LinearGauge.Model); + static Locale: any; model:LinearGauge.Model; defaults:LinearGauge.Model; @@ -37168,7 +39594,7 @@ export interface Model { /** Specifies the scales * @Default {null} */ - scales?: Scales; + scales?: Array; /** Specifies the theme for Linear gauge. See LinearGauge.Themes * @Default {flatlight} @@ -38402,7 +40828,7 @@ export interface ScalesTick { width?: number; } -export interface Scales { +export interface Scale { /** Specifies the backgroundColor of the Scale. * @Default {null} @@ -38699,6 +41125,7 @@ class CircularGauge extends ej.Widget { static fn: CircularGauge; constructor(element: JQuery, options?: CircularGauge.Model); constructor(element: Element, options?: CircularGauge.Model); + static Locale: any; model:CircularGauge.Model; defaults:CircularGauge.Model; @@ -39204,7 +41631,7 @@ export interface Model { /** Specify the pointers, ticks, labels, indicators, ranges of circular gauge * @Default {null} */ - scales?: Scales; + scales?: Array; /** Specify the theme of circular gauge. * @Default {flatlight} @@ -40389,7 +42816,7 @@ export interface ScalesTick { width?: number; } -export interface Scales { +export interface Scale { /** Specify backgroundColor for the scale of circular gauge * @Default {null} @@ -40710,6 +43137,7 @@ class DigitalGauge extends ej.Widget { static fn: DigitalGauge; constructor(element: JQuery, options?: DigitalGauge.Model); constructor(element: Element, options?: DigitalGauge.Model); + static Locale: any; model:DigitalGauge.Model; defaults:DigitalGauge.Model; @@ -40778,7 +43206,7 @@ export interface Model { /** Specifies the items for the DigitalGauge. * @Default {null} */ - items?: Items; + items?: Array; /** Specifies the matrixSegmentData for the DigitalGauge. */ @@ -40840,7 +43268,7 @@ export interface InitEventArgs { /** returns the name of the event */ - type?: string; + type?: String; } export interface ItemRenderingEventArgs { @@ -40867,7 +43295,7 @@ export interface ItemRenderingEventArgs { /** returns the name of the event */ - type?: string; + type?: String; } export interface LoadEventArgs { @@ -40894,7 +43322,7 @@ export interface LoadEventArgs { /** returns the name of the event */ - type?: string; + type?: String; } export interface RenderCompleteEventArgs { @@ -40921,7 +43349,7 @@ export interface RenderCompleteEventArgs { /** returns the name of the event */ - type?: string; + type?: String; } export interface Frame { @@ -41029,7 +43457,7 @@ export interface ItemsSegmentSettings { width?: number; } -export interface Items { +export interface Item { /** Specifies the Character settings for the DigitalGauge. * @Default {null} @@ -41129,6 +43557,7 @@ class Chart extends ej.Widget { static fn: Chart; constructor(element: JQuery, options?: Chart.Model); constructor(element: Element, options?: Chart.Model); + static Locale: any; model:Chart.Model; defaults:Chart.Model; @@ -41244,6 +43673,10 @@ export interface Model { */ primaryXAxis?: PrimaryXAxis; + /** To override x axis for particular series, create an axis object by providing unique name by using name property and add it to axes array. Then, assign the name to the series’s xAxisName property to link both axis and series. + */ + axes?: Array; + /** This is a vertical axis that contains options to configure axis. This is the primary y axis for all the series in series array. To override y axis for particular series, create an axis object by providing unique name by using name property and add it to axes array. Then, assign the name to the series’s yAxisName property to link both axis and series. */ primaryYAxis?: PrimaryYAxis; @@ -41429,11 +43862,11 @@ export interface AxesLabelRenderingEventArgs { /** Formatted text of the respective label. You can also add custom text to the label. */ - LabelText?: string; + LabelText?: String; /** Actual value of the label. */ - LabelValue?: string; + LabelValue?: String; /** Set this option to true to cancel the event. */ @@ -41604,11 +44037,11 @@ export interface DisplayTextRenderingEventArgs { */ locationY?: number; - /** Index of the series in series Collection whose data label is being rendered + /** Index of the series in series Collection whose data label is being rendered */ seriesIndex?: number; - /** Index of the point in series whose data label is being rendered + /** Index of the point in series whose data label is being rendered */ pointIndex?: number; @@ -41909,7 +44342,7 @@ export interface SeriesRenderingEventArgs { export interface SymbolRenderingEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -41932,7 +44365,7 @@ export interface SymbolRenderingEventArgs { export interface TitleRenderingEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -41959,7 +44392,7 @@ export interface TitleRenderingEventArgs { export interface ToolTipInitializeEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -41986,7 +44419,7 @@ export interface ToolTipInitializeEventArgs { export interface TrackAxisToolTipEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42017,7 +44450,7 @@ export interface TrackAxisToolTipEventArgs { export interface TrackToolTipEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42052,7 +44485,7 @@ export interface TrackToolTipEventArgs { export interface AxisLabelClickEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42064,7 +44497,7 @@ export interface AxisLabelClickEventArgs { */ type?: string; - /** X and Y co-ordinate of the labels in chart area. + /** X and Y co-ordinate of the labels in chart area. */ location?: any; @@ -42083,7 +44516,7 @@ export interface AxisLabelClickEventArgs { export interface AxisLabelMouseMoveEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42095,7 +44528,7 @@ export interface AxisLabelMouseMoveEventArgs { */ type?: string; - /** X and Y co-ordinate of the labels in chart area. + /** X and Y co-ordinate of the labels in chart area. */ location?: any; @@ -42114,7 +44547,7 @@ export interface AxisLabelMouseMoveEventArgs { export interface ChartClickEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42126,30 +44559,30 @@ export interface ChartClickEventArgs { */ type?: string; - /** X and Y co-ordinate of the points with respect to chart area. + /** X and Y co-ordinate of the points with respect to chart area. */ location?: any; - /** ID of the target element. + /** ID of the target element. */ id?: string; - /** Width and height of the chart. + /** Width and height of the chart. */ size?: any; - /** x-coordinate of the pointer, relative to the page + /** x-coordinate of the pointer, relative to the page */ pageX?: number; - /** y-coordinate of the pointer, relative to the page + /** y-coordinate of the pointer, relative to the page */ pageY?: number; } export interface ChartMouseMoveEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42161,30 +44594,30 @@ export interface ChartMouseMoveEventArgs { */ type?: string; - /** X and Y co-ordinate of the points with respect to chart area. + /** X and Y co-ordinate of the points with respect to chart area. */ location?: any; - /** ID of the target element. + /** ID of the target element. */ id?: string; - /** Width and height of the chart. + /** Width and height of the chart. */ size?: any; - /** x-coordinate of the pointer, relative to the page + /** x-coordinate of the pointer, relative to the page */ pageX?: number; - /** y-coordinate of the pointer, relative to the page + /** y-coordinate of the pointer, relative to the page */ pageY?: number; } export interface ChartDoubleClickEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42196,30 +44629,30 @@ export interface ChartDoubleClickEventArgs { */ type?: string; - /** X and Y co-ordinate of the points with respect to chart area. + /** X and Y co-ordinate of the points with respect to chart area. */ location?: any; - /** ID of the target element. + /** ID of the target element. */ id?: string; - /** Width and height of the chart. + /** Width and height of the chart. */ size?: any; - /** x-coordinate of the pointer, relative to the page + /** x-coordinate of the pointer, relative to the page */ pageX?: number; - /** y-coordinate of the pointer, relative to the page + /** y-coordinate of the pointer, relative to the page */ pageY?: number; } export interface AnnotationClickEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42231,26 +44664,26 @@ export interface AnnotationClickEventArgs { */ type?: string; - /** X and Y co-ordinate of the annotation in chart area. + /** X and Y co-ordinate of the annotation in chart area. */ location?: any; - /** Information about the annotation, like Coordinate unit, Region, content + /** Information about the annotation, like Coordinate unit, Region, content */ contentData?: any; - /** x-coordinate of the pointer, relative to the page + /** x-coordinate of the pointer, relative to the page */ pageX?: number; - /** y-coordinate of the pointer, relative to the page + /** y-coordinate of the pointer, relative to the page */ pageY?: number; } export interface AfterResizeEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42262,34 +44695,34 @@ export interface AfterResizeEventArgs { */ type?: string; - /** Chart width, after resize + /** Chart width, after resize */ width?: number; - /** Chart height, after resize + /** Chart height, after resize */ height?: number; - /** Chart width, before resize + /** Chart width, before resize */ prevWidth?: number; - /** Chart height, before resize + /** Chart height, before resize */ prevHeight?: number; - /** Chart width, when the chart was first rendered + /** Chart width, when the chart was first rendered */ originalWidth?: number; - /** Chart height, when the chart was first rendered + /** Chart height, when the chart was first rendered */ originalHeight?: number; } export interface BeforeResizeEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42301,26 +44734,26 @@ export interface BeforeResizeEventArgs { */ type?: string; - /** Chart width, before resize + /** Chart width, before resize */ currentWidth?: number; - /** Chart height, before resize + /** Chart height, before resize */ currentHeight?: number; - /** Chart width, after resize + /** Chart width, after resize */ newWidth?: number; - /** Chart height, after resize + /** Chart height, after resize */ newHeight?: number; } export interface ErrorBarRenderingEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -42332,7 +44765,7 @@ export interface ErrorBarRenderingEventArgs { */ type?: string; - /** Error bar Object + /** Error bar Object */ errorbar?: any; } @@ -42735,6 +45168,11 @@ export interface CommonSeriesOptionsMarkerDataLabelFont { */ opacity?: number; + /** Font color of the data label text. + * @Default {null} + */ + color?: string; + /** Font size of the data label. * @Default {12px} */ @@ -42771,6 +45209,16 @@ export interface CommonSeriesOptionsMarkerDataLabel { */ angle?: number; + /** Maximum label width of the data label. + * @Default {null} + */ + maximumLabelWidth?: number; + + /** Enable the wrap option to the data label. + * @Default {false} + */ + enableWrap?: boolean; + /** Options for customizing the border of the data label. */ border?: CommonSeriesOptionsMarkerDataLabelBorder; @@ -42879,6 +45327,29 @@ export interface CommonSeriesOptionsMarker { visible?: boolean; } +export interface CommonSeriesOptionsCornerRadius { + + /** Specifies the radius for the top left corner. + * @Default {0} + */ + topLeft?: number; + + /** Specifies the radius for the top right corner. + * @Default {0} + */ + topRight?: number; + + /** Specifies the radius for the bottom left corner. + * @Default {0} + */ + bottomLeft?: number; + + /** Specifies the radius for the bottom right corner. + * @Default {0} + */ + bottomRight?: number; +} + export interface CommonSeriesOptionsTooltipBorder { /** Border color of the tooltip. @@ -43263,6 +45734,11 @@ export interface CommonSeriesOptions { */ border?: CommonSeriesOptionsBorder; + /** To render the column and bar type series in rectangle/cylinder shape. See ColumnFacet + * @Default {rectangle} + */ + columnFacet?: ej.datavisualization.Chart.ColumnFacet|string; + /** Relative width of the columns in column type series. Value ranges from 0 to 1. Width also depends upon columnSpacing property. * @Default {0.7} */ @@ -43424,6 +45900,10 @@ export interface CommonSeriesOptions { */ startAngle?: number; + /** Options for customizing the corner radius. cornerRadius property also takes the numeric input and applies it for all the four corners of the column. + */ + cornerRadius?: CommonSeriesOptionsCornerRadius; + /** Options for customizing the tooltip of chart. */ tooltip?: CommonSeriesOptionsTooltip; @@ -43473,7 +45953,7 @@ export interface CommonSeriesOptions { */ close?: string; - /** zOrder of the series. + /** Z-order of the series. * @Default {0} */ zOrder?: number; @@ -43513,6 +45993,51 @@ export interface CommonSeriesOptions { selectionSettings?: CommonSeriesOptionsSelectionSettings; } +export interface CrosshairTrackballTooltipSettingsBorder { + + /** Border width of the trackball tooltip. + * @Default {null} + */ + width?: number; + + /** Border color of the trackball tooltip. + * @Default {null} + */ + color?: string; +} + +export interface CrosshairTrackballTooltipSettings { + + /** Options for customizing the trackball tooltip border. + */ + border?: CrosshairTrackballTooltipSettingsBorder; + + /** Background color of the trackball tooltip. + * @Default {null} + */ + fill?: string; + + /** Rounded corner x value of the trackball tooltip. + * @Default {3} + */ + rx?: number; + + /** Rounded corner y value of the trackball tooltip. + * @Default {3} + */ + ry?: number; + + /** Opacity value of the trackball tooltip. + * @Default {1} + */ + opacity?: number; + + /** Specifies the mode of the trackball tooltip. + * @Default {float. See CrosshairMode} + */ + mode?: ej.datavisualization.Chart.CrosshairMode|string; +} + export interface CrosshairMarkerBorder { /** Border width of the marker. @@ -43570,6 +46095,10 @@ export interface CrosshairLine { export interface Crosshair { + /** Options for customizing the trackball tooltip. + */ + trackballTooltipSettings?: CrosshairTrackballTooltipSettings; + /** Options for customizing the marker in crosshair. */ marker?: CrosshairMarker; @@ -44243,6 +46772,107 @@ export interface PrimaryXAxisRange { interval?: number; } +export interface PrimaryXAxisMultiLevelLabelsFont { + + /** Font color of the multi level labels text. + * @Default {null} + */ + color?: string; + + /** Font family of the multi level labels text. + * @Default {Segoe UI} + */ + fontFamily?: string; + + /** Font style of the multi level labels text. + * @Default {Normal} + */ + fontStyle?: ej.datavisualization.Chart.FontStyle|string; + + /** Font weight of the multi level label text. + * @Default {regular} + */ + fontWeight?: string; + + /** Opacity of the multi level label text. + * @Default {1} + */ + opacity?: number; + + /** Font size of the multi level label text. + * @Default {12px} + */ + size?: string; +} + +export interface PrimaryXAxisMultiLevelLabelsBorder { + + /** Border color of the multi level labels. + * @Default {null} + */ + color?: string; + + /** Border width of the multi level labels. + * @Default {1} + */ + width?: number; + + /** Border type of the multi level labels. + * @Default {rectangle. See Type} + */ + type?: ej.datavisualization.Chart.MultiLevelLabelsBorderType|string; +} + +export interface PrimaryXAxisMultiLevelLabel { + + /** Visibility of the multi level labels. + * @Default {false} + */ + visible?: boolean; + + /** Text of the multi level labels. + */ + text?: string; + + /** Starting value of the multi level labels. + * @Default {null} + */ + start?: number; + + /** Ending value of the multi level labels. + * @Default {null} + */ + end?: number; + + /** Specifies the level of multi level labels. + * @Default {0} + */ + level?: number; + + /** Specifies the maximum width of the text in multi level labels. + * @Default {null} + */ + maximumTextWidth?: number; + + /** Specifies the alignment of the text in multi level labels. + * @Default {center. See TextAlignment} + */ + textAlignment?: ej.datavisualization.Chart.TextAlignment|string; + + /** Specifies the handling of text over flow in multi level labels. + * @Default {center. See TextOverflow} + */ + textOverflow?: ej.datavisualization.Chart.TextOverflow|string; + + /** Options for customizing the font of the text. + */ + font?: PrimaryXAxisMultiLevelLabelsFont; + + /** Options for customizing the border of the series. + */ + border?: PrimaryXAxisMultiLevelLabelsBorder; +} + export interface PrimaryXAxisStripLineFont { /** Font color of the strip line text. @@ -44333,6 +46963,19 @@ export interface PrimaryXAxisStripLine { zIndex?: ej.datavisualization.Chart.ZIndex|string; } +export interface PrimaryXAxisLabelBorder { + + /** Specifies the color of the label border. + * @Default {null} + */ + color?: string; + + /** Specifies the width of the label border. + * @Default {1} + */ + width?: number; +} + export interface PrimaryXAxisTitleFont { /** Font family of the title text. @@ -44385,6 +47028,21 @@ export interface PrimaryXAxisTitle { * @Default {true} */ visible?: boolean; + + /** offset value for axis title. + * @Default {0} + */ + offset?: number; + + /** Specifies the position of the axis title. + * @Default {outside. See Position} + */ + position?: ej.datavisualization.Chart.LabelPosition|string; + + /** Specifies the position of the axis title. + * @Default {center. See Alignment} + */ + alignment?: ej.datavisualization.Chart.TextAlignment|string; } export interface PrimaryXAxis { @@ -44431,6 +47089,11 @@ export interface PrimaryXAxis { */ desiredIntervals?: number; + /** Specifies the placement of labels. + * @Default {ej.datavisualization.Chart.LabelPlacement.BetweenTicks. See LabelPlacement} + */ + labelPlacement?: ej.datavisualization.Chart.LabelPlacement|string; + /** Specifies the position of labels at the edge of the axis. * @Default {ej.datavisualization.Chart.EdgeLabelPlacement.None. See EdgeLabelPlacement} */ @@ -44470,6 +47133,11 @@ export interface PrimaryXAxis { */ labelPosition?: ej.datavisualization.Chart.LabelPosition|string; + /** Specifies the position of the axis labels. + * @Default {center. See Alignment} + */ + alignment?: ej.datavisualization.Chart.LabelAlignment|string; + /** Angle in degrees to rotate the axis labels. * @Default {null} */ @@ -44540,6 +47208,11 @@ export interface PrimaryXAxis { */ roundingPlaces?: number; + /** Options for customizing the multi level labels. + * @Default {[ ]} + */ + multiLevelLabels?: Array; + /** Options for customizing the strip lines. * @Default {[ ]} */ @@ -44550,6 +47223,10 @@ export interface PrimaryXAxis { */ tickLinesPosition?: ej.datavisualization.Chart.TickLinesPosition|string; + /** Options for customizing the border of the labels. + */ + labelBorder?: PrimaryXAxisLabelBorder; + /** Options for customizing the axis title. */ title?: PrimaryXAxisTitle; @@ -44575,6 +47252,677 @@ export interface PrimaryXAxis { zoomPosition?: number; } +export interface AxesAlternateGridBandEven { + + /** Fill color for the even grid bands. + * @Default {transparent} + */ + fill?: string; + + /** Opacity of the even grid band. + * @Default {1} + */ + opacity?: number; +} + +export interface AxesAlternateGridBandOdd { + + /** Fill color of the odd grid bands + * @Default {transparent} + */ + fill?: string; + + /** Opacity of odd grid band + * @Default {1} + */ + opacity?: number; +} + +export interface AxesAlternateGridBand { + + /** Options for customizing even grid band. + */ + even?: AxesAlternateGridBandEven; + + /** Options for customizing odd grid band. + */ + odd?: AxesAlternateGridBandOdd; +} + +export interface AxesAxisLine { + + /** Pattern of dashes and gaps to be applied to the axis line. + * @Default {null} + */ + dashArray?: string; + + /** Padding for axis line. Normally, it is used along with plotOffset to pad the plot area. + * @Default {null} + */ + offset?: number; + + /** Show/hides the axis line. + * @Default {true} + */ + visible?: boolean; + + /** Width of axis line. + * @Default {1} + */ + width?: number; +} + +export interface AxesCrosshairLabel { + + /** Show/hides the crosshair label associated with this axis. + * @Default {false} + */ + visible?: boolean; +} + +export interface AxesFont { + + /** Font family of labels. + * @Default {Segoe UI} + */ + fontFamily?: string; + + /** Font style of labels. + * @Default {ej.datavisualization.Chart.FontStyle.Normal. See FontStyle} + */ + fontStyle?: ej.datavisualization.Chart.FontStyle|string; + + /** Font weight of the label. + * @Default {ej.datavisualization.Chart.FontWeight.Regular. See FontWeight} + */ + fontWeight?: ej.datavisualization.Chart.FontWeight|string; + + /** Opacity of the axis labels. + * @Default {1} + */ + opacity?: number; + + /** Font size of the axis labels. + * @Default {13px} + */ + size?: string; +} + +export interface AxesMajorGridLines { + + /** Pattern of dashes and gaps used to stroke the major grid lines. + * @Default {null} + */ + dashArray?: string; + + /** Color of the major grid line. + * @Default {null} + */ + color?: string; + + /** Opacity of major grid lines. + * @Default {1} + */ + opacity?: number; + + /** Show/hides the major grid lines. + * @Default {true} + */ + visible?: boolean; + + /** Width of the major grid lines. + * @Default {1} + */ + width?: number; +} + +export interface AxesMajorTickLines { + + /** Length of the major tick lines. + * @Default {5} + */ + size?: number; + + /** Show/hides the major tick lines. + * @Default {true} + */ + visible?: boolean; + + /** Width of the major tick lines. + * @Default {1} + */ + width?: number; +} + +export interface AxesMinorGridLines { + + /** Patterns of dashes and gaps used to stroke the minor grid lines. + * @Default {null} + */ + dashArray?: string; + + /** Show/hides the minor grid lines. + * @Default {true} + */ + visible?: boolean; + + /** Width of the minorGridLines. + * @Default {1} + */ + width?: number; +} + +export interface AxesMinorTickLines { + + /** Length of the minor tick lines. + * @Default {5} + */ + size?: number; + + /** Show/hides the minor tick lines. + * @Default {true} + */ + visible?: boolean; + + /** Width of the minor tick line. + * @Default {1} + */ + width?: number; +} + +export interface AxesRange { + + /** Minimum value of the axis range. + * @Default {null} + */ + min?: number; + + /** Maximum value of the axis range. + * @Default {null} + */ + max?: number; + + /** Interval of the axis range. + * @Default {null} + */ + interval?: number; +} + +export interface AxesMultiLevelLabelsFont { + + /** Font color of the multi level labels text. + * @Default {null} + */ + color?: string; + + /** Font family of the multi level labels text. + * @Default {Segoe UI} + */ + fontFamily?: string; + + /** Font style of the multi level labels text. + * @Default {Normal} + */ + fontStyle?: ej.datavisualization.Chart.FontStyle|string; + + /** Font weight of the multi level label text. + * @Default {regular} + */ + fontWeight?: string; + + /** Opacity of the multi level label text. + * @Default {1} + */ + opacity?: number; + + /** Font size of the multi level label text. + * @Default {12px} + */ + size?: string; +} + +export interface AxesMultiLevelLabelsBorder { + + /** Border color of the multi level labels. + * @Default {null} + */ + color?: string; + + /** Border width of the multi level labels. + * @Default {1} + */ + width?: number; + + /** Border type of the multi level labels. + * @Default {rectangle. See Type} + */ + type?: ej.datavisualization.Chart.MultiLevelLabelsBorderType|string; +} + +export interface AxesMultiLevelLabel { + + /** Visibility of the multi level labels. + * @Default {false} + */ + visible?: boolean; + + /** Text of the multi level labels. + */ + text?: string; + + /** Starting value of the multi level labels. + * @Default {null} + */ + start?: number; + + /** Ending value of the multi level labels. + * @Default {null} + */ + end?: number; + + /** Specifies the level of multi level labels. + * @Default {0} + */ + level?: number; + + /** Specifies the maximum width of the text in multi level labels. + * @Default {null} + */ + maximumTextWidth?: number; + + /** Specifies the alignment of the text in multi level labels. + * @Default {center. See TextAlignment} + */ + textAlignment?: ej.datavisualization.Chart.TextAlignment|string; + + /** Specifies the handling of text over flow in multi level labels. + * @Default {center. See TextOverflow} + */ + textOverflow?: ej.datavisualization.Chart.TextOverflow|string; + + /** Options for customizing the font of the text. + */ + font?: AxesMultiLevelLabelsFont; + + /** Options for customizing the border of the series. + */ + border?: AxesMultiLevelLabelsBorder; +} + +export interface AxesStripLineFont { + + /** Font color of the strip line text. + * @Default {black} + */ + color?: string; + + /** Font family of the strip line text. + * @Default {Segoe UI} + */ + fontFamily?: string; + + /** Font style of the strip line text. + * @Default {Normal} + */ + fontStyle?: ej.datavisualization.Chart.FontStyle|string; + + /** Font weight of the strip line text. + * @Default {regular} + */ + fontWeight?: string; + + /** Opacity of the strip line text. + * @Default {1} + */ + opacity?: number; + + /** Font size of the strip line text. + * @Default {12px} + */ + size?: string; +} + +export interface AxesStripLine { + + /** Border color of the strip line. + * @Default {gray} + */ + borderColor?: string; + + /** Background color of the strip line. + * @Default {gray} + */ + color?: string; + + /** End value of the strip line. + * @Default {null} + */ + end?: number; + + /** Options for customizing the font of the text. + */ + font?: AxesStripLineFont; + + /** Start value of the strip line. + * @Default {null} + */ + start?: number; + + /** Indicates whether to render the strip line from the minimum/start value of the axis. This property does not work when start property is set. + * @Default {false} + */ + startFromAxis?: boolean; + + /** Specifies text to be displayed inside the strip line. + * @Default {stripLine} + */ + text?: string; + + /** Specifies the alignment of the text inside the strip line. + * @Default {middlecenter. See TextAlignment} + */ + textAlignment?: ej.datavisualization.Chart.TextAlignment|string; + + /** Show/hides the strip line. + * @Default {false} + */ + visible?: boolean; + + /** Width of the strip line. + * @Default {0} + */ + width?: number; + + /** Specifies the order where the strip line and the series have to be rendered. When Z-order is “behind”, strip line is rendered under the series and when it is “over”, it is rendered above the series. + * @Default {over. See ZIndex} + */ + zIndex?: ej.datavisualization.Chart.ZIndex|string; +} + +export interface AxesLabelBorder { + + /** Specifies the color of the label border. + * @Default {null} + */ + color?: string; + + /** Specifies the width of the label border. + * @Default {1} + */ + width?: number; +} + +export interface AxesTitleFont { + + /** Font family of the title text. + * @Default {Segoe UI} + */ + fontFamily?: string; + + /** Font style of the title text. + * @Default {ej.datavisualization.Chart.FontStyle.Normal} + */ + fontStyle?: ej.datavisualization.Chart.FontStyle|string; + + /** Font weight of the title text. + * @Default {ej.datavisualization.Chart.FontWeight.Regular. See FontWeight} + */ + fontWeight?: ej.datavisualization.Chart.FontWeight|string; + + /** Opacity of the axis title text. + * @Default {1} + */ + opacity?: number; + + /** Font size of the axis title. + * @Default {16px} + */ + size?: string; +} + +export interface AxesTitle { + + /** Specifies whether to trim the axis title when it exceeds the chart area or the maximum width of the title. + * @Default {false} + */ + enableTrim?: boolean; + + /** Options for customizing the title font. + */ + font?: AxesTitleFont; + + /** Maximum width of the title, when the title exceeds this width, the title gets trimmed, when enableTrim is true. + * @Default {34} + */ + maximumTitleWidth?: number; + + /** Title for the axis. + */ + text?: string; + + /** Controls the visibility of axis title. + * @Default {true} + */ + visible?: boolean; + + /** offset value for axis title. + * @Default {0} + */ + offset?: number; + + /** Specifies the position of the axis title. + * @Default {outside. See Position} + */ + position?: ej.datavisualization.Chart.LabelPosition|string; + + /** Specifies the position of the axis title. + * @Default {center. See Alignment} + */ + alignment?: ej.datavisualization.Chart.TextAlignment|string; +} + +export interface Axis { + + /** Options for customizing axis alternate grid band. + */ + alternateGridBand?: AxesAlternateGridBand; + + /** Specifies where axis should intersect the vertical axis or vice versa. Value should be provided in axis co-ordinates. If provided value is greater than the maximum value of crossing axis, then axis will be placed at the opposite side. + * @Default {null} + */ + crossesAt?: number; + + /** Category axis can also plot points based on index value of data points. Index based plotting can be enabled by setting ‘isIndexed’ property to true. + * @Default {false} + */ + isIndexed?: boolean; + + /** Options for customizing the axis line. + */ + axisLine?: AxesAxisLine; + + /** Specifies the index of the column where the axis is associated, when the chart area is divided into multiple plot areas by using columnDefinitions. + * @Default {null} + */ + columnIndex?: number; + + /** Specifies the number of columns or plot areas an axis has to span horizontally. + * @Default {null} + */ + columnSpan?: number; + + /** Options to customize the crosshair label. + */ + crosshairLabel?: AxesCrosshairLabel; + + /** With this setting, you can request axis to calculate intervals approximately equal to your desired interval. + * @Default {null} + */ + desiredIntervals?: number; + + /** Specifies the placement of labels. + * @Default {ej.datavisualization.Chart.LabelPlacement.BetweenTicks. See LabelPlacement} + */ + labelPlacement?: ej.datavisualization.Chart.LabelPlacement|string; + + /** Specifies the position of labels at the edge of the axis. + * @Default {ej.datavisualization.Chart.EdgeLabelPlacement.None. See EdgeLabelPlacement} + */ + edgeLabelPlacement?: ej.datavisualization.Chart.EdgeLabelPlacement|string; + + /** Specifies whether to trim the axis label when the width of the label exceeds the maximumLabelWidth. + * @Default {false} + */ + enableTrim?: boolean; + + /** Options for customizing the font of the axis Labels. + */ + font?: AxesFont; + + /** Specifies the type of interval in date time axis. + * @Default {null. See IntervalType} + */ + intervalType?: ej.datavisualization.Chart.IntervalType|string; + + /** Specifies whether to inverse the axis. + * @Default {false} + */ + isInversed?: boolean; + + /** Custom formatting for axis label and supports all standard formatting type of numerical and date time values. + * @Default {null} + */ + labelFormat?: string; + + /** Specifies the action to take when the axis labels are overlapping with each other. + * @Default {ej.datavisualization.Chart.LabelIntersectAction.None. See LabelIntersectAction} + */ + labelIntersectAction?: ej.datavisualization.Chart.LabelIntersectAction|string; + + /** Specifies the position of the axis labels. + * @Default {outside. See LabelPosition} + */ + labelPosition?: ej.datavisualization.Chart.LabelPosition|string; + + /** Specifies the position of the axis labels. + * @Default {center. See Alignment} + */ + alignment?: ej.datavisualization.Chart.LabelAlignment|string; + + /** Angle in degrees to rotate the axis labels. + * @Default {null} + */ + labelRotation?: number; + + /** Logarithmic base value. This is applicable only for logarithmic axis. + * @Default {10} + */ + logBase?: number; + + /** Options for customizing major gird lines. + */ + majorGridLines?: AxesMajorGridLines; + + /** Options for customizing the major tick lines. + */ + majorTickLines?: AxesMajorTickLines; + + /** Maximum number of labels to be displayed in every 100 pixels. + * @Default {3} + */ + maximumLabels?: number; + + /** Maximum width of the axis label. When the label exceeds the width, the label gets trimmed when the enableTrim is set to true. + * @Default {34} + */ + maximumLabelWidth?: number; + + /** Options for customizing the minor grid lines. + */ + minorGridLines?: AxesMinorGridLines; + + /** Options for customizing the minor tick lines. + */ + minorTickLines?: AxesMinorTickLines; + + /** Specifies the number of minor ticks per interval. + * @Default {null} + */ + minorTicksPerInterval?: number; + + /** Unique name of the axis. To associate an axis with the series, you have to set this name to the xAxisName/yAxisName property of the series. + * @Default {null} + */ + name?: string; + + /** Specifies whether to render the axis at the opposite side of its default position. + * @Default {false} + */ + opposedPosition?: boolean; + + /** Specifies the padding for the plot area. + * @Default {10} + */ + plotOffset?: number; + + /** Options to customize the range of the axis. + */ + range?: AxesRange; + + /** Specifies the padding for the axis range. + * @Default {None. See RangePadding} + */ + rangePadding?: ej.datavisualization.Chart.RangePadding|string; + + /** Rounds the number to the given number of decimals. + * @Default {null} + */ + roundingPlaces?: number; + + /** Options for customizing the multi level labels. + * @Default {[ ]} + */ + multiLevelLabels?: Array; + + /** Options for customizing the strip lines. + * @Default {[ ]} + */ + stripLine?: Array; + + /** Specifies the position of the axis tick lines. + * @Default {outside. See TickLinesPosition} + */ + tickLinesPosition?: ej.datavisualization.Chart.TickLinesPosition|string; + + /** Options for customizing the border of the labels. + */ + labelBorder?: AxesLabelBorder; + + /** Options for customizing the axis title. + */ + title?: AxesTitle; + + /** Specifies the type of data the axis is handling. + * @Default {null. See ValueType} + */ + valueType?: ej.datavisualization.Chart.ValueType|string; + + /** Show/hides the axis. + * @Default {true} + */ + visible?: boolean; + + /** The axis is scaled by this factor. When zoomFactor is 0.5, the chart is scaled by 200% along this axis. Value ranges from 0 to 1. + * @Default {1} + */ + zoomFactor?: number; + + /** Position of the zoomed axis. Value ranges from 0 to 1. + * @Default {0} + */ + zoomPosition?: number; +} + export interface PrimaryYAxisAlternateGridBandEven { /** Fill color for the even grid bands. @@ -44771,6 +48119,107 @@ export interface PrimaryYAxisRange { interval?: number; } +export interface PrimaryYAxisMultiLevelLabelsFont { + + /** Font color of the multi level labels text. + * @Default {null} + */ + color?: string; + + /** Font family of the multi level labels text. + * @Default {Segoe UI} + */ + fontFamily?: string; + + /** Font style of the multi level labels text. + * @Default {Normal} + */ + fontStyle?: ej.datavisualization.Chart.FontStyle|string; + + /** Font weight of the multi level label text. + * @Default {regular} + */ + fontWeight?: string; + + /** Opacity of the multi level label text. + * @Default {1} + */ + opacity?: number; + + /** Font size of the multi level label text. + * @Default {12px} + */ + size?: string; +} + +export interface PrimaryYAxisMultiLevelLabelsBorder { + + /** Border color of the multi level labels. + * @Default {null} + */ + color?: string; + + /** Border width of the multi level labels. + * @Default {1} + */ + width?: number; + + /** Border type of the multi level labels. + * @Default {rectangle. See Type} + */ + type?: ej.datavisualization.Chart.MultiLevelLabelsBorderType|string; +} + +export interface PrimaryYAxisMultiLevelLabel { + + /** Visibility of the multi level labels. + * @Default {false} + */ + visible?: boolean; + + /** Text of the multi level labels. + */ + text?: string; + + /** Starting value of the multi level labels. + * @Default {null} + */ + start?: number; + + /** Ending value of the multi level labels. + * @Default {null} + */ + end?: number; + + /** Specifies the level of multi level labels. + * @Default {0} + */ + level?: number; + + /** Specifies the maximum width of the text in multi level labels. + * @Default {null} + */ + maximumTextWidth?: number; + + /** Specifies the alignment of the text in multi level labels. + * @Default {center. See TextAlignment} + */ + textAlignment?: ej.datavisualization.Chart.TextAlignment|string; + + /** Specifies the handling of text over flow in multi level labels. + * @Default {center. See TextOverflow} + */ + textOverflow?: ej.datavisualization.Chart.TextOverflow|string; + + /** Options for customizing the font of the text. + */ + font?: PrimaryYAxisMultiLevelLabelsFont; + + /** Options for customizing the border of the series. + */ + border?: PrimaryYAxisMultiLevelLabelsBorder; +} + export interface PrimaryYAxisStripLineFont { /** Font color of the strip line text. @@ -44861,6 +48310,19 @@ export interface PrimaryYAxisStripLine { zIndex?: ej.datavisualization.Chart.ZIndex|string; } +export interface PrimaryYAxisLabelBorder { + + /** Specifies the color of the label border. + * @Default {null} + */ + color?: string; + + /** Specifies the width of the label border. + * @Default {1} + */ + width?: number; +} + export interface PrimaryYAxisTitleFont { /** Font family of the title text. @@ -44913,6 +48375,21 @@ export interface PrimaryYAxisTitle { * @Default {true} */ visible?: boolean; + + /** offset value for axis title. + * @Default {0} + */ + offset?: number; + + /** Specifies the position of the axis title. + * @Default {outside. See Position} + */ + position?: ej.datavisualization.Chart.LabelPosition|string; + + /** Specifies the position of the axis title. + * @Default {center. See Alignment} + */ + alignment?: ej.datavisualization.Chart.TextAlignment|string; } export interface PrimaryYAxis { @@ -44944,6 +48421,11 @@ export interface PrimaryYAxis { */ desiredIntervals?: number; + /** Specifies the placement of labels. + * @Default {ej.datavisualization.Chart.LabelPlacement.BetweenTicks. See LabelPlacement} + */ + labelPlacement?: ej.datavisualization.Chart.LabelPlacement|string; + /** Specifies the position of labels at the edge of the axis. * @Default {ej.datavisualization.Chart.EdgeLabelPlacement.None. See EdgeLabelPlacement} */ @@ -44983,6 +48465,11 @@ export interface PrimaryYAxis { */ labelPosition?: ej.datavisualization.Chart.LabelPosition|string; + /** Specifies the position of the axis labels. + * @Default {center. See Alignment} + */ + alignment?: ej.datavisualization.Chart.LabelAlignment|string; + /** Logarithmic base value. This is applicable only for logarithmic axis. * @Default {10} */ @@ -45058,6 +48545,11 @@ export interface PrimaryYAxis { */ rowSpan?: number; + /** Options for customizing the multi level labels. + * @Default {[ ]} + */ + multiLevelLabels?: Array; + /** Options for customizing the strip lines. * @Default {[ ]} */ @@ -45068,6 +48560,10 @@ export interface PrimaryYAxis { */ tickLinesPosition?: ej.datavisualization.Chart.TickLinesPosition|string; + /** Options for customizing the border of the labels. + */ + labelBorder?: PrimaryYAxisLabelBorder; + /** Options for customizing the axis title. */ title?: PrimaryYAxisTitle; @@ -45223,6 +48719,11 @@ export interface SeriesMarkerDataLabelFont { */ fontFamily?: string; + /** Font color of the data label text. + * @Default {null} + */ + color?: string; + /** Font style of the data label. * @Default {normal. See FontStyle} */ @@ -45274,6 +48775,16 @@ export interface SeriesMarkerDataLabel { */ angle?: number; + /** Maximum label width of the data label. + * @Default {null} + */ + maximumLabelWidth?: number; + + /** Enable the wrap option to the data label. + * @Default {false} + */ + enableWrap?: boolean; + /** Options for customizing the border of the data label. */ border?: SeriesMarkerDataLabelBorder; @@ -45838,6 +49349,29 @@ export interface SeriesPoint { y?: number; } +export interface SeriesCornerRadius { + + /** Specifies the radius for the top left corner. + * @Default {0} + */ + topLeft?: number; + + /** Specifies the radius for the top right corner. + * @Default {0} + */ + topRight?: number; + + /** Specifies the radius for the bottom left corner. + * @Default {0} + */ + bottomLeft?: number; + + /** Specifies the radius for the bottom right corner. + * @Default {0} + */ + bottomRight?: number; +} + export interface SeriesTooltipBorder { /** Border Color of the tooltip. @@ -46079,6 +49613,11 @@ export interface Series { */ bullFillColor?: string; + /** To render the column and bar type series in rectangle/cylinder shape. See ColumnFacet + * @Default {rectangle} + */ + columnFacet?: ej.datavisualization.Chart.ColumnFacet|string; + /** Relative width of the columns in column type series. Value ranges from 0 to 1. Width also depends upon columnSpacing property. * @Default {0.7} */ @@ -46111,7 +49650,7 @@ export interface Series { /** Type of series to be drawn in radar or polar series. * @Default {line. See DrawType} */ - drawType?: boolean; + drawType?: ej.datavisualization.Chart.DrawType|string; /** Enable/disable the animation of series. * @Default {false} @@ -46261,6 +49800,10 @@ export interface Series { */ startAngle?: number; + /** Options for customizing the corner radius. cornerRadius property also takes the numeric input and applies it for all the four corners of the column. + */ + cornerRadius?: SeriesCornerRadius; + /** Options for customizing the tooltip of chart. */ tooltip?: SeriesTooltip; @@ -46325,7 +49868,7 @@ export interface Series { */ pointColorMappingName?: string; - /** zOrder of the series. + /** Z-order of the series. * @Default {0} */ zOrder?: number; @@ -46646,6 +50189,16 @@ Pixel, } module Chart { +enum ColumnFacet +{ +//string +Rectangle, +//string +Cylinder, +} +} +module Chart +{ enum DrawType { //string @@ -46962,6 +50515,16 @@ Y, } module Chart { +enum CrosshairMode +{ +//string +Float, +//string +Grouping, +} +} +module Chart +{ enum CrosshairType { //string @@ -47012,6 +50575,16 @@ WrapAndTrim, } module Chart { +enum LabelPlacement +{ +//string +OnTicks, +//string +BetweenTicks, +} +} +module Chart +{ enum EdgeLabelPlacement { //string @@ -47066,6 +50639,18 @@ MultipleRows, } module Chart { +enum LabelAlignment +{ +//string +Near, +//string +Far, +//string +Center, +} +} +module Chart +{ enum RangePadding { //string @@ -47080,6 +50665,22 @@ Round, } module Chart { +enum MultiLevelLabelsBorderType +{ +//string +Rectangle, +//string +None, +//string +WithoutTopAndBottom, +//string +Brace, +//string +CurlyBrace, +} +} +module Chart +{ enum TextAlignment { //string @@ -47155,6 +50756,7 @@ class RangeNavigator extends ej.Widget { static fn: RangeNavigator; constructor(element: JQuery, options?: RangeNavigator.Model); constructor(element: Element, options?: RangeNavigator.Model); + static Locale: any; model:RangeNavigator.Model; defaults:RangeNavigator.Model; @@ -48269,6 +51871,7 @@ class BulletGraph extends ej.Widget { static fn: BulletGraph; constructor(element: JQuery, options?: BulletGraph.Model); constructor(element: Element, options?: BulletGraph.Model); + static Locale: any; model:BulletGraph.Model; defaults:BulletGraph.Model; @@ -49308,6 +52911,7 @@ class Barcode extends ej.Widget { static fn: Barcode; constructor(element: JQuery, options?: Barcode.Model); constructor(element: Element, options?: Barcode.Model); + static Locale: any; model:Barcode.Model; defaults:Barcode.Model; @@ -49462,6 +53066,7 @@ class Map extends ej.Widget { static fn: Map; constructor(element: JQuery, options?: Map.Model); constructor(element: Element, options?: Map.Model); + static Locale: any; model:Map.Model; defaults:Map.Model; @@ -49703,6 +53308,36 @@ export interface NavigationControl { orientation?: ej.datavisualization.Map.LabelOrientation|string; } +export interface LayersBubbleSettingsColorMappingsRangeColorMapping { + + /** Start range colorMappings in the bubble layer. + * @Default {null} + */ + from?: number; + + /** End range colorMappings in the bubble layer. + * @Default {null} + */ + to?: number; + + /** GradientColors in the bubble layer of map. + */ + gradientColors?: Array; + + /** Color of the bubble layer. + * @Default {null} + */ + color?: string; +} + +export interface LayersBubbleSettingsColorMappings { + + /** Specifies the range colorMappings in the bubble layer. + * @Default {null} + */ + rangeColorMapping?: Array; +} + export interface LayersBubbleSettings { /** Specifies the bubble Opacity value of bubbles for shape layer in map @@ -49718,7 +53353,7 @@ export interface LayersBubbleSettings { /** Specifies the colorMappings of the shape layer in map * @Default {null} */ - colorMappings?: any; + colorMappings?: LayersBubbleSettingsColorMappings; /** Specifies the bubble color valuePath of the shape layer in map * @Default {null} @@ -49761,7 +53396,7 @@ export interface LayersLabelSettings { /** enable or disable the enableSmartLabel property * @Default {false} */ - enableSmartLabel?: boolean; + enableSmartLabel?: Boolean; /** set the labelLength property * @Default {'2'} @@ -50245,6 +53880,7 @@ class TreeMap extends ej.Widget { static fn: TreeMap; constructor(element: JQuery, options?: TreeMap.Model); constructor(element: Element, options?: TreeMap.Model); + static Locale: any; model:TreeMap.Model; defaults:TreeMap.Model; @@ -50516,7 +54152,7 @@ export interface LegendSettings { */ template?: string; - /** Specifies the mode for legendSettings whether defaul or interactive mode + /** Specifies the mode for legendSettings whether default or interactive mode * @Default {default} */ mode?: string; @@ -50776,6 +54412,7 @@ class Diagram extends ej.Widget { static fn: Diagram; constructor(element: JQuery, options?: Diagram.Model); constructor(element: Element, options?: Diagram.Model); + static Locale: any; model:Diagram.Model; defaults:Diagram.Model; @@ -50841,6 +54478,11 @@ class Diagram extends ej.Widget { */ clear(): void; + /** Clears the actions which is recorded to perform undo/redo operation in the diagram. + * @returns {void} + */ + clearHistory(): void; + /** Remove the current selection in diagram * @returns {void} */ @@ -50857,10 +54499,10 @@ class Diagram extends ej.Widget { cut(): void; /** Export the diagram as downloadable files or as data - * @param {Diagram.Options} options to export the desired region of diagram to the desired formats.NameTypeDescriptionfileNamestringname of the file to be downloaded.formatstringformat of the exported file/data. See [File Formats](/js/api/global#fileformats).modestringto set whether to export diagram as a file or as raw data. See [Export Modes](/js/api/global#exportmodes).regionstringto set the region of the diagram to be exported. See [Region](/js/api/global#region).boundsobjectto export any custom region of diagram.marginobjectto set margin to the exported data. - * @returns {string} + * @param {Diagram.Options} options to export the desired region of diagram to the desired formats.NameTypeDescriptionfileNamestringname of the file to be downloaded.formatstringformat of the exported file/data. See [File Formats](/api/js/global#fileformats).modestringto set whether to export diagram as a file or as raw data. See [Export Modes](/api/js/global#exportmodes).regionstringto set the region of the diagram to be exported. See [Region](/api/js/global#region).boundsobjectto export any custom region of diagram.marginobjectto set margin to the exported data. + * @returns {String} */ - exportDiagram(options?: Diagram.Options): string; + exportDiagram(options?: Diagram.Options): String; /** Read a node/connector object by its name * @param {string} name of the node/connector that is to be identified @@ -50869,8 +54511,8 @@ class Diagram extends ej.Widget { findNode(name: string): any; /** Fit the diagram content into diagram viewport - * @param {string} to set the mode of fit to command. See [Fit Mode](/js/api/global#fitmode) - * @param {string} to set whether the region to be fit will be based on diagram elements or page settings [Region](/js/api/global#region) + * @param {string} to set the mode of fit to command. See [Fit Mode](/api/js/global#fitmode) + * @param {string} to set whether the region to be fit will be based on diagram elements or page settings [Region](/api/js/global#region) * @param {any} to set the required margin * @returns {void} */ @@ -51093,15 +54735,15 @@ export interface Options { */ fileName?: string; - /** format of the exported file/data. See [File Formats](/js/api/global#fileformats). + /** format of the exported file/data. See [File Formats](/api/js/global#fileformats). */ format?: string; - /** to set whether to export diagram as a file or as raw data. See [Export Modes](/js/api/global#exportmodes). + /** to set whether to export diagram as a file or as raw data. See [Export Modes](/api/js/global#exportmodes). */ mode?: string; - /** to set the region of the diagram to be exported. See [Region](/js/api/global#region). + /** to set the region of the diagram to be exported. See [Region](/api/js/global#region). */ region?: string; @@ -51170,12 +54812,12 @@ export interface Model { /** Enables or disables auto scroll in diagram * @Default {true} */ - enableAutoScroll?: boolean; + enableAutoScroll?: Boolean; /** Enables or disables diagram context menu * @Default {true} */ - enableContextMenu?: boolean; + enableContextMenu?: Boolean; /** Specifies the height of the diagram * @Default {null} @@ -51220,7 +54862,7 @@ export interface Model { /** Enables or disables tooltip of diagram * @Default {true} */ - showTooltip?: boolean; + showTooltip?: Boolean; /** Defines the gridlines and defines how and when the objects have to be snapped */ @@ -51288,6 +54930,9 @@ export interface Model { /** Triggers when a symbol is dragged and dropped from symbol palette to drawing area */ drop? (e: DropEventArgs): void; + /** Triggers when editor got focus at the time of node's label or text node editing. */ + editorFocusChange? (e: EditorFocusChangeEventArgs): void; + /** Triggers when a child is added to or removed from a group */ groupChange? (e: GroupChangeEventArgs): void; @@ -51339,6 +54984,10 @@ export interface AutoScrollChangeEventArgs { /** Returns the delay between subsequent auto scrolls */ delay?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ClickEventArgs { @@ -51366,6 +55015,10 @@ export interface ClickEventArgs { /** parameter returns the actual click event arguments that explains which button is clicked */ event?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ConnectionChangeEventArgs { @@ -51385,6 +55038,10 @@ export interface ConnectionChangeEventArgs { /** parameter defines whether to cancel the change or not */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ConnectorCollectionChangeEventArgs { @@ -51400,6 +55057,14 @@ export interface ConnectorCollectionChangeEventArgs { /** parameter defines whether to cancel the collection change or not */ cancel?: boolean; + + /** triggers before and after adding the connector in the diagram which can be differentiated through `state` argument. We can cancel the event only before adding the connector. + */ + state?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ConnectorSourceChangeEventArgs { @@ -51427,6 +55092,10 @@ export interface ConnectorSourceChangeEventArgs { /** parameter defines whether to cancel the change or not */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ConnectorTargetChangeEventArgs { @@ -51454,6 +55123,10 @@ export interface ConnectorTargetChangeEventArgs { /** parameter defines whether to cancel the change or not */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ContextMenuBeforeOpenEventArgs { @@ -51469,6 +55142,10 @@ export interface ContextMenuBeforeOpenEventArgs { /** parameter returns the object that was clicked */ target?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ContextMenuClickEventArgs { @@ -51496,6 +55173,10 @@ export interface ContextMenuClickEventArgs { /** parameter defines whether to execute the click event or not */ canExecute?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DoubleClickEventArgs { @@ -51507,6 +55188,10 @@ export interface DoubleClickEventArgs { /** parameter returns the selected object */ element?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DragEventArgs { @@ -51530,6 +55215,10 @@ export interface DragEventArgs { /** parameter returns whether or not to cancel the drag event */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DragEnterEventArgs { @@ -51541,6 +55230,10 @@ export interface DragEnterEventArgs { /** parameter returns whether to add or remove the symbol from diagram */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DragLeaveEventArgs { @@ -51548,6 +55241,10 @@ export interface DragLeaveEventArgs { /** parameter returns the node or connector that is dragged outside of the diagram */ element?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DragOverEventArgs { @@ -51575,6 +55272,10 @@ export interface DragOverEventArgs { /** parameter returns whether or not to cancel the dragOver event */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface DropEventArgs { @@ -51597,7 +55298,14 @@ export interface DropEventArgs { /** parameter returns the enum which defines the type of the source */ - sourceType?: string; + sourceType?: String; + + /** parameter returns the id of the diagram + */ + diagramId?: string; +} + +export interface EditorFocusChangeEventArgs { } export interface GroupChangeEventArgs { @@ -51617,6 +55325,10 @@ export interface GroupChangeEventArgs { /** parameter returns the cause of group change("group", unGroup") */ cause?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface HistoryChangeEventArgs { @@ -51628,6 +55340,10 @@ export interface HistoryChangeEventArgs { /** A collection of objects that are changed in the last undo/redo */ Source?: Array; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ItemClickEventArgs { @@ -51647,6 +55363,10 @@ export interface ItemClickEventArgs { /** parameter returns the actual click event arguments that explains which button is clicked */ event?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface MouseEnterEventArgs { @@ -51662,6 +55382,10 @@ export interface MouseEnterEventArgs { /** parameter returns the target object over which the selected object is dragged */ target?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface MouseLeaveEventArgs { @@ -51677,6 +55401,10 @@ export interface MouseLeaveEventArgs { /** parameter returns the target object over which the selected object is dragged */ target?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface MouseOverEventArgs { @@ -51692,6 +55420,10 @@ export interface MouseOverEventArgs { /** parameter returns the object over which the element is being dragged. */ target?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface NodeCollectionChangeEventArgs { @@ -51707,6 +55439,14 @@ export interface NodeCollectionChangeEventArgs { /** parameter defines whether to cancel the collection change or not */ cancel?: boolean; + + /** triggers before and after adding the node in the diagram which can be differentiated through `state` argument. We can cancel the event only before adding the node + */ + state?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface PropertyChangeEventArgs { @@ -51717,7 +55457,7 @@ export interface PropertyChangeEventArgs { /** parameter returns the action is nudge or not */ - cause?: string; + cause?: String; /** parameter returns the new value of the node property that is being changed */ @@ -51730,6 +55470,10 @@ export interface PropertyChangeEventArgs { /** parameter returns the name of the property that is changed */ propertyName?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface RotationChangeEventArgs { @@ -51749,6 +55493,10 @@ export interface RotationChangeEventArgs { /** parameter to specify whether or not to cancel the event */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface ScrollChangeEventArgs { @@ -51760,6 +55508,10 @@ export interface ScrollChangeEventArgs { /** parameter returns the previous zoom value, horizontal and vertical scroll offsets. */ oldValues?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface SegmentChangeEventArgs { @@ -51779,6 +55531,10 @@ export interface SegmentChangeEventArgs { /** parameter to specify whether or not to cancel the event */ cancel?: boolean; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface SelectionChangeEventArgs { @@ -51806,6 +55562,14 @@ export interface SelectionChangeEventArgs { /** parameter to specify whether or not to cancel the selection change event */ cancel?: boolean; + + /** triggers before and after adding the selection to the object in the diagram which can be differentiated through `state` argument. We can cancel the event only before the selection of the object. + */ + state?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface SizeChangeEventArgs { @@ -51833,6 +55597,10 @@ export interface SizeChangeEventArgs { /** parameter returns the difference between new and old value */ offset?: any; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface TextChangeEventArgs { @@ -51848,6 +55616,10 @@ export interface TextChangeEventArgs { /** parameter returns the keyCode of the key entered */ keyCode?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface CreateEventArgs { @@ -51859,6 +55631,10 @@ export interface CreateEventArgs { /** Returns the name of the event */ type?: string; + + /** parameter returns the id of the diagram + */ + diagramId?: string; } export interface BackgroundImage { @@ -51867,16 +55643,6 @@ export interface BackgroundImage { * @Default {ej.datavisualization.Diagram.ImageAlignment.XMidYMid} */ alignment?: ej.datavisualization.Diagram.ImageAlignment |string; - - /** Defines how the background image should be scaled/stretched - * @Default {ej.datavisualization.Diagram.ScaleConstraints.Meet} - */ - scale?: ej.datavisualization.Diagram.ScaleConstraints |string; - - /** Sets the source path of the background image - * @Default {null} - */ - source?: string; } export interface CommandManagerCommandsGesture { @@ -51953,7 +55719,7 @@ export interface ConnectorsLabel { /** Enables/disables the bold style * @Default {false} */ - bold?: boolean; + bold?: Boolean; /** Sets the border color of the label * @Default {transparent} @@ -51968,7 +55734,7 @@ export interface ConnectorsLabel { /** Defines whether the label should be aligned within the connector boundaries * @Default {true} */ - boundaryConstraints?: boolean; + boundaryConstraints?: Boolean; /** Sets the fill color of the text area * @Default {transparent} @@ -51998,7 +55764,7 @@ export interface ConnectorsLabel { /** Enables/disables the italic style * @Default {false} */ - italic?: boolean; + italic?: Boolean; /** Gets whether the label is currently being edited or not. * @Default {ej.datavisualization.Diagram.LabelEditMode.Edit} @@ -52027,7 +55793,7 @@ export interface ConnectorsLabel { /** Defines whether the label is editable or not * @Default {false} */ - readOnly?: boolean; + readOnly?: Boolean; /** Defines whether the label should be positioned whether relative to segments or connector boundaries * @Default {ej.datavisualization.Diagram.LabelRelativeMode.SegmentPath} @@ -52066,7 +55832,7 @@ export interface ConnectorsLabel { /** Enables or disables the visibility of the label * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** Sets the width of the label(the maximum value of label width and the connector width will be considered as label width) * @Default {50} @@ -52121,6 +55887,41 @@ export interface ConnectorsSegment { vector2?: any; } +export interface ConnectorsShapeMultiplicitySource { + + /** Defines the source label to connector. Applicable, if the connector is of type "UML" + * @Default {true} + */ + optional?: boolean; + + /** Defines the source label to connector. Applicable, if the connector is of type "UML" + * @Default {null} + */ + lowerBounds?: number; + + /** Defines the source label to connector. Applicable, if the connector is of type "UML" + * @Default {null} + */ + upperBounds?: number; +} + +export interface ConnectorsShapeMultiplicity { + + /** Sets the type of the multiplicity. Applicable, if the connector is of type "classifier" + * @Default {ej.datavisualization.Diagram.Multiplicity.OneToOne} + */ + type?: ej.datavisualization.Diagram.Multiplicity|string; + + /** Defines the source label to connector. Applicable, if the connector is of type "UML" + */ + source?: ConnectorsShapeMultiplicitySource; + + /** Defines the target label to connector. Applicable, if the connector is of type "UML" + * @Default {true} + */ + target?: ej.datavisualization.Diagram.ConnectorsShapeMultiplicitySource|string; +} + export interface ConnectorsShape { /** Sets the type of the connector @@ -52151,11 +55952,12 @@ export interface ConnectorsShape { /** Defines the role of the connector in a UML Class Diagram. Applicable, if the type of the connector is "classifier". * @Default {ej.datavisualization.Diagram.ClassifierShapes.Association} */ - relationship?: string; + relationship?: ej.datavisualization.Diagram.ClassifierShapes|string; - /** Defines the multiplicity of a relationship in UML class diagram + /** Defines the multiplicity option of the connector + * @Default {null} */ - multiplicity?: string; + multiplicity?: ConnectorsShapeMultiplicity; } export interface ConnectorsSourceDecorator { @@ -52402,7 +56204,7 @@ export interface Connector { /** Enables or disables the visibility of connector * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** Sets the z-index of the connector * @Default {0} @@ -52420,7 +56222,7 @@ export interface ContextMenu { /** To set whether to display the default context menu items or not * @Default {false} */ - showCustomMenuItemsOnly?: boolean; + showCustomMenuItemsOnly?: Boolean; } export interface DataSourceSettings { @@ -52495,6 +56297,16 @@ export interface HistoryManager { */ redo?: Function; + /** The redoStack property is used to get the number of redo actions to be stored on the history manager. Its an read-only property and the collection should not be modified. + * @Default {[]} + */ + redoStack?: Array; + + /** The stackLimit property used to restrict the undo and redo actions to a certain limit. + * @Default {null} + */ + stackLimit?: number; + /** A method that starts to group the changes to revert/restore them in a single undo or redo */ startGroupAction?: Function; @@ -52502,6 +56314,11 @@ export interface HistoryManager { /** Defines what should be happened while trying to revert a custom change */ undo?: Function; + + /** The undoStack property is used to get the number of undo actions to be stored on the history manager. Its an read-only property and the collection should not be modified. + * @Default {[]} + */ + undoStack?: Array; } export interface Layout { @@ -52629,6 +56446,54 @@ export interface NodesClass { methods?: Array; } +export interface NodesCollapseIcon { + + /** Sets the border color for collapse icon of node + * @Default {black} + */ + borderColor?: string; + + /** Sets the border width for collapse icon of node + * @Default {1} + */ + borderWidth?: number; + + /** Sets the fill color for collapse icon of node + * @Default {white} + */ + fillColor?: string; + + /** Defines the height for collapse icon of node + * @Default {15} + */ + height?: number; + + /** Sets the horizontal alignment of the icon. + * @Default {ej.datavisualization.Diagram.HorizontalAlignment.Center} + */ + horizontalAlignment?: ej.datavisualization.Diagram.HorizontalAlignment|string; + + /** To set the margin for the collapse icon of node + * @Default {ej.datavisualization.Diagram.Margin()} + */ + margin?: any; + + /** Sets the fraction/ratio(relative to node) that defines the position of the icon + * @Default {ej.datavisualization.Diagram.Point(0.5, 1)} + */ + offset?: any; + + /** Defines the shape of the collapsed state of the node. + * @Default {ej.datavisualization.Diagram.IconShapes.None} + */ + shape?: ej.datavisualization.Diagram.IconShapes|string; + + /** Sets the vertical alignment of the icon. + * @Default {ej.datavisualization.Diagram.VerticalAlignment.Center} + */ + verticalAlignment?: ej.datavisualization.Diagram.VerticalAlignment|string; +} + export interface NodesContainer { /** Defines the orientation of the container. Applicable, if the group is a container. @@ -52652,7 +56517,7 @@ export interface NodesData { /** Defines whether the BPMN data object is a collection or not * @Default {false} */ - collection?: boolean; + collection?: Boolean; } export interface NodesEnumerationMember { @@ -52674,6 +56539,54 @@ export interface NodesEnumeration { members?: Array; } +export interface NodesExpandIcon { + + /** Sets the border color for expand icon of node + * @Default {black} + */ + borderColor?: string; + + /** Sets the border width for expand icon of node + * @Default {1} + */ + borderWidth?: number; + + /** Sets the fill color for expand icon of node + * @Default {white} + */ + fillColor?: string; + + /** Defines the height for expand icon of node + * @Default {15} + */ + height?: number; + + /** Sets the horizontal alignment of the icon. + * @Default {ej.datavisualization.Diagram.HorizontalAlignment.Center} + */ + horizontalAlignment?: ej.datavisualization.Diagram.HorizontalAlignment|string; + + /** To set the margin for the expand icon of node + * @Default {ej.datavisualization.Diagram.Margin()} + */ + margin?: any; + + /** Sets the fraction/ratio(relative to node) that defines the position of the icon + * @Default {ej.datavisualization.Diagram.Point(0.5, 1)} + */ + offset?: any; + + /** Defines the shape of the expanded state of the node. + * @Default {ej.datavisualization.Diagram.IconShapes.None} + */ + shape?: ej.datavisualization.Diagram.IconShapes|string; + + /** Sets the vertical alignment of the icon. + * @Default {ej.datavisualization.Diagram.VerticalAlignment.Center} + */ + verticalAlignment?: ej.datavisualization.Diagram.VerticalAlignment|string; +} + export interface NodesGradientLinearGradient { /** Defines the different colors and the region of color transitions @@ -52806,7 +56719,7 @@ export interface NodesLabel { /** Enables/disables the bold style * @Default {false} */ - bold?: boolean; + bold?: Boolean; /** Sets the border color of the label * @Default {transparent} @@ -52846,7 +56759,7 @@ export interface NodesLabel { /** Enables/disables the italic style * @Default {false} */ - italic?: boolean; + italic?: Boolean; /** To set the margin of the label * @Default {ej.datavisualization.Diagram.Margin()} @@ -52875,7 +56788,7 @@ export interface NodesLabel { /** Defines whether the label is editable or not * @Default {false} */ - readOnly?: boolean; + readOnly?: Boolean; /** Defines the angle to which the label needs to be rotated * @Default {0} @@ -52904,7 +56817,7 @@ export interface NodesLabel { /** Enables or disables the visibility of the label * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** Sets the width of the label(the maximum value of label width and the node width will be considered as label width) * @Default {50} @@ -52957,7 +56870,7 @@ export interface NodesLane { /** Defines the object as a lane * @Default {false} */ - isLane?: boolean; + isLane?: Boolean; /** Sets the unique identifier of the lane */ @@ -52974,7 +56887,7 @@ export interface NodesPaletteItem { /** Defines whether the symbol should be drawn at its actual size regardless of precedence factors or not * @Default {true} */ - enableScale?: boolean; + enableScale?: Boolean; /** Defines the height of the symbol * @Default {0} @@ -53123,7 +57036,7 @@ export interface NodesSubProcess { /** Defines whether the BPMN sub process is without any prescribed order or not * @Default {false} */ - adhoc?: boolean; + adhoc?: Boolean; /** Sets the boundary of the BPMN process * @Default {ej.datavisualization.Diagram.BPMNBoundary.Default} @@ -53133,12 +57046,12 @@ export interface NodesSubProcess { /** Sets whether the BPMN subprocess is triggered as a compensation of a specific activity * @Default {false} */ - compensation?: boolean; + compensation?: Boolean; /** Sets whether the BPMN subprocess is triggered as a collapsed of a specific activity * @Default {true} */ - collapsed?: boolean; + collapsed?: Boolean; /** Sets the type of the event by which the sub-process will be triggered * @Default {ej.datavisualization.Diagram.BPMNEvents.Start} @@ -53154,6 +57067,11 @@ export interface NodesSubProcess { */ loop?: ej.datavisualization.Diagram.BPMNLoops|string; + /** Defines the children for BPMN's SubProcess + * @Default {[]} + */ + Processes?: Array; + /** Defines the type of the event trigger * @Default {ej.datavisualization.Diagram.BPMNTriggers.Message} */ @@ -53170,12 +57088,12 @@ export interface NodesTask { /** To set whether the task is a global task or not * @Default {false} */ - call?: boolean; + call?: Boolean; /** Sets whether the task is triggered as a compensation of another specific activity * @Default {false} */ - compensation?: boolean; + compensation?: Boolean; /** Sets the loop type of a BPMN task. * @Default {ej.datavisualization.Diagram.BPMNLoops.None} @@ -53222,7 +57140,7 @@ export interface Node { /** Defines whether the group can be ungrouped or not * @Default {true} */ - canUngroup?: boolean; + canUngroup?: Boolean; /** Array of JSON objects where each object represents a child node/connector * @Default {[]} @@ -53239,6 +57157,10 @@ export interface Node { */ class?: NodesClass; + /** Defines the state of the node is collapsed. + */ + collapseIcon?: NodesCollapseIcon; + /** Defines the distance to be left between a node and its connections(In coming and out going connections). * @Default {0} */ @@ -53280,7 +57202,11 @@ export interface Node { /** Defines whether the node can be automatically arranged using layout or not * @Default {false} */ - excludeFromLayout?: boolean; + excludeFromLayout?: Boolean; + + /** Defines the state of the node is expanded or collapsed. + */ + expandIcon?: NodesExpandIcon; /** Defines the fill color of the node * @Default {white} @@ -53329,12 +57255,12 @@ export interface Node { /** Defines whether the sub tree of the node is expanded or collapsed * @Default {true} */ - isExpanded?: boolean; + isExpanded?: Boolean; /** Sets the node as a swimlane * @Default {false} */ - isSwimlane?: boolean; + isSwimlane?: Boolean; /** A collection of objects where each object represents a label * @Default {[]} @@ -53478,11 +57404,6 @@ export interface Node { */ rotateAngle?: number; - /** Defines how the node should be scaled/stretched - * @Default {ej.datavisualization.Diagram.ScaleConstraints.Meet} - */ - scale?: ej.datavisualization.Diagram.ScaleConstraints |string; - /** Defines the opacity and the position of shadow * @Default {ej.datavisualization.Diagram.Shadow()} */ @@ -53539,7 +57460,7 @@ export interface Node { /** Defines the visibility of the node * @Default {true} */ - visible?: boolean; + visible?: Boolean; /** Defines the width of the node * @Default {0} @@ -53562,7 +57483,7 @@ export interface PageSettings { /** Sets whether multiple pages can be created to fit all nodes and connectors * @Default {false} */ - multiplePage?: boolean; + multiplePage?: Boolean; /** Defines the background color of diagram pages * @Default {#ffffff} @@ -53617,7 +57538,7 @@ export interface PageSettings { /** Enables or disables the page breaks * @Default {false} */ - showPageBreak?: boolean; + showPageBreak?: Boolean; } export interface ScrollSettings { @@ -53668,7 +57589,7 @@ export interface SelectedItemsUserHandle { /** Defines whether the user handle should be added, when more than one element is selected * @Default {false} */ - enableMultiSelection?: boolean; + enableMultiSelection?: Boolean; /** Sets the stroke color of the user handle * @Default {transparent} @@ -53696,7 +57617,7 @@ export interface SelectedItemsUserHandle { /** Defines the visibility of the user handle * @Default {true} */ - visible?: boolean; + visible?: Boolean; } export interface SelectedItems { @@ -53801,7 +57722,7 @@ export interface SnapSettings { /** Enables or disables snapping nodes/connectors to objects * @Default {true} */ - enableSnapToObject?: boolean; + enableSnapToObject?: Boolean; /** Defines the appearance of horizontal gridlines */ @@ -53862,11 +57783,11 @@ export interface Tooltip { } module Diagram { -enum ImageAlignment +enum ImageAlignment { //Scales the graphic content non-uniformly to the width and height of the diagram area None, -//Used to align the image at the top left of diagram area +//Used to align the image at the top left of diagram area XMinYMin, //Used to align the image at the left center of diagram area XMinYMid, @@ -53888,18 +57809,6 @@ XMaxYMax, } module Diagram { -enum ScaleConstraints -{ -//Used to scale the image non-uniformly to the given width/height -None, -//Used to scale the image uniformly so that it fits the viewport -Meet, -//Used to scale the image uniformly to the maximum -Slice, -} -} -module Diagram -{ enum BridgeDirection { //Used to set the direction of line bridges as left @@ -54048,6 +57957,8 @@ DragLabel, InheritBridging, //Enables user interaction to the connector PointerEvents, +//Enables the contrast between clean edges of connector over rendering speed and geometric precision +CrispEdges, //Enables all constraints Default, } @@ -54114,7 +58025,7 @@ enum BPMNFlows { //Used to specify the Sequence flow in a BPMN Process Sequence, -//Used to specify the Association flow in a BPMN Process +//Used to specify the Association flow in a BPMN Process Association, //Used to specify the Message flow in a BPMN Process Message, @@ -54158,6 +58069,42 @@ Default, } module Diagram { +enum ClassifierShapes +{ +//Used to define a Class +Class, +//Used to define an Interface +Interface, +//Used to define an Enumeration +Enumeration, +//Used to notate association in UML Class Diagram +Association, +//Used to notate aggregation in a UML Class Diagram +Aggregation, +//Used to notate composition in a UML Class Diagram +Composition, +//Used to notate dependency in a UML Class Diagram +Dependency, +//Used to notate inheritance in a UML Class Diagram +Inheritance, +} +} +module Diagram +{ +enum Multiplicity +{ +//Each entity instance is related to a single instance of another entity +OneToOne, +//An entity instance can be related to multiple instances of the other entities +OneToMany, +//Multiple instances of an entity can be related to a single instance of the other entity +ManyToOne, +//The entity instances can be related to multiple instances of each other +ManyToMany, +} +} +module Diagram +{ enum DecoratorShapes { //Used to set decorator shape as none @@ -54206,6 +58153,8 @@ PannableY, Pannable, //Enables/Disables undo actions Undoable, +//Enables/Disables the sharp edges +CrispEdges, //Enables all Constraints Default, } @@ -54264,14 +58213,22 @@ Bottom, } module Diagram { -enum ClassifierShapes +enum IconShapes { -//Used to define a Class -Class, -//Used to define an Interface -Interface, -//Used to define an Enumeration -Enumeration, +//Used to set collapse icon shape as none +None, +//Used to set collapse icon shape as Arrow(Up/Down) +Arrow, +//Used to set collapse icon shape as Plus +Plus, +//Used to set collapse icon shape as Minus +Minus, +//Used to set collapse icon shape as path +Path, +//Used to set icon shape as template +Template, +//Used to set icon shape as image +Image, } } module Diagram @@ -54318,6 +58275,8 @@ AllowPan, AspectRatio, //Enables the user interaction with the node PointerEvents, +//Enables contrast between clean edges for the node over rendering speed and geometric precision +CrispEdges, //Enables all node constraints Default, } @@ -54440,6 +58399,8 @@ enum PortConstraints None, //Enables connections with connector Connect, +//Enables to create the connection when mouse hover on the port. +ConnectOnDrag, } } module Diagram @@ -54672,7 +58633,7 @@ All, } module Diagram { -enum UserHandlePositions +enum UserHandlePositions { //Set the position of the userhandle as topleft TopLeft, @@ -54747,6 +58708,7 @@ class HeatMap extends ej.Widget { static fn: HeatMap; constructor(element: JQuery, options?: HeatMap.Model); constructor(element: Element, options?: HeatMap.Model); + static Locale: any; model:HeatMap.Model; defaults:HeatMap.Model; } @@ -54767,7 +58729,7 @@ export interface Model { /** Specifies the name of the heat map. * @Default {null} */ - id?: number; + id?: Number; /** Specifies the source data of the heat map. * @Default {[]} @@ -54782,12 +58744,12 @@ export interface Model { /** Specifies can enable responsive mode or not for heat map. * @Default {false} */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Specifies whether the virtualization can be enable or not. * @Default {false} */ - enableVirtualization?: boolean; + enableVirtualization?: Boolean; /** Specifies the default column properties for all the column style not specified in column properties. * @Default {[]} @@ -54892,7 +58854,7 @@ export interface HeatMapCell { /** Specifies whether the cell color can be visible or not. * @Default {true} */ - showColor?: boolean; + showColor?: Boolean; } export interface DefaultColumnStyle { @@ -54904,11 +58866,11 @@ export interface DefaultColumnStyle { /** Specifies the template id of the heat map column header. */ - headerTemplateID?: string; + headerTemplateID?: String; /** Specifies the template id of all individual cell data of the heat map. */ - templateID?: string; + templateID?: String; } export interface ItemsMappingColumnStyle { @@ -54916,7 +58878,7 @@ export interface ItemsMappingColumnStyle { /** Specifies the width of the heat map column. * @Default {0} */ - width?: number; + width?: Number; /** Specifies the text align mode of the heat map column. * @Default {ej.HeatMap.TextAlign.Center} @@ -55019,16 +58981,16 @@ export interface ColorMappingCollectionLabel { /** Enables/disables the bold style of the heat map label. * @Default {false} */ - bold?: boolean; + bold?: Boolean; /** Enables/disables the italic style of the heat map label. * @Default {false} */ - italic?: boolean; + italic?: Boolean; /** specifies the text value of the heat map label. */ - text?: string; + text?: String; /** Specifies the text style of the heat map label. * @Default {ej.HeatMap.TextDecoration.None} @@ -55038,17 +59000,17 @@ export interface ColorMappingCollectionLabel { /** Specifies the font size of the heat map label. * @Default {10} */ - fontSize?: number; + fontSize?: Number; /** Specifies the font family of the heat map label. * @Default {Arial} */ - fontFamily?: string; + fontFamily?: String; /** Specifies the font color of the heat map label. * @Default {black} */ - fontColor?: string; + fontColor?: String; } export interface ColorMappingCollection { @@ -55056,12 +59018,12 @@ export interface ColorMappingCollection { /** Specifies the color of the heat map column data. * @Default {white} */ - color?: string; + color?: String; /** Specifies the color values of the heat map column data. * @Default {0} */ - value?: number; + value?: Number; /** Specifies the label properties of the heat map color. * @Default {null} @@ -55073,17 +59035,17 @@ module HeatMap { enum CellVisibility { -//Display the content of the cell +//Display the content of the cell Visible, -//Hide the content of the cell +//Hide the content of the cell Hidden, } } module HeatMap { -enum TextDecoration +enum TextDecoration { -//Defines a line below the text +//Defines a line below the text Underline, //Defines a line above the text Overline, @@ -55098,6 +59060,7 @@ class HeatMapLegend extends ej.Widget { static fn: HeatMapLegend; constructor(element: JQuery, options?: HeatMapLegend.Model); constructor(element: Element, options?: HeatMapLegend.Model); + static Locale: any; model:HeatMapLegend.Model; defaults:HeatMapLegend.Model; } @@ -55118,12 +59081,12 @@ export interface Model { /** Specifies can enable responsive mode or not for heatmap legend. * @Default {false} */ - isResponsive?: boolean; + isResponsive?: Boolean; /** Specifies whether the cell label can be shown or not. * @Default {false} */ - showLabel?: boolean; + showLabel?: Boolean; /** Specifies the color values of the column data. * @Default {[]} @@ -55146,16 +59109,16 @@ export interface ColorMappingCollectionLabel { /** Enables/disables the bold style of the heatmap legend label. * @Default {false} */ - bold?: boolean; + bold?: Boolean; /** Enables/disables the italic style of the heatmap legend label. * @Default {false} */ - italic?: boolean; + italic?: Boolean; /** specifies the text value of the heatmap legend label. */ - text?: string; + text?: String; /** Specifies the text style of the heatmap legend label. * @Default {ej.HeatMap.TextDecoration.None} @@ -55165,17 +59128,17 @@ export interface ColorMappingCollectionLabel { /** Specifies the font size of the heatmap legend label. * @Default {10} */ - fontSize?: number; + fontSize?: Number; /** Specifies the font family of the heatmap legend label. * @Default {Arial} */ - fontFamily?: string; + fontFamily?: String; /** Specifies the font color of the heatmap legend label. * @Default {black} */ - fontColor?: string; + fontColor?: String; } export interface ColorMappingCollection { @@ -55183,12 +59146,12 @@ export interface ColorMappingCollection { /** Specifies the color of the heatmap legend data. * @Default {white} */ - color?: string; + color?: String; /** Specifies the color values of the heatmap legend column data. * @Default {0} */ - value?: number; + value?: Number; /** Specifies the label properties of the heatmap legend color. * @Default {null} @@ -55200,9 +59163,9 @@ module HeatMap { enum LegendOrientation { -//Scales the graphic content non-uniformly to the width and height of the diagram area +//Scales the graphic content non-uniformly to the width and height of the diagram area Horizontal, -//Used to align the image at the top left of diagram area +//Used to align the image at the top left of diagram area Vertical, } } @@ -55210,9 +59173,9 @@ module HeatMap { enum LegendMode { -//Scales the graphic content non-uniformly to the width and height of the diagram area +//Scales the graphic content non-uniformly to the width and height of the diagram area Gradient, -//Used to align the image at the top left of diagram area +//Used to align the image at the top left of diagram area List, } } @@ -55221,6 +59184,7 @@ class Sparkline extends ej.Widget { static fn: Sparkline; constructor(element: JQuery, options?: Sparkline.Model); constructor(element: Element, options?: Sparkline.Model); + static Locale: any; model:Sparkline.Model; defaults:Sparkline.Model; @@ -55408,7 +59372,7 @@ export interface LoadedEventArgs { export interface TooltipInitializeEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -55532,7 +59496,7 @@ export interface PointRegionMouseClickEventArgs { export interface SparklineMouseMoveEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -55547,7 +59511,7 @@ export interface SparklineMouseMoveEventArgs { export interface SparklineMouseLeaveEventArgs { - /** Set this option to true to cancel the event + /** Set this option to true to cancel the event */ cancel?: boolean; @@ -55817,6 +59781,7 @@ class Overview extends ej.Widget { static fn: Overview; constructor(element: JQuery, options?: Overview.Model); constructor(element: Element, options?: Overview.Model); + static Locale: any; model:Overview.Model; defaults:Overview.Model; } @@ -55934,6 +59899,11 @@ ejDigitalGauge(options?: ej.datavisualization.DigitalGauge.Model): JQuery; ejDigitalGauge(memberName: any, value?: any, param?: any): any; data(key: "ejDigitalGauge"): ej.datavisualization.DigitalGauge; +ejDocumentEditor(): JQuery; +ejDocumentEditor(options?: ej.DocumentEditor.Model): JQuery; +ejDocumentEditor(memberName: any, value?: any, param?: any): any; +data(key: "ejDocumentEditor"): ej.DocumentEditor; + ejDraggable(): JQuery; ejDraggable(options?: ej.Draggable.Model): JQuery; ejDraggable(memberName: any, value?: any, param?: any): any; @@ -56139,6 +60109,11 @@ ejScroller(options?: ej.Scroller.Model): JQuery; ejScroller(memberName: any, value?: any, param?: any): any; data(key: "ejScroller"): ej.Scroller; +ejSignature(): JQuery; +ejSignature(options?: ej.Signature.Model): JQuery; +ejSignature(memberName: any, value?: any, param?: any): any; +data(key: "ejSignature"): ej.Signature; + ejSlider(): JQuery; ejSlider(options?: ej.Slider.Model): JQuery; ejSlider(memberName: any, value?: any, param?: any): any; @@ -56149,6 +60124,11 @@ ejSparkline(options?: ej.datavisualization.Sparkline.Model): JQuery; ejSparkline(memberName: any, value?: any, param?: any): any; data(key: "ejSparkline"): ej.datavisualization.Sparkline; +ejSpellCheck(): JQuery; +ejSpellCheck(options?: ej.SpellCheck.Model): JQuery; +ejSpellCheck(memberName: any, value?: any, param?: any): any; +data(key: "ejSpellCheck"): ej.SpellCheck; + ejSplitButton(): JQuery; ejSplitButton(options?: ej.SplitButton.Model): JQuery; ejSplitButton(memberName: any, value?: any, param?: any): any; diff --git a/ej.web.all/tsconfig.json b/ej.web.all/tsconfig.json index 1322d35b68..e3f12bcda5 100644 --- a/ej.web.all/tsconfig.json +++ b/ej.web.all/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ejs-locals/tsconfig.json b/ejs-locals/tsconfig.json index 5ca396497a..546031bb2f 100644 --- a/ejs-locals/tsconfig.json +++ b/ejs-locals/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ejs/index.d.ts b/ejs/index.d.ts index 8a5cd267f8..a5bfb23ee9 100644 --- a/ejs/index.d.ts +++ b/ejs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ejs.js v2.3.3 +// Type definitions for ejs.js v2.3.3 // Project: http://ejs.co/ // Definitions by: Ben Liddicott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,7 +11,12 @@ declare namespace Ejs { function resolveInclude(name: string, filename: string): string; function compile(template: string, opts?: Options): (TemplateFunction); function render(template: string, data?: Data, opts?: Options): string; - function renderFile(path: string, data?: Data, opts?: Options, cb?: Function): any;// TODO RenderFileCallback return type + + type RenderFileCallback = (err: Error, str?: string) => T; + function renderFile(path: string, cb: RenderFileCallback): T; + function renderFile(path: string, data: Data, cb: RenderFileCallback): T; + function renderFile(path: string, data: Data, opts: Options, cb: RenderFileCallback): T; + function clearCache(): any; interface TemplateFunction { diff --git a/ejs/tsconfig.json b/ejs/tsconfig.json index ae818d75b3..7ef3389d19 100644 --- a/ejs/tsconfig.json +++ b/ejs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ejson/ejson-tests.ts b/ejson/ejson-tests.ts index ef9b940bb8..1902849b3d 100644 --- a/ejson/ejson-tests.ts +++ b/ejson/ejson-tests.ts @@ -1,8 +1,6 @@ -/// - import { - clone as importedClone, - parse as importedParse, + clone as importedClone, + parse as importedParse, stringify as importedStringify, toJSONValue as importedToJSONValue, fromJSONValue as importedFromJSONValue, diff --git a/ejson/ejson.d.ts b/ejson/ejson.d.ts deleted file mode 100644 index 029222239c..0000000000 --- a/ejson/ejson.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Type definitions for ejson v2.1.2 -// Project: https://www.npmjs.com/package/ejson -// Definitions by: Shantanu Bhadoria -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare module "ejson" { - interface StringifyOptions { - canonical: boolean; - indent: boolean|number|string; - } - - interface CloneOptions { - keyOrderSensitive: boolean; - } - - function clone(obj: T): T; - function parse(str: string): any; - function stringify(obj: any, options?: StringifyOptions): string; - - function toJSONValue(obj: any): string; - function fromJSONValue(obj: string): any; - function isBinary(value: any): boolean; - function newBinary(len: number): Uint8Array; - function equals(a: any, b: any, options?: CloneOptions): boolean; -} diff --git a/ejson/index.d.ts b/ejson/index.d.ts new file mode 100644 index 0000000000..d2882646eb --- /dev/null +++ b/ejson/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for ejson v2.1.2 +// Project: https://www.npmjs.com/package/ejson +// Definitions by: Shantanu Bhadoria +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface StringifyOptions { + canonical: boolean; + indent: boolean|number|string; +} + +interface CloneOptions { + keyOrderSensitive: boolean; +} + +export function clone(obj: T): T; +export function parse(str: string): any; +export function stringify(obj: any, options?: StringifyOptions): string; + +export function toJSONValue(obj: any): string; +export function fromJSONValue(obj: string): any; +export function isBinary(value: any): boolean; +export function newBinary(len: number): Uint8Array; +export function equals(a: any, b: any, options?: CloneOptions): boolean; diff --git a/ejson/tsconfig.json b/ejson/tsconfig.json new file mode 100644 index 0000000000..52ab4c1534 --- /dev/null +++ b/ejson/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "ejson-tests.ts" + ] +} \ No newline at end of file diff --git a/elastic.js/index.d.ts b/elastic.js/index.d.ts index 9bf5f6a9dc..99a45f58fa 100644 --- a/elastic.js/index.d.ts +++ b/elastic.js/index.d.ts @@ -2350,7 +2350,7 @@ declare module elasticjs { Sets the distance unit. Valid values are: in, yd, ft, km, NM, mm, cm, mi, and m. */ - unit(unit: Number): GeoDistanceAggregation; + unit(unit: string): GeoDistanceAggregation; } @@ -2485,7 +2485,7 @@ declare module elasticjs { Sets the distance unit. Valid values are "mi" for miles or "km" for kilometers. Defaults to "km". */ - unit(unit: Number): GeoDistanceFacet; + unit(unit: string): GeoDistanceFacet; /* Allows you to specify a different value field to aggrerate over. @@ -2582,7 +2582,7 @@ declare module elasticjs { Sets the distance unit. Valid values are "mi" for miles or "km" for kilometers. Defaults to "km". */ - unit(unit: Number): GeoDistanceFilter; + unit(unit: string): GeoDistanceFilter; } @@ -2706,7 +2706,7 @@ declare module elasticjs { Sets the distance unit. Valid values are "mi" for miles or "km" for kilometers. Defaults to "km". */ - unit(unit: Number): GeoDistanceRangeFilter; + unit(unit: string): GeoDistanceRangeFilter; } @@ -7413,7 +7413,7 @@ declare module elasticjs { Valid during sort types: geo distance */ - unit(unit: Number): Sort; + unit(unit: string): Sort; } diff --git a/elastic.js/tsconfig.json b/elastic.js/tsconfig.json index f6456edfc5..a735abad21 100644 --- a/elastic.js/tsconfig.json +++ b/elastic.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/elasticsearch/elasticsearch-tests.ts b/elasticsearch/elasticsearch-tests.ts index f57ee926ce..c9be3c01ef 100644 --- a/elasticsearch/elasticsearch-tests.ts +++ b/elasticsearch/elasticsearch-tests.ts @@ -1,4 +1,3 @@ - import elasticsearch = require("elasticsearch"); var client = new elasticsearch.Client({ @@ -15,8 +14,7 @@ client = new elasticsearch.Client({ }); client.ping({ - requestTimeout: 30000, - hello: "elasticsearch" + requestTimeout: 30000 }, function (error) { }); @@ -48,12 +46,12 @@ client.create({ }); client.cluster.getSettings({ - masterTimeout: 100 + masterTimeout: '100s' }, (err, response) => { }); client.cluster.health({ - masterTimeout: 100 + masterTimeout: '100s' }, (err, response) => { }); @@ -85,4 +83,167 @@ client.cluster.state({ client.cluster.stats({ ignore: 1 }, (err, response) => { -}); \ No newline at end of file +}); + +client.count({ + index: 'index_name' +}, function (error, response) { + // ... +}); + +client.count({ + index: 'index_name', + body: { + query: { + filtered: { + filter: { + terms: { + foo: ['bar'] + } + } + } + } + } +}, function (err, response) { + // ... +}); + +client.explain({ + // the document to test + index: 'myindex', + type: 'mytype', + id: '1', + + // the query to score it against + q: 'field:value' +}, function (error, response) { + // ... +}); + +client.explain({ + index: 'myindex', + type: 'mytype', + id: '1', + body: { + query: { + match: { title: 'test' } + } + } +}, function (error, response) { + // ... +}); + +client.index({ + index: 'myindex', + type: 'mytype', + id: '1', + body: { + title: 'Test 1', + tags: ['y', 'z'], + published: true, + } +}, function (error, response) { + +}); + +client.mget({ + body: { + docs: [ + { _index: 'indexA', _type: 'typeA', _id: '1' }, + { _index: 'indexB', _type: 'typeB', _id: '1' }, + { _index: 'indexC', _type: 'typeC', _id: '1' } + ] + } +}, function (error, response) { + // ... +}); + +client.mget({ + index: 'myindex', + type: 'mytype', + body: { + ids: [1, 2, 3] + } +}, function (error, response) { + // ... +}); + +client.search({ + index: 'myindex', + q: 'title:test' +}, function (error, response) { + // ... +}); + +client.search({ + index: 'myindex', + body: { + query: { + match: { + title: 'test' + } + }, + facets: { + tags: { + terms: { + field: 'tags' + } + } + } + } +}, function (error, response) { + // ... +}); + +client.suggest({ + index: 'myindex', + body: { + mysuggester: { + text: 'tset', + term: { + field: 'title' + } + } + } +}, function (error, response) { +}); + + +// first we do a search, and specify a scroll timeout +var allTitles: string[] = []; +client.search({ + index: 'myindex', + // Set to 30 seconds because we are calling right back + scroll: '30s', + searchType: 'query_then_fetch', + docvalueFields: ['title'], + q: 'title:test' +}, function getMoreUntilDone(error, response) { + // collect the title from each response + response.hits.hits.forEach(function (hit) { + allTitles.push(hit.fields.title); + }); + + if (response.hits.total !== allTitles.length) { + // now we can call scroll over and over + client.scroll({ + scrollId: response._scroll_id, + scroll: '30s' + }, getMoreUntilDone); + } else { + console.log('every "test" title', allTitles); + } +}); + +client.indices.updateAliases({ + body: { + actions: [ + { remove: { index: 'logstash-2014.04', alias: 'logstash-current' } }, + { add: { index: 'logstash-2014.05', alias: 'logstash-current' } } + ] + } +}).then(function (response) { + // ... +}, function (error) { + // ... +}); diff --git a/elasticsearch/index.d.ts b/elasticsearch/index.d.ts index 26a9a1e880..f3ac0992c6 100644 --- a/elasticsearch/index.d.ts +++ b/elasticsearch/index.d.ts @@ -1,66 +1,91 @@ -// Type definitions for elasticsearch +// Type definitions for elasticsearch 5.0 // Project: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html -// Definitions by: Casper Skydt , Blake Smith , Dave Dunkin +// Definitions by: Casper Skydt , Blake Smith , Dave Dunkin , Jeffery Grajkowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module Elasticsearch { export class Client { constructor(params: ConfigOptions); - indices: Indices; - cluster: Cluster; cat: Cat; + cluster: Cluster; + indices: Indices; + ingest: Ingest; + nodes: Nodes; + snapshot: Snapshot; + tasks: Tasks; bulk(params: BulkIndexDocumentsParams): PromiseLike; bulk(params: BulkIndexDocumentsParams, callback: (error: any, response: any) => void): void; - create(params: CreateDocumentParams): PromiseLike; - create(params: CreateDocumentParams, callback: (err: any, response: any, status: any) => void): void; - delete(params: DeleteDocumentParams): PromiseLike; - delete(params: DeleteDocumentParams, callback: (error: any, response: any) => void): void; + clearScroll(params: ClearScrollParams, callback: (error: any, response: any) => void): void; + clearScroll(params: ClearScrollParams): PromiseLike; + count(params: CountParams, callback: (error: any, response: CountResponse) => void): void; + count(params: CountParams): PromiseLike; + create(params: CreateDocumentParams): PromiseLike; + create(params: CreateDocumentParams, callback: (err: any, response: CreateDocumentResponse, status: any) => void): void; + delete(params: DeleteDocumentParams): PromiseLike; + delete(params: DeleteDocumentParams, callback: (error: any, response: DeleteDocumentResponse) => void): void; + deleteByQuery(params: DeleteDocumentByQueryParams): PromiseLike; + deleteByQuery(params: DeleteDocumentByQueryParams, callback: (error: any, response: DeleteDocumentByQueryResponse) => void): void; + deleteScript(params: DeleteScriptParams): PromiseLike; + deleteScript(params: DeleteScriptParams, callback: (error: any, response: any) => void): void; + deleteTemplate(params: DeleteTemplateParams): PromiseLike; + deleteTemplate(params: DeleteTemplateParams, callback: (error: any, response: any) => void): void; exists(params: ExistsParams): PromiseLike; exists(params: ExistsParams, callback: (error: any, response: any, status?: any) => void): void; + explain(params: ExplainParams): PromiseLike; + explain(params: ExplainParams, callback: (error: any, response: ExplainResponse) => void): void; + fieldStats(params: FieldStatsParams): PromiseLike; + fieldStats(params: FieldStatsParams, callback: (error: any, response: FieldStatsResponse) => void): void; get(params: GetParams, callback: (error: any, response: GetResponse) => void): void; get(params: GetParams): PromiseLike>; + getScript(params: GetScriptParams): PromiseLike; + getScript(params: GetScriptParams, callback: (error: any, response: any) => void): void; + getSource(params: GetSourceParams): PromiseLike; + getSource(params: GetSourceParams, callback: (error: any, response: any) => void): void; + getTemplate(params: GetTemplateParams): PromiseLike; + getTemplate(params: GetTemplateParams, callback: (error: any, response: any) => void): void; index(params: IndexDocumentParams): PromiseLike; index(params: IndexDocumentParams, callback: (error: any, response: any) => void): void; + info(params: InfoParams): PromiseLike; + info(params: InfoParams, callback: (error: any, response: any) => void): void; mget(params: MGetParams, callback: (error: any, response: MGetResponse) => void): void; mget(params: MGetParams): PromiseLike>; msearch(params: MSearchParams, callback: (error: any, response: MSearchResponse) => void): void; msearch(params: MSearchParams): PromiseLike>; + msearchTemplate(params: MSearchTemplateParams, callback: (error: any, response: MSearchResponse) => void): void; + msearchTemplate(params: MSearchTemplateParams): PromiseLike>; + mtermvectors(params: MTermVectorsParams): PromiseLike; + mtermvectors(params: MTermVectorsParams, callback: (error: any, response: any) => void): void; ping(params: PingParams): PromiseLike; ping(params: PingParams, callback: (err: any, response: any, status: any) => void): void; + putScript(params: PutScriptParams): PromiseLike; + putScript(params: PutScriptParams, callback: (err: any, response: any, status: any) => void): void; + putTemplate(params: PutTemplateParams): PromiseLike; + putTemplate(params: PutTemplateParams, callback: (err: any, response: any, status: any) => void): void; + reindex(params: ReindexParams): PromiseLike; + reindex(params: ReindexParams, callback: (error: any, response: ReindexResponse) => void): void; + reindexRethrottle(params: ReindexRethrottleParams): PromiseLike; + reindexRethrottle(params: ReindexRethrottleParams, callback: (error: any, response: any) => void): void; + renderSearchTemplate(params: RenderSearchTemplateParams): PromiseLike; + renderSearchTemplate(params: RenderSearchTemplateParams, callback: (error: any, response: any) => void): void; scroll(params: ScrollParams): PromiseLike; scroll(params: ScrollParams, callback: (error: any, response: any) => void): void; search(params: SearchParams): PromiseLike>; search(params: SearchParams, callback: (error: any, response: SearchResponse) => void): void; + searchShards(params: SearchShardsParams): PromiseLike; + searchShards(params: SearchShardsParams, callback: (error: any, response: SearchShardsResponse) => void): void; + searchTemplate(params: SearchTemplateParams): PromiseLike; + searchTemplate(params: SearchTemplateParams, callback: (error: any, response: any) => void): void; suggest(params: SuggestParams): PromiseLike; suggest(params: SuggestParams, callback: (error: any, response: any) => void): void; + termvectors(params: TermvectorsParams): PromiseLike; + termvectors(params: TermvectorsParams, callback: (error: any, response: any) => void): void; update(params: UpdateDocumentParams): PromiseLike; update(params: UpdateDocumentParams, callback: (error: any, response: any) => void): void; + updateByQuery(params: UpdateDocumentByQueryParams): PromiseLike; + updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: any) => void): void; } - export class Indices { - delete(params: IndicesDeleteParams, callback: (error: any, response: any, status: any) => void): void; - delete(params: IndicesDeleteParams): PromiseLike; - create(params: IndicesCreateParams, callback: (error: any, response: any, status: any) => void): void; - create(params: IndicesCreateParams): PromiseLike; - exists(params: IndicesIndexExitsParams, callback: (error: any, response: any, status: any) => void): void; - exists(params: IndicesIndexExitsParams): PromiseLike; - existsType(params: IndicesIndexExitsParams & {type: string}, callback: (error: any, response: any, status: any) => void): void; - existsType(params: IndicesIndexExitsParams & {type: string}): PromiseLike; - get(params: IndicesGetParams, callback: (error: any, response: any, status: any) => void): void; - get(params: IndicesGetParams): PromiseLike; - getAlias(params: IndicesGetAliasParams, callback: (error: any, response: any, status: any) => void): void; - getAlias(params: IndicesGetAliasParams): PromiseLike; - putAlias(params: IndicesPutAliasParams, callback: (error: any, response: any, status: any) => void): void; - putAlias(params: IndicesPutAliasParams): PromiseLike; - putTemplate(params: IndicesPutTemplateParams, callback: (error: any, response: any) => void): void; - putTemplate(params: IndicesPutTemplateParams): PromiseLike; - putMapping(params: IndicesPutMappingParams, callback: (error: any, response: any) => void): void; - putMapping(params: IndicesPutMappingParams): PromiseLike; - refresh(params: IndicesRefreshParams, callback: (error: any, response: any) => void): void; - refresh(params: IndicesRefreshParams): PromiseLike; - } - - export interface ConfigOptions{ + export interface ConfigOptions { host?: any; hosts?: any; log?: any; @@ -100,103 +125,245 @@ declare module Elasticsearch { filterPath?: string | string[]; } + export interface ShardsResponse { + total: number; + successful: number; + failed: number; + } + + /** + * A string of a number and a time unit. A time unit is one of + * [d, h, m, s, ms, micros, nanos]. eg: "30s" for 30 seconds. + * These are incorrectly identified as `Date | number` in the docs as of 2016-11-15. + */ + export type TimeSpan = string; + + export type NameList = string | string[] | boolean; + export type Refresh = boolean | "true" | "false" | "wait_for" | ""; + export type VersionType = "internal" | "external" | "external_gte" | "force"; + export type ExpandWildcards = "open" | "closed" | "none" | "all"; + export type DefaultOperator = "AND" | "OR"; + export interface BulkIndexDocumentsParams extends GenericParams { - refresh?: boolean; - routing? : string; - timeout?: number | Date; + waitForActiveShards?: string; + refresh?: Refresh; + routing?: string; + timeout?: TimeSpan; type?: string; - fields?: string | string[] | boolean; + fields?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + pipeline?: string; index?: string; } - export interface CreateDocumentParams extends GenericParams { - consistency?: "one" | "quorum" | "all"; - parent?: string; - refresh?: boolean; + export interface ClearScrollParams extends GenericParams { + scrollId: NameList; + } + + export interface CountParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + minScore?: number; + preference?: string; routing?: string; - timeout?: number | Date; - timestamp?: number | Date; - ttl?: number; + q?: string; + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + index?: NameList; + type?: NameList; + } + + export interface CountResponse { + count: number; + _shards: ShardsResponse; + } + + export interface CreateDocumentParams extends GenericParams { + waitForActiveShards?: string; + parent?: string; + refresh?: Refresh; + timeout?: TimeSpan; + timestamp?: Date | number; + ttl?: TimeSpan; version?: number; - versionType?: "internal" | "external" | "external_gte" | "force"; + versionType?: VersionType; + pipeline?: string; id: string; index: string; type: string; } - export interface IndicesGetParams extends GenericParams { - ignoreUnavailable?: boolean; - index: string | string[] | boolean; + export interface CreateDocumentResponse { + _shards: ShardsResponse; + _index: string; + _type: string; + _id: string; + _version: number; + created: boolean; + result: string; } - export interface IndicesRefreshParams extends GenericParams { - force?: boolean; - ignoreUnavailable?: boolean; - index: string | string[] | boolean; - } - - export interface IndicesDeleteParams extends GenericParams { - index: string | string[] | boolean; - timeout?: Date | number; - masterTimeout?: Date | number; - } - - export interface IndicesCreateParams extends GenericParams { - index: string | string[] | boolean; - timeout?: Date | number; - masterTimeout?: Date | number; - } - - export interface IndicesPutTemplateParams extends GenericParams { - order?: number; - create?: boolean; - timeout?: Date | number; - masterTimeout?: Date | number; - flatSettings?: boolean; - name: string; - body: string | any; - } - - export interface IndicesPutMappingParams extends GenericParams { - timeout?: Date | number; - masterTimeout?: Date | number; - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: "open" | "closed" | "none" | "all"; - updateAllTypes?: boolean; - index: string | string[] | boolean; - type: string; - } - - export interface IndicesGetAliasParams extends GenericParams { - ignoreUnavailable?: boolean; - allowNoIndices?: boolean; - expandWildcards?: "open" | "closed" | "none" | "all"; - local?: boolean; - index?: string | string[] | boolean; - name: string | string[] | boolean; - } - - export interface IndicesPutAliasParams extends GenericParams { - index?: string | string[] | boolean; - name: string | string[] | boolean; - } - - export interface GetParams extends GenericParams { + export interface DeleteDocumentParams extends GenericParams { + waitForActiveShards?: string; + parent?: string; + refresh?: Refresh; + routing?: string; + timeout?: TimeSpan; + version?: number; + versionType?: VersionType; index: string; type: string; id: string; - fields?: string | string[] | boolean; + } + + export interface DeleteDocumentResponse { + _shards: ShardsResponse; + found: boolean; + _index: string; + _type: string; + _id: string; + _version: number; + result: string; + } + + export interface DeleteDocumentByQueryParams extends GenericParams { + waitForActiveShards?: string; + parent?: string; + refresh?: Refresh; + routing?: string; + timeout?: TimeSpan; + version?: number; + versionType?: VersionType; + index: string; + type: string; + id: string; + } + + export interface DeleteDocumentByQueryResponse { + took: number; + timed_out: boolean; + deleted: number; + batches: number; + version_conflicts: number; + noops: number; + retries: { + bulk: number; + search: number; + }; + throttled_millis: number; + requests_per_second: number; + throttled_until_millis: number; + total: number; + failures: any[]; + } + + export interface DeleteScriptParams extends GenericParams { + id: string; + lang: string; + } + + export interface DeleteTemplateParams extends GenericParams { + id: string; + } + + export interface ExistsParams extends GenericParams { parent?: string; preference?: string; realtime?: boolean; refresh?: boolean; routing?: string; - _source?: string | string[] | boolean; - _sourceExclude?: string | string[] | boolean; - _sourceInclude?: string | string[] | boolean; + id: string; + index: string; + type: string; + } + + export interface ExplainParams extends GenericParams { + analyzeWildcard?: boolean; + analyzer?: string; + defaultOperator?: DefaultOperator; + df?: string; + storedFields?: NameList; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + parent?: string; + preference?: string; + q?: string; + routing?: string; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + id?: string; + index?: string; + type?: string; + } + + export interface ExplainResponse { + _index: string; + _type: string; + _id: string; + matched: boolean; + explanation: ExplainResponseDetails; + } + + export interface ExplainResponseDetails { + value: number; + description: string; + details: ExplainResponseDetails[]; + } + + export interface FieldStatsParams extends GenericParams { + fields?: NameList; + level?: "indices" | "cluster"; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; + } + + export interface FieldStatsResponse { + _shards: ShardsResponse; + indices: { [indexName: string]: FieldStatsResponseIndex }; + conflicts?: { [fieldName: string]: string }; + } + + export interface FieldStatsResponseIndex { + fields: { [fieldName: string]: FieldStatsResponseField }; + } + + export interface FieldStatsResponseField { + max_doc: number; + doc_count: number; + density: number; + sum_doc_freq: number; + sum_total_term_freq: number; + min_value: any; + max_value: any; + is_searchable: string; + is_aggregatable: string; + } + + export interface GetParams extends GenericParams { + storedFields?: NameList; + parent?: string; + preference?: string; + realtime?: boolean; + refresh?: boolean; + routing?: string; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; version?: number; - versionType?: string; + versionType?: VersionType; + id: string; + index: string; + type: string; } export interface GetResponse { @@ -208,103 +375,59 @@ declare module Elasticsearch { _source: T; } - export interface ExistsParams extends GenericParams { + export interface GetScriptParams extends GenericParams { id: string; - index: string; - parent?: string; + lang: string; + } + + export interface GetSourceParams extends GenericParams { preference?: string; realtime?: boolean; refresh?: boolean; routing?: string; + _source: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + version?: number; + versionType?: VersionType; + id: string; + index: string; type: string; } + export interface GetTemplateParams extends GenericParams { + id: string; + } + export interface IndexDocumentParams extends GenericParams { + waitForActiveShards?: string; + opType?: "index" | "create"; + parent?: string; + refresh?: string; + routing?: string; + timeout?: TimeSpan; + timestamp?: Date | number; + ttl?: TimeSpan; + version?: number; + versionType?: VersionType; + pipeline?: string; + id?: string; index: string; type: string; - id: string; body: T; - consistensy?: string; - parent?: string; - replication?: string; - routing?: string; - timeout?: Date | number; - timestamp?: Date | number; - version?: number; - versionType?: string; } - export interface ScrollParams extends GenericParams { - scroll: string; - scrollId: string; - } - - export interface SearchParams extends GenericParams { - index?: string; - type?: string | string[] | number; - body?: any; - q?: string; - scroll?: string; - search_type?: string; - fields?: string[]; - from?: number; - size?: number; - sort?: string | string[] | boolean; - _source?: string | string[] | boolean; - _sourceExclude?: string | string[] | boolean; - _sourceInclude?: string | string[] | boolean; - stats?: string | string[] | boolean; - suggestField?: string; - suggestSize?: number; - suggestText?: string; - timeout?: Date | number; - } - - export interface SearchResponse { - took: number, - timed_out: boolean, - _scroll_id?: string, - _shards: { - total: number, - successful: number, - failed: number - }, - hits: { - total: number, - max_score: number, - hits: { - _index: string, - _type: string, - _id: string, - _score: number, - _source: T, - _version: number, - _explanation?: Explanation, - fields?: any, - highlight?: any, - inner_hits?: any - }[] - }, - aggregations?: any - } - - export interface MSearchParams extends GenericParams { - index?: string | string[] | Boolean; - type?: string | string[] | Boolean; - search_type?: string; - } - - export interface MSearchResponse { - responses?: SearchResponse[]; + export interface InfoParams extends GenericParams { } export interface MGetParams extends GenericParams { - fields?: string | string[] | Boolean; + storedFields?: NameList; preference?: string; realtime?: Boolean; refresh?: Boolean; - _sourceExclude?: string | string[] | boolean; - _sourceInclude?: string | string[] | boolean; + source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; index?: string; type?: string; } @@ -313,137 +436,1143 @@ declare module Elasticsearch { docs?: GetResponse[]; } - export interface IndicesIndexExitsParams extends GenericParams { - index: string | string[] | boolean; - ignoreUnavailable?: boolean; + export interface MSearchParams extends GenericParams { + search_type?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; + maxConcurrentSearches?: number; + index?: NameList; + type?: NameList; + } + + export interface MSearchResponse { + responses?: SearchResponse[]; + } + + export interface MSearchTemplateParams extends GenericParams { + search_type?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; + index?: NameList; + type?: NameList; + } + + export interface MTermVectorsParams extends GenericParams { + ids?: NameList; + termStatistics?: boolean; + fieldStatistics?: boolean; + fields?: NameList; + offsets?: boolean; + positions?: boolean; + payloads?: boolean; + preference?: string; + routing?: string; + parent?: string; + realtime?: boolean; + version?: number; + versionType?: VersionType; + index: string; + type: string; } export interface PingParams extends GenericParams { - requestTimeout?: number; - hello?: string; } - export interface DeleteDocumentParams extends GenericParams { - index: string; - type: string; + export interface PutScriptParams extends GenericParams { id: string; - parent?: string; + lang: string; + body: any; + } + + export interface PutTemplateParams extends GenericParams { + id: string; + body: any; + } + + export interface ReindexParams extends GenericParams { refresh?: boolean; + timeout?: TimeSpan; + waitForActiveShards?: string; + waitForCompletion?: boolean; + requestsPerSecond?: number; + body: { + conflicts?: string; + source: { + index: string | string[]; + type?: string | string[]; + query?: any; + sort?: any; + size?: number; + remote?: { + host: string; + username?: string; + password?: string; + } + }; + dest: { + index: string; + version_type?: string; + op_type?: string; + routing?: string; + pipeline?: string; + }; + script?: { + inline: string; + lang: string; + } + } } - export interface UpdateDocumentParams extends GenericParams { - index: string; - type: string; + export interface ReindexResponse { + took: number; + updated: number; + created: number; + batches: number; + version_conflicts: number; + retries: { + bulk: number; + search: number; + } + throttled_millis: number; + failures: any[]; + } + + export interface ReindexRethrottleParams extends GenericParams { + requestsPerSecond: number; + taskId: string; + } + + export interface RenderSearchTemplateParams extends GenericParams { id: string; - body?: string | any; - version?: Number; - timesstamp?: Date | Number; - scriptedUpsert?: Boolean; - scriptId?: any; - script?: any; + } + + export interface ScrollParams extends GenericParams { + scroll: TimeSpan; + scrollId: string; + } + + export interface SearchParams extends GenericParams { + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + explain?: boolean; + storedFields?: NameList; + docvalueFields?: NameList; + fielddataFields?: NameList; + from?: number; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + preference?: string; + q?: string; + routing?: NameList; + scroll?: TimeSpan; + searchType?: "query_then_fetch" | "dfs_query_then_fetch"; + size?: number; + sort?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + terminateAfter?: number; + stats?: NameList; + suggestField?: string; + suggestMode?: "missing" | "popular" | "always"; + suggestSize?: number; + suggestText?: string; + timeout?: TimeSpan; + trackScores?: boolean; + version?: boolean; + requestCache?: boolean; + index?: NameList; + type?: NameList; + } + + export interface SearchResponse { + took: number; + timed_out: boolean; + _scroll_id?: string; + _shards: ShardsResponse; + hits: { + total: number; + max_score: number; + hits: { + _index: string; + _type: string; + _id: string; + _score: number; + _source: T; + _version: number; + _explanation?: Explanation; + fields?: any; + highlight?: any; + inner_hits?: any; + }[]; + }; + aggregations?: any; + } + + export interface SearchShardsParams extends GenericParams { + preference?: string; routing?: string; - retryOnConflict?: Number; - refresh?: Boolean; - parent?: string; - lang?:string; - fields?: string | string[] | Boolean; - consistensy?: string; + local?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; + type: NameList; + } + + export interface SearchShardsResponse { + nodes: any; + shards: SearchShardsResponseShard[][]; + } + + export interface SearchShardsResponseShard { + index: string; + node: string; + primary: boolean; + share: number; + state: string; + allocation_id: { + id: string; + }; + relocating_node: any; + } + + export interface SearchTemplateParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + preference?: string; + routing?: NameList; + scroll?: TimeSpan; + searchType?: "query_then_fetch" | "query_and_fetch" | "dfs_query_then_fetch" | "dfs_query_and_fetch"; + index: NameList; + type: NameList; } export interface SuggestParams extends GenericParams { ignoreUnavailable?: boolean; allowNoIndices?: boolean; - expandWildcards?: "open" | "closed" | "none" | "all"; + expandWildcards?: ExpandWildcards; preference?: string; routing?: string; - source?: string; - body: string | any; - index: string | string[] | boolean; + index: NameList; + } + + export interface TermvectorsParams extends GenericParams { + termStatistics?: boolean; + fieldStatistics?: boolean; + fields?: NameList; + offsets?: boolean; + positions?: boolean; + payloads?: boolean; + preference?: string; + routing?: string; + parent?: string; + realtime?: boolean; + version?: number; + versionType?: VersionType; + index: string; + type: string; + id?: string; + } + + export interface UpdateDocumentParams extends GenericParams { + waitForActiveShards?: string; + fields?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + lang?: string; + parent?: string; + refresh?: Refresh; + retryOnConflict?: number; + routing?: string; + timeout?: TimeSpan; + timestamp?: Date | number; + ttl?: TimeSpan; + version?: number; + versionType?: "internal" | "force"; + id: string; + index: string; + type: string; + } + + export interface UpdateDocumentByQueryParams extends GenericParams { + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + explain?: boolean; + storedFields?: NameList; + docvalueFields?: NameList; + fielddataFields?: NameList; + from?: number; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + conflicts?: "abort" | "proceed"; + expandWildcards?: ExpandWildcards; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + pipeline?: string; + preference?: string; + q?: string; + routing?: NameList; + scroll?: TimeSpan; + searchType?: "query_then_fetch" | "dfs_query_then_fetch"; + searchTimeout?: TimeSpan; + size?: number; + sort?: NameList; + _source?: NameList; + _sourceExclude?: NameList; + _sourceInclude?: NameList; + terminateAfter?: number; + stats?: NameList; + suggestField?: string; + suggestMode?: "missing" | "popular" | "always"; + suggestSize?: number; + suggestText?: string; + timeout?: TimeSpan; + trackScores?: boolean; + version?: boolean; + versionType?: boolean; + requestCache?: boolean; + refresh?: boolean; + waitForActiveShards?: string; + scrollSize?: number; + waitForCompletion?: boolean; + requestsPerSecond?: number; + index: NameList; + type: NameList; } export interface Cat { - health(params: CatHealthOptions, callback: (error: any, response: any) => void): void; - health(params: CatHealthOptions): PromiseLike + aliases(params: CatAliasesParams, callback: (error: any, response: any) => void): void; + aliases(params: CatAliasesParams): PromiseLike; + allocation(params: CatAllocationParams, callback: (error: any, response: any) => void): void; + allocation(params: CatAllocationParams): PromiseLike; + count(params: CatCountParams, callback: (error: any, response: any) => void): void; + count(params: CatAllocationParams): PromiseLike; + fielddata(params: CatFielddataParams, callback: (error: any, response: any) => void): void; + fielddata(params: CatFielddataParams): PromiseLike; + health(params: CatHealthParams, callback: (error: any, response: any) => void): void; + health(params: CatHealthParams): PromiseLike; + help(params: CatHelpParams, callback: (error: any, response: any) => void): void; + help(params: CatHelpParams): PromiseLike; + indices(params: CatIndicesParams, callback: (error: any, response: any) => void): void; + indices(params: CatIndicesParams): PromiseLike; + master(params: CatCommonParams, callback: (error: any, response: any) => void): void; + master(params: CatCommonParams): PromiseLike; + nodeattrs(params: CatCommonParams, callback: (error: any, response: any) => void): void; + nodeattrs(params: CatCommonParams): PromiseLike; + nodes(params: CatCommonParams, callback: (error: any, response: any) => void): void; + nodes(params: CatCommonParams): PromiseLike; + pendingTasks(params: CatCommonParams, callback: (error: any, response: any) => void): void; + pendingTasks(params: CatCommonParams): PromiseLike; + plugins(params: CatCommonParams, callback: (error: any, response: any) => void): void; + plugins(params: CatCommonParams): PromiseLike; + recovery(params: CatRecoveryParams, callback: (error: any, response: any) => void): void; + recovery(params: CatRecoveryParams): PromiseLike; + repositories(params: CatCommonParams, callback: (error: any, response: any) => void): void; + repositories(params: CatCommonParams): PromiseLike; + segments(params: CatSegmentsParams, callback: (error: any, response: any) => void): void; + segments(params: CatSegmentsParams): PromiseLike; + shards(params: CatShardsParams, callback: (error: any, response: any) => void): void; + shards(params: CatShardsParams): PromiseLike; + snapshots(params: CatSnapshotsParams, callback: (error: any, response: any) => void): void; + snapshots(params: CatSnapshotsParams): PromiseLike; + tasks(params: CatTasksParams, callback: (error: any, response: any) => void): void; + tasks(params: CatTasksParams): PromiseLike; + threadPool(params: CatThreadPoolParams, callback: (error: any, response: any) => void): void; + threadPool(params: CatThreadPoolParams): PromiseLike; } - export interface CatHealthOptions extends GenericParams { + export type CatBytes = "b" | "k" | "kb" | "m" | "mb" | "g" | "gb" | "t" | "tb" | "p" | "pb"; + + export interface CatCommonParams extends GenericParams { + format: string; local?: boolean; - masterTimeout?: number | Date; - h?: string | string[] | boolean; + masterTimeout?: TimeSpan; + h?: NameList; help?: boolean; - ts?: boolean; v?: boolean; } + export interface CatAliasesParams extends CatCommonParams { + name?: NameList; + } + + export interface CatAllocationParams extends CatCommonParams { + bytes?: CatBytes; + nodeId?: NameList; + } + + export interface CatCountParams extends CatCommonParams { + index?: NameList; + } + + export interface CatFielddataParams extends CatCommonParams { + bytes?: CatBytes; + fields?: NameList; + } + + export interface CatHealthParams extends CatCommonParams { + ts?: boolean; + } + + export interface CatHelpParams extends GenericParams { + help?: boolean; + } + + export interface CatIndicesParams extends CatCommonParams { + bytes?: CatBytes; + health?: "green" | "yellow" | "red"; + pri?: boolean; + index?: NameList; + } + + export interface CatRecoveryParams extends GenericParams { + format: string; + bytes?: CatBytes; + masterTimeout?: TimeSpan; + h?: NameList; + help?: boolean; + v?: boolean; + } + + export interface CatSegmentsParams extends GenericParams { + format: string; + h?: NameList; + help?: boolean; + v?: boolean; + index?: NameList; + } + + export interface CatShardsParams extends CatCommonParams { + index?: NameList; + } + + export interface CatSnapshotsParams extends GenericParams { + format: string; + ignoreUnavailable?: boolean; + masterTimeout?: TimeSpan; + h?: NameList; + help?: boolean; + v?: boolean; + repository?: NameList; + } + + export interface CatTasksParams extends GenericParams { + format: string; + nodeId?: NameList; + actions?: NameList; + detailed?: boolean; + parentNode?: string; + parentTask?: number; + h?: NameList; + help?: boolean; + v?: boolean; + } + + export interface CatThreadPoolParams extends CatCommonParams { + size?: "" | "k" | "m" | "g" | "t" | "p"; + threadPoolPatterns?: NameList; + } + export interface Cluster { - getSettings(params: ClusterGetSettingsOptions, callback: (error: any, response: any) => void): void; - getSettings(params: ClusterGetSettingsOptions): PromiseLike; - health(params: ClusterHealthOptions, callback: (error: any, response: any) => void): void; - health(params: ClusterHealthOptions): PromiseLike; - pendingTasks(params: ClusterPendingTasksOptions, callback: (error: any, response: any) => void): void; - pendingTasks(params: ClusterPendingTasksOptions): PromiseLike; - putSettings(params: ClusterPutSettingsOptions, callback: (error: any, response: any) => void): void; - putSettings(params: ClusterPutSettingsOptions): PromiseLike; - reroute(params: ClusterRerouteOptions, callback: (error: any, response: any) => void): void; - reroute(params: ClusterRerouteOptions): PromiseLike; - state(params: ClusterStateOptions, callback: (error: any, response: any) => void): void; - state(params: ClusterStateOptions): PromiseLike; - stats(params: ClusterStatsOptions, callback: (error: any, response: any) => void): void; - stats(params: ClusterStatsOptions): PromiseLike; + allocationExplain(params: ClusterAllocationExplainParams, callback: (error: any, response: any) => void): void; + allocationExplain(params: ClusterAllocationExplainParams): PromiseLike; + getSettings(params: ClusterGetSettingsParams, callback: (error: any, response: any) => void): void; + getSettings(params: ClusterGetSettingsParams): PromiseLike; + health(params: ClusterHealthParams, callback: (error: any, response: any) => void): void; + health(params: ClusterHealthParams): PromiseLike; + pendingTasks(params: ClusterPendingTasksParams, callback: (error: any, response: any) => void): void; + pendingTasks(params: ClusterPendingTasksParams): PromiseLike; + putSettings(params: ClusterPutSettingsParams, callback: (error: any, response: any) => void): void; + putSettings(params: ClusterPutSettingsParams): PromiseLike; + reroute(params: ClusterRerouteParams, callback: (error: any, response: any) => void): void; + reroute(params: ClusterRerouteParams): PromiseLike; + state(params: ClusterStateParams, callback: (error: any, response: any) => void): void; + state(params: ClusterStateParams): PromiseLike; + stats(params: ClusterStatsParams, callback: (error: any, response: any) => void): void; + stats(params: ClusterStatsParams): PromiseLike; } - export interface ClusterGetSettingsOptions extends GenericParams { + export interface ClusterAllocationExplainParams extends GenericParams { + includeYesDecisions?: boolean; + includeDiskInfo?: boolean; + } + + export interface ClusterGetSettingsParams extends GenericParams { flatSettings?: boolean; - masterTimeout?: number | Date; - timeout?: number | Date; + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + includeDefaults?: boolean; } - export interface ClusterHealthOptions extends GenericParams { - level?: string; // cluster, indices, shards + export interface ClusterHealthParams extends GenericParams { + level?: "cluster" | "indices" | "shards"; local?: boolean; - masterTimeout?: number | Date; - waitForActiveShards?: number; + masterTimeout?: TimeSpan; + waitForActiveShards?: string; waitForNodes?: string; - waitForRelocatingShards?: number; - waitForStatus?: string; // green, yellow, red - index?: string | string[] | boolean; + waitForEvents?: "immediate" | "urgent" | "high" | "normal" | "low" | "languid"; + waitForRelocatingShards?: boolean; + waitForStatus?: "green" | "yellow" | "red"; + index?: NameList; } - export interface ClusterPendingTasksOptions extends GenericParams { + export interface ClusterPendingTasksParams extends GenericParams { local?: boolean; - masterTimeout?: number | Date; + masterTimeout?: TimeSpan; } - export interface ClusterPutSettingsOptions extends GenericParams { + export interface ClusterPutSettingsParams extends GenericParams { flatSettings?: boolean; - masterTimeout?: number | Date; - timeout?: number | Date; + masterTimeout?: TimeSpan; + timeout?: TimeSpan; } - export interface ClusterRerouteOptions extends GenericParams { + export interface ClusterRerouteParams extends GenericParams { dryRun?: boolean; explain?: boolean; - metric?: string | string[] | boolean; - masterTimeout?: number | Date; - timeout?: number | Date; + retryFailed?: boolean; + metric?: NameList; + masterTimeout?: TimeSpan; + timeout?: TimeSpan; } - export interface ClusterStateOptions extends GenericParams { + export interface ClusterStateParams extends GenericParams { local?: boolean; - masterTimeout?: number | Date; + masterTimeout?: TimeSpan; flatSettings?: boolean; ignoreUnavailable?: boolean; allowNoIndices?: boolean; - expandWildcards?: string; // open, closed, none, all (default open) - index?: string | string[] | boolean; - metric?: string | string[] | boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; + metric?: NameList; } - export interface ClusterStatsOptions extends GenericParams { + export interface ClusterStatsParams extends GenericParams { flatSettings?: boolean; human?: boolean; - timeout?: number | Date; - nodeId?: string | string[] | boolean; + timeout?: TimeSpan; + nodeId?: NameList; + } + + export class Indices { + analyze(params: IndicesAnalyzeParams, callback: (error: any, response: any, status: any) => void): void; + analyze(params: IndicesAnalyzeParams): PromiseLike; + clearCache(params: IndicesClearCacheParams, callback: (error: any, response: any, status: any) => void): void; + clearCache(params: IndicesClearCacheParams): PromiseLike; + close(params: IndicesCloseParams, callback: (error: any, response: any, status: any) => void): void; + close(params: IndicesCloseParams): PromiseLike; + create(params: IndicesCreateParams, callback: (error: any, response: any, status: any) => void): void; + create(params: IndicesCreateParams): PromiseLike; + delete(params: IndicesDeleteParams, callback: (error: any, response: any, status: any) => void): void; + delete(params: IndicesDeleteParams): PromiseLike; + deleteAlias(params: IndicesDeleteAliasParams, callback: (error: any, response: any, status: any) => void): void; + deleteAlias(params: IndicesDeleteAliasParams): PromiseLike; + deleteTemplate(params: IndicesDeleteTemplateParams, callback: (error: any, response: any, status: any) => void): void; + deleteTemplate(params: IndicesDeleteTemplateParams): PromiseLike; + exists(params: IndicesExistsParams, callback: (error: any, response: any, status: any) => void): void; + exists(params: IndicesExistsParams): PromiseLike; + existsAlias(params: IndicesExistsAliasParams, callback: (error: any, response: any, status: any) => void): void; + existsAlias(params: IndicesExistsAliasParams): PromiseLike; + existsTemplate(params: IndicesExistsTemplateParams, callback: (error: any, response: any, status: any) => void): void; + existsTemplate(params: IndicesExistsTemplateParams): PromiseLike; + existsType(params: IndicesExistsTypeParams, callback: (error: any, response: any, status: any) => void): void; + existsType(params: IndicesExistsTypeParams): PromiseLike; + flush(params: IndicesFlushParams, callback: (error: any, response: any, status: any) => void): void; + flush(params: IndicesFlushParams): PromiseLike; + flushSynced(params: IndicesFlushSyncedParams, callback: (error: any, response: any, status: any) => void): void; + flushSynced(params: IndicesFlushSyncedParams): PromiseLike; + forcemerge(params: IndicesForcemergeParams, callback: (error: any, response: any, status: any) => void): void; + forcemerge(params: IndicesForcemergeParams): PromiseLike; + get(params: IndicesGetParams, callback: (error: any, response: any, status: any) => void): void; + get(params: IndicesGetParams): PromiseLike; + getAlias(params: IndicesGetAliasParams, callback: (error: any, response: any, status: any) => void): void; + getAlias(params: IndicesGetAliasParams): PromiseLike; + getFieldMapping(params: IndicesGetFieldMappingParams, callback: (error: any, response: any, status: any) => void): void; + getFieldMapping(params: IndicesGetFieldMappingParams): PromiseLike; + getMapping(params: IndicesGetMappingParams, callback: (error: any, response: any, status: any) => void): void; + getMapping(params: IndicesGetMappingParams): PromiseLike; + getSettings(params: IndicesGetSettingsParams, callback: (error: any, response: any, status: any) => void): void; + getSettings(params: IndicesGetSettingsParams): PromiseLike; + getTemplate(params: IndicesGetTemplateParams, callback: (error: any, response: any, status: any) => void): void; + getTemplate(params: IndicesGetTemplateParams): PromiseLike; + getUpgrade(params: IndicesGetUpgradeParams, callback: (error: any, response: any, status: any) => void): void; + getUpgrade(params: IndicesGetUpgradeParams): PromiseLike; + open(params: IndicesOpenParams, callback: (error: any, response: any, status: any) => void): void; + open(params: IndicesOpenParams): PromiseLike; + putAlias(params: IndicesPutAliasParams, callback: (error: any, response: any, status: any) => void): void; + putAlias(params: IndicesPutAliasParams): PromiseLike; + putMapping(params: IndicesPutMappingParams, callback: (error: any, response: any, status: any) => void): void; + putMapping(params: IndicesPutMappingParams): PromiseLike; + putSettings(params: IndicesPutSettingsParams, callback: (error: any, response: any, status: any) => void): void; + putSettings(params: IndicesPutSettingsParams): PromiseLike; + putTemplate(params: IndicesPutTemplateParams, callback: (error: any, response: any) => void): void; + putTemplate(params: IndicesPutTemplateParams): PromiseLike; + recovery(params: IndicesRecoveryParams, callback: (error: any, response: any) => void): void; + recovery(params: IndicesRecoveryParams): PromiseLike; + refresh(params: IndicesRefreshParams, callback: (error: any, response: any) => void): void; + refresh(params: IndicesRefreshParams): PromiseLike; + rollover(params: IndicesRolloverParams, callback: (error: any, response: IndicesRolloverResponse) => void): void; + rollover(params: IndicesRolloverParams): PromiseLike; + segments(params: IndicesSegmentsParams, callback: (error: any, response: any) => void): void; + segments(params: IndicesSegmentsParams): PromiseLike; + shardStores(params: IndicesShardStoresParams, callback: (error: any, response: any) => void): void; + shardStores(params: IndicesShardStoresParams): PromiseLike; + shrink(params: IndicesShrinkParams, callback: (error: any, response: any) => void): void; + shrink(params: IndicesShrinkParams): PromiseLike; + stats(params: IndicesStatsParams, callback: (error: any, response: any) => void): void; + stats(params: IndicesStatsParams): PromiseLike; + updateAliases(params: IndicesUpdateAliasesParams, callback: (error: any, response: any) => void): void; + updateAliases(params: IndicesUpdateAliasesParams): PromiseLike; + upgrade(params: IndicesUpgradeParams, callback: (error: any, response: any) => void): void; + upgrade(params: IndicesUpgradeParams): PromiseLike; + validateQuery(params: IndicesValidateQueryParams, callback: (error: any, response: any) => void): void; + validateQuery(params: IndicesValidateQueryParams): PromiseLike; + } + + export interface IndicesAnalyzeParams extends GenericParams { + analyzer?: string; + charFilter?: NameList; + field?: string; + filter?: NameList; + index?: string; + perferLocal?: boolean; + text?: NameList; + tokenizer?: string; + explain?: boolean; + attributes?: NameList; + format?: "" + } + + export interface IndicesClearCacheParams extends GenericParams { + fieldData?: boolean; + fielddata?: boolean; // yes the docs really have both + fields?: NameList; + query?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; + recycler?: boolean; + request?: boolean; + } + + export interface IndicesCloseParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; + } + + export interface IndicesCreateParams extends GenericParams { + waitForActiveShards?: string; + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + updateAllTypes?: boolean; + index: string; + } + + export interface IndicesDeleteParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + index: NameList; + } + + export interface IndicesDeleteAliasParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + index: NameList; + name: NameList; + } + + export interface IndicesDeleteTemplateParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + name: string; + } + + export interface IndicesExistsParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index: NameList; + } + + export interface IndicesExistsAliasParams extends IndicesExistsParams { + name: NameList; + } + + export interface IndicesExistsTemplateParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + name: NameList; + } + + export interface IndicesExistsTypeParams extends IndicesExistsParams { + type: NameList; + } + + export interface IndicesFlushParams extends GenericParams { + force?: boolean; + waitIfOngoing?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; + } + + export interface IndicesFlushSyncedParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index: NameList; + } + + export interface IndicesForcemergeParams extends GenericParams { + flush?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + maxNumSegments?: number; + onlyExpungeDeletes?: boolean; + operationThreading?: any; // even the docs don't know what this does + waitForMerge?: boolean; + index: NameList; + } + + export interface IndicesGetParams extends GenericParams { + local?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + flatSettings?: boolean; + human?: boolean; + includeDefaults?: boolean; + index?: NameList; + feature?: NameList; + } + + export interface IndicesGetAliasParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index?: NameList; + name?: NameList; + } + + export interface IndicesGetFieldMappingParams extends GenericParams { + includeDefaults?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index?: NameList; + type?: NameList; + fields?: NameList; + } + + export interface IndicesGetMappingParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + local?: boolean; + index?: NameList; + type?: NameList; + } + + export interface IndicesGetSettingsParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + flatSettings?: boolean; + local?: boolean; + human?: boolean; + includeDefaults?: boolean; + index?: NameList; + name?: NameList; + } + + export interface IndicesGetTemplateParams extends GenericParams { + flatSettings?: boolean; + masterTimeout?: TimeSpan; + local?: boolean; + name?: NameList; + } + + export interface IndicesGetUpgradeParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + human?: boolean; + index?: NameList; + } + + export interface IndicesOpenParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + index?: NameList; + } + + export interface IndicesPutAliasParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + index?: NameList; + name: NameList; + } + + export interface IndicesPutMappingParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + updateAllTypes?: boolean; + index: NameList; + type: string; + body: any; + } + + export interface IndicesPutSettingsParams extends GenericParams { + masterTimeout?: TimeSpan; + preserveExisting?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + flatSettings?: boolean; + index: NameList; + body: any; + } + + export interface IndicesPutTemplateParams extends GenericParams { + order?: number; + create?: boolean; + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + flatSettings?: boolean; + name: string; + body: any; + } + + export interface IndicesRecoveryParams extends GenericParams { + detailed?: boolean; + activeOnly?: boolean; + human?: boolean; + index: NameList; + } + + export interface IndicesRefreshParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + force?: boolean; + operationThreading?: any; // even the docs don't know what this does + index: NameList; + } + + export interface IndicesRolloverParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + waitForActiveShards?: number | string; + alias?: string; + newIndex?: string; + } + + export interface IndicesRolloverResponse { + acknowledged: boolean; + shards_acknowledged: boolean; + old_index: string; + new_index: string; + rolled_over: boolean; + dry_run: boolean; + conditions: { [condition: string]: boolean }; + } + + export interface IndicesSegmentsParams extends GenericParams { + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + human?: boolean; + operationThreading?: any; // even the docs don't know what this does + verbose?: boolean; + index: NameList; + } + + export interface IndicesShardStoresParams extends GenericParams { + status?: NameList; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + operationThreading?: any; // even the docs don't know what this does + index: NameList; + } + + export interface IndicesShrinkParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + waitForActiveShards?: string | number; + index: string; + target: string; + } + + export interface IndicesStatsParams extends GenericParams { + completionFields?: NameList; + fielddataFields?: NameList; + fields?: NameList; + groups?: NameList; + human?: boolean; + level?: "cluster" | "indices" | "shards"; + types?: NameList; + index: NameList; + metric?: NameList; + } + + export interface IndicesUpdateAliasesParams extends GenericParams { + timeout?: TimeSpan; + masterTimeout?: TimeSpan; + body: { + actions: IndicesUpdateAliasesParamsAction[]; + } + } + + export interface IndicesUpdateAliasesParamsAction { + add?: { + index?: string; + indices?: string[]; + alias: string; + }; + remove?: { + index?: string; + indices?: string[]; + alias: string; + }; + remove_index?: { + index: string; + } + } + + export interface IndicesUpgradeParams extends GenericParams { + expandWildcards?: ExpandWildcards; + ignoreUnavailable?: boolean; + waitForCompletion?: boolean; + onlyAncientSegments?: boolean; + index: NameList; + } + + export interface IndicesValidateQueryParams extends GenericParams { + explain?: boolean; + ignoreUnavailable?: boolean; + allowNoIndices?: boolean; + expandWildcards?: ExpandWildcards; + operationThreading?: any; // even the docs don't know what this does + q?: string; + analyzer?: string; + analyzeWildcard?: boolean; + defaultOperator?: DefaultOperator; + df?: string; + lenient?: boolean; + lowercaseExpandedTerms?: boolean; + rewrite?: boolean; + index: NameList; + type?: NameList; + } + + export class Ingest { + deletePipeline(params: IngestDeletePipelineParams, callback: (error: any, response: any, status: any) => void): void; + deletePipeline(params: IngestDeletePipelineParams): PromiseLike; + getPipeline(params: IngestGetPipelineParams, callback: (error: any, response: any, status: any) => void): void; + getPipeline(params: IngestGetPipelineParams): PromiseLike; + putPipeline(params: IngestPutPipelineParams, callback: (error: any, response: any, status: any) => void): void; + putPipeline(params: IngestPutPipelineParams): PromiseLike; + simulate(params: IngestSimulateParams, callback: (error: any, response: any, status: any) => void): void; + simulate(params: IngestSimulateParams): PromiseLike; + } + + export interface IngestDeletePipelineParams extends GenericParams { + masterTimeout?: number; + timeout?: number; + id: string; + } + + export interface IngestGetPipelineParams extends GenericParams { + masterTimeout?: number; + id: string; + } + + export interface IngestPutPipelineParams extends GenericParams { + masterTimeout?: number; + timeout?: number; + id: string; + body: any; + } + + export interface IngestSimulateParams extends GenericParams { + verbose?: boolean; + id: string; + } + + export class Nodes { + hotThreads(params: NodesHotThreadsParams, callback: (error: any, response: any, status: any) => void): void; + hotThreads(params: NodesHotThreadsParams): PromiseLike; + info(params: NodesInfoParams, callback: (error: any, response: any, status: any) => void): void; + info(params: NodesInfoParams): PromiseLike; + stats(params: NodesStatsParams, callback: (error: any, response: any, status: any) => void): void; + stats(params: NodesStatsParams): PromiseLike; + } + + export interface NodesHotThreadsParams extends GenericParams { + interval?: TimeSpan; + snapshots?: number; + threads?: number; + ignoreIdleThreads?: boolean; + type?: "cpu" | "wait" | "blocked"; + timeout?: TimeSpan; + nodeId: NameList; + } + + export interface NodesInfoParams extends GenericParams { + flatSettings?: boolean; + human?: boolean; + timeout?: TimeSpan; + nodeId: NameList; + metric?: NameList; + } + + export interface NodesStatsParams extends GenericParams { + completionFields?: NameList; + fielddataFields?: NameList; + fields?: NameList; + groups?: boolean; + human?: boolean; + level?: "indices" | "node" | "shards"; + types?: NameList; + timeout?: TimeSpan; + metric?: NameList; + indexMetric?: NameList; + nodeId?: NameList; + } + + export class Snapshot { + create(params: SnapshotCreateParams, callback: (error: any, response: any, status: any) => void): void; + create(params: SnapshotCreateParams): PromiseLike; + createRepository(params: SnapshotCreateRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + createRepository(params: SnapshotCreateRepositoryParams): PromiseLike; + delete(params: SnapshotDeleteParams, callback: (error: any, response: any, status: any) => void): void; + delete(params: SnapshotDeleteParams): PromiseLike; + deleteRepository(params: SnapshotDeleteRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + deleteRepository(params: SnapshotDeleteRepositoryParams): PromiseLike; + get(params: SnapshotGetParams, callback: (error: any, response: any, status: any) => void): void; + get(params: SnapshotGetParams): PromiseLike; + getRepository(params: SnapshotGetRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + getRepository(params: SnapshotGetRepositoryParams): PromiseLike; + restore(params: SnapshotRestoreParams, callback: (error: any, response: any, status: any) => void): void; + restore(params: SnapshotRestoreParams): PromiseLike; + status(params: SnapshotStatusParams, callback: (error: any, response: any, status: any) => void): void; + status(params: SnapshotStatusParams): PromiseLike; + verifyRepository(params: SnapshotVerifyRepositoryParams, callback: (error: any, response: any, status: any) => void): void; + verifyRepository(params: SnapshotVerifyRepositoryParams): PromiseLike; + } + + export interface SnapshotCreateParams extends GenericParams { + masterTimeout?: TimeSpan; + waitForCompletion?: boolean; + repository: string; + snapshot: string; + } + + export interface SnapshotCreateRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + verify?: boolean; + repository: string; + } + + export interface SnapshotDeleteParams extends GenericParams { + masterTimeout?: TimeSpan; + repository: string; + snapshot: string; + } + + export interface SnapshotDeleteRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + repository: string; + } + + export interface SnapshotGetParams extends GenericParams { + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + repository: string; + snapshot: NameList; + } + + export interface SnapshotGetRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + local?: boolean; + repository: NameList; + } + + export interface SnapshotRestoreParams extends GenericParams { + masterTimeout?: TimeSpan; + waitForCompletion?: boolean; + repository: string; + snapshot: string; + } + + export interface SnapshotStatusParams extends GenericParams { + masterTimeout?: TimeSpan; + ignoreUnavailable?: boolean; + repository: string; + snapshot: NameList; + } + + export interface SnapshotVerifyRepositoryParams extends GenericParams { + masterTimeout?: TimeSpan; + timeout?: TimeSpan; + repository: string; + } + + export class Tasks { + cancel(params: TasksCancelParams, callback: (error: any, response: any, status: any) => void): void; + cancel(params: TasksCancelParams): PromiseLike; + get(params: TasksGetParams, callback: (error: any, response: any, status: any) => void): void; + get(params: TasksGetParams): PromiseLike; + list(params: TasksListParams, callback: (error: any, response: any, status: any) => void): void; + list(params: TasksListParams): PromiseLike; + } + + export interface TasksCancelParams extends GenericParams { + nodeId?: NameList; + actions?: NameList; + parentNode?: string; + parentTask?: string; + taskId?: string; + } + + export interface TasksGetParams extends GenericParams { + waitForCompletion?: boolean; + taskId?: string; + } + + export interface TasksListParams extends GenericParams { + nodeId?: NameList; + actions?: NameList; + detailed?: boolean; + parentNode?: string; + parentTask?: string; + waitForCompletion?: boolean; + groupBy?: "nodes" | "parents"; } } diff --git a/elasticsearch/tsconfig.json b/elasticsearch/tsconfig.json index d6f1afd5c4..287c983130 100644 --- a/elasticsearch/tsconfig.json +++ b/elasticsearch/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/electron-builder/tsconfig.json b/electron-builder/tsconfig.json index f29d1b2984..9519423b02 100644 --- a/electron-builder/tsconfig.json +++ b/electron-builder/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/electron-debug/electron-debug-tests.ts b/electron-debug/electron-debug-tests.ts new file mode 100644 index 0000000000..15910e76d7 --- /dev/null +++ b/electron-debug/electron-debug-tests.ts @@ -0,0 +1,8 @@ +import debug = require('electron-debug') + +debug({enabled: false}); + +debug({showDevTools: true}); +debug({showDevTools: 'right'}); +debug({showDevTools: 'bottom'}); +debug({showDevTools: 'undocked'}); diff --git a/electron-debug/index.d.ts b/electron-debug/index.d.ts new file mode 100644 index 0000000000..4806b7ccf5 --- /dev/null +++ b/electron-debug/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for electron-debug v1.1.0 +// Project: https://github.com/sindresorhus/electron-debug +// Definitions by: Daniel Perez Alvarez +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Install keyboard shortcuts and optionally activate DevTools on each + * created BrowserWindow. + */ +declare function electronDebug(options: { + /** Enable debug options. */ + enabled?: boolean; + /** Show DevTools on each created BrowserWindow. */ + showDevTools?: boolean | 'right' | 'bottom' | 'undocked'; +}): void; + +export = electronDebug; diff --git a/electron-debug/tsconfig.json b/electron-debug/tsconfig.json new file mode 100644 index 0000000000..5252723379 --- /dev/null +++ b/electron-debug/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "electron-debug-tests.ts" + ] +} \ No newline at end of file diff --git a/electron-devtools-installer/tsconfig.json b/electron-devtools-installer/tsconfig.json index cc35ce2733..75bf78de62 100644 --- a/electron-devtools-installer/tsconfig.json +++ b/electron-devtools-installer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/electron-json-storage/tsconfig.json b/electron-json-storage/tsconfig.json index 8185e6b0d2..149ae11d8d 100644 --- a/electron-json-storage/tsconfig.json +++ b/electron-json-storage/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/electron-notifications/tsconfig.json b/electron-notifications/tsconfig.json index 546ef78b0b..adba6ee9c5 100644 --- a/electron-notifications/tsconfig.json +++ b/electron-notifications/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/electron-notify/tsconfig.json b/electron-notify/tsconfig.json index 3c0b906028..1e63f414e9 100644 --- a/electron-notify/tsconfig.json +++ b/electron-notify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/electron-packager/tsconfig.json b/electron-packager/tsconfig.json index 91124af365..6e968aa378 100644 --- a/electron-packager/tsconfig.json +++ b/electron-packager/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/electron-window-state/tsconfig.json b/electron-window-state/tsconfig.json index 50201aae1f..fe8785b215 100644 --- a/electron-window-state/tsconfig.json +++ b/electron-window-state/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/electron/electron-prebuilt.d.ts b/electron/electron-prebuilt.d.ts deleted file mode 100644 index 585c9e4668..0000000000 --- a/electron/electron-prebuilt.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for electron 1.3.3 -// Project: https://github.com/electron-userland/electron-prebuilt -// Definitions by: rhysd -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -// this file will be removed. diff --git a/electron/electron-tests.ts b/electron/electron-tests.ts new file mode 100644 index 0000000000..00b34d60b1 --- /dev/null +++ b/electron/electron-tests.ts @@ -0,0 +1,7 @@ +/// +/// + +import electron = require('electron'); +import child_process = require('child_process'); + +child_process.spawn(electron); diff --git a/electron/github-electron-main-tests.ts b/electron/github-electron-main-tests.ts index df5e6723eb..ce5bbf8e2e 100644 --- a/electron/github-electron-main-tests.ts +++ b/electron/github-electron-main-tests.ts @@ -9,6 +9,7 @@ import { ipcMain, Menu, MenuItem, + net, powerMonitor, powerSaveBlocker, protocol, @@ -62,6 +63,7 @@ app.on('ready', () => { mainWindow.loadURL(`file://${__dirname}/index.html`); mainWindow.loadURL('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'}); mainWindow.webContents.loadURL('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer'}); + mainWindow.webContents.loadURL('file://foo/bar', {userAgent: 'cool-agent', httpReferrer: 'greateRefferer', postData: [{type: 'blob', blobUUID: 'hogefuga'}]}); mainWindow.webContents.openDevTools(); mainWindow.webContents.toggleDevTools(); @@ -79,6 +81,9 @@ app.on('ready', () => { mainWindow = null; }); + mainWindow.webContents.setVisualZoomLevelLimits(50, 200); + mainWindow.webContents.setLayoutZoomLevelLimits(50, 200); + mainWindow.webContents.print({silent: true, printBackground: false}); mainWindow.webContents.print(); @@ -92,7 +97,7 @@ app.on('ready', () => { mainWindow.webContents.printToPDF({}, (err, data) => {}); - mainWindow.webContents.executeJavaScript('return true;'); + mainWindow.webContents.executeJavaScript('return true;').then((v: boolean) => console.log(v)); mainWindow.webContents.executeJavaScript('return true;', true); mainWindow.webContents.executeJavaScript('return true;', true, (result: boolean) => console.log(result)); mainWindow.webContents.insertText('blah, blah, blah'); @@ -312,6 +317,10 @@ var window = new BrowserWindow(); window.setProgressBar(0.5); window.setRepresentedFilename('/etc/passwd'); window.setDocumentEdited(true); +window.previewFile('/path/to/file'); +window.previewFile('/path/to/file', 'Displayed Name'); +window.setVibrancy('light'); +window.setVibrancy('titlebar'); // Online/Offline Event Detection // https://github.com/atom/electron/blob/master/docs/tutorial/online-offline-events.md @@ -319,7 +328,7 @@ window.setDocumentEdited(true); var onlineStatusWindow: Electron.BrowserWindow; app.on('ready', () => { - onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false }); + onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false, vibrancy: 'sidebar' }); onlineStatusWindow.loadURL(`file://${__dirname}/online-status.html`); }); app.on('accessibility-support-changed', (_, enabled) => console.log('accessibility: ' + enabled)); @@ -732,6 +741,51 @@ Menu.buildFromTemplate([ { label: '3', position: 'endof=numbers' } ]); +// net +// https://github.com/electron/electron/blob/master/docs/api/net.md + +app.on('ready', () => { + const request = net.request('https://github.com') + request.setHeader('Some-Custom-Header-Name', 'Some-Custom-Header-Value'); + let header = request.getHeader('Some-Custom-Header-Name'); + request.removeHeader('Some-Custom-Header-Name'); + request.on('response', (response) => { + console.log(`Status code: ${response.statusCode}`); + console.log(`Status message: ${response.statusMessage}`); + console.log(`Headers: ${JSON.stringify(response.headers)}`); + console.log(`Http version: ${response.httpVersion}`); + console.log(`Major Http version: ${response.httpVersionMajor}`); + console.log(`Minor Http version: ${response.httpVersionMinor}`); + response.on('data', (chunk) => { + console.log(`BODY: ${chunk}`); + }) + response.on('end', () => { + console.log('No more data in response.'); + }) + response.on('error', () => { + console.log('"error" event emitted'); + }); + response.on('aborted', () => { + console.log('"aborted" event emitted'); + }); + }) + request.on('login', (authInfo, callback) => { + callback('username', 'password'); + }); + request.on('finish', () => { + console.log('"finish" event emitted'); + }); + request.on('abort', () => { + console.log('"abort" event emitted'); + }); + request.on('error', () => { + console.log('"error" event emitted'); + }); + request.write('Hello World!', 'utf-8', () => { }); + request.end('Hello World!', 'utf-8', () => { }); + request.abort(); +}) + // power-monitor // https://github.com/atom/electron/blob/master/docs/api/power-monitor.md @@ -823,20 +877,25 @@ app.on('ready', () => { // clipboard // https://github.com/atom/electron/blob/master/docs/api/clipboard.md -clipboard.writeText('Example String'); -clipboard.writeText('Example String', 'selection'); -clipboard.writeBookmark('foo', 'http://example.com'); -clipboard.writeBookmark('foo', 'http://example.com', 'selection'); -console.log(clipboard.readText('selection')); -console.log(clipboard.availableFormats()); -console.log(clipboard.readBookmark().title); -clipboard.clear(); +{ + let str: string; + clipboard.writeText('Example String'); + clipboard.writeText('Example String', 'selection'); + clipboard.writeBookmark('foo', 'http://example.com'); + clipboard.writeBookmark('foo', 'http://example.com', 'selection'); + clipboard.writeFindText('foo'); + str = clipboard.readText('selection'); + str = clipboard.readFindText(); + console.log(clipboard.availableFormats()); + console.log(clipboard.readBookmark().title); + clipboard.clear(); -clipboard.write({ - html: '', - text: 'Hello World!', - image: clipboard.readImage() -}); + clipboard.write({ + html: '', + text: 'Hello World!', + image: clipboard.readImage() + }); +} // crash-reporter // https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md @@ -1005,6 +1064,7 @@ session.defaultSession.enableNetworkEmulation({ session.defaultSession.setCertificateVerifyProc((hostname, cert, callback) => { callback((hostname === 'github.com') ? true : false); + console.log(cert.issuer.commonName); }); session.defaultSession.setPermissionRequestHandler(function(webContents, permission, callback) { diff --git a/electron/github-electron-renderer-tests.ts b/electron/github-electron-renderer-tests.ts index 87d9a4abf7..20dca2d07e 100644 --- a/electron/github-electron-renderer-tests.ts +++ b/electron/github-electron-renderer-tests.ts @@ -57,7 +57,8 @@ console.log(webFrame.getZoomFactor()); webFrame.setZoomLevel(200); console.log(webFrame.getZoomLevel()); -webFrame.setZoomLevelLimits(50, 200); +webFrame.setVisualZoomLevelLimits(50, 200); +webFrame.setLayoutZoomLevelLimits(50, 200); webFrame.setSpellCheckProvider('en-US', true, { spellCheck: text => { @@ -68,12 +69,16 @@ webFrame.setSpellCheckProvider('en-US', true, { webFrame.registerURLSchemeAsSecure('app'); webFrame.registerURLSchemeAsBypassingCSP('app'); webFrame.registerURLSchemeAsPrivileged('app'); +webFrame.registerURLSchemeAsPrivileged('app', { + secure: true, + supportFetchAPI: true, +}); webFrame.insertText('text'); webFrame.executeJavaScript('JSON.stringify({})', false, (result) => { console.log(result); -}); +}).then((result: string) => console.log('OK:' + result)); console.log(webFrame.getResourceUsage()); webFrame.clearCache(); diff --git a/electron/github-electron.d.ts b/electron/github-electron.d.ts new file mode 100644 index 0000000000..f87b50b362 --- /dev/null +++ b/electron/github-electron.d.ts @@ -0,0 +1,5765 @@ +// Type definitions for Electron v1.4.4 +// Project: http://electron.atom.io/ +// Definitions by: jedmao , rhysd , Milan Burda +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace Electron { + + interface Event { + preventDefault: Function; + sender: NodeJS.EventEmitter; + } + + type Point = { + x: number; + y: number; + } + + type Size = { + width: number; + height: number; + } + + type Rectangle = { + x: number; + y: number; + width: number; + height: number; + } + + interface Destroyable { + /** + * Destroys the object. + */ + destroy(): void; + /** + * @returns Whether the object is destroyed. + */ + isDestroyed(): boolean; + } + + // https://github.com/electron/electron/blob/master/docs/api/app.md + + /** + * The app module is responsible for controlling the application's lifecycle. + */ + interface App extends NodeJS.EventEmitter { + /** + * Emitted when the application has finished basic startup. + * On Windows and Linux, the will-finish-launching event + * is the same as the ready event; on macOS, this event represents + * the applicationWillFinishLaunching notification of NSApplication. + * You would usually set up listeners for the open-file and open-url events here, + * and start the crash reporter and auto updater. + * + * In most cases, you should just do everything in the ready event handler. + */ + on(event: 'will-finish-launching', listener: Function): this; + /** + * Emitted when Electron has finished initialization. + */ + on(event: 'ready', listener: (event: Event, launchInfo: Object) => void): this; + /** + * Emitted when all windows have been closed. + * + * If you do not subscribe to this event and all windows are closed, + * the default behavior is to quit the app; however, if you subscribe, + * you control whether the app quits or not. + * If the user pressed Cmd + Q, or the developer called app.quit(), + * Electron will first try to close all the windows and then emit the will-quit event, + * and in this case the window-all-closed event would not be emitted. + */ + on(event: 'window-all-closed', listener: Function): this; + /** + * Emitted before the application starts closing its windows. + * Calling event.preventDefault() will prevent the default behaviour, which is terminating the application. + */ + on(event: 'before-quit', listener: (event: Event) => void): this; + /** + * Emitted when all windows have been closed and the application will quit. + * Calling event.preventDefault() will prevent the default behaviour, which is terminating the application. + */ + on(event: 'will-quit', listener: (event: Event) => void): this; + /** + * Emitted when the application is quitting. + */ + on(event: 'quit', listener: (event: Event, exitCode: number) => void): this; + /** + * Emitted when the user wants to open a file with the application. + * The open-file event is usually emitted when the application is already open + * and the OS wants to reuse the application to open the file. + * open-file is also emitted when a file is dropped onto the dock and the application + * is not yet running. Make sure to listen for the open-file event very early + * in your application startup to handle this case (even before the ready event is emitted). + * + * You should call event.preventDefault() if you want to handle this event. + * + * Note: This is only implemented on macOS. + */ + on(event: 'open-file', listener: (event: Event, url: string) => void): this; + /** + * Emitted when the user wants to open a URL with the application. + * The URL scheme must be registered to be opened by your application. + * + * You should call event.preventDefault() if you want to handle this event. + * + * Note: This is only implemented on macOS. + */ + on(event: 'open-url', listener: (event: Event, url: string) => void): this; + /** + * Emitted when the application is activated, which usually happens when clicks on the applications’s dock icon. + * Note: This is only implemented on macOS. + */ + on(event: 'activate', listener: Function): this; + /** + * Emitted during Handoff when an activity from a different device wants to be resumed. + * You should call event.preventDefault() if you want to handle this event. + */ + on(event: 'continue-activity', listener: (event: Event, type: string, userInfo: Object) => void): this; + /** + * Emitted when a browserWindow gets blurred. + */ + on(event: 'browser-window-blur', listener: (event: Event, browserWindow: BrowserWindow) => void): this; + /** + * Emitted when a browserWindow gets focused. + */ + on(event: 'browser-window-focus', listener: (event: Event, browserWindow: BrowserWindow) => void): this; + /** + * Emitted when a new browserWindow is created. + */ + on(event: 'browser-window-created', listener: (event: Event, browserWindow: BrowserWindow) => void): this; + /** + * Emitted when a new webContents is created. + */ + on(event: 'web-contents-created', listener: (event: Event, webContents: WebContents) => void): this; + /** + * Emitted when failed to verify the certificate for url, to trust the certificate + * you should prevent the default behavior with event.preventDefault() and call callback(true). + */ + on(event: 'certificate-error', listener: (event: Event, + webContents: WebContents, + url: string, + error: string, + certificate: Certificate, + callback: (trust: boolean) => void + ) => void): this; + /** + * Emitted when a client certificate is requested. + * + * The url corresponds to the navigation entry requesting the client certificate + * and callback needs to be called with an entry filtered from the list. + * Using event.preventDefault() prevents the application from using the first certificate from the store. + */ + on(event: 'select-client-certificate', listener: (event: Event, + webContents: WebContents, + url: string, + certificateList: Certificate[], + callback: (certificate: Certificate) => void + ) => void): this; + /** + * Emitted when webContents wants to do basic auth. + * + * The default behavior is to cancel all authentications, to override this + * you should prevent the default behavior with event.preventDefault() + * and call callback(username, password) with the credentials. + */ + on(event: 'login', listener: (event: Event, + webContents: WebContents, + request: LoginRequest, + authInfo: LoginAuthInfo, + callback: (username: string, password: string) => void + ) => void): this; + /** + * Emitted when the gpu process crashes. + */ + on(event: 'gpu-process-crashed', listener: (event: Event, killed: boolean) => void): this; + /** + * Emitted when Chrome's accessibility support changes. + * + * Note: This API is only available on macOS and Windows. + */ + on(event: 'accessibility-support-changed', listener: (event: Event, accessibilitySupportEnabled: boolean) => void): this; + on(event: string, listener: Function): this; + /** + * Try to close all windows. The before-quit event will first be emitted. + * If all windows are successfully closed, the will-quit event will be emitted + * and by default the application would be terminated. + * + * This method guarantees all beforeunload and unload handlers are correctly + * executed. It is possible that a window cancels the quitting by returning + * false in beforeunload handler. + */ + quit(): void; + /** + * Exits immediately with exitCode. + * All windows will be closed immediately without asking user + * and the before-quit and will-quit events will not be emitted. + */ + exit(exitCode?: number): void; + /** + * Relaunches the app when current instance exits. + * + * By default the new instance will use the same working directory + * and command line arguments with current instance. + * When args is specified, the args will be passed as command line arguments instead. + * When execPath is specified, the execPath will be executed for relaunch instead of current app. + * + * Note that this method does not quit the app when executed, you have to call app.quit + * or app.exit after calling app.relaunch to make the app restart. + * + * When app.relaunch is called for multiple times, multiple instances + * will be started after current instance exited. + */ + relaunch(options?: { + args?: string[], + execPath?: string + }): void; + /** + * @returns Whether Electron has finished initializing. + */ + isReady(): boolean; + /** + * On Linux, focuses on the first visible window. + * On macOS, makes the application the active app. + * On Windows, focuses on the application’s first window. + */ + focus(): void; + /** + * Hides all application windows without minimizing them. + * Note: This is only implemented on macOS. + */ + hide(): void; + /** + * Shows application windows after they were hidden. Does not automatically focus them. + * Note: This is only implemented on macOS. + */ + show(): void; + /** + * Returns the current application directory. + */ + getAppPath(): string; + /** + * @returns The path to a special directory or file associated with name. + * On failure an Error would throw. + */ + getPath(name: AppPathName): string; + /** + * Overrides the path to a special directory or file associated with name. + * If the path specifies a directory that does not exist, the directory will + * be created by this method. On failure an Error would throw. + * + * You can only override paths of names defined in app.getPath. + * + * By default web pages' cookies and caches will be stored under userData + * directory, if you want to change this location, you have to override the + * userData path before the ready event of app module gets emitted. + */ + setPath(name: AppPathName, path: string): void; + /** + * @returns The version of loaded application, if no version is found in + * application's package.json, the version of current bundle or executable. + */ + getVersion(): string; + /** + * @returns The current application's name, the name in package.json would be used. + * Usually the name field of package.json is a short lowercased name, according to + * the spec of npm modules. So usually you should also specify a productName field, + * which is your application's full capitalized name, and it will be preferred over + * name by Electron. + */ + getName(): string; + /** + * Overrides the current application's name. + */ + setName(name: string): void; + /** + * @returns The current application locale. + */ + getLocale(): string; + /** + * Adds path to recent documents list. + * + * This list is managed by the system, on Windows you can visit the list from + * task bar, and on macOS you can visit it from dock menu. + * + * Note: This is only implemented on macOS and Windows. + */ + addRecentDocument(path: string): void; + /** + * Clears the recent documents list. + * + * Note: This is only implemented on macOS and Windows. + */ + clearRecentDocuments(): void; + /** + * Sets the current executable as the default handler for a protocol (aka URI scheme). + * Once registered, all links with your-protocol:// will be opened with the current executable. + * The whole link, including protocol, will be passed to your application as a parameter. + * + * On Windows you can provide optional parameters path, the path to your executable, + * and args, an array of arguments to be passed to your executable when it launches. + * + * @param protocol The name of your protocol, without ://. + * @param path Defaults to process.execPath. + * @param args Defaults to an empty array. + * + * Note: This is only implemented on macOS and Windows. + * On macOS, you can only register protocols that have been added to your app's info.plist. + */ + setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; + /** + * Removes the current executable as the default handler for a protocol (aka URI scheme). + * + * @param protocol The name of your protocol, without ://. + * @param path Defaults to process.execPath. + * @param args Defaults to an empty array. + * + * Note: This is only implemented on macOS and Windows. + */ + removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; + /** + * @param protocol The name of your protocol, without ://. + * @param path Defaults to process.execPath. + * @param args Defaults to an empty array. + * + * @returns Whether the current executable is the default handler for a protocol (aka URI scheme). + * + * Note: This is only implemented on macOS and Windows. + */ + isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean; + /** + * Adds tasks to the Tasks category of JumpList on Windows. + * + * Note: This API is only available on Windows. + */ + setUserTasks(tasks: Task[]): boolean; + /** + * Note: This API is only available on Windows. + */ + getJumpListSettings(): JumpListSettings; + /** + * Sets or removes a custom Jump List for the application. + * + * If categories is null the previously set custom Jump List (if any) will be replaced + * by the standard Jump List for the app (managed by Windows). + * + * Note: This API is only available on Windows. + */ + setJumpList(categories: JumpListCategory[]): SetJumpListResult; + /** + * This method makes your application a Single Instance Application instead of allowing + * multiple instances of your app to run, this will ensure that only a single instance + * of your app is running, and other instances signal this instance and exit. + */ + makeSingleInstance(callback: (args: string[], workingDirectory: string) => void): boolean; + /** + * Releases all locks that were created by makeSingleInstance. This will allow + * multiple instances of the application to once again run side by side. + */ + releaseSingleInstance(): void; + /** + * Creates an NSUserActivity and sets it as the current activity. + * The activity is eligible for Handoff to another device afterward. + * + * @param type Uniquely identifies the activity. Maps to NSUserActivity.activityType. + * @param userInfo App-specific state to store for use by another device. + * @param webpageURL The webpage to load in a browser if no suitable app is + * installed on the resuming device. The scheme must be http or https. + * + * Note: This API is only available on macOS. + */ + setUserActivity(type: string, userInfo: Object, webpageURL?: string): void; + /** + * @returns The type of the currently running activity. + * + * Note: This API is only available on macOS. + */ + getCurrentActivityType(): string; + /** + * Changes the Application User Model ID to id. + * + * Note: This is only implemented on Windows. + */ + setAppUserModelId(id: string): void; + /** + * Imports the certificate in pkcs12 format into the platform certificate store. + * @param callback Called with the result of import operation, a value of 0 indicates success + * while any other value indicates failure according to chromium net_error_list. + * + * Note: This API is only available on Linux. + */ + importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void; + /** + * Disables hardware acceleration for current app. + * This method can only be called before app is ready. + */ + disableHardwareAcceleration(): void; + /** + * @returns whether current desktop environment is Unity launcher. (Linux) + * + * Note: This API is only available on Linux. + */ + isUnityRunning(): boolean; + /** + * Returns a Boolean, true if Chrome's accessibility support is enabled, false otherwise. + * This API will return true if the use of assistive technologies, such as screen readers, + * has been detected. + * See https://www.chromium.org/developers/design-documents/accessibility for more details. + * + * Note: This API is only available on macOS and Windows. + */ + isAccessibilitySupportEnabled(): boolean; + /** + * @returns an Object with the login item settings of the app. + * + * Note: This API is only available on macOS and Windows. + */ + getLoginItemSettings(): LoginItemSettings; + /** + * Set the app's login item settings. + * + * Note: This API is only available on macOS and Windows. + */ + setLoginItemSettings(settings: LoginItemSettings): void; + /** + * Set the about panel options. This will override the values defined in the app's .plist file. + * See the Apple docs for more details. + * + * Note: This API is only available on macOS. + */ + setAboutPanelOptions(options: AboutPanelOptions): void; + commandLine: CommandLine; + /** + * Note: This API is only available on macOS. + */ + dock: Dock; + } + + type AppPathName = 'home'|'appData'|'userData'|'temp'|'exe'|'module'|'desktop'|'documents'|'downloads'|'music'|'pictures'|'videos'|'pepperFlashSystemPlugin'; + + interface ImportCertificateOptions { + /** + * Path for the pkcs12 file. + */ + certificate: string; + /** + * Passphrase for the certificate. + */ + password: string; + } + + interface CommandLine { + /** + * Append a switch [with optional value] to Chromium's command line. + * + * Note: This will not affect process.argv, and is mainly used by developers + * to control some low-level Chromium behaviors. + */ + appendSwitch(_switch: string, value?: string): void; + /** + * Append an argument to Chromium's command line. The argument will quoted properly. + * + * Note: This will not affect process.argv. + */ + appendArgument(value: string): void; + } + + interface Dock { + /** + * When critical is passed, the dock icon will bounce until either the + * application becomes active or the request is canceled. + * + * When informational is passed, the dock icon will bounce for one second. + * However, the request remains active until either the application becomes + * active or the request is canceled. + * + * @param type The default is informational. + * @returns An ID representing the request. + */ + bounce(type?: 'critical' | 'informational'): number; + /** + * Cancel the bounce of id. + * + * Note: This API is only available on macOS. + */ + cancelBounce(id: number): void; + /** + * Bounces the Downloads stack if the filePath is inside the Downloads folder. + * + * Note: This API is only available on macOS. + */ + downloadFinished(filePath: string): void; + /** + * Sets the string to be displayed in the dock’s badging area. + * + * Note: This API is only available on macOS. + */ + setBadge(text: string): void; + /** + * Returns the badge string of the dock. + * + * Note: This API is only available on macOS. + */ + getBadge(): string; + /** + * Sets the counter badge for current app. Setting the count to 0 will hide the badge. + * + * @returns True when the call succeeded, otherwise returns false. + * + * Note: This API is only available on macOS and Linux. + */ + setBadgeCount(count: number): boolean; + /** + * @returns The current value displayed in the counter badge. + * + * Note: This API is only available on macOS and Linux. + */ + getBadgeCount(): number; + /** + * Hides the dock icon. + * + * Note: This API is only available on macOS. + */ + hide(): void; + /** + * Shows the dock icon. + * + * Note: This API is only available on macOS. + */ + show(): void; + /** + * @returns Whether the dock icon is visible. + * The app.dock.show() call is asynchronous so this method might not return true immediately after that call. + * + * Note: This API is only available on macOS. + */ + isVisible(): boolean; + /** + * Sets the application dock menu. + * + * Note: This API is only available on macOS. + */ + setMenu(menu: Menu): void; + /** + * Sets the image associated with this dock icon. + * + * Note: This API is only available on macOS. + */ + setIcon(icon: NativeImage | string): void; + } + + interface Task { + /** + * Path of the program to execute, usually you should specify process.execPath + * which opens current program. + */ + program: string; + /** + * The arguments of command line when program is executed. + */ + arguments: string; + /** + * The string to be displayed in a JumpList. + */ + title: string; + /** + * Description of this task. + */ + description?: string; + /** + * The absolute path to an icon to be displayed in a JumpList, it can be + * arbitrary resource file that contains an icon, usually you can specify + * process.execPath to show the icon of the program. + */ + iconPath: string; + /** + * The icon index in the icon file. If an icon file consists of two or more + * icons, set this value to identify the icon. If an icon file consists of + * one icon, this value is 0. + */ + iconIndex?: number; + } + + /** + * ok - Nothing went wrong. + * error - One or more errors occured, enable runtime logging to figure out the likely cause. + * invalidSeparatorError - An attempt was made to add a separator to a custom category in the Jump List. + * Separators are only allowed in the standard Tasks category. + * fileTypeRegistrationError - An attempt was made to add a file link to the Jump List + * for a file type the app isn't registered to handle. + * customCategoryAccessDeniedError - Custom categories can't be added to the Jump List + * due to user privacy or group policy settings. + */ + type SetJumpListResult = 'ok' | 'error' | 'invalidSeparatorError' | 'fileTypeRegistrationError' | 'customCategoryAccessDeniedError'; + + interface JumpListSettings { + /** + * The minimum number of items that will be shown in the Jump List. + */ + minItems: number; + /** + * Items that the user has explicitly removed from custom categories in the Jump List. + */ + removedItems: JumpListItem[]; + } + + interface JumpListCategory { + /** + * tasks - Items in this category will be placed into the standard Tasks category. + * frequent - Displays a list of files frequently opened by the app, the name of the category and its items are set by Windows. + * recent - Displays a list of files recently opened by the app, the name of the category and its items are set by Windows. + * custom - Displays tasks or file links, name must be set by the app. + */ + type?: 'tasks' | 'frequent' | 'recent' | 'custom'; + /** + * Must be set if type is custom, otherwise it should be omitted. + */ + name?: string; + /** + * Array of JumpListItem objects if type is tasks or custom, otherwise it should be omitted. + */ + items?: JumpListItem[]; + } + + interface JumpListItem { + /** + * task - A task will launch an app with specific arguments. + * separator - Can be used to separate items in the standard Tasks category. + * file - A file link will open a file using the app that created the Jump List. + */ + type: 'task' | 'separator' | 'file'; + /** + * Path of the file to open, should only be set if type is file. + */ + path?: string; + /** + * Path of the program to execute, usually you should specify process.execPath which opens the current program. + * Should only be set if type is task. + */ + program?: string; + /** + * The command line arguments when program is executed. Should only be set if type is task. + */ + args?: string; + /** + * The text to be displayed for the item in the Jump List. Should only be set if type is task. + */ + title?: string; + /** + * Description of the task (displayed in a tooltip). Should only be set if type is task. + */ + description?: string; + /** + * The absolute path to an icon to be displayed in a Jump List, which can be an arbitrary + * resource file that contains an icon (e.g. .ico, .exe, .dll). + * You can usually specify process.execPath to show the program icon. + */ + iconPath?: string; + /** + * The index of the icon in the resource file. If a resource file contains multiple icons + * this value can be used to specify the zero-based index of the icon that should be displayed + * for this task. If a resource file contains only one icon, this property should be set to zero. + */ + iconIndex?: number; + } + + interface LoginItemSettings { + /** + * True if the app is set to open at login. + */ + openAtLogin: boolean; + /** + * True if the app is set to open as hidden at login. This setting is only supported on macOS. + */ + openAsHidden: boolean; + /** + * True if the app was opened at login automatically. This setting is only supported on macOS. + */ + wasOpenedAtLogin?: boolean; + /** + * True if the app was opened as a hidden login item. This indicates that the app should not + * open any windows at startup. This setting is only supported on macOS. + */ + wasOpenedAsHidden?: boolean; + /** + * True if the app was opened as a login item that should restore the state from the previous session. + * This indicates that the app should restore the windows that were open the last time the app was closed. + * This setting is only supported on macOS. + */ + restoreState?: boolean; + } + + interface AboutPanelOptions { + /** + * The app's name. + */ + applicationName?: string; + /** + * The app's version. + */ + applicationVersion?: string; + /** + * Copyright information. + */ + copyright?: string; + /** + * Credit information. + */ + credits?: string; + /** + * The app's build version number. + */ + version?: string; + } + + // https://github.com/electron/electron/blob/master/docs/api/auto-updater.md + + /** + * This module provides an interface for the Squirrel auto-updater framework. + */ + interface AutoUpdater extends NodeJS.EventEmitter { + /** + * Emitted when there is an error while updating. + */ + on(event: 'error', listener: (error: Error) => void): this; + /** + * Emitted when checking if an update has started. + */ + on(event: 'checking-for-update', listener: Function): this; + /** + * Emitted when there is an available update. The update is downloaded automatically. + */ + on(event: 'update-available', listener: Function): this; + /** + * Emitted when there is no available update. + */ + on(event: 'update-not-available', listener: Function): this; + /** + * Emitted when an update has been downloaded. + * Note: On Windows only releaseName is available. + */ + on(event: 'update-downloaded', listener: (event: Event, releaseNotes: string, releaseName: string, releaseDate: Date, updateURL: string) => void): this; + on(event: string, listener: Function): this; + /** + * Set the url and initialize the auto updater. + */ + setFeedURL(url: string, requestHeaders?: Headers): void; + /** + * @returns The current update feed URL. + */ + getFeedURL(): string; + /** + * Ask the server whether there is an update, you have to call setFeedURL + * before using this API + */ + checkForUpdates(): void; + /** + * Restarts the app and installs the update after it has been downloaded. + * It should only be called after update-downloaded has been emitted. + */ + quitAndInstall(): void; + } + + // https://github.com/electron/electron/blob/master/docs/api/browser-window.md + + /** + * The BrowserWindow class gives you ability to create a browser window. + * You can also create a window without chrome by using Frameless Window API. + */ + class BrowserWindow extends NodeJS.EventEmitter implements Destroyable { + /** + * Emitted when the document changed its title, + * calling event.preventDefault() would prevent the native window’s title to change. + */ + on(event: 'page-title-updated', listener: (event: Event, title: string) => void): this; + /** + * Emitted when the window is going to be closed. It’s emitted before the beforeunload + * and unload event of the DOM. Calling event.preventDefault() will cancel the close. + */ + on(event: 'close', listener: (event: Event) => void): this; + /** + * Emitted when the window is closed. After you have received this event + * you should remove the reference to the window and avoid using it anymore. + */ + on(event: 'closed', listener: Function): this; + /** + * Emitted when the web page becomes unresponsive. + */ + on(event: 'unresponsive', listener: Function): this; + /** + * Emitted when the unresponsive web page becomes responsive again. + */ + on(event: 'responsive', listener: Function): this; + /** + * Emitted when the window loses focus. + */ + on(event: 'blur', listener: Function): this; + /** + * Emitted when the window gains focus. + */ + on(event: 'focus', listener: Function): this; + /** + * Emitted when the window is shown. + */ + on(event: 'show', listener: Function): this; + /** + * Emitted when the window is hidden. + */ + on(event: 'hide', listener: Function): this; + /** + * Emitted when the web page has been rendered and window can be displayed without visual flash. + */ + on(event: 'ready-to-show', listener: Function): this; + /** + * Emitted when window is maximized. + */ + on(event: 'maximize', listener: Function): this; + /** + * Emitted when the window exits from maximized state. + */ + on(event: 'unmaximize', listener: Function): this; + /** + * Emitted when the window is minimized. + */ + on(event: 'minimize', listener: Function): this; + /** + * Emitted when the window is restored from minimized state. + */ + on(event: 'restore', listener: Function): this; + /** + * Emitted when the window is getting resized. + */ + on(event: 'resize', listener: Function): this; + /** + * Emitted when the window is getting moved to a new position. + */ + on(event: 'move', listener: Function): this; + /** + * Emitted when the window enters full screen state. + */ + on(event: 'enter-full-screen', listener: Function): this; + /** + * Emitted when the window leaves full screen state. + */ + on(event: 'leave-full-screen', listener: Function): this; + /** + * Emitted when the window enters full screen state triggered by HTML API. + */ + on(event: 'enter-html-full-screen', listener: Function): this; + /** + * Emitted when the window leaves full screen state triggered by HTML API. + */ + on(event: 'leave-html-full-screen', listener: Function): this; + /** + * Emitted when an App Command is invoked. These are typically related + * to keyboard media keys or browser commands, as well as the "Back" / + * "Forward" buttons built into some mice on Windows. + * Note: This is only implemented on Windows. + */ + on(event: 'app-command', listener: (event: Event, command: string) => void): this; + /** + * Emitted when scroll wheel event phase has begun. + * Note: This is only implemented on macOS. + */ + on(event: 'scroll-touch-begin', listener: Function): this; + /** + * Emitted when scroll wheel event phase has ended. + * Note: This is only implemented on macOS. + */ + on(event: 'scroll-touch-end', listener: Function): this; + /** + * Emitted when scroll wheel event phase filed upon reaching the edge of element. + * Note: This is only implemented on macOS. + */ + on(event: 'scroll-touch-edge', listener: Function): this; + /** + * Emitted on 3-finger swipe. + * Note: This is only implemented on macOS. + */ + on(event: 'swipe', listener: (event: Event, direction: SwipeDirection) => void): this; + on(event: string, listener: Function): this; + /** + * Creates a new BrowserWindow with native properties as set by the options. + */ + constructor(options?: BrowserWindowOptions); + /** + * @returns All opened browser windows. + */ + static getAllWindows(): BrowserWindow[]; + /** + * @returns The window that is focused in this application. + */ + static getFocusedWindow(): BrowserWindow; + /** + * Find a window according to the webContents it owns. + */ + static fromWebContents(webContents: WebContents): BrowserWindow; + /** + * Find a window according to its ID. + */ + static fromId(id: number): BrowserWindow; + /** + * Adds devtools extension located at path. The extension will be remembered + * so you only need to call this API once, this API is not for programming use. + * @returns The extension's name. + * + * Note: This API cannot be called before the ready event of the app module is emitted. + */ + static addDevToolsExtension(path: string): string; + /** + * Remove a devtools extension. + * @param name The name of the devtools extension to remove. + * + * Note: This API cannot be called before the ready event of the app module is emitted. + */ + static removeDevToolsExtension(name: string): void; + /** + * @returns devtools extensions. + * + * Note: This API cannot be called before the ready event of the app module is emitted. + */ + static getDevToolsExtensions(): DevToolsExtensions; + /** + * The WebContents object this window owns, all web page related events and + * operations would be done via it. + * Note: Users should never store this object because it may become null when + * the renderer process (web page) has crashed. + */ + webContents: WebContents; + /** + * Get the unique ID of this window. + */ + id: number; + /** + * Force closing the window, the unload and beforeunload event won't be emitted + * for the web page, and close event would also not be emitted for this window, + * but it would guarantee the closed event to be emitted. + * You should only use this method when the renderer process (web page) has crashed. + */ + destroy(): void; + /** + * Try to close the window, this has the same effect with user manually clicking + * the close button of the window. The web page may cancel the close though, + * see the close event. + */ + close(): void; + /** + * Focus on the window. + */ + focus(): void; + /** + * Remove focus on the window. + */ + blur(): void; + /** + * @returns Whether the window is focused. + */ + isFocused(): boolean; + /** + * @returns Whether the window is destroyed. + */ + isDestroyed(): boolean; + /** + * Shows and gives focus to the window. + */ + show(): void; + /** + * Shows the window but doesn't focus on it. + */ + showInactive(): void; + /** + * Hides the window. + */ + hide(): void; + /** + * @returns Whether the window is visible to the user. + */ + isVisible(): boolean; + /** + * @returns Whether the window is a modal window. + */ + isModal(): boolean; + /** + * Maximizes the window. + */ + maximize(): void; + /** + * Unmaximizes the window. + */ + unmaximize(): void; + /** + * @returns Whether the window is maximized. + */ + isMaximized(): boolean; + /** + * Minimizes the window. On some platforms the minimized window will be + * shown in the Dock. + */ + minimize(): void; + /** + * Restores the window from minimized state to its previous state. + */ + restore(): void; + /** + * @returns Whether the window is minimized. + */ + isMinimized(): boolean; + /** + * Sets whether the window should be in fullscreen mode. + */ + setFullScreen(flag: boolean): void; + /** + * @returns Whether the window is in fullscreen mode. + */ + isFullScreen(): boolean; + /** + * This will have a window maintain an aspect ratio. + * The extra size allows a developer to have space, specified in pixels, + * not included within the aspect ratio calculations. + * This API already takes into account the difference between a window’s size and its content size. + * + * Note: This API is available only on macOS. + */ + setAspectRatio(aspectRatio: number, extraSize?: Size): void; + /** + * Resizes and moves the window to width, height, x, y. + */ + setBounds(options: Rectangle, animate?: boolean): void; + /** + * @returns The window's width, height, x and y values. + */ + getBounds(): Rectangle; + /** + * Resizes and moves the window's client area (e.g. the web page) to width, height, x, y. + */ + setContentBounds(options: Rectangle, animate?: boolean): void; + /** + * @returns The window's client area (e.g. the web page) width, height, x and y values. + */ + getContentBounds(): Rectangle; + /** + * Resizes the window to width and height. + */ + setSize(width: number, height: number, animate?: boolean): void; + /** + * @returns The window's width and height. + */ + getSize(): number[]; + /** + * Resizes the window's client area (e.g. the web page) to width and height. + */ + setContentSize(width: number, height: number, animate?: boolean): void; + /** + * @returns The window's client area's width and height. + */ + getContentSize(): number[]; + /** + * Sets the minimum size of window to width and height. + */ + setMinimumSize(width: number, height: number): void; + /** + * @returns The window's minimum width and height. + */ + getMinimumSize(): number[]; + /** + * Sets the maximum size of window to width and height. + */ + setMaximumSize(width: number, height: number): void; + /** + * @returns The window's maximum width and height. + */ + getMaximumSize(): number[]; + /** + * Sets whether the window can be manually resized by user. + */ + setResizable(resizable: boolean): void; + /** + * @returns Whether the window can be manually resized by user. + */ + isResizable(): boolean; + /** + * Sets whether the window can be moved by user. On Linux does nothing. + * Note: This API is available only on macOS and Windows. + */ + setMovable(movable: boolean): void; + /** + * Note: This API is available only on macOS and Windows. + * @returns Whether the window can be moved by user. On Linux always returns true. + */ + isMovable(): boolean; + /** + * Sets whether the window can be manually minimized by user. On Linux does nothing. + * Note: This API is available only on macOS and Windows. + */ + setMinimizable(minimizable: boolean): void; + /** + * Note: This API is available only on macOS and Windows. + * @returns Whether the window can be manually minimized by user. On Linux always returns true. + */ + isMinimizable(): boolean; + /** + * Sets whether the window can be manually maximized by user. On Linux does nothing. + * Note: This API is available only on macOS and Windows. + */ + setMaximizable(maximizable: boolean): void; + /** + * Note: This API is available only on macOS and Windows. + * @returns Whether the window can be manually maximized by user. On Linux always returns true. + */ + isMaximizable(): boolean; + /** + * Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window. + */ + setFullScreenable(fullscreenable: boolean): void; + /** + * @returns Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window. + */ + isFullScreenable(): boolean; + /** + * Sets whether the window can be manually closed by user. On Linux does nothing. + * Note: This API is available only on macOS and Windows. + */ + setClosable(closable: boolean): void; + /** + * Note: This API is available only on macOS and Windows. + * @returns Whether the window can be manually closed by user. On Linux always returns true. + */ + isClosable(): boolean; + /** + * Sets whether the window should show always on top of other windows. After + * setting this, the window is still a normal window, not a toolbox window + * which can not be focused on. + */ + setAlwaysOnTop(flag: boolean, level?: WindowLevel): void; + /** + * @returns Whether the window is always on top of other windows. + */ + isAlwaysOnTop(): boolean; + /** + * Moves window to the center of the screen. + */ + center(): void; + /** + * Moves window to x and y. + */ + setPosition(x: number, y: number, animate?: boolean): void; + /** + * @returns The window's current position. + */ + getPosition(): number[]; + /** + * Changes the title of native window to title. + */ + setTitle(title: string): void; + /** + * Note: The title of web page can be different from the title of the native window. + * @returns The title of the native window. + */ + getTitle(): string; + /** + * Changes the attachment point for sheets on macOS. + * Note: This API is available only on macOS. + */ + setSheetOffset(offsetY: number, offsetX?: number): void; + /** + * Starts or stops flashing the window to attract user's attention. + */ + flashFrame(flag: boolean): void; + /** + * Makes the window do not show in Taskbar. + */ + setSkipTaskbar(skip: boolean): void; + /** + * Enters or leaves the kiosk mode. + */ + setKiosk(flag: boolean): void; + /** + * @returns Whether the window is in kiosk mode. + */ + isKiosk(): boolean; + /** + * The native type of the handle is HWND on Windows, NSView* on macOS, + * and Window (unsigned long) on Linux. + * @returns The platform-specific handle of the window as Buffer. + */ + getNativeWindowHandle(): Buffer; + /** + * Hooks a windows message. The callback is called when the message is received in the WndProc. + * Note: This API is available only on Windows. + */ + hookWindowMessage(message: number, callback: Function): void; + /** + * @returns Whether the message is hooked. + */ + isWindowMessageHooked(message: number): boolean; + /** + * Unhook the window message. + */ + unhookWindowMessage(message: number): void; + /** + * Unhooks all of the window messages. + */ + unhookAllWindowMessages(): void; + /** + * Sets the pathname of the file the window represents, and the icon of the + * file will show in window's title bar. + * Note: This API is available only on macOS. + */ + setRepresentedFilename(filename: string): void; + /** + * Note: This API is available only on macOS. + * @returns The pathname of the file the window represents. + */ + getRepresentedFilename(): string; + /** + * Specifies whether the window’s document has been edited, and the icon in + * title bar will become grey when set to true. + * Note: This API is available only on macOS. + */ + setDocumentEdited(edited: boolean): void; + /** + * Note: This API is available only on macOS. + * @returns Whether the window's document has been edited. + */ + isDocumentEdited(): boolean; + focusOnWebView(): void; + blurWebView(): void; + /** + * Captures the snapshot of page within rect, upon completion the callback + * will be called. Omitting the rect would capture the whole visible page. + * Note: Be sure to read documents on remote buffer in remote if you are going + * to use this API in renderer process. + * @param callback Supplies the image that stores data of the snapshot. + */ + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + /** + * Captures the snapshot of page within rect, upon completion the callback + * will be called. Omitting the rect would capture the whole visible page. + * Note: Be sure to read documents on remote buffer in remote if you are going + * to use this API in renderer process. + * @param callback Supplies the image that stores data of the snapshot. + */ + capturePage(callback: (image: NativeImage) => void): void; + /** + * Same as webContents.loadURL(url). + */ + loadURL(url: string, options?: LoadURLOptions): void; + /** + * Same as webContents.reload. + */ + reload(): void; + /** + * Sets the menu as the window top menu. + * Note: This API is not available on macOS. + */ + setMenu(menu: Menu): void; + /** + * Sets the progress value in the progress bar. + * On Linux platform, only supports Unity desktop environment, you need to + * specify the *.desktop file name to desktopName field in package.json. + * By default, it will assume app.getName().desktop. + * @param progress Valid range is [0, 1.0]. If < 0, the progress bar is removed. + * If greater than 0, it becomes indeterminate. + */ + setProgressBar(progress: number, options?: { + /** + * Mode for the progress bar. + * Note: This is only implemented on Windows. + */ + mode: 'none' | 'normal' | 'indeterminate' | 'error' | 'paused' + }): void; + /** + * Sets a 16px overlay onto the current Taskbar icon, usually used to convey + * some sort of application status or to passively notify the user. + * Note: This API is only available on Windows 7 or above. + * @param overlay The icon to display on the bottom right corner of the Taskbar + * icon. If this parameter is null, the overlay is cleared + * @param description Provided to Accessibility screen readers. + */ + setOverlayIcon(overlay: NativeImage, description: string): void; + /** + * Sets whether the window should have a shadow. On Windows and Linux does nothing. + * Note: This API is available only on macOS. + */ + setHasShadow(hasShadow: boolean): void; + /** + * Note: This API is available only on macOS. + * @returns whether the window has a shadow. On Windows and Linux always returns true. + */ + hasShadow(): boolean; + /** + * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image + * of a window in a taskbar button layout. + * @returns Whether the thumbnail has been added successfully. + * + * Note: This API is available only on Windows. + */ + setThumbarButtons(buttons: ThumbarButton[]): boolean; + /** + * Sets the region of the window to show as the thumbnail image displayed when hovering + * over the window in the taskbar. You can reset the thumbnail to be the entire window + * by specifying an empty region: {x: 0, y: 0, width: 0, height: 0}. + * + * Note: This API is available only on Windows. + */ + setThumbnailClip(region: Rectangle): boolean; + /** + * Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar. + * Note: This API is available only on Windows. + */ + setThumbnailToolTip(toolTip: string): boolean; + /** + * Same as webContents.showDefinitionForSelection(). + * Note: This API is available only on macOS. + */ + showDefinitionForSelection(): void; + /** + * Changes window icon. + * Note: This API is not available on macOS. + */ + setIcon(icon: NativeImage): void; + /** + * Sets whether the window menu bar should hide itself automatically. Once set + * the menu bar will only show when users press the single Alt key. + * If the menu bar is already visible, calling setAutoHideMenuBar(true) won't + * hide it immediately. + */ + setAutoHideMenuBar(hide: boolean): void; + /** + * @returns Whether menu bar automatically hides itself. + */ + isMenuBarAutoHide(): boolean; + /** + * Sets whether the menu bar should be visible. If the menu bar is auto-hide, + * users can still bring up the menu bar by pressing the single Alt key. + */ + setMenuBarVisibility(visibile: boolean): void; + /** + * @returns Whether the menu bar is visible. + */ + isMenuBarVisible(): boolean; + /** + * Sets whether the window should be visible on all workspaces. + * Note: This API does nothing on Windows. + */ + setVisibleOnAllWorkspaces(visible: boolean): void; + /** + * Note: This API always returns false on Windows. + * @returns Whether the window is visible on all workspaces. + */ + isVisibleOnAllWorkspaces(): boolean; + /** + * Makes the window ignore all mouse events. + * + * All mouse events happened in this window will be passed to the window below this window, + * but if this window has focus, it will still receive keyboard events. + */ + setIgnoreMouseEvents(ignore: boolean): void; + /** + * Prevents the window contents from being captured by other apps. + * + * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. + * On Windows it calls SetWindowDisplayAffinity with WDA_MONITOR. + */ + setContentProtection(enable: boolean): void; + /** + * Changes whether the window can be focused. + * Note: This API is available only on Windows. + */ + setFocusable(focusable: boolean): void; + /** + * Sets parent as current window's parent window, + * passing null will turn current window into a top-level window. + * Note: This API is not available on Windows. + */ + setParentWindow(parent: BrowserWindow): void; + /** + * @returns The parent window. + */ + getParentWindow(): BrowserWindow; + /** + * @returns All child windows. + */ + getChildWindows(): BrowserWindow[]; + } + + type WindowLevel = 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver' | 'dock'; + type SwipeDirection = 'up' | 'right' | 'down' | 'left'; + type ThumbarButtonFlags = 'enabled' | 'disabled' | 'dismissonclick' | 'nobackground' | 'hidden' | 'noninteractive'; + + interface ThumbarButton { + icon: NativeImage | string; + click: Function; + tooltip?: string; + flags?: ThumbarButtonFlags[]; + } + + interface DevToolsExtensions { + [name: string]: { + name: string; + value: string; + } + } + + interface WebPreferences { + /** + * Whether to enable DevTools. + * If it is set to false, can not use BrowserWindow.webContents.openDevTools() to open DevTools. + * Default: true. + */ + devTools?: boolean; + /** + * Whether node integration is enabled. + * Default: true. + */ + nodeIntegration?: boolean; + /** + * Specifies a script that will be loaded before other scripts run in the page. + * This script will always have access to node APIs no matter whether node integration is turned on or off. + * The value should be the absolute file path to the script. + * When node integration is turned off, the preload script can reintroduce + * Node global symbols back to the global scope. + */ + preload?: string; + /** + * Sets the session used by the page. Instead of passing the Session object directly, + * you can also choose to use the partition option instead, which accepts a partition string. + * When both session and partition are provided, session would be preferred. + * Default: the default session. + */ + session?: Session; + /** + * Sets the session used by the page according to the session’s partition string. + * If partition starts with persist:, the page will use a persistent session available + * to all pages in the app with the same partition. if there is no persist: prefix, + * the page will use an in-memory session. By assigning the same partition, + * multiple pages can share the same session. + * Default: the default session. + */ + partition?: string; + /** + * The default zoom factor of the page, 3.0 represents 300%. + * Default: 1.0. + */ + zoomFactor?: number; + /** + * Enables JavaScript support. + * Default: true. + */ + javascript?: boolean; + /** + * When setting false, it will disable the same-origin policy (Usually using testing + * websites by people), and set allowDisplayingInsecureContent and allowRunningInsecureContent + * to true if these two options are not set by user. + * Default: true. + */ + webSecurity?: boolean; + /** + * Allow an https page to display content like images from http URLs. + * Default: false. + */ + allowDisplayingInsecureContent?: boolean; + /** + * Allow a https page to run JavaScript, CSS or plugins from http URLs. + * Default: false. + */ + allowRunningInsecureContent?: boolean; + /** + * Enables image support. + * Default: true. + */ + images?: boolean; + /** + * Make TextArea elements resizable. + * Default: true. + */ + textAreasAreResizable?: boolean; + /** + * Enables WebGL support. + * Default: true. + */ + webgl?: boolean; + /** + * Enables WebAudio support. + * Default: true. + */ + webaudio?: boolean; + /** + * Whether plugins should be enabled. + * Default: false. + */ + plugins?: boolean; + /** + * Enables Chromium’s experimental features. + * Default: false. + */ + experimentalFeatures?: boolean; + /** + * Enables Chromium’s experimental canvas features. + * Default: false. + */ + experimentalCanvasFeatures?: boolean; + /** + * Enables DirectWrite font rendering system on Windows. + * Default: true. + */ + directWrite?: boolean; + /** + * Enables scroll bounce (rubber banding) effect on macOS. + * Default: false. + */ + scrollBounce?: boolean; + /** + * A list of feature strings separated by ",", like CSSVariables,KeyboardEventKey to enable. + */ + blinkFeatures?: string; + /** + * A list of feature strings separated by ",", like CSSVariables,KeyboardEventKey to disable. + */ + disableBlinkFeatures?: string; + /** + * Sets the default font for the font-family. + */ + defaultFontFamily?: { + /** + * Default: Times New Roman. + */ + standard?: string; + /** + * Default: Times New Roman. + */ + serif?: string; + /** + * Default: Arial. + */ + sansSerif?: string; + /** + * Default: Courier New. + */ + monospace?: string; + }; + /** + * Default: 16. + */ + defaultFontSize?: number; + /** + * Default: 13. + */ + defaultMonospaceFontSize?: number; + /** + * Default: 0. + */ + minimumFontSize?: number; + /** + * Default: ISO-8859-1. + */ + defaultEncoding?: string; + /** + * Whether to throttle animations and timers when the page becomes background. + * Default: true. + */ + backgroundThrottling?: boolean; + /** + * Whether to enable offscreen rendering for the browser window. + * Default: false. + */ + offscreen?: boolean; + /** + * Whether to enable Chromium OS-level sandbox. + * Default: false. + */ + sandbox?: boolean; + } + + interface BrowserWindowOptions { + /** + * Window’s width in pixels. + * Default: 800. + */ + width?: number; + /** + * Window’s height in pixels. + * Default: 600. + */ + height?: number; + /** + * Window’s left offset from screen. + * Default: center the window. + */ + x?: number; + /** + * Window’s top offset from screen. + * Default: center the window. + */ + y?: number; + /** + * The width and height would be used as web page’s size, which means + * the actual window’s size will include window frame’s size and be slightly larger. + * Default: false. + */ + useContentSize?: boolean; + /** + * Show window in the center of the screen. + * Default: true + */ + center?: boolean; + /** + * Window’s minimum width. + * Default: 0. + */ + minWidth?: number; + /** + * Window’s minimum height. + * Default: 0. + */ + minHeight?: number; + /** + * Window’s maximum width. + * Default: no limit. + */ + maxWidth?: number; + /** + * Window’s maximum height. + * Default: no limit. + */ + maxHeight?: number; + /** + * Whether window is resizable. + * Default: true. + */ + resizable?: boolean; + /** + * Whether window is movable. + * Note: This is not implemented on Linux. + * Default: true. + */ + movable?: boolean; + /** + * Whether window is minimizable. + * Note: This is not implemented on Linux. + * Default: true. + */ + minimizable?: boolean; + /** + * Whether window is maximizable. + * Note: This is not implemented on Linux. + * Default: true. + */ + maximizable?: boolean; + /** + * Whether window is closable. + * Note: This is not implemented on Linux. + * Default: true. + */ + closable?: boolean; + /** + * Whether the window can be focused. + * On Windows setting focusable: false also implies setting skipTaskbar: true. + * On Linux setting focusable: false makes the window stop interacting with wm, + * so the window will always stay on top in all workspaces. + * Default: true. + */ + focusable?: boolean; + /** + * Whether the window should always stay on top of other windows. + * Default: false. + */ + alwaysOnTop?: boolean; + /** + * Whether the window should show in fullscreen. + * When explicitly set to false the fullscreen button will be hidden or disabled on macOS. + * Default: false. + */ + fullscreen?: boolean; + /** + * Whether the window can be put into fullscreen mode. + * On macOS, also whether the maximize/zoom button should toggle full screen mode or maximize window. + * Default: true. + */ + fullscreenable?: boolean; + /** + * Whether to show the window in taskbar. + * Default: false. + */ + skipTaskbar?: boolean; + /** + * The kiosk mode. + * Default: false. + */ + kiosk?: boolean; + /** + * Default window title. + * Default: "Electron". + */ + title?: string; + /** + * The window icon, when omitted on Windows the executable’s icon would be used as window icon. + */ + icon?: NativeImage|string; + /** + * Whether window should be shown when created. + * Default: true. + */ + show?: boolean; + /** + * Specify false to create a Frameless Window. + * Default: true. + */ + frame?: boolean; + /** + * Specify parent window. + * Default: null. + */ + parent?: BrowserWindow; + /** + * Whether this is a modal window. This only works when the window is a child window. + * Default: false. + */ + modal?: boolean; + /** + * Whether the web view accepts a single mouse-down event that simultaneously activates the window. + * Default: false. + */ + acceptFirstMouse?: boolean; + /** + * Whether to hide cursor when typing. + * Default: false. + */ + disableAutoHideCursor?: boolean; + /** + * Auto hide the menu bar unless the Alt key is pressed. + * Default: true. + */ + autoHideMenuBar?: boolean; + /** + * Enable the window to be resized larger than screen. + * Default: false. + */ + enableLargerThanScreen?: boolean; + /** + * Window’s background color as Hexadecimal value, like #66CD00 or #FFF or #80FFFFFF (alpha is supported). + * Default: #FFF (white). + */ + backgroundColor?: string; + /** + * Whether window should have a shadow. + * Note: This is only implemented on macOS. + * Default: true. + */ + hasShadow?: boolean; + /** + * Forces using dark theme for the window. + * Note: Only works on some GTK+3 desktop environments. + * Default: false. + */ + darkTheme?: boolean; + /** + * Makes the window transparent. + * Default: false. + */ + transparent?: boolean; + /** + * The type of window, default is normal window. + */ + type?: BrowserWindowType; + /** + * The style of window title bar. + */ + titleBarStyle?: 'default' | 'hidden' | 'hidden-inset'; + /** + * Use WS_THICKFRAME style for frameless windows on Windows + */ + thickFrame?: boolean; + /** + * Settings of web page’s features. + */ + webPreferences?: WebPreferences; + } + + type BrowserWindowType = BrowserWindowTypeLinux | BrowserWindowTypeMac | BrowserWindowTypeWindows; + type BrowserWindowTypeLinux = 'desktop' | 'dock' | 'toolbar' | 'splash' | 'notification'; + type BrowserWindowTypeMac = 'desktop' | 'textured'; + type BrowserWindowTypeWindows = 'toolbar'; + + // https://github.com/electron/electron/blob/master/docs/api/clipboard.md + + /** + * The clipboard module provides methods to perform copy and paste operations. + */ + interface Clipboard { + /** + * @returns The contents of the clipboard as plain text. + */ + readText(type?: ClipboardType): string; + /** + * Writes the text into the clipboard as plain text. + */ + writeText(text: string, type?: ClipboardType): void; + /** + * @returns The contents of the clipboard as markup. + */ + readHTML(type?: ClipboardType): string; + /** + * Writes markup to the clipboard. + */ + writeHTML(markup: string, type?: ClipboardType): void; + /** + * @returns The contents of the clipboard as a NativeImage. + */ + readImage(type?: ClipboardType): NativeImage; + /** + * Writes the image into the clipboard. + */ + writeImage(image: NativeImage, type?: ClipboardType): void; + /** + * @returns The contents of the clipboard as RTF. + */ + readRTF(type?: ClipboardType): string; + /** + * Writes the text into the clipboard in RTF. + */ + writeRTF(text: string, type?: ClipboardType): void; + /** + * Clears everything in clipboard. + */ + clear(type?: ClipboardType): void; + /** + * @returns Array available formats for the clipboard type. + */ + availableFormats(type?: ClipboardType): string[]; + /** + * Returns whether the clipboard supports the format of specified data. + * Note: This API is experimental and could be removed in future. + * @returns Whether the clipboard has data in the specified format. + */ + has(format: string, type?: ClipboardType): boolean; + /** + * Reads the data in the clipboard of the specified format. + * Note: This API is experimental and could be removed in future. + */ + read(format: string, type?: ClipboardType): string | NativeImage; + /** + * Writes data to the clipboard. + */ + write(data: { + text?: string; + rtf?: string; + html?: string; + image?: NativeImage; + }, type?: ClipboardType): void; + /** + * @returns An Object containing title and url keys representing the bookmark in the clipboard. + * + * Note: This API is available on macOS and Windows. + */ + readBookmark(): Bookmark; + /** + * Writes the title and url into the clipboard as a bookmark. + * + * Note: This API is available on macOS and Windows. + */ + writeBookmark(title: string, url: string, type?: ClipboardType): void; + } + + type ClipboardType = '' | 'selection'; + + interface Bookmark { + title: string; + url: string; + } + + // https://github.com/electron/electron/blob/master/docs/api/content-tracing.md + + /** + * The content-tracing module is used to collect tracing data generated by the underlying Chromium content module. + * This module does not include a web interface so you need to open chrome://tracing/ + * in a Chrome browser and load the generated file to view the result. + */ + interface ContentTracing { + /** + * Get a set of category groups. The category groups can change as new code paths are reached. + * + * @param callback Called once all child processes have acknowledged the getCategories request. + */ + getCategories(callback: (categoryGroups: string[]) => void): void; + /** + * Start recording on all processes. Recording begins immediately locally and asynchronously + * on child processes as soon as they receive the EnableRecording request. + * + * @param callback Called once all child processes have acknowledged the startRecording request. + */ + startRecording(options: ContentTracingOptions, callback: Function): void; + /** + * Stop recording on all processes. Child processes typically are caching trace data and + * only rarely flush and send trace data back to the main process. That is because it may + * be an expensive operation to send the trace data over IPC, and we would like to avoid + * much runtime overhead of tracing. So, to end tracing, we must asynchronously ask all + * child processes to flush any pending trace data. + * + * @param resultFilePath Trace data will be written into this file if it is not empty, + * or into a temporary file. + * @param callback Called once all child processes have acknowledged the stopRecording request. + */ + stopRecording(resultFilePath: string, callback: (filePath: string) => void): void; + /** + * Start monitoring on all processes. Monitoring begins immediately locally and asynchronously + * on child processes as soon as they receive the startMonitoring request. + * + * @param callback Called once all child processes have acked to the startMonitoring request. + */ + startMonitoring(options: ContentTracingOptions, callback: Function): void; + /** + * Stop monitoring on all processes. + * + * @param callback Called once all child processes have acknowledged the stopMonitoring request. + */ + stopMonitoring(callback: Function): void; + /** + * Get the current monitoring traced data. Child processes typically are caching trace data + * and only rarely flush and send trace data back to the main process. That is because it may + * be an expensive operation to send the trace data over IPC, and we would like to avoid much + * runtime overhead of tracing. So, to end tracing, we must asynchronously ask all child + * processes to flush any pending trace data. + * + * @param callback Called once all child processes have acknowledged the captureMonitoringSnapshot request. + */ + captureMonitoringSnapshot(resultFilePath: string, callback: (filePath: string) => void): void; + /** + * Get the maximum usage across processes of trace buffer as a percentage of the full state. + * + * @param callback Called when the TraceBufferUsage value is determined. + */ + getTraceBufferUsage(callback: Function): void; + /** + * @param callback Called every time the given event occurs on any process. + */ + setWatchEvent(categoryName: string, eventName: string, callback: Function): void; + /** + * Cancel the watch event. This may lead to a race condition with the watch event callback if tracing is enabled. + */ + cancelWatchEvent(): void; + } + + interface ContentTracingOptions { + /** + * Filter to control what category groups should be traced. + * A filter can have an optional - prefix to exclude category groups + * that contain a matching category. Having both included and excluded + * category patterns in the same list is not supported. + * + * Examples: + * test_MyTest* + * test_MyTest*,test_OtherStuff + * -excluded_category1,-excluded_category2 + */ + categoryFilter: string; + /** + * Controls what kind of tracing is enabled, it is a comma-delimited list. + * + * Possible options are: + * record-until-full + * record-continuously + * trace-to-console + * enable-sampling + * enable-systrace + * + * The first 3 options are trace recoding modes and hence mutually exclusive. + * If more than one trace recording modes appear in the traceOptions string, + * the last one takes precedence. If none of the trace recording modes are specified, + * recording mode is record-until-full. + * + * The trace option will first be reset to the default option (record_mode set + * to record-until-full, enable_sampling and enable_systrace set to false) + * before options parsed from traceOptions are applied on it. + */ + traceOptions: string; + } + + // https://github.com/electron/electron/blob/master/docs/api/crash-reporter.md + + /** + * The crash-reporter module enables sending your app's crash reports. + */ + interface CrashReporter { + /** + * You are required to call this method before using other crashReporter APIs. + * + * Note: On macOS, Electron uses a new crashpad client, which is different from breakpad + * on Windows and Linux. To enable the crash collection feature, you are required to call + * the crashReporter.start API to initialize crashpad in the main process and in each + * renderer process from which you wish to collect crash reports. + */ + start(options: CrashReporterStartOptions): void; + /** + * @returns The crash report. When there was no crash report + * sent or the crash reporter is not started, null will be returned. + */ + getLastCrashReport(): CrashReport; + /** + * @returns All uploaded crash reports. + */ + getUploadedReports(): CrashReport[]; + } + + interface CrashReporterStartOptions { + /** + * Default: app.getName() + */ + productName?: string; + companyName: string; + /** + * URL that crash reports would be sent to as POST. + */ + submitURL: string; + /** + * Send the crash report without user interaction. + * Default: true. + */ + autoSubmit?: boolean; + /** + * Default: false. + */ + ignoreSystemCrashHandler?: boolean; + /** + * An object you can define that will be sent along with the report. + * Only string properties are sent correctly, nested objects are not supported. + */ + extra?: {[prop: string]: string}; + } + + interface CrashReport { + id: string; + date: Date; + } + + // https://github.com/electron/electron/blob/master/docs/api/desktop-capturer.md + + /** + * The desktopCapturer module can be used to get available sources + * that can be used to be captured with getUserMedia. + */ + interface DesktopCapturer { + /** + * Starts a request to get all desktop sources. + * + * Note: There is no guarantee that the size of source.thumbnail is always + * the same as the thumnbailSize in options. It also depends on the scale of the screen or window. + */ + getSources(options: DesktopCapturerOptions, callback: (error: Error, sources: DesktopCapturerSource[]) => any): void; + } + + interface DesktopCapturerOptions { + /** + * The types of desktop sources to be captured. + */ + types?: ('screen' | 'window')[]; + /** + * The suggested size that thumbnail should be scaled. + * Default: {width: 150, height: 150} + */ + thumbnailSize?: Size; + } + + interface DesktopCapturerSource { + /** + * The id of the captured window or screen used in navigator.webkitGetUserMedia. + * The format looks like window:XX or screen:XX where XX is a random generated number. + */ + id: string; + /** + * The described name of the capturing screen or window. + * If the source is a screen, the name will be Entire Screen or Screen ; + * if it is a window, the name will be the window’s title. + */ + name: string; + /** + * A thumbnail image. + */ + thumbnail: NativeImage; + } + + // https://github.com/electron/electron/blob/master/docs/api/dialog.md + + /** + * The dialog module provides APIs to show native system dialogs, such as opening files or alerting, + * so web applications can deliver the same user experience as native applications. + */ + interface Dialog { + /** + * Note: On Windows and Linux an open dialog can not be both a file selector and a directory selector, + * so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown. + * + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns an array of file paths chosen by the user, + * otherwise returns undefined. + */ + showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions, callback?: (fileNames: string[]) => void): string[]; + /** + * Note: On Windows and Linux an open dialog can not be both a file selector and a directory selector, + * so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown. + * + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns an array of file paths chosen by the user, + * otherwise returns undefined. + */ + showOpenDialog(options: OpenDialogOptions, callback?: (fileNames: string[]) => void): string[]; + /** + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns the path of file chosen by the user, otherwise + * returns undefined. + */ + showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions, callback?: (fileName: string) => void): string; + /** + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns the path of file chosen by the user, otherwise + * returns undefined. + */ + showSaveDialog(options: SaveDialogOptions, callback?: (fileName: string) => void): string; + /** + * Shows a message box. It will block until the message box is closed. + * @param callback If supplied, the API call will be asynchronous. + * @returns The index of the clicked button. + */ + showMessageBox(browserWindow: BrowserWindow, options: ShowMessageBoxOptions, callback?: (response: number) => void): number; + /** + * Shows a message box. It will block until the message box is closed. + * @param callback If supplied, the API call will be asynchronous. + * @returns The index of the clicked button. + */ + showMessageBox(options: ShowMessageBoxOptions, callback?: (response: number) => void): number; + /** + * Displays a modal dialog that shows an error message. + * + * This API can be called safely before the ready event the app module emits, + * it is usually used to report errors in early stage of startup. + * If called before the app readyevent on Linux, the message will be emitted to stderr, + * and no GUI dialog will appear. + */ + showErrorBox(title: string, content: string): void; + } + + interface OpenDialogOptions { + title?: string; + defaultPath?: string; + /** + * Custom label for the confirmation button, when left empty the default label will be used. + */ + buttonLabel?: string; + /** + * File types that can be displayed or selected. + */ + filters?: { + name: string; + /** + * Extensions without wildcards or dots (e.g. 'png' is good but '.png' and '*.png' are bad). + * To show all files, use the '*' wildcard (no other wildcard is supported). + */ + extensions: string[]; + }[]; + /** + * Contains which features the dialog should use. + */ + properties?: ('openFile' | 'openDirectory' | 'multiSelections' | 'createDirectory' | 'showHiddenFiles')[]; + } + + interface SaveDialogOptions { + title?: string; + defaultPath?: string; + /** + * Custom label for the confirmation button, when left empty the default label will be used. + */ + buttonLabel?: string; + /** + * File types that can be displayed, see dialog.showOpenDialog for an example. + */ + filters?: { + name: string; + extensions: string[]; + }[]; + } + + interface ShowMessageBoxOptions { + /** + * On Windows, "question" displays the same icon as "info", unless you set an icon using the "icon" option. + */ + type?: 'none' | 'info' | 'error' | 'question' | 'warning'; + /** + * Texts for buttons. On Windows, an empty array will result in one button labeled "OK". + */ + buttons?: string[]; + /** + * Index of the button in the buttons array which will be selected by default when the message box opens. + */ + defaultId?: number; + /** + * Title of the message box (some platforms will not show it). + */ + title?: string; + /** + * Contents of the message box. + */ + message?: string; + /** + * Extra information of the message. + */ + detail?: string; + icon?: NativeImage; + /** + * The value will be returned when user cancels the dialog instead of clicking the buttons of the dialog. + * By default it is the index of the buttons that have "cancel" or "no" as label, + * or 0 if there is no such buttons. On macOS and Windows the index of "Cancel" button + * will always be used as cancelId, not matter whether it is already specified. + */ + cancelId?: number; + /** + * On Windows Electron will try to figure out which one of the buttons are common buttons + * (like "Cancel" or "Yes"), and show the others as command links in the dialog. + * This can make the dialog appear in the style of modern Windows apps. + * If you don’t like this behavior, you can set noLink to true. + */ + noLink?: boolean; + } + + // https://github.com/electron/electron/blob/master/docs/api/download-item.md + + /** + * DownloadItem represents a download item in Electron. + */ + interface DownloadItem extends NodeJS.EventEmitter { + /** + * Emitted when the download has been updated and is not done. + */ + on(event: 'updated', listener: (event: Event, state: 'progressing' | 'interrupted') => void): this; + /** + * Emits when the download is in a terminal state. This includes a completed download, + * a cancelled download (via downloadItem.cancel()), and interrupted download that can’t be resumed. + */ + on(event: 'done', listener: (event: Event, state: 'completed' | 'cancelled' | 'interrupted') => void): this; + on(event: string, listener: Function): this; + /** + * Set the save file path of the download item. + * Note: The API is only available in session’s will-download callback function. + * If user doesn’t set the save path via the API, Electron will use the original + * routine to determine the save path (Usually prompts a save dialog). + */ + setSavePath(path: string): void; + /** + * @returns The save path of the download item. + * This will be either the path set via downloadItem.setSavePath(path) or the path selected from the shown save dialog. + */ + getSavePath(): string; + /** + * Pauses the download. + */ + pause(): void; + /** + * @returns Whether the download is paused. + */ + isPaused(): boolean; + /** + * Resumes the download that has been paused. + */ + resume(): void; + /** + * @returns Whether the download can resume. + */ + canResume(): boolean; + /** + * Cancels the download operation. + */ + cancel(): void; + /** + * @returns The origin url where the item is downloaded from. + */ + getURL(): string; + /** + * @returns The mime type. + */ + getMimeType(): string; + /** + * @returns Whether the download has user gesture. + */ + hasUserGesture(): boolean; + /** + * @returns The file name of the download item. + * Note: The file name is not always the same as the actual one saved in local disk. + * If user changes the file name in a prompted download saving dialog, + * the actual name of saved file will be different. + */ + getFilename(): string; + /** + * @returns The total size in bytes of the download item. If the size is unknown, it returns 0. + */ + getTotalBytes(): number; + /** + * @returns The received bytes of the download item. + */ + getReceivedBytes(): number; + /** + * @returns The Content-Disposition field from the response header. + */ + getContentDisposition(): string; + /** + * @returns The current state. + */ + getState(): 'progressing' | 'completed' | 'cancelled' | 'interrupted'; + } + + // https://github.com/electron/electron/blob/master/docs/api/global-shortcut.md + + /** + * The globalShortcut module can register/unregister a global keyboard shortcut + * with the operating system so that you can customize the operations for various shortcuts. + * Note: The shortcut is global; it will work even if the app does not have the keyboard focus. + * You should not use this module until the ready event of the app module is emitted. + */ + interface GlobalShortcut { + /** + * Registers a global shortcut of accelerator. + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + * @param callback Called when the registered shortcut is pressed by the user. + */ + register(accelerator: string, callback: Function): void; + /** + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + * @returns Whether the accelerator is registered. + */ + isRegistered(accelerator: string): boolean; + /** + * Unregisters the global shortcut of keycode. + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + */ + unregister(accelerator: string): void; + /** + * Unregisters all the global shortcuts. + */ + unregisterAll(): void; + } + + // https://github.com/electron/electron/blob/master/docs/api/ipc-main.md + + /** + * The ipcMain module handles asynchronous and synchronous messages + * sent from a renderer process (web page). + * Messages sent from a renderer will be emitted to this module. + */ + interface IpcMain extends NodeJS.EventEmitter { + addListener(channel: string, listener: IpcMainEventListener): this; + on(channel: string, listener: IpcMainEventListener): this; + once(channel: string, listener: IpcMainEventListener): this; + removeListener(channel: string, listener: IpcMainEventListener): this; + removeAllListeners(channel?: string): this; + } + + type IpcMainEventListener = (event: IpcMainEvent, ...args: any[]) => void; + + interface IpcMainEvent { + /** + * Set this to the value to be returned in a synchronous message. + */ + returnValue?: any; + /** + * Returns the webContents that sent the message, you can call sender.send + * to reply to the asynchronous message. + */ + sender: WebContents; + } + + // https://github.com/electron/electron/blob/master/docs/api/ipc-renderer.md + + /** + * The ipcRenderer module provides a few methods so you can send synchronous + * and asynchronous messages from the render process (web page) to the main process. + * You can also receive replies from the main process. + */ + interface IpcRenderer extends NodeJS.EventEmitter { + addListener(channel: string, listener: IpcRendererEventListener): this; + on(channel: string, listener: IpcRendererEventListener): this; + once(channel: string, listener: IpcRendererEventListener): this; + removeListener(channel: string, listener: IpcRendererEventListener): this; + removeAllListeners(channel?: string): this; + /** + * Send ...args to the renderer via channel in asynchronous message, the main + * process can handle it by listening to the channel event of ipc module. + */ + send(channel: string, ...args: any[]): void; + /** + * Send ...args to the renderer via channel in synchronous message, and returns + * the result sent from main process. The main process can handle it by listening + * to the channel event of ipc module, and returns by setting event.returnValue. + * Note: Usually developers should never use this API, since sending synchronous + * message would block the whole renderer process. + * @returns The result sent from the main process. + */ + sendSync(channel: string, ...args: any[]): any; + /** + * Like ipc.send but the message will be sent to the host page instead of the main process. + * This is mainly used by the page in to communicate with host page. + */ + sendToHost(channel: string, ...args: any[]): void; + } + + type IpcRendererEventListener = (event: IpcRendererEvent, ...args: any[]) => void; + + interface IpcRendererEvent { + /** + * You can call sender.send to reply to the asynchronous message. + */ + sender: IpcRenderer; + } + + // https://github.com/electron/electron/blob/master/docs/api/menu-item.md + // https://github.com/electron/electron/blob/master/docs/api/accelerator.md + + /** + * The MenuItem allows you to add items to an application or context menu. + */ + class MenuItem { + /** + * Create a new menu item. + */ + constructor(options: MenuItemOptions); + + click: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void; + /** + * Read-only property. + */ + type: MenuItemType; + /** + * Read-only property. + */ + role: MenuItemRole | MenuItemRoleMac; + /** + * Read-only property. + */ + accelerator: string; + /** + * Read-only property. + */ + icon: NativeImage | string; + /** + * Read-only property. + */ + submenu: Menu | MenuItemOptions[]; + + label: string; + sublabel: string; + enabled: boolean; + visible: boolean; + checked: boolean; + } + + type MenuItemType = 'normal' | 'separator' | 'submenu' | 'checkbox' | 'radio'; + type MenuItemRole = 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteandmatchstyle' | 'selectall' | 'delete' | 'minimize' | 'close' | 'quit' | 'togglefullscreen' | 'resetzoom' | 'zoomin' | 'zoomout'; + type MenuItemRoleMac = 'about' | 'hide' | 'hideothers' | 'unhide' | 'startspeaking' | 'stopspeaking' | 'front' | 'zoom' | 'window' | 'help' | 'services'; + + interface MenuItemOptions { + /** + * Callback when the menu item is clicked. + */ + click?: (menuItem: MenuItem, browserWindow: BrowserWindow) => void; + /** + * Can be normal, separator, submenu, checkbox or radio. + */ + type?: MenuItemType; + label?: string; + sublabel?: string; + /** + * An accelerator is string that represents a keyboard shortcut, it can contain + * multiple modifiers and key codes, combined by the + character. + * + * Examples: + * CommandOrControl+A + * CommandOrControl+Shift+Z + * + * Platform notice: + * On Linux and Windows, the Command key would not have any effect, + * you can use CommandOrControl which represents Command on macOS and Control on + * Linux and Windows to define some accelerators. + * + * Use Alt instead of Option. The Option key only exists on macOS, whereas + * the Alt key is available on all platforms. + * + * The Super key is mapped to the Windows key on Windows and Linux and Cmd on macOS. + * + * Available modifiers: + * Command (or Cmd for short) + * Control (or Ctrl for short) + * CommandOrControl (or CmdOrCtrl for short) + * Alt + * Option + * AltGr + * Shift + * Super + * + * Available key codes: + * 0 to 9 + * A to Z + * F1 to F24 + * Punctuations like ~, !, @, #, $, etc. + * Plus + * Space + * Tab + * Backspace + * Delete + * Insert + * Return (or Enter as alias) + * Up, Down, Left and Right + * Home and End + * PageUp and PageDown + * Escape (or Esc for short) + * VolumeUp, VolumeDown and VolumeMute + * MediaNextTrack, MediaPreviousTrack, MediaStop and MediaPlayPause + * PrintScreen + */ + accelerator?: string; + /** + * In Electron for the APIs that take images, you can pass either file paths + * or NativeImage instances. When passing null, an empty image will be used. + */ + icon?: NativeImage|string; + /** + * If false, the menu item will be greyed out and unclickable. + */ + enabled?: boolean; + /** + * If false, the menu item will be entirely hidden. + */ + visible?: boolean; + /** + * Should only be specified for 'checkbox' or 'radio' type menu items. + */ + checked?: boolean; + /** + * Should be specified for submenu type menu item, when it's specified the + * type: 'submenu' can be omitted for the menu item + */ + submenu?: Menu|MenuItemOptions[]; + /** + * Unique within a single menu. If defined then it can be used as a reference + * to this item by the position attribute. + */ + id?: string; + /** + * This field allows fine-grained definition of the specific location within + * a given menu. + */ + position?: string; + /** + * Define the action of the menu item, when specified the click property will be ignored + */ + role?: MenuItemRole | MenuItemRoleMac; + } + + // https://github.com/electron/electron/blob/master/docs/api/menu.md + + /** + * The Menu class is used to create native menus that can be used as application + * menus and context menus. This module is a main process module which can be used + * in a render process via the remote module. + * + * Each menu consists of multiple menu items, and each menu item can have a submenu. + */ + class Menu extends NodeJS.EventEmitter { + /** + * Creates a new menu. + */ + constructor(); + /** + * Sets menu as the application menu on macOS. On Windows and Linux, the menu + * will be set as each window's top menu. + */ + static setApplicationMenu(menu: Menu): void; + /** + * @returns The application menu if set, or null if not set. + */ + static getApplicationMenu(): Menu; + /** + * Sends the action to the first responder of application. + * This is used for emulating default Cocoa menu behaviors, + * usually you would just use the role property of MenuItem. + * + * Note: This method is macOS only. + */ + static sendActionToFirstResponder(action: string): void; + /** + * @param template Generally, just an array of options for constructing MenuItem. + * You can also attach other fields to element of the template, and they will + * become properties of the constructed menu items. + */ + static buildFromTemplate(template: MenuItemOptions[]): Menu; + /** + * Pops up this menu as a context menu in the browserWindow. You can optionally + * provide a (x,y) coordinate to place the menu at, otherwise it will be placed + * at the current mouse cursor position. + * @param x Horizontal coordinate where the menu will be placed. + * @param y Vertical coordinate where the menu will be placed. + */ + popup(browserWindow?: BrowserWindow, x?: number, y?: number): void; + /** + * Appends the menuItem to the menu. + */ + append(menuItem: MenuItem): void; + /** + * Inserts the menuItem to the pos position of the menu. + */ + insert(position: number, menuItem: MenuItem): void; + /** + * @returns an array containing the menu’s items. + */ + items: MenuItem[]; + } + + // https://github.com/electron/electron/blob/master/docs/api/native-image.md + + /** + * This class is used to represent an image. + */ + class NativeImage { + /** + * Creates an empty NativeImage instance. + */ + static createEmpty(): NativeImage; + /** + * Creates a new NativeImage instance from file located at path. + * This method returns an empty image if the path does not exist, cannot be read, or is not a valid image. + */ + static createFromPath(path: string): NativeImage; + /** + * Creates a new NativeImage instance from buffer. + * @param scaleFactor 1.0 by default. + */ + static createFromBuffer(buffer: Buffer, scaleFactor?: number): NativeImage; + /** + * Creates a new NativeImage instance from dataURL + */ + static createFromDataURL(dataURL: string): NativeImage; + /** + * @returns Buffer that contains the image's PNG encoded data. + */ + toPNG(): Buffer; + /** + * @returns Buffer that contains the image's JPEG encoded data. + */ + toJPEG(quality: number): Buffer; + /** + * @returns Buffer that contains a copy of the image's raw bitmap pixel data. + */ + toBitmap(): Buffer; + /** + * @returns Buffer that contains the image's raw bitmap pixel data. + * + * The difference between getBitmap() and toBitmap() is, getBitmap() does not copy the bitmap data, + * so you have to use the returned Buffer immediately in current event loop tick, + * otherwise the data might be changed or destroyed. + */ + getBitmap(): Buffer; + /** + * @returns The data URL of the image. + */ + toDataURL(): string; + /** + * The native type of the handle is NSImage* on macOS. + * Note: This is only implemented on macOS. + * @returns The platform-specific handle of the image as Buffer. + */ + getNativeHandle(): Buffer; + /** + * @returns Whether the image is empty. + */ + isEmpty(): boolean; + /** + * @returns The size of the image. + */ + getSize(): Size; + /** + * Marks the image as template image. + */ + setTemplateImage(option: boolean): void; + /** + * Returns a boolean whether the image is a template image. + */ + isTemplateImage(): boolean; + /** + * @param rect The area of the image to crop + * @returns The cropped image. + */ + crop(rect: Rectangle): NativeImage; + /** + * @returns The resized image. + * If only the height or the width are specified then the current aspect ratio will be preserved in the resized image. + */ + resize(options: { + width?: number; + height?: number; + /** + * The desired quality of the resized image. + * Default: best. + */ + quality?: 'good' | 'better' | 'best'; + }): NativeImage; + /** + * @returns The image's aspect ratio. + */ + getAspectRatio(): number; + } + + // https://github.com/electron/electron/blob/master/docs/api/power-monitor.md + + /** + * The power-monitor module is used to monitor power state changes. + * You should not use this module until the ready event of the app module is emitted. + */ + interface PowerMonitor extends NodeJS.EventEmitter { + /** + * Emitted when the system is suspending. + */ + on(event: 'suspend', listener: Function): this; + /** + * Emitted when system is resuming. + */ + on(event: 'resume', listener: Function): this; + /** + * Emitted when the system changes to AC power. + */ + on(event: 'on-ac', listener: Function): this; + /** + * Emitted when system changes to battery power. + */ + on(event: 'on-battery', listener: Function): this; + on(event: string, listener: Function): this; + } + + // https://github.com/electron/electron/blob/master/docs/api/power-save-blocker.md + + /** + * The powerSaveBlocker module is used to block the system from entering + * low-power (sleep) mode and thus allowing the app to keep the system and screen active. + */ + interface PowerSaveBlocker { + /** + * Starts preventing the system from entering lower-power mode. + * @returns The blocker ID that is assigned to this power blocker. + * Note: prevent-display-sleep has higher has precedence over prevent-app-suspension. + */ + start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number; + /** + * @param id The power save blocker id returned by powerSaveBlocker.start. + * Stops the specified power save blocker. + */ + stop(id: number): void; + /** + * @param id The power save blocker id returned by powerSaveBlocker.start. + * @returns Whether the corresponding powerSaveBlocker has started. + */ + isStarted(id: number): boolean; + } + + // https://github.com/electron/electron/blob/master/docs/api/protocol.md + + /** + * The protocol module can register a custom protocol or intercept an existing protocol. + */ + interface Protocol { + /** + * Registers custom schemes as standard schemes. + */ + registerStandardSchemes(schemes: string[]): void; + /** + * Registers custom schemes to handle service workers. + */ + registerServiceWorkerSchemes(schemes: string[]): void; + /** + * Registers a protocol of scheme that will send the file as a response. + */ + registerFileProtocol(scheme: string, handler: FileProtocolHandler, completion?: (error: Error) => void): void; + /** + * Registers a protocol of scheme that will send a Buffer as a response. + */ + registerBufferProtocol(scheme: string, handler: BufferProtocolHandler, completion?: (error: Error) => void): void; + /** + * Registers a protocol of scheme that will send a String as a response. + */ + registerStringProtocol(scheme: string, handler: StringProtocolHandler, completion?: (error: Error) => void): void; + /** + * Registers a protocol of scheme that will send an HTTP request as a response. + */ + registerHttpProtocol(scheme: string, handler: HttpProtocolHandler, completion?: (error: Error) => void): void; + /** + * Unregisters the custom protocol of scheme. + */ + unregisterProtocol(scheme: string, completion?: (error: Error) => void): void; + /** + * The callback will be called with a boolean that indicates whether there is already a handler for scheme. + */ + isProtocolHandled(scheme: string, callback: (handled: boolean) => void): void; + /** + * Intercepts scheme protocol and uses handler as the protocol’s new handler which sends a file as a response. + */ + interceptFileProtocol(scheme: string, handler: FileProtocolHandler, completion?: (error: Error) => void): void; + /** + * Intercepts scheme protocol and uses handler as the protocol’s new handler which sends a Buffer as a response. + */ + interceptBufferProtocol(scheme: string, handler: BufferProtocolHandler, completion?: (error: Error) => void): void; + /** + * Intercepts scheme protocol and uses handler as the protocol’s new handler which sends a String as a response. + */ + interceptStringProtocol(scheme: string, handler: StringProtocolHandler, completion?: (error: Error) => void): void; + /** + * Intercepts scheme protocol and uses handler as the protocol’s new handler which sends a new HTTP request as a response. + */ + interceptHttpProtocol(scheme: string, handler: HttpProtocolHandler, completion?: (error: Error) => void): void; + /** + * Remove the interceptor installed for scheme and restore its original handler. + */ + uninterceptProtocol(scheme: string, completion?: (error: Error) => void): void; + } + + type FileProtocolHandler = (request: ProtocolRequest, callback: FileProtocolCallback) => void; + type BufferProtocolHandler = (request: ProtocolRequest, callback: BufferProtocolCallback) => void; + type StringProtocolHandler = (request: ProtocolRequest, callback: StringProtocolCallback) => void; + type HttpProtocolHandler = (request: ProtocolRequest, callback: HttpProtocolCallback) => void; + + interface ProtocolRequest { + url: string; + referrer: string; + method: string; + uploadData?: { + /** + * Content being sent. + */ + bytes: Buffer, + /** + * Path of file being uploaded. + */ + file: string, + /** + * UUID of blob data. Use session.getBlobData method to retrieve the data. + */ + blobUUID: string; + }[]; + } + + interface ProtocolCallback { + (error: number): void; + (obj: { + error: number + }): void; + (): void; + } + + interface FileProtocolCallback extends ProtocolCallback { + (filePath: string): void; + (obj: { + path: string + }): void; + } + + interface BufferProtocolCallback extends ProtocolCallback { + (buffer: Buffer): void; + (obj: { + data: Buffer, + mimeType: string, + charset?: string + }): void; + } + + interface StringProtocolCallback extends ProtocolCallback { + (str: string): void; + (obj: { + data: Buffer, + mimeType: string, + charset?: string + }): void; + } + + interface HttpProtocolCallback extends ProtocolCallback { + (redirectRequest: { + url: string; + method: string; + session?: Object; + uploadData?: { + contentType: string; + data: string; + }; + }): void; + } + + // https://github.com/electron/electron/blob/master/docs/api/remote.md + + /** + * The remote module provides a simple way to do inter-process communication (IPC) + * between the renderer process (web page) and the main process. + */ + interface Remote extends CommonElectron { + /** + * @returns The object returned by require(module) in the main process. + */ + require(module: string): any; + /** + * @returns The BrowserWindow object which this web page belongs to. + */ + getCurrentWindow(): BrowserWindow; + /** + * @returns The WebContents object of this web page. + */ + getCurrentWebContents(): WebContents; + /** + * @returns The global variable of name (e.g. global[name]) in the main process. + */ + getGlobal(name: string): any; + /** + * Returns the process object in the main process. This is the same as + * remote.getGlobal('process'), but gets cached. + */ + process: NodeJS.Process; + } + + // https://github.com/electron/electron/blob/master/docs/api/screen.md + + /** + * The Display object represents a physical display connected to the system. + * A fake Display may exist on a headless system, or a Display may correspond to a remote, virtual display. + */ + interface Display { + /** + * Unique identifier associated with the display. + */ + id: number; + bounds: Rectangle; + workArea: Rectangle; + size: Size; + workAreaSize: Size; + /** + * Output device’s pixel scale factor. + */ + scaleFactor: number; + /** + * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees. + */ + rotation: number; + touchSupport: 'available' | 'unavailable' | 'unknown'; + } + + type DisplayMetrics = 'bounds' | 'workArea' | 'scaleFactor' | 'rotation'; + + /** + * The screen module retrieves information about screen size, displays, cursor position, etc. + * You can not use this module until the ready event of the app module is emitted. + */ + interface Screen extends NodeJS.EventEmitter { + /** + * Emitted when newDisplay has been added. + */ + on(event: 'display-added', listener: (event: Event, newDisplay: Display) => void): this; + /** + * Emitted when oldDisplay has been removed. + */ + on(event: 'display-removed', listener: (event: Event, oldDisplay: Display) => void): this; + /** + * Emitted when one or more metrics change in a display. + */ + on(event: 'display-metrics-changed', listener: (event: Event, display: Display, changedMetrics: DisplayMetrics[]) => void): this; + on(event: string, listener: Function): this; + /** + * @returns The current absolute position of the mouse pointer. + */ + getCursorScreenPoint(): Point; + /** + * @returns The primary display. + */ + getPrimaryDisplay(): Display; + /** + * @returns An array of displays that are currently available. + */ + getAllDisplays(): Display[]; + /** + * @returns The display nearest the specified point. + */ + getDisplayNearestPoint(point: Point): Display; + /** + * @returns The display that most closely intersects the provided bounds. + */ + getDisplayMatching(rect: Rectangle): Display; + } + + // https://github.com/electron/electron/blob/master/docs/api/session.md + + /** + * The session module can be used to create new Session objects. + * You can also access the session of existing pages by using + * the session property of webContents which is a property of BrowserWindow. + */ + class Session extends NodeJS.EventEmitter { + /** + * @returns a new Session instance from partition string. + */ + static fromPartition(partition: string, options?: FromPartitionOptions): Session; + /** + * @returns the default session object of the app. + */ + static defaultSession: Session; + /** + * Emitted when Electron is about to download item in webContents. + * Calling event.preventDefault() will cancel the download + * and item will not be available from next tick of the process. + */ + on(event: 'will-download', listener: (event: Event, item: DownloadItem, webContents: WebContents) => void): this; + on(event: string, listener: Function): this; + /** + * The cookies gives you ability to query and modify cookies. + */ + cookies: SessionCookies; + /** + * @returns the session’s current cache size. + */ + getCacheSize(callback: (size: number) => void): void; + /** + * Clears the session’s HTTP cache. + */ + clearCache(callback: Function): void; + /** + * Clears the data of web storages. + */ + clearStorageData(callback: Function): void; + /** + * Clears the data of web storages. + */ + clearStorageData(options: ClearStorageDataOptions, callback: Function): void; + /** + * Writes any unwritten DOMStorage data to disk. + */ + flushStorageData(): void; + /** + * Sets the proxy settings. + */ + setProxy(config: ProxyConfig, callback: Function): void; + /** + * Resolves the proxy information for url. + */ + resolveProxy(url: URL, callback: (proxy: string) => void): void; + /** + * Sets download saving directory. + * By default, the download directory will be the Downloads under the respective app folder. + */ + setDownloadPath(path: string): void; + /** + * Emulates network with the given configuration for the session. + */ + enableNetworkEmulation(options: NetworkEmulationOptions): void; + /** + * Disables any network emulation already active for the session. + * Resets to the original network configuration. + */ + disableNetworkEmulation(): void; + /** + * Sets the certificate verify proc for session, the proc will be called + * whenever a server certificate verification is requested. + * + * Calling setCertificateVerifyProc(null) will revert back to default certificate verify proc. + */ + setCertificateVerifyProc(proc: (hostname: string, cert: Certificate, callback: (accepted: boolean) => void) => void): void; + /** + * Sets the handler which can be used to respond to permission requests for the session. + */ + setPermissionRequestHandler(handler: (webContents: WebContents, permission: Permission, callback: (allow: boolean) => void) => void): void; + /** + * Clears the host resolver cache. + */ + clearHostResolverCache(callback: Function): void; + /** + * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate authentication. + * @param domains Comma-seperated list of servers for which integrated authentication is enabled. + */ + allowNTLMCredentialsForDomains(domains: string): void; + /** + * Overrides the userAgent and acceptLanguages for this session. + * The acceptLanguages must a comma separated ordered list of language codes, for example "en-US,fr,de,ko,zh-CN,ja". + * This doesn't affect existing WebContents, and each WebContents can use webContents.setUserAgent to override the session-wide user agent. + */ + setUserAgent(userAgent: string, acceptLanguages?: string): void; + /** + * @returns The user agent for this session. + */ + getUserAgent(): string; + /** + * Returns the blob data associated with the identifier. + */ + getBlobData(identifier: string, callback: (result: Buffer) => void): void; + /** + * The webRequest API set allows to intercept and modify contents of a request at various stages of its lifetime. + */ + webRequest: WebRequest; + /** + * @returns An instance of protocol module for this session. + */ + protocol: Protocol; + } + + type Permission = 'media' | 'geolocation' | 'notifications' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal'; + + interface FromPartitionOptions { + /** + * Whether to enable cache. + */ + cache?: boolean; + } + + interface ClearStorageDataOptions { + /** + * Should follow window.location.origin’s representation scheme://host:port. + */ + origin?: string; + /** + * The types of storages to clear. + */ + storages?: ('appcache' | 'cookies' | 'filesystem' | 'indexdb' | 'localstorage' | 'shadercache' | 'websql' | 'serviceworkers')[]; + /** + * The types of quotas to clear. + */ + quotas?: ('temporary' | 'persistent' | 'syncable')[]; + } + + interface ProxyConfig { + /** + * The URL associated with the PAC file. + */ + pacScript: string; + /** + * Rules indicating which proxies to use. + */ + proxyRules: string; + /** + * Rules indicating which URLs should bypass the proxy settings. + */ + proxyBypassRules: string; + } + + interface NetworkEmulationOptions { + /** + * Whether to emulate network outage. + * Default: false. + */ + offline?: boolean; + /** + * RTT in ms. + * Default: 0, which will disable latency throttling. + */ + latency?: number; + /** + * Download rate in Bps. + * Default: 0, which will disable download throttling. + */ + downloadThroughput?: number; + /** + * Upload rate in Bps. + * Default: 0, which will disable upload throttling. + */ + uploadThroughput?: number; + } + + interface CookieFilter { + /** + * Retrieves cookies which are associated with url. Empty implies retrieving cookies of all urls. + */ + url?: string; + /** + * Filters cookies by name. + */ + name?: string; + /** + * Retrieves cookies whose domains match or are subdomains of domains. + */ + domain?: string; + /** + * Retrieves cookies whose path matches path. + */ + path?: string; + /** + * Filters cookies by their Secure property. + */ + secure?: boolean; + /** + * Filters out session or persistent cookies. + */ + session?: boolean; + } + + interface Cookie { + /** + * Emitted when a cookie is changed because it was added, edited, removed, or expired. + */ + on(event: 'changed', listener: (event: Event, cookie: Cookie, cause: CookieChangedCause) => void): this; + on(event: string, listener: Function): this; + /** + * The name of the cookie. + */ + name: string; + /** + * The value of the cookie. + */ + value: string; + /** + * The domain of the cookie. + */ + domain: string; + /** + * Whether the cookie is a host-only cookie. + */ + hostOnly: string; + /** + * The path of the cookie. + */ + path: string; + /** + * Whether the cookie is marked as secure. + */ + secure: boolean; + /** + * Whether the cookie is marked as HTTP only. + */ + httpOnly: boolean; + /** + * Whether the cookie is a session cookie or a persistent cookie with an expiration date. + */ + session: boolean; + /** + * The expiration date of the cookie as the number of seconds since the UNIX epoch. + * Not provided for session cookies. + */ + expirationDate?: number; + } + + type CookieChangedCause = 'explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite'; + + interface CookieDetails { + /** + * The URL associated with the cookie. + */ + url: string; + /** + * The name of the cookie. + * Default: empty. + */ + name?: string; + /** + * The value of the cookie. + * Default: empty. + */ + value?: string; + /** + * The domain of the cookie. + * Default: empty. + */ + domain?: string; + /** + * The path of the cookie. + * Default: empty. + */ + path?: string; + /** + * Whether the cookie should be marked as secure. + * Default: false. + */ + secure?: boolean; + /** + * Whether the cookie should be marked as HTTP only. + * Default: false. + */ + httpOnly?: boolean; + /** + * The expiration date of the cookie as the number of seconds since the UNIX epoch. + * If omitted, the cookie becomes a session cookie. + */ + expirationDate?: number; + } + + interface SessionCookies { + /** + * Sends a request to get all cookies matching filter. + */ + get(filter: CookieFilter, callback: (error: Error, cookies: Cookie[]) => void): void; + /** + * Sets the cookie with details. + */ + set(details: CookieDetails, callback: (error: Error) => void): void; + /** + * Removes the cookies matching url and name. + */ + remove(url: string, name: string, callback: (error: Error) => void): void; + } + + /** + * Each API accepts an optional filter and a listener, the listener will be called when the API's event has happened. + * Passing null as listener will unsubscribe from the event. + * + * The filter will be used to filter out the requests that do not match the URL patterns. + * If the filter is omitted then all requests will be matched. + * + * For certain events the listener is passed with a callback, + * which should be called with an response object when listener has done its work. + */ + interface WebRequest { + /** + * The listener will be called when a request is about to occur. + */ + onBeforeRequest(listener: (details: WebRequest.BeforeRequestDetails, callback: WebRequest.BeforeRequestCallback) => void): void; + /** + * The listener will be called when a request is about to occur. + */ + onBeforeRequest(filter: WebRequest.Filter, listener: (details: WebRequest.BeforeRequestDetails, callback: WebRequest.BeforeRequestCallback) => void): void; + /** + * The listener will be called before sending an HTTP request, once the request headers are available. + * This may occur after a TCP connection is made to the server, but before any http data is sent. + */ + onBeforeSendHeaders(listener: (details: WebRequest.BeforeSendHeadersDetails, callback: WebRequest.BeforeSendHeadersCallback) => void): void; + /** + * The listener will be called before sending an HTTP request, once the request headers are available. + * This may occur after a TCP connection is made to the server, but before any http data is sent. + */ + onBeforeSendHeaders(filter: WebRequest.Filter, listener: (details: WebRequest.BeforeSendHeadersDetails, callback: WebRequest.BeforeSendHeadersCallback) => void): void; + /** + * The listener will be called just before a request is going to be sent to the server, + * modifications of previous onBeforeSendHeaders response are visible by the time this listener is fired. + */ + onSendHeaders(listener: (details: WebRequest.SendHeadersDetails) => void): void; + /** + * The listener will be called just before a request is going to be sent to the server, + * modifications of previous onBeforeSendHeaders response are visible by the time this listener is fired. + */ + onSendHeaders(filter: WebRequest.Filter, listener: (details: WebRequest.SendHeadersDetails) => void): void; + /** + * The listener will be called when HTTP response headers of a request have been received. + */ + onHeadersReceived(listener: (details: WebRequest.HeadersReceivedDetails, callback: WebRequest.HeadersReceivedCallback) => void): void; + /** + * The listener will be called when HTTP response headers of a request have been received. + */ + onHeadersReceived(filter: WebRequest.Filter, listener: (details: WebRequest.HeadersReceivedDetails, callback: WebRequest.HeadersReceivedCallback) => void): void; + /** + * The listener will be called when first byte of the response body is received. + * For HTTP requests, this means that the status line and response headers are available. + */ + onResponseStarted(listener: (details: WebRequest.ResponseStartedDetails) => void): void; + /** + * The listener will be called when first byte of the response body is received. + * For HTTP requests, this means that the status line and response headers are available. + */ + onResponseStarted(filter: WebRequest.Filter, listener: (details: WebRequest.ResponseStartedDetails) => void): void; + /** + * The listener will be called when a server initiated redirect is about to occur. + */ + onBeforeRedirect(listener: (details: WebRequest.BeforeRedirectDetails) => void): void; + /** + * The listener will be called when a server initiated redirect is about to occur. + */ + onBeforeRedirect(filter: WebRequest.Filter, listener: (details: WebRequest.BeforeRedirectDetails) => void): void; + /** + * The listener will be called when a request is completed. + */ + onCompleted(listener: (details: WebRequest.CompletedDetails) => void): void; + /** + * The listener will be called when a request is completed. + */ + onCompleted(filter: WebRequest.Filter, listener: (details: WebRequest.CompletedDetails) => void): void; + /** + * The listener will be called when an error occurs. + */ + onErrorOccurred(listener: (details: WebRequest.ErrorOccurredDetails) => void): void; + /** + * The listener will be called when an error occurs. + */ + onErrorOccurred(filter: WebRequest.Filter, listener: (details: WebRequest.ErrorOccurredDetails) => void): void; + } + + namespace WebRequest { + interface Filter { + urls: string[]; + } + + interface Details { + id: number; + url: string; + method: string; + resourceType: string; + timestamp: number; + } + + interface UploadData { + /** + * Content being sent. + */ + bytes: Buffer; + /** + * Path of file being uploaded. + */ + file: string; + /** + * UUID of blob data. Use session.getBlobData method to retrieve the data. + */ + blobUUID: string; + } + + interface BeforeRequestDetails extends Details { + uploadData?: UploadData[]; + } + + type BeforeRequestCallback = (response: { + cancel?: boolean; + /** + * The original request is prevented from being sent or completed, and is instead redirected to the given URL. + */ + redirectURL?: string; + }) => void; + + interface BeforeSendHeadersDetails extends Details { + requestHeaders: Headers; + } + + type BeforeSendHeadersCallback = (response: { + cancel?: boolean; + /** + * When provided, request will be made with these headers. + */ + requestHeaders?: Headers; + }) => void; + + interface SendHeadersDetails extends Details { + requestHeaders: Headers; + } + + interface HeadersReceivedDetails extends Details { + statusLine: string; + statusCode: number; + responseHeaders: Headers; + } + + type HeadersReceivedCallback = (response: { + cancel?: boolean; + /** + * When provided, the server is assumed to have responded with these headers. + */ + responseHeaders?: Headers; + /** + * Should be provided when overriding responseHeaders to change header status + * otherwise original response header's status will be used. + */ + statusLine?: string; + }) => void; + + interface ResponseStartedDetails extends Details { + responseHeaders: Headers; + fromCache: boolean; + statusCode: number; + statusLine: string; + } + + interface BeforeRedirectDetails extends Details { + redirectURL: string; + statusCode: number; + ip?: string; + fromCache: boolean; + responseHeaders: Headers; + } + + interface CompletedDetails extends Details { + responseHeaders: Headers; + fromCache: boolean; + statusCode: number; + statusLine: string; + } + + interface ErrorOccurredDetails extends Details { + fromCache: boolean; + error: string; + } + } + + // https://github.com/electron/electron/blob/master/docs/api/shell.md + + /** + * The shell module provides functions related to desktop integration. + */ + interface Shell { + /** + * Show the given file in a file manager. If possible, select the file. + * @returns Whether the item was successfully shown. + */ + showItemInFolder(fullPath: string): boolean; + /** + * Open the given file in the desktop's default manner. + * @returns Whether the item was successfully shown. + */ + openItem(fullPath: string): boolean; + /** + * Open the given external protocol URL in the desktop's default manner + * (e.g., mailto: URLs in the default mail user agent). + * @returns Whether an application was available to open the URL. + */ + openExternal(url: string, options?: { + /** + * Bring the opened application to the foreground. + * Default: true. + */ + activate: boolean; + }): boolean; + /** + * Move the given file to trash. + * @returns Whether the item was successfully moved to the trash. + */ + moveItemToTrash(fullPath: string): boolean; + /** + * Play the beep sound. + */ + beep(): void; + /** + * Creates or updates a shortcut link at shortcutPath. + * + * Note: This API is available only on Windows. + */ + writeShortcutLink(shortcutPath: string, options: ShortcutLinkOptions): boolean; + /** + * Creates or updates a shortcut link at shortcutPath. + * + * Note: This API is available only on Windows. + */ + writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutLinkOptions): boolean; + /** + * Resolves the shortcut link at shortcutPath. + * An exception will be thrown when any error happens. + * + * Note: This API is available only on Windows. + */ + readShortcutLink(shortcutPath: string): ShortcutLinkOptions; + } + + interface ShortcutLinkOptions { + /** + * The target to launch from this shortcut. + */ + target: string; + /** + * The working directory. + * Default: empty. + */ + cwd?: string; + /** + * The arguments to be applied to target when launching from this shortcut. + * Default: empty. + */ + args?: string; + /** + * The description of the shortcut. + * Default: empty. + */ + description?: string; + /** + * The path to the icon, can be a DLL or EXE. icon and iconIndex have to be set together. + * Default: empty, which uses the target's icon. + */ + icon?: string; + /** + * The resource ID of icon when icon is a DLL or EXE. + * Default: 0. + */ + iconIndex?: number; + /** + * The Application User Model ID. + * Default: empty. + */ + appUserModelId?: string; + } + + // https://github.com/electron/electron/blob/master/docs/api/system-preferences.md + + type SystemColor = + '3d-dark-shadow' | // Dark shadow for three-dimensional display elements. + '3d-face' | // Face color for three-dimensional display elements and for dialog box backgrounds. + '3d-highlight' | // Highlight color for three-dimensional display elements. + '3d-light' | // Light color for three-dimensional display elements. + '3d-shadow' | // Shadow color for three-dimensional display elements. + 'active-border' | // Active window border. + 'active-caption' | // Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled. + 'active-caption-gradient' | // Right side color in the color gradient of an active window's title bar. + 'app-workspace' | // Background color of multiple document interface (MDI) applications. + 'button-text' | // Text on push buttons. + 'caption-text' | // Text in caption, size box, and scroll bar arrow box. + 'desktop' | // Desktop background color. + 'disabled-text' | // Grayed (disabled) text. + 'highlight' | // Item(s) selected in a control. + 'highlight-text' | // Text of item(s) selected in a control. + 'hotlight' | // Color for a hyperlink or hot-tracked item. + 'inactive-border' | // Inactive window border. + 'inactive-caption' | // Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled. + 'inactive-caption-gradient' | // Right side color in the color gradient of an inactive window's title bar. + 'inactive-caption-text' | // Color of text in an inactive caption. + 'info-background' | // Background color for tooltip controls. + 'info-text' | // Text color for tooltip controls. + 'menu' | // Menu background. + 'menu-highlight' | // The color used to highlight menu items when the menu appears as a flat menu. + 'menubar' | // The background color for the menu bar when menus appear as flat menus. + 'menu-text' | // Text in menus. + 'scrollbar' | // Scroll bar gray area. + 'window' | // Window background. + 'window-frame' | // Window frame. + 'window-text'; // Text in windows. + + /** + * Get system preferences. + */ + interface SystemPreferences { + /** + * Note: This is only implemented on Windows. + */ + on(event: 'accent-color-changed', listener: (event: Event, newColor: string) => void): this; + /** + * Note: This is only implemented on Windows. + */ + on(event: 'color-changed', listener: (event: Event) => void): this; + /** + * Note: This is only implemented on Windows. + */ + on(event: 'inverted-color-scheme-changed', listener: ( + event: Event, + /** + * @param invertedColorScheme true if an inverted color scheme, such as a high contrast theme, is being used, false otherwise. + */ + invertedColorScheme: boolean + ) => void): this; + on(event: string, listener: Function): this; + /** + * @returns Whether the system is in Dark Mode. + * + * Note: This is only implemented on macOS. + */ + isDarkMode(): boolean; + /** + * @returns Whether the Swipe between pages setting is on. + * + * Note: This is only implemented on macOS. + */ + isSwipeTrackingFromScrollEventsEnabled(): boolean; + /** + * Posts event as native notifications of macOS. + * The userInfo contains the user information dictionary sent along with the notification. + * + * Note: This is only implemented on macOS. + */ + postNotification(event: string, userInfo: Object): void; + /** + * Posts event as native notifications of macOS. + * The userInfo contains the user information dictionary sent along with the notification. + * + * Note: This is only implemented on macOS. + */ + postLocalNotification(event: string, userInfo: Object): void; + /** + * Subscribes to native notifications of macOS, callback will be called when the corresponding event happens. + * The id of the subscriber is returned, which can be used to unsubscribe the event. + * + * Note: This is only implemented on macOS. + */ + subscribeNotification(event: string, callback: (event: Event, userInfo: Object) => void): number; + /** + * Removes the subscriber with id. + * + * Note: This is only implemented on macOS. + */ + unsubscribeNotification(id: number): void; + /** + * Same as subscribeNotification, but uses NSNotificationCenter for local defaults. + */ + subscribeLocalNotification(event: string, callback: (event: Event, userInfo: Object) => void): number; + /** + * Same as unsubscribeNotification, but removes the subscriber from NSNotificationCenter. + */ + unsubscribeLocalNotification(id: number): void; + /** + * Get the value of key in system preferences. + * + * Note: This is only implemented on macOS. + */ + getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any; + /** + * @returns Whether DWM composition (Aero Glass) is enabled. + * + * Note: This is only implemented on Windows. + */ + isAeroGlassEnabled(): boolean; + /** + * @returns The users current system wide color preference in the form of an RGBA hexadecimal string. + * + * Note: This is only implemented on Windows. + */ + getAccentColor(): string; + /** + * @returns true if an inverted color scheme, such as a high contrast theme, is active, false otherwise. + * + * Note: This is only implemented on Windows. + */ + isInvertedColorScheme(): boolean; + /** + * @returns The system color setting in RGB hexadecimal form (#ABCDEF). See the Windows docs for more details. + * + * Note: This is only implemented on Windows. + */ + getColor(color: SystemColor): string; + } + + // https://github.com/electron/electron/blob/master/docs/api/tray.md + + /** + * A Tray represents an icon in an operating system's notification area. + */ + class Tray extends NodeJS.EventEmitter implements Destroyable { + /** + * Emitted when the tray icon is clicked. + * Note: The bounds payload is only implemented on macOS and Windows. + */ + on(event: 'click', listener: (modifiers: Modifiers, bounds: Rectangle) => void): this; + /** + * Emitted when the tray icon is right clicked. + * Note: This is only implemented on macOS and Windows. + */ + on(event: 'right-click', listener: (modifiers: Modifiers, bounds: Rectangle) => void): this; + /** + * Emitted when the tray icon is double clicked. + * Note: This is only implemented on macOS and Windows. + */ + on(event: 'double-click', listener: (modifiers: Modifiers, bounds: Rectangle) => void): this; + /** + * Emitted when the tray balloon shows. + * Note: This is only implemented on Windows. + */ + on(event: 'balloon-show', listener: Function): this; + /** + * Emitted when the tray balloon is clicked. + * Note: This is only implemented on Windows. + */ + on(event: 'balloon-click', listener: Function): this; + /** + * Emitted when the tray balloon is closed because of timeout or user manually closes it. + * Note: This is only implemented on Windows. + */ + on(event: 'balloon-closed', listener: Function): this; + /** + * Emitted when any dragged items are dropped on the tray icon. + * Note: This is only implemented on macOS. + */ + on(event: 'drop', listener: Function): this; + /** + * Emitted when dragged files are dropped in the tray icon. + * Note: This is only implemented on macOS + */ + on(event: 'drop-files', listener: (event: Event, files: string[]) => void): this; + /** + * Emitted when dragged text is dropped in the tray icon. + * Note: This is only implemented on macOS + */ + on(event: 'drop-text', listener: (event: Event, text: string) => void): this; + /** + * Emitted when a drag operation enters the tray icon. + * Note: This is only implemented on macOS + */ + on(event: 'drag-enter', listener: Function): this; + /** + * Emitted when a drag operation exits the tray icon. + * Note: This is only implemented on macOS + */ + on(event: 'drag-leave', listener: Function): this; + /** + * Emitted when a drag operation ends on the tray or ends at another location. + * Note: This is only implemented on macOS + */ + on(event: 'drag-end', listener: Function): this; + on(event: string, listener: Function): this; + /** + * Creates a new tray icon associated with the image. + */ + constructor(image: NativeImage|string); + /** + * Destroys the tray icon immediately. + */ + destroy(): void; + /** + * Sets the image associated with this tray icon. + */ + setImage(image: NativeImage|string): void; + /** + * Sets the image associated with this tray icon when pressed. + */ + setPressedImage(image: NativeImage): void; + /** + * Sets the hover text for this tray icon. + */ + setToolTip(toolTip: string): void; + /** + * Sets the title displayed aside of the tray icon in the status bar. + * Note: This is only implemented on macOS. + */ + setTitle(title: string): void; + /** + * Sets when the tray's icon background becomes highlighted. + * Note: This is only implemented on macOS. + */ + setHighlightMode(mode: 'selection' | 'always' | 'never'): void; + /** + * Displays a tray balloon. + * Note: This is only implemented on Windows. + */ + displayBalloon(options?: { + icon?: NativeImage; + title?: string; + content?: string; + }): void; + /** + * Pops up the context menu of tray icon. When menu is passed, + * the menu will showed instead of the tray's context menu. + * The position is only available on Windows, and it is (0, 0) by default. + * Note: This is only implemented on macOS and Windows. + */ + popUpContextMenu(menu?: Menu, position?: Point): void; + /** + * Sets the context menu for this icon. + */ + setContextMenu(menu: Menu): void; + /** + * @returns The bounds of this tray icon. + */ + getBounds(): Rectangle; + /** + * @returns Whether the tray icon is destroyed. + */ + isDestroyed(): boolean; + } + + interface Modifiers { + altKey: boolean; + shiftKey: boolean; + ctrlKey: boolean; + metaKey: boolean; + } + + interface DragItem { + /** + * The absolute path of the file to be dragged + */ + file: string; + /** + * The image showing under the cursor when dragging. + */ + icon: NativeImage; + } + + // https://github.com/electron/electron/blob/master/docs/api/web-contents.md + + interface WebContentsStatic { + /** + * @returns An array of all WebContents instances. This will contain web contents for all windows, + * webviews, opened devtools, and devtools extension background pages. + */ + getAllWebContents(): WebContents[]; + /** + * @returns The web contents that is focused in this application, otherwise returns null. + */ + getFocusedWebContents(): WebContents; + /** + * Find a WebContents instance according to its ID. + */ + fromId(id: number): WebContents; + } + + /** + * A WebContents is responsible for rendering and controlling a web page. + */ + interface WebContents extends NodeJS.EventEmitter { + /** + * Emitted when the navigation is done, i.e. the spinner of the tab has stopped spinning, + * and the onload event was dispatched. + */ + on(event: 'did-finish-load', listener: Function): this; + /** + * This event is like did-finish-load but emitted when the load failed or was cancelled, + * e.g. window.stop() is invoked. + */ + on(event: 'did-fail-load', listener: (event: Event, errorCode: number, errorDescription: string, validatedURL: string, isMainFrame: boolean) => void): this; + /** + * Emitted when a frame has done navigation. + */ + on(event: 'did-frame-finish-load', listener: (event: Event, isMainFrame: boolean) => void): this; + /** + * Corresponds to the points in time when the spinner of the tab started spinning. + */ + on(event: 'did-start-loading', listener: Function): this; + /** + * Corresponds to the points in time when the spinner of the tab stopped spinning. + */ + on(event: 'did-stop-loading', listener: Function): this; + /** + * Emitted when details regarding a requested resource are available. + * status indicates the socket connection to download the resource. + */ + on(event: 'did-get-response-details', listener: (event: Event, + status: boolean, + newURL: string, + originalURL: string, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: Headers, + resourceType: string + ) => void): this; + /** + * Emitted when a redirect is received while requesting a resource. + */ + on(event: 'did-get-redirect-request', listener: (event: Event, + oldURL: string, + newURL: string, + isMainFrame: boolean, + httpResponseCode: number, + requestMethod: string, + referrer: string, + headers: Headers + ) => void): this; + /** + * Emitted when the document in the given frame is loaded. + */ + on(event: 'dom-ready', listener: (event: Event) => void): this; + /** + * Emitted when page receives favicon URLs. + */ + on(event: 'page-favicon-updated', listener: (event: Event, favicons: string[]) => void): this; + /** + * Emitted when the page requests to open a new window for a url. + * It could be requested by window.open or an external link like . + * + * By default a new BrowserWindow will be created for the url. + * + * Calling event.preventDefault() will prevent creating new windows. + * In such case, the event.newGuest may be set with a reference + * to a BrowserWindow instance to make it used by the Electron's runtime. + */ + on(event: 'new-window', listener: (event: WebContents.NewWindowEvent, + url: string, + frameName: string, + disposition: NewWindowDisposition, + /** + * The options which will be used for creating the new BrowserWindow. + */ + options: BrowserWindowOptions, + /** + * The non-standard features (features not handled by Chromium or Electron) given to window.open(). + */ + additionalFeatures: string[] + ) => void): this; + /** + * Emitted when a user or the page wants to start navigation. + * It can happen when the window.location object is changed or a user clicks a link in the page. + * + * This event will not emit when the navigation is started programmatically with APIs like + * webContents.loadURL and webContents.back. + * + * It is also not emitted for in-page navigations, such as clicking anchor links + * or updating the window.location.hash. Use did-navigate-in-page event for this purpose. + * + * Calling event.preventDefault() will prevent the navigation. + */ + on(event: 'will-navigate', listener: (event: Event, url: string) => void): this; + /** + * Emitted when a navigation is done. + * + * This event is not emitted for in-page navigations, such as clicking anchor links + * or updating the window.location.hash. Use did-navigate-in-page event for this purpose. + */ + on(event: 'did-navigate', listener: (event: Event, url: string) => void): this; + /** + * Emitted when an in-page navigation happened. + * + * When in-page navigation happens, the page URL changes but does not cause + * navigation outside of the page. Examples of this occurring are when anchor links + * are clicked or when the DOM hashchange event is triggered. + */ + on(event: 'did-navigate-in-page', listener: (event: Event, url: string, isMainFrame: boolean) => void): this; + /** + * Emitted when the renderer process has crashed. + */ + on(event: 'crashed', listener: (event: Event, killed: boolean) => void): this; + /** + * Emitted when a plugin process has crashed. + */ + on(event: 'plugin-crashed', listener: (event: Event, name: string, version: string) => void): this; + /** + * Emitted when webContents is destroyed. + */ + on(event: 'destroyed', listener: Function): this; + /** + * Emitted when DevTools is opened. + */ + on(event: 'devtools-opened', listener: Function): this; + /** + * Emitted when DevTools is closed. + */ + on(event: 'devtools-closed', listener: Function): this; + /** + * Emitted when DevTools is focused / opened. + */ + on(event: 'devtools-focused', listener: Function): this; + /** + * Emitted when failed to verify the certificate for url. + * The usage is the same with the "certificate-error" event of app. + */ + on(event: 'certificate-error', listener: (event: Event, + url: string, + error: string, + certificate: Certificate, + callback: (trust: boolean) => void + ) => void): this; + /** + * Emitted when a client certificate is requested. + * The usage is the same with the "select-client-certificate" event of app. + */ + on(event: 'select-client-certificate', listener: (event: Event, + url: string, + certificateList: Certificate[], + callback: (certificate: Certificate) => void + ) => void): this; + /** + * Emitted when webContents wants to do basic auth. + * The usage is the same with the "login" event of app. + */ + on(event: 'login', listener: (event: Event, + request: LoginRequest, + authInfo: LoginAuthInfo, + callback: (username: string, password: string) => void + ) => void): this; + /** + * Emitted when a result is available for webContents.findInPage request. + */ + on(event: 'found-in-page', listener: (event: Event, result: FoundInPageResult) => void): this; + /** + * Emitted when media starts playing. + */ + on(event: 'media-started-playing', listener: Function): this; + /** + * Emitted when media is paused or done playing. + */ + on(event: 'media-paused', listener: Function): this; + /** + * Emitted when a page’s theme color changes. This is usually due to encountering a meta tag: + * + */ + on(event: 'did-change-theme-color', listener: Function): this; + /** + * Emitted when mouse moves over a link or the keyboard moves the focus to a link. + */ + on(event: 'update-target-url', listener: (event: Event, url: string) => void): this; + /** + * Emitted when the cursor’s type changes. + * If the type parameter is custom, the image parameter will hold the custom cursor image + * in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor. + */ + on(event: 'cursor-changed', listener: (event: Event, type: CursorType, image?: NativeImage, scale?: number, size?: Size, hotspot?: Point) => void): this; + /** + * Emitted when there is a new context menu that needs to be handled. + */ + on(event: 'context-menu', listener: (event: Event, params: ContextMenuParams) => void): this; + /** + * Emitted when bluetooth device needs to be selected on call to navigator.bluetooth.requestDevice. + * To use navigator.bluetooth api webBluetooth should be enabled. + * If event.preventDefault is not called, first available device will be selected. + * callback should be called with deviceId to be selected, + * passing empty string to callback will cancel the request. + */ + on(event: 'select-bluetooth-device', listener: (event: Event, deviceList: BluetoothDevice[], callback: (deviceId: string) => void) => void): this; + /** + * Emitted when a new frame is generated. Only the dirty area is passed in the buffer. + */ + on(event: 'paint', listener: (event: Event, dirtyRect: Rectangle, image: NativeImage) => void): this; + on(event: string, listener: Function): this; + /** + * Loads the url in the window. + * @param url Must contain the protocol prefix (e.g., the http:// or file://). + */ + loadURL(url: string, options?: LoadURLOptions): void; + /** + * Initiates a download of the resource at url without navigating. + * The will-download event of session will be triggered. + */ + downloadURL(url: string): void; + /** + * @returns The URL of current web page. + */ + getURL(): string; + /** + * @returns The title of web page. + */ + getTitle(): string; + /** + * @returns The favicon of the web page. + */ + getFavicon(): NativeImage; + /** + * @returns Whether web page is still loading resources. + */ + isLoading(): boolean; + /** + * @returns Whether the main frame (and not just iframes or frames within it) is still loading. + */ + isLoadingMainFrame(): boolean; + /** + * @returns Whether web page is waiting for a first-response for the main + * resource of the page. + */ + isWaitingForResponse(): boolean; + /** + * Stops any pending navigation. + */ + stop(): void; + /** + * Reloads current page. + */ + reload(): void; + /** + * Reloads current page and ignores cache. + */ + reloadIgnoringCache(): void; + /** + * @returns Whether the web page can go back. + */ + canGoBack(): boolean; + /** + * @returns Whether the web page can go forward. + */ + canGoForward(): boolean; + /** + * @returns Whether the web page can go to offset. + */ + canGoToOffset(offset: number): boolean; + /** + * Clears the navigation history. + */ + clearHistory(): void; + /** + * Makes the web page go back. + */ + goBack(): void; + /** + * Makes the web page go forward. + */ + goForward(): void; + /** + * Navigates to the specified absolute index. + */ + goToIndex(index: number): void; + /** + * Navigates to the specified offset from the "current entry". + */ + goToOffset(offset: number): void; + /** + * @returns Whether the renderer process has crashed. + */ + isCrashed(): boolean; + /** + * Overrides the user agent for this page. + */ + setUserAgent(userAgent: string): void; + /** + * @returns The user agent for this web page. + */ + getUserAgent(): string; + /** + * Injects CSS into this page. + */ + insertCSS(css: string): void; + /** + * Evaluates code in page. + * @param code Code to evaluate. + */ + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void; + /** + * Mute the audio on the current web page. + */ + setAudioMuted(muted: boolean): void; + /** + * @returns Whether this page has been muted. + */ + isAudioMuted(): boolean; + /** + * Changes the zoom factor to the specified factor. + * Zoom factor is zoom percent divided by 100, so 300% = 3.0. + */ + setZoomFactor(factor: number): void; + /** + * Sends a request to get current zoom factor. + */ + getZoomFactor(callback: (zoomFactor: number) => void): void; + /** + * Changes the zoom level to the specified level. + * The original size is 0 and each increment above or below represents + * zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. + */ + setZoomLevel(level: number): void; + /** + * Sends a request to get current zoom level. + */ + getZoomLevel(callback: (zoomLevel: number) => void): void; + /** + * Sets the maximum and minimum zoom level. + */ + setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; + /** + * Executes the editing command undo in web page. + */ + undo(): void; + /** + * Executes the editing command redo in web page. + */ + redo(): void; + /** + * Executes the editing command cut in web page. + */ + cut(): void; + /** + * Executes the editing command copy in web page. + */ + copy(): void; + /** + * Copy the image at the given position to the clipboard. + */ + copyImageAt(x: number, y: number): void; + /** + * Executes the editing command paste in web page. + */ + paste(): void; + /** + * Executes the editing command pasteAndMatchStyle in web page. + */ + pasteAndMatchStyle(): void; + /** + * Executes the editing command delete in web page. + */ + delete(): void; + /** + * Executes the editing command selectAll in web page. + */ + selectAll(): void; + /** + * Executes the editing command unselect in web page. + */ + unselect(): void; + /** + * Executes the editing command replace in web page. + */ + replace(text: string): void; + /** + * Executes the editing command replaceMisspelling in web page. + */ + replaceMisspelling(text: string): void; + /** + * Inserts text to the focused element. + */ + insertText(text: string): void; + /** + * Starts a request to find all matches for the text in the web page. + * The result of the request can be obtained by subscribing to found-in-page event. + * @returns The request id used for the request. + */ + findInPage(text: string, options?: FindInPageOptions): number; + /** + * Stops any findInPage request for the webContents with the provided action. + */ + stopFindInPage(action: StopFindInPageAtion): void; + /** + * Checks if any serviceworker is registered. + */ + hasServiceWorker(callback: (hasServiceWorker: boolean) => void): void; + /** + * Unregisters any serviceworker if present. + */ + unregisterServiceWorker(callback: (isFulfilled: boolean) => void): void; + /** + * Prints window's web page. When silent is set to false, Electron will pick up system's default printer and default settings for printing. + * Calling window.print() in web page is equivalent to call WebContents.print({silent: false, printBackground: false}). + * Note: On Windows, the print API relies on pdf.dll. If your application doesn't need print feature, you can safely remove pdf.dll in saving binary size. + */ + print(options?: PrintOptions): void; + /** + * Prints windows' web page as PDF with Chromium's preview printing custom settings. + */ + printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void; + /** + * Adds the specified path to DevTools workspace. + */ + addWorkSpace(path: string): void; + /** + * Removes the specified path from DevTools workspace. + */ + removeWorkSpace(path: string): void; + /** + * Opens the developer tools. + */ + openDevTools(options?: { + /** + * Opens the devtools with specified dock state. Defaults to last used dock state. + */ + mode?: 'right' | 'bottom' | 'undocked' | 'detach' + }): void; + /** + * Closes the developer tools. + */ + closeDevTools(): void; + /** + * Returns whether the developer tools are opened. + */ + isDevToolsOpened(): boolean; + /** + * Returns whether the developer tools are focussed. + */ + isDevToolsFocused(): boolean; + /** + * Toggle the developer tools. + */ + toggleDevTools(): void; + /** + * Starts inspecting element at position (x, y). + */ + inspectElement(x: number, y: number): void; + /** + * Opens the developer tools for the service worker context. + */ + inspectServiceWorker(): void; + /** + * Send args.. to the web page via channel in asynchronous message, the web page + * can handle it by listening to the channel event of ipc module. + * Note: + * 1. The IPC message handler in web pages do not have a event parameter, + * which is different from the handlers on the main process. + * 2. There is no way to send synchronous messages from the main process + * to a renderer process, because it would be very easy to cause dead locks. + */ + send(channel: string, ...args: any[]): void; + /** + * Enable device emulation with the given parameters. + */ + enableDeviceEmulation(parameters: DeviceEmulationParameters): void; + /** + * Disable device emulation. + */ + disableDeviceEmulation(): void; + /** + * Sends an input event to the page. + */ + sendInputEvent(event: SendInputEvent): void; + /** + * Begin subscribing for presentation events and captured frames, + * The callback will be called when there is a presentation event. + */ + beginFrameSubscription(onlyDirty: boolean, callback: BeginFrameSubscriptionCallback): void; + /** + * Begin subscribing for presentation events and captured frames, + * The callback will be called when there is a presentation event. + */ + beginFrameSubscription(callback: BeginFrameSubscriptionCallback): void; + /** + * End subscribing for frame presentation events. + */ + endFrameSubscription(): void; + /** + * @returns If the process of saving page has been initiated successfully. + */ + savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML', callback?: (eror: Error) => void): boolean; + /** + * Shows pop-up dictionary that searches the selected word on the page. + * Note: This API is available only on macOS. + */ + showDefinitionForSelection(): void; + /** + * @returns Whether offscreen rendering is enabled. + */ + isOffscreen(): boolean; + /** + * If offscreen rendering is enabled and not painting, start painting. + */ + startPainting(): void; + /** + * If offscreen rendering is enabled and painting, stop painting. + */ + stopPainting(): void; + /** + * If offscreen rendering is enabled returns whether it is currently painting. + */ + isPainting(): boolean; + /** + * If offscreen rendering is enabled sets the frame rate to the specified number. + * Only values between 1 and 60 are accepted. + */ + setFrameRate(fps: number): void; + /** + * If offscreen rendering is enabled returns the current frame rate. + */ + getFrameRate(): number; + /** + * If offscreen rendering is enabled invalidates the frame and generates a new one through the 'paint' event. + */ + invalidate(): void; + /** + * Sets the item as dragging item for current drag-drop operation. + */ + startDrag(item: DragItem): void; + /** + * Captures a snapshot of the page within rect. + */ + capturePage(callback: (image: NativeImage) => void): void; + /** + * Captures a snapshot of the page within rect. + */ + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + /** + * @returns The unique ID of this WebContents. + */ + id: number; + /** + * @returns The session object used by this webContents. + */ + session: Session; + /** + * @returns The WebContents that might own this WebContents. + */ + hostWebContents: WebContents; + /** + * @returns The WebContents of DevTools for this WebContents. + * Note: Users should never store this object because it may become null + * when the DevTools has been closed. + */ + devToolsWebContents: WebContents; + /** + * @returns Debugger API + */ + debugger: Debugger; + } + + namespace WebContents { + interface NewWindowEvent extends Event { + newGuest?: BrowserWindow; + } + } + + interface BeginFrameSubscriptionCallback { + ( + /** + * The frameBuffer is a Buffer that contains raw pixel data. + * On most machines, the pixel data is effectively stored in 32bit BGRA format, + * but the actual representation depends on the endianness of the processor + * (most modern processors are little-endian, on machines with big-endian + * processors the data is in 32bit ARGB format). + */ + frameBuffer: Buffer, + /** + * The dirtyRect is an object with x, y, width, height properties that describes which part of the page was repainted. + * If onlyDirty is set to true, frameBuffer will only contain the repainted area. onlyDirty defaults to false. + */ + dirtyRect?: Rectangle + ): void + } + + interface ContextMenuParams { + /** + * x coordinate + */ + x: number; + /** + * y coordinate + */ + y: number; + /** + * URL of the link that encloses the node the context menu was invoked on. + */ + linkURL: string; + /** + * Text associated with the link. May be an empty string if the contents of the link are an image. + */ + linkText: string; + /** + * URL of the top level page that the context menu was invoked on. + */ + pageURL: string; + /** + * URL of the subframe that the context menu was invoked on. + */ + frameURL: string; + /** + * Source URL for the element that the context menu was invoked on. + * Elements with source URLs are images, audio and video. + */ + srcURL: string; + /** + * Type of the node the context menu was invoked on. + */ + mediaType: 'none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin'; + /** + * Parameters for the media element the context menu was invoked on. + */ + mediaFlags: { + /** + * Whether the media element has crashed. + */ + inError: boolean; + /** + * Whether the media element is paused. + */ + isPaused: boolean; + /** + * Whether the media element is muted. + */ + isMuted: boolean; + /** + * Whether the media element has audio. + */ + hasAudio: boolean; + /** + * Whether the media element is looping. + */ + isLooping: boolean; + /** + * Whether the media element's controls are visible. + */ + isControlsVisible: boolean; + /** + * Whether the media element's controls are toggleable. + */ + canToggleControls: boolean; + /** + * Whether the media element can be rotated. + */ + canRotate: boolean; + } + /** + * Whether the context menu was invoked on an image which has non-empty contents. + */ + hasImageContents: boolean; + /** + * Whether the context is editable. + */ + isEditable: boolean; + /** + * These flags indicate whether the renderer believes it is able to perform the corresponding action. + */ + editFlags: { + /** + * Whether the renderer believes it can undo. + */ + canUndo: boolean; + /** + * Whether the renderer believes it can redo. + */ + canRedo: boolean; + /** + * Whether the renderer believes it can cut. + */ + canCut: boolean; + /** + * Whether the renderer believes it can copy + */ + canCopy: boolean; + /** + * Whether the renderer believes it can paste. + */ + canPaste: boolean; + /** + * Whether the renderer believes it can delete. + */ + canDelete: boolean; + /** + * Whether the renderer believes it can select all. + */ + canSelectAll: boolean; + } + /** + * Text of the selection that the context menu was invoked on. + */ + selectionText: string; + /** + * Title or alt text of the selection that the context was invoked on. + */ + titleText: string; + /** + * The misspelled word under the cursor, if any. + */ + misspelledWord: string; + /** + * The character encoding of the frame on which the menu was invoked. + */ + frameCharset: string; + /** + * If the context menu was invoked on an input field, the type of that field. + */ + inputFieldType: 'none' | 'plainText' | 'password' | 'other'; + /** + * Input source that invoked the context menu. + */ + menuSourceType: 'none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu'; + } + + interface BluetoothDevice { + deviceName: string; + deviceId: string; + } + + interface Headers { + [key: string]: string; + } + + type NewWindowDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'; + + /** + * Specifies the action to take place when ending webContents.findInPage request. + * 'clearSelection' - Clear the selection. + * 'keepSelection' - Translate the selection into a normal selection. + * 'activateSelection' - Focus and click the selection node. + */ + type StopFindInPageAtion = 'clearSelection' | 'keepSelection' | 'activateSelection'; + + type CursorType = 'default' | 'crosshair' | 'pointer' | 'text' | 'wait' | 'help' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ns-resize' | 'ew-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'm-panning' | 'e-panning' | 'n-panning' | 'ne-panning' | 'nw-panning' | 's-panning' | 'se-panning' |'sw-panning' | 'w-panning' | 'move' | 'vertical-text' | 'cell' | 'context-menu' | 'alias' | 'progress' | 'nodrop' | 'copy' | 'none' | 'not-allowed' | 'zoom-in' | 'zoom-out' | 'grab' | 'grabbing' | 'custom'; + + interface LoadURLOptions { + /** + * HTTP Referrer URL. + */ + httpReferrer?: string; + /** + * User agent originating the request. + */ + userAgent?: string; + /** + * Extra headers separated by "\n" + */ + extraHeaders?: string; + } + + interface PrintOptions { + /** + * Don't ask user for print settings. + * Defaults: false. + */ + silent?: boolean; + /** + * Also prints the background color and image of the web page. + * Defaults: false. + */ + printBackground?: boolean; + } + + interface PrintToPDFOptions { + /** + * Specify the type of margins to use. + * 0 - default + * 1 - none + * 2 - minimum + * Default: 0 + */ + marginsType?: number; + /** + * Specify page size of the generated PDF. + * Default: A4. + */ + pageSize?: 'A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid' | Size; + /** + * Whether to print CSS backgrounds. + * Default: false. + */ + printBackground?: boolean; + /** + * Whether to print selection only. + * Default: false. + */ + printSelectionOnly?: boolean; + /** + * true for landscape, false for portrait. + * Default: false. + */ + landscape?: boolean; + } + + interface Certificate { + /** + * PEM encoded data. + */ + data: string; + /** + * Issuer's Common Name. + */ + issuerName: string; + /** + * Subject's Common Name. + */ + subjectName: string; + /** + * Hex value represented string. + */ + serialNumber: string; + /** + * Start date of the certificate being valid in seconds. + */ + validStart: number; + /** + * End date of the certificate being valid in seconds. + */ + validExpiry: number; + /** + * Fingerprint of the certificate. + */ + fingerprint: string; + } + + interface LoginRequest { + method: string; + url: string; + referrer: string; + } + + interface LoginAuthInfo { + isProxy: boolean; + scheme: string; + host: string; + port: number; + realm: string; + } + + interface FindInPageOptions { + /** + * Whether to search forward or backward, defaults to true + */ + forward?: boolean; + /** + * Whether the operation is first request or a follow up, defaults to false. + */ + findNext?: boolean; + /** + * Whether search should be case-sensitive, defaults to false. + */ + matchCase?: boolean; + /** + * Whether to look only at the start of words. defaults to false. + */ + wordStart?: boolean; + /** + * When combined with wordStart, accepts a match in the middle of a word + * if the match begins with an uppercase letter followed by a lowercase + * or non-letter. Accepts several other intra-word matches, defaults to false. + */ + medialCapitalAsWordStart?: boolean; + } + + interface FoundInPageResult { + requestId: number; + /** + * Indicates if more responses are to follow. + */ + finalUpdate: boolean; + /** + * Position of the active match. + */ + activeMatchOrdinal?: number; + /** + * Number of Matches. + */ + matches?: number; + /** + * Coordinates of first match region. + */ + selectionArea?: Rectangle; + } + + interface DeviceEmulationParameters { + /** + * Specify the screen type to emulated + * Default: desktop + */ + screenPosition?: 'desktop' | 'mobile'; + /** + * Set the emulated screen size (screenPosition == mobile) + */ + screenSize?: Size; + /** + * Position the view on the screen (screenPosition == mobile) + * Default: {x: 0, y: 0} + */ + viewPosition?: Point; + /** + * Set the device scale factor (if zero defaults to original device scale factor) + * Default: 0 + */ + deviceScaleFactor: number; + /** + * Set the emulated view size (empty means no override). + */ + viewSize?: Size; + /** + * Whether emulated view should be scaled down if necessary to fit into available space + * Default: false + */ + fitToView?: boolean; + /** + * Offset of the emulated view inside available space (not in fit to view mode) + * Default: {x: 0, y: 0} + */ + offset?: Point; + /** + * Scale of emulated view inside available space (not in fit to view mode) + * Default: 1 + */ + scale: number; + } + + interface SendInputEvent { + type: 'mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove' | 'keyDown' | 'keyUp' | 'char'; + modifiers: ('shift' | 'control' | 'alt' | 'meta' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right')[]; + } + + interface SendInputKeyboardEvent extends SendInputEvent { + keyCode: string; + } + + interface SendInputMouseEvent extends SendInputEvent { + x: number; + y: number; + button?: 'left' | 'middle' | 'right'; + globalX?: number; + globalY?: number; + movementX?: number; + movementY?: number; + clickCount?: number; + } + + interface SendInputMouseWheelEvent extends SendInputEvent { + deltaX?: number; + deltaY?: number; + wheelTicksX?: number; + wheelTicksY?: number; + accelerationRatioX?: number; + accelerationRatioY?: number; + hasPreciseScrollingDeltas?: boolean; + canScroll?: boolean; + } + + /** + * Debugger API serves as an alternate transport for remote debugging protocol. + */ + interface Debugger extends NodeJS.EventEmitter { + /** + * Attaches the debugger to the webContents. + * @param protocolVersion Requested debugging protocol version. + */ + attach(protocolVersion?: string): void; + /** + * @returns Whether a debugger is attached to the webContents. + */ + isAttached(): boolean; + /** + * Detaches the debugger from the webContents. + */ + detach(): void; + /** + * Send given command to the debugging target. + * @param method Method name, should be one of the methods defined by the remote debugging protocol. + * @param commandParams JSON object with request parameters. + * @param callback Response defined by the ‘returns’ attribute of the command description in the remote debugging protocol. + */ + sendCommand(method: string, commandParams?: any, callback?: (error: Error, result: any) => void): void; + /** + * Emitted when debugging session is terminated. This happens either when + * webContents is closed or devtools is invoked for the attached webContents. + */ + on(event: 'detach', listener: (event: Event, reason: string) => void): this; + /** + * Emitted whenever debugging target issues instrumentation event. + * Event parameters defined by the ‘parameters’ attribute in the remote debugging protocol. + */ + on(event: 'message', listener: (event: Event, method: string, params: any) => void): this; + on(event: string, listener: Function): this; + } + + // https://github.com/electron/electron/blob/master/docs/api/web-frame.md + + /** + * The web-frame module allows you to customize the rendering of the current web page. + */ + interface WebFrame { + /** + * Changes the zoom factor to the specified factor, zoom factor is + * zoom percent / 100, so 300% = 3.0. + */ + setZoomFactor(factor: number): void; + /** + * @returns The current zoom factor. + */ + getZoomFactor(): number; + /** + * Changes the zoom level to the specified level, 0 is "original size", and each + * increment above or below represents zooming 20% larger or smaller to default + * limits of 300% and 50% of original size, respectively. + */ + setZoomLevel(level: number): void; + /** + * @returns The current zoom level. + */ + getZoomLevel(): number; + /** + * Sets the maximum and minimum zoom level. + */ + setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; + /** + * Sets a provider for spell checking in input fields and text areas. + */ + setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: { + /** + * @returns Whether the word passed is correctly spelled. + */ + spellCheck: (text: string) => boolean; + }): void; + /** + * Sets the scheme as secure scheme. Secure schemes do not trigger mixed content + * warnings. For example, https and data are secure schemes because they cannot be + * corrupted by active network attackers. + */ + registerURLSchemeAsSecure(scheme: string): void; + /** + * Resources will be loaded from this scheme regardless of the current page’s Content Security Policy. + */ + registerURLSchemeAsBypassingCSP(scheme: string): void; + /** + * Registers the scheme as secure, bypasses content security policy for resources, + * allows registering ServiceWorker and supports fetch API. + */ + registerURLSchemeAsPrivileged(scheme: string): void; + /** + * Inserts text to the focused element. + */ + insertText(text: string): void; + /** + * Evaluates `code` in page. + * In the browser window some HTML APIs like `requestFullScreen` can only be + * invoked by a gesture from the user. Setting `userGesture` to `true` will remove + * this limitation. + */ + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void; + /** + * @returns Object describing usage information of Blink’s internal memory caches. + */ + getResourceUsage(): ResourceUsages; + /** + * Attempts to free memory that is no longer being used (like images from a previous navigation). + */ + clearCache(): void; + } + + interface ResourceUsages { + fonts: ResourceUsage; + images: ResourceUsage; + cssStyleSheets: ResourceUsage; + xslStyleSheets: ResourceUsage; + scripts: ResourceUsage; + other: ResourceUsage; + } + + interface ResourceUsage { + count: number; + decodedSize: number; + liveSize: number; + purgeableSize: number; + purgedSize: number; + size: number; + } + + // https://github.com/electron/electron/blob/master/docs/api/web-view-tag.md + + /** + * Use the webview tag to embed 'guest' content (such as web pages) in your Electron app. + * The guest content is contained within the webview container. + * An embedded page within your app controls how the guest content is laid out and rendered. + * + * Unlike an iframe, the webview runs in a separate process than your app. + * It doesn't have the same permissions as your web page and all interactions between your app + * and embedded content will be asynchronous. This keeps your app safe from the embedded content. + */ + interface WebViewElement extends HTMLElement { + /** + * Returns the visible URL. Writing to this attribute initiates top-level navigation. + * Assigning src its own value will reload the current page. + * The src attribute can also accept data URLs, such as data:text/plain,Hello, world!. + */ + src: string; + /** + * If "on", the webview container will automatically resize within the bounds specified + * by the attributes minwidth, minheight, maxwidth, and maxheight. + * These constraints do not impact the webview unless autosize is enabled. + * When autosize is enabled, the webview container size cannot be less than + * the minimum values or greater than the maximum. + */ + autosize: string; + /** + * If "on", the guest page in webview will have node integration and can use node APIs + * like require and process to access low level system resources. + */ + nodeintegration: string; + /** + * If "on", the guest page in webview will be able to use browser plugins. + */ + plugins: string; + /** + * Specifies a script that will be loaded before other scripts run in the guest page. + * The protocol of script's URL must be either file: or asar:, + * because it will be loaded by require in guest page under the hood. + * + * When the guest page doesn't have node integration this script will still have access to all Node APIs, + * but global objects injected by Node will be deleted after this script has finished executing. + */ + preload: string; + /** + * Sets the referrer URL for the guest page. + */ + httpreferrer: string; + /** + * Sets the user agent for the guest page before the page is navigated to. + * Once the page is loaded, use the setUserAgent method to change the user agent. + */ + useragent: string; + /** + * If "on", the guest page will have web security disabled. + */ + disablewebsecurity: string; + /** + * Sets the session used by the page. If partition starts with persist:, + * the page will use a persistent session available to all pages in the app with the same partition. + * If there is no persist: prefix, the page will use an in-memory session. + * By assigning the same partition, multiple pages can share the same session. + * If the partition is unset then default session of the app will be used. + * + * This value can only be modified before the first navigation, + * since the session of an active renderer process cannot change. + * Subsequent attempts to modify the value will fail with a DOM exception. + */ + partition: string; + /** + * If "on", the guest page will be allowed to open new windows. + */ + allowpopups: string; + /** + * A list of strings which specifies the blink features to be enabled separated by ,. + */ + blinkfeatures: string; + /** + * A list of strings which specifies the blink features to be disabled separated by ,. + */ + disableblinkfeatures: string; + /** + * A value that links the webview to a specific webContents. + * When a webview first loads a new webContents is created and this attribute is set + * to its instance identifier. Setting this attribute on a new or existing webview connects + * it to the existing webContents that currently renders in a different webview. + * + * The existing webview will see the destroy event and will then create a new webContents when a new url is loaded. + */ + guestinstance: string; + /** + * Loads the url in the webview, the url must contain the protocol prefix, e.g. the http:// or file://. + */ + loadURL(url: string, options?: LoadURLOptions): void; + /** + * @returns URL of guest page. + */ + getURL(): string; + /** + * @returns The title of guest page. + */ + getTitle(): string; + /** + * @returns Whether the web page is destroyed. + */ + isDestroyed(): boolean; + /** + * @returns Whether the web page is focused. + */ + isFocused(): boolean; + /** + * @returns Whether guest page is still loading resources. + */ + isLoading(): boolean; + /** + * Returns a boolean whether the guest page is waiting for a first-response for the main resource of the page. + */ + isWaitingForResponse(): boolean; + /** + * Stops any pending navigation. + */ + stop(): void; + /** + * Reloads the guest page. + */ + reload(): void; + /** + * Reloads the guest page and ignores cache. + */ + reloadIgnoringCache(): void; + /** + * @returns Whether the guest page can go back. + */ + canGoBack(): boolean; + /** + * @returns Whether the guest page can go forward. + */ + canGoForward(): boolean; + /** + * @returns Whether the guest page can go to offset. + */ + canGoToOffset(offset: number): boolean; + /** + * Clears the navigation history. + */ + clearHistory(): void; + /** + * Makes the guest page go back. + */ + goBack(): void; + /** + * Makes the guest page go forward. + */ + goForward(): void; + /** + * Navigates to the specified absolute index. + */ + goToIndex(index: number): void; + /** + * Navigates to the specified offset from the "current entry". + */ + goToOffset(offset: number): void; + /** + * @returns Whether the renderer process has crashed. + */ + isCrashed(): boolean; + /** + * Overrides the user agent for the guest page. + */ + setUserAgent(userAgent: string): void; + /** + * @returns The user agent for guest page. + */ + getUserAgent(): string; + /** + * Injects CSS into the guest page. + */ + insertCSS(css: string): void; + /** + * Evaluates code in page. If userGesture is set, it will create the user gesture context in the page. + * HTML APIs like requestFullScreen, which require user action, can take advantage of this option for automation. + */ + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void; + /** + * Opens a DevTools window for guest page. + */ + openDevTools(): void; + /** + * Closes the DevTools window of guest page. + */ + closeDevTools(): void; + /** + * @returns Whether guest page has a DevTools window attached. + */ + isDevToolsOpened(): boolean; + /** + * @returns Whether DevTools window of guest page is focused. + */ + isDevToolsFocused(): boolean; + /** + * Starts inspecting element at position (x, y) of guest page. + */ + inspectElement(x: number, y: number): void; + /** + * Opens the DevTools for the service worker context present in the guest page. + */ + inspectServiceWorker(): void; + /** + * Set guest page muted. + */ + setAudioMuted(muted: boolean): void; + /** + * @returns Whether guest page has been muted. + */ + isAudioMuted(): boolean; + /** + * Executes editing command undo in page. + */ + undo(): void; + /** + * Executes editing command redo in page. + */ + redo(): void; + /** + * Executes editing command cut in page. + */ + cut(): void; + /** + * Executes editing command copy in page. + */ + copy(): void; + /** + * Executes editing command paste in page. + */ + paste(): void; + /** + * Executes editing command pasteAndMatchStyle in page. + */ + pasteAndMatchStyle(): void; + /** + * Executes editing command delete in page. + */ + delete(): void; + /** + * Executes editing command selectAll in page. + */ + selectAll(): void; + /** + * Executes editing command unselect in page. + */ + unselect(): void; + /** + * Executes editing command replace in page. + */ + replace(text: string): void; + /** + * Executes editing command replaceMisspelling in page. + */ + replaceMisspelling(text: string): void; + /** + * Inserts text to the focused element. + */ + insertText(text: string): void; + /** + * Starts a request to find all matches for the text in the web page. + * The result of the request can be obtained by subscribing to found-in-page event. + * @returns The request id used for the request. + */ + findInPage(text: string, options?: FindInPageOptions): number; + /** + * Stops any findInPage request for the webview with the provided action. + */ + stopFindInPage(action: StopFindInPageAtion): void; + /** + * Prints webview's web page. Same with webContents.print([options]). + */ + print(options?: PrintOptions): void; + /** + * Prints webview's web page as PDF, Same with webContents.printToPDF(options, callback) + */ + printToPDF(options: PrintToPDFOptions, callback: (error: Error, data: Buffer) => void): void; + /** + * Send an asynchronous message to renderer process via channel, you can also send arbitrary arguments. + * The renderer process can handle the message by listening to the channel event with the ipcRenderer module. + * See webContents.send for examples. + */ + send(channel: string, ...args: any[]): void; + /** + * Sends an input event to the page. + * See webContents.sendInputEvent for detailed description of event object. + */ + sendInputEvent(event: SendInputEvent): void + /** + * Changes the zoom factor to the specified factor. + * Zoom factor is zoom percent divided by 100, so 300% = 3.0. + */ + setZoomFactor(factor: number): void; + /** + * Changes the zoom level to the specified level. + * The original size is 0 and each increment above or below represents + * zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively. + */ + setZoomLevel(level: number): void; + /** + * Shows pop-up dictionary that searches the selected word on the page. + * Note: This API is available only on macOS. + */ + showDefinitionForSelection(): void; + /** + * @returns The WebContents associated with this webview. + */ + getWebContents(): WebContents; + /** + * Captures a snapshot of the webview's page. Same as webContents.capturePage([rect, ]callback). + */ + capturePage(callback: (image: NativeImage) => void): void; + /** + * Captures a snapshot of the webview's page. Same as webContents.capturePage([rect, ]callback). + */ + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + /** + * Fired when a load has committed. This includes navigation within the current document + * as well as subframe document-level loads, but does not include asynchronous resource loads. + */ + addEventListener(type: 'load-commit', listener: (event: WebViewElement.LoadCommitEvent) => void, useCapture?: boolean): void; + /** + * Fired when the navigation is done, i.e. the spinner of the tab will stop spinning, and the onload event is dispatched. + */ + addEventListener(type: 'did-finish-load', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * This event is like did-finish-load, but fired when the load failed or was cancelled, e.g. window.stop() is invoked. + */ + addEventListener(type: 'did-fail-load', listener: (event: WebViewElement.DidFailLoadEvent) => void, useCapture?: boolean): void; + /** + * Fired when a frame has done navigation. + */ + addEventListener(type: 'did-frame-finish-load', listener: (event: WebViewElement.DidFrameFinishLoadEvent) => void, useCapture?: boolean): void; + /** + * Corresponds to the points in time when the spinner of the tab starts spinning. + */ + addEventListener(type: 'did-start-loading', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Corresponds to the points in time when the spinner of the tab stops spinning. + */ + addEventListener(type: 'did-stop-loading', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Fired when details regarding a requested resource is available. + * status indicates socket connection to download the resource. + */ + addEventListener(type: 'did-get-response-details', listener: (event: WebViewElement.DidGetResponseDetails) => void, useCapture?: boolean): void; + /** + * Fired when a redirect was received while requesting a resource. + */ + addEventListener(type: 'did-get-redirect-request', listener: (event: WebViewElement.DidGetRedirectRequestEvent) => void, useCapture?: boolean): void; + /** + * Fired when document in the given frame is loaded. + */ + addEventListener(type: 'dom-ready', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Fired when page title is set during navigation. explicitSet is false when title is synthesized from file URL. + */ + addEventListener(type: 'page-title-updated', listener: (event: WebViewElement.PageTitleUpdatedEvent) => void, useCapture?: boolean): void; + /** + * Fired when page receives favicon URLs. + */ + addEventListener(type: 'page-favicon-updated', listener: (event: WebViewElement.PageFaviconUpdatedEvent) => void, useCapture?: boolean): void; + /** + * Fired when page enters fullscreen triggered by HTML API. + */ + addEventListener(type: 'enter-html-full-screen', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Fired when page leaves fullscreen triggered by HTML API. + */ + addEventListener(type: 'leave-html-full-screen', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Fired when the guest window logs a console message. + */ + addEventListener(type: 'console-message', listener: (event: WebViewElement.ConsoleMessageEvent) => void, useCapture?: boolean): void; + /** + * Fired when a result is available for webview.findInPage request. + */ + addEventListener(type: 'found-in-page', listener: (event: WebViewElement.FoundInPageEvent) => void, useCapture?: boolean): void; + /** + * Fired when the guest page attempts to open a new browser window. + */ + addEventListener(type: 'new-window', listener: (event: WebViewElement.NewWindowEvent) => void, useCapture?: boolean): void; + /** + * Emitted when a user or the page wants to start navigation. + * It can happen when the window.location object is changed or a user clicks a link in the page. + * + * This event will not emit when the navigation is started programmatically with APIs + * like .loadURL and .back. + * + * It is also not emitted during in-page navigation, such as clicking anchor links + * or updating the window.location.hash. Use did-navigate-in-page event for this purpose. + * + * Calling event.preventDefault() does NOT have any effect. + */ + addEventListener(type: 'will-navigate', listener: (event: WebViewElement.WillNavigateEvent) => void, useCapture?: boolean): void; + /** + * Emitted when a navigation is done. + * + * This event is not emitted for in-page navigations, such as clicking anchor links + * or updating the window.location.hash. Use did-navigate-in-page event for this purpose. + */ + addEventListener(type: 'did-navigate', listener: (event: WebViewElement.DidNavigateEvent) => void, useCapture?: boolean): void; + /** + * Emitted when an in-page navigation happened. + * + * When in-page navigation happens, the page URL changes but does not cause + * navigation outside of the page. Examples of this occurring are when anchor links + * are clicked or when the DOM hashchange event is triggered. + */ + addEventListener(type: 'did-navigate-in-page', listener: (event: WebViewElement.DidNavigateInPageEvent) => void, useCapture?: boolean): void; + /** + * Fired when the guest page attempts to close itself. + */ + addEventListener(type: 'close', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Fired when the guest page has sent an asynchronous message to embedder page. + */ + addEventListener(type: 'ipc-message', listener: (event: WebViewElement.IpcMessageEvent) => void, useCapture?: boolean): void; + /** + * Fired when the renderer process is crashed. + */ + addEventListener(type: 'crashed', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Fired when the gpu process is crashed. + */ + addEventListener(type: 'gpu-crashed', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Fired when a plugin process is crashed. + */ + addEventListener(type: 'plugin-crashed', listener: (event: WebViewElement.PluginCrashedEvent) => void, useCapture?: boolean): void; + /** + * Fired when the WebContents is destroyed. + */ + addEventListener(type: 'destroyed', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Emitted when media starts playing. + */ + addEventListener(type: 'media-started-playing', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Emitted when media is paused or done playing. + */ + addEventListener(type: 'media-paused', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Emitted when a page's theme color changes. This is usually due to encountering a meta tag: + * + */ + addEventListener(type: 'did-change-theme-color', listener: (event: WebViewElement.DidChangeThemeColorEvent) => void, useCapture?: boolean): void; + /** + * Emitted when mouse moves over a link or the keyboard moves the focus to a link. + */ + addEventListener(type: 'update-target-url', listener: (event: WebViewElement.UpdateTargetUrlEvent) => void, useCapture?: boolean): void; + /** + * Emitted when DevTools is opened. + */ + addEventListener(type: 'devtools-opened', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Emitted when DevTools is closed. + */ + addEventListener(type: 'devtools-closed', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + /** + * Emitted when DevTools is focused / opened. + */ + addEventListener(type: 'devtools-focused', listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + addEventListener(type: string, listener: (event: WebViewElement.Event) => void, useCapture?: boolean): void; + } + + namespace WebViewElement { + type Event = ElectronPrivate.GlobalEvent; + + interface LoadCommitEvent extends Event { + url: string; + isMainFrame: boolean; + } + + interface DidFailLoadEvent extends Event { + errorCode: number; + errorDescription: string; + validatedURL: string; + isMainFrame: boolean; + } + + interface DidFrameFinishLoadEvent extends Event { + isMainFrame: boolean; + } + + interface DidGetResponseDetails extends Event { + status: boolean; + newURL: string; + originalURL: string; + httpResponseCode: number; + requestMethod: string; + referrer: string; + headers: Headers; + resourceType: string; + } + + interface DidGetRedirectRequestEvent extends Event { + oldURL: string; + newURL: string; + isMainFrame: boolean; + httpResponseCode: number; + requestMethod: string; + referrer: string; + headers: Headers; + } + + interface PageTitleUpdatedEvent extends Event { + title: string; + explicitSet: string; + } + + interface PageFaviconUpdatedEvent extends Event { + favicons: string[]; + } + + interface ConsoleMessageEvent extends Event { + level: number; + message: string; + line: number; + sourceId: string; + } + + interface FoundInPageEvent extends Event { + result: FoundInPageResult; + } + + interface NewWindowEvent extends Event { + url: string; + frameName: string; + disposition: NewWindowDisposition; + options: BrowserWindowOptions; + } + + interface WillNavigateEvent extends Event { + url: string; + } + + interface DidNavigateEvent extends Event { + url: string; + } + + interface DidNavigateInPageEvent extends Event { + url: string; + isMainFrame: boolean; + } + + interface IpcMessageEvent extends Event { + channel: string; + args: any[]; + } + + interface PluginCrashedEvent extends Event { + name: string; + version: string; + } + + interface DidChangeThemeColorEvent extends Event { + themeColor: string; + } + + interface UpdateTargetUrlEvent extends Event { + url: string; + } + } + + /** + * The BrowserWindowProxy object is returned from window.open and provides limited functionality with the child window. + */ + interface BrowserWindowProxy { + /** + * Removes focus from the child window. + */ + blur(): void; + /** + * Forcefully closes the child window without calling its unload event. + */ + close(): void; + /** + * Set to true after the child window gets closed. + */ + closed: boolean; + /** + * Evaluates the code in the child window. + */ + eval(code: string): void; + /** + * Focuses the child window (brings the window to front). + */ + focus(): void; + /** + * Sends a message to the child window with the specified origin or * for no origin preference. + * In addition to these methods, the child window implements window.opener object with no + * properties and a single method. + */ + postMessage(message: string, targetOrigin: string): void; + /** + * Invokes the print dialog on the child window. + */ + print(): void; + } + + // https://github.com/electron/electron/blob/master/docs/api/synopsis.md + + interface CommonElectron { + clipboard: Electron.Clipboard; + crashReporter: Electron.CrashReporter; + nativeImage: typeof Electron.NativeImage; + shell: Electron.Shell; + + app: Electron.App; + autoUpdater: Electron.AutoUpdater; + BrowserWindow: typeof Electron.BrowserWindow; + contentTracing: Electron.ContentTracing; + dialog: Electron.Dialog; + ipcMain: Electron.IpcMain; + globalShortcut: Electron.GlobalShortcut; + Menu: typeof Electron.Menu; + MenuItem: typeof Electron.MenuItem; + powerMonitor: Electron.PowerMonitor; + powerSaveBlocker: Electron.PowerSaveBlocker; + protocol: Electron.Protocol; + screen: Electron.Screen; + session: typeof Electron.Session; + systemPreferences: Electron.SystemPreferences; + Tray: typeof Electron.Tray; + webContents: Electron.WebContentsStatic; + } + + interface ElectronMainAndRenderer extends CommonElectron { + desktopCapturer: Electron.DesktopCapturer; + ipcRenderer: Electron.IpcRenderer; + remote: Electron.Remote; + webFrame: Electron.WebFrame; + } +} + +declare namespace ElectronPrivate { + type GlobalEvent = Event; +} + +interface Document { + createElement(tagName: 'webview'): Electron.WebViewElement; +} + +// https://github.com/electron/electron/blob/master/docs/api/window-open.md + +interface Window { + /** + * Creates a new window. + */ + open(url: string, frameName?: string, features?: string): Electron.BrowserWindowProxy; +} + +// https://github.com/electron/electron/blob/master/docs/api/file-object.md + +interface File { + /** + * Exposes the real path of the filesystem. + */ + path: string; +} + +// https://github.com/electron/electron/blob/master/docs/api/process.md + +declare namespace NodeJS { + + interface ProcessVersions { + /** + * Electron's version string. + */ + electron: string; + /** + * Chrome's version string. + */ + chrome: string; + } + + interface Process { + /** + * Setting this to true can disable the support for asar archives in Node's built-in modules. + */ + noAsar?: boolean; + /** + * Process's type + */ + type: 'browser' | 'renderer'; + /** + * Path to JavaScript source code. + */ + resourcesPath: string; + /** + * For Mac App Store build, this value is true, for other builds it is undefined. + */ + mas?: boolean; + /** + * If the app is running as a Windows Store app (appx), this value is true, for other builds it is undefined. + */ + windowsStore?: boolean; + /** + * When app is started by being passed as parameter to the default app, + * this value is true in the main process, otherwise it is undefined. + */ + defaultApp?: boolean; + /** + * Emitted when Electron has loaded its internal initialization script + * and is beginning to load the web page or the main script. + */ + on(event: 'loaded', listener: Function): this; + on(event: string, listener: Function): this; + /** + * Causes the main thread of the current process crash; + */ + crash(): void; + /** + * Causes the main thread of the current process hang. + */ + hang(): void; + /** + * Sets the file descriptor soft limit to maxDescriptors or the OS hard limit, + * whichever is lower for the current process. + * + * Note: This API is only available on macOS and Linux. + */ + setFdLimit(maxDescriptors: number): void; + /** + * @returns Object giving memory usage statistics about the current process. + * Note: All statistics are reported in Kilobytes. + */ + getProcessMemoryInfo(): ProcessMemoryInfo; + /** + * @returns Object giving memory usage statistics about the entire system. + * Note: All statistics are reported in Kilobytes. + */ + getSystemMemoryInfo(): SystemMemoryInfo; + } + + interface ProcessMemoryInfo { + /** + * The amount of memory currently pinned to actual physical RAM. + */ + workingSetSize: number; + /** + * The maximum amount of memory that has ever been pinned to actual physical RAM. + */ + peakWorkingSetSize: number; + /** + * The amount of memory not shared by other processes, such as JS heap or HTML content. + */ + privateBytes: number; + /** + * The amount of memory shared between processes, typically memory consumed by the Electron code itself. + */ + sharedBytes: number; + } + + interface SystemMemoryInfo { + /** + * The total amount of physical memory available to the system. + */ + total: number; + /** + * The total amount of memory not being used by applications or disk cache. + */ + free: number; + /** + * The total amount of swap memory available to the system. + */ + swapTotal: number; + /** + * The free amount of swap memory available to the system. + */ + swapFree: number; + } +} + +declare module 'electron' { + var electron: Electron.ElectronMainAndRenderer; + export = electron; +} + +interface NodeRequireFunction { + (moduleName: 'electron'): Electron.ElectronMainAndRenderer; +} diff --git a/electron/index.d.ts b/electron/index.d.ts index d39710189b..3ee92c80b9 100644 --- a/electron/index.d.ts +++ b/electron/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Electron v1.4.2 +// Type definitions for Electron v1.4.8 // Project: http://electron.atom.io/ -// Definitions by: jedmao , rhysd , Milan Burda +// Definitions by: jedmao , rhysd , Milan Burda , aliib // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -42,6 +42,8 @@ declare namespace Electron { // https://github.com/electron/electron/blob/master/docs/api/app.md + type VibrancyType = 'appearance-based' | 'light' | 'dark' | 'titlebar' | 'selection' | 'menu' | 'popover' | 'sidebar' | 'medium-light' | 'ultra-dark'; + /** * The app module is responsible for controlling the application's lifecycle. */ @@ -1023,6 +1025,14 @@ declare namespace Electron { * Note: This API is available only on macOS. */ setAspectRatio(aspectRatio: number, extraSize?: Size): void; + /** + * Uses Quick Look to preview a file at a given path. + * + * @param path The absolute path to the file to preview with QuickLook. + * @param displayName The name of the file to display on the Quick Look modal view. + * Note: This API is available only on macOS. + */ + previewFile(path: string, displayName?: string): void; /** * Resizes and moves the window to width, height, x, y. */ @@ -1383,6 +1393,13 @@ declare namespace Electron { * @returns All child windows. */ getChildWindows(): BrowserWindow[]; + /** + * Adds a vibrancy effect to the browser window. Passing null or + * an empty string will remove the vibrancy effect on the window. + * + * Note: This API is available only on macOS. + */ + setVibrancy(type: VibrancyType): void; } type WindowLevel = 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver' | 'dock'; @@ -1772,6 +1789,10 @@ declare namespace Electron { * Use WS_THICKFRAME style for frameless windows on Windows */ thickFrame?: boolean; + /** + * Add a type of vibrancy effect to the window, only on macOS + */ + vibrancy?: VibrancyType; /** * Settings of web page’s features. */ @@ -1861,6 +1882,20 @@ declare namespace Electron { * Note: This API is available on macOS and Windows. */ writeBookmark(title: string, url: string, type?: ClipboardType): void; + /** + * The text on the find pasteboard. This method uses synchronous IPC when called from the renderer process. + * The cached value is reread from the find pasteboard whenever the application is activated. + * + * Note: This API is available on macOS. + */ + readFindText(): string; + /** + * Writes the text into the find pasteboard as plain text. + * This method uses synchronous IPC when called from the renderer process. + * + * Note: This API is available on macOS. + */ + writeFindText(text: string): void; } type ClipboardType = '' | 'selection'; @@ -2455,7 +2490,7 @@ declare namespace Electron { } type MenuItemType = 'normal' | 'separator' | 'submenu' | 'checkbox' | 'radio'; - type MenuItemRole = 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteandmatchstyle' | 'selectall' | 'delete' | 'minimize' | 'close' | 'quit' | 'togglefullscreen' | 'resetzoom' | 'zoomin' | 'zoomout'; + type MenuItemRole = 'undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteandmatchstyle' | 'selectall' | 'delete' | 'minimize' | 'close' | 'quit' | 'togglefullscreen' | 'resetzoom' | 'zoomin' | 'zoomout' | 'reload' | 'toggledevtools'; type MenuItemRoleMac = 'about' | 'hide' | 'hideothers' | 'unhide' | 'startspeaking' | 'stopspeaking' | 'front' | 'zoom' | 'window' | 'help' | 'services'; interface MenuItemOptions { @@ -2687,6 +2722,249 @@ declare namespace Electron { isTemplateImage(): boolean; } + // https://github.com/electron/electron/blob/master/docs/api/net.md + + /** + * The net module is a client-side API for issuing HTTP(S) requests. + * It is similar to the HTTP and HTTPS modules of Node.js but uses Chromium’s native + * networking library instead of the Node.js implementation, offering better support + * for web proxies. + * The following is a non-exhaustive list of why you may consider using the net module + * instead of the native Node.js modules: + * - Automatic management of system proxy configuration, support of the wpad protocol + * and proxy pac configuration files. + * - Automatic tunneling of HTTPS requests. + * - Support for authenticating proxies using basic, digest, NTLM, Kerberos or negotiate + * authentication schemes. + * - Support for traffic monitoring proxies: Fiddler-like proxies used for access control + * and monitoring. + * + * The net module API has been specifically designed to mimic, as closely as possible, + * the familiar Node.js API. The API components including classes, methods, + * properties and event names are similar to those commonly used in Node.js. + * + * The net API can be used only after the application emits the ready event. + * Trying to use the module before the ready event will throw an error. + */ + interface Net extends NodeJS.EventEmitter { + /** + * @param options The ClientRequest constructor options. + * @param callback A one time listener for the response event. + * + * @returns a ClientRequest instance using the provided options which are directly + * forwarded to the ClientRequest constructor. + */ + request(options: string | RequestOptions, callback?: (response: IncomingMessage) => void): ClientRequest; + } + + /** + * The RequestOptions interface allows to define various options for an HTTP request. + */ + interface RequestOptions { + /** + * The HTTP request method. Defaults to the GET method. + */ + method?: string; + /** + * The request URL. Must be provided in the absolute form with the protocol + * scheme specified as http or https. + */ + url?: string; + /** + * The Session instance with which the request is associated. + */ + session?: Session; + /** + * The name of the partition with which the request is associated. + * Defaults to the empty string. The session option prevails on partition. + * Thus if a session is explicitly specified, partition is ignored. + */ + partition?: string; + /** + * The protocol scheme in the form ‘scheme:’. Currently supported values are ‘http:’ or ‘https:’. + * Defaults to ‘http:’. + */ + Protocol?: 'http:' | 'https:'; + /** + * The server host provided as a concatenation of the hostname and the port number ‘hostname:port’. + */ + host?: string; + /** + * The server host name. + */ + hostname?: string; + /** + * The server’s listening port number. + */ + port?: number; + /** + * The path part of the request URL. + */ + path?: string; + /** + * A map specifying extra HTTP header name/value. + */ + headers?: { [key: string]: any }; + } + + /** + * The ClientRequest class represents an HTTP request. + */ + class ClientRequest extends NodeJS.EventEmitter { + /** + * Emitted when an HTTP response is received for the request. + */ + on(event: 'response', listener: (response: IncomingMessage) => void): this; + /** + * Emitted when an authenticating proxy is asking for user credentials. + * The callback function is expected to be called back with user credentials. + * Providing empty credentials will cancel the request and report an authentication + * error on the response object. + */ + on(event: 'login', listener: (authInfo: LoginAuthInfo, callback: (username?: string, password?: string) => void) => void): this; + /** + * Emitted just after the last chunk of the request’s data has been written into + * the request object. + */ + on(event: 'finish', listener: () => void): this; + /** + * Emitted when the request is aborted. The abort event will not be fired if the + * request is already closed. + */ + on(event: 'abort', listener: () => void): this; + /** + * Emitted when the net module fails to issue a network request. + * Typically when the request object emits an error event, a close event will + * subsequently follow and no response object will be provided. + */ + on(event: 'error', listener: (error: Error) => void): this; + /** + * Emitted as the last event in the HTTP request-response transaction. + * The close event indicates that no more events will be emitted on either the + * request or response objects. + */ + on(event: 'close', listener: () => void): this; + on(event: string, listener: Function): this; + /** + * A Boolean specifying whether the request will use HTTP chunked transfer encoding or not. + * Defaults to false. The property is readable and writable, however it can be set only before + * the first write operation as the HTTP headers are not yet put on the wire. + * Trying to set the chunkedEncoding property after the first write will throw an error. + * + * Using chunked encoding is strongly recommended if you need to send a large request + * body as data will be streamed in small chunks instead of being internally buffered + * inside Electron process memory. + */ + chunkedEncoding: boolean; + /** + * @param options If options is a String, it is interpreted as the request URL. + * If it is an object, it is expected to be a RequestOptions. + * @param callback A one time listener for the response event. + */ + constructor(options: string | RequestOptions, callback?: (response: IncomingMessage) => void); + /** + * Adds an extra HTTP header. The header name will issued as it is without lowercasing. + * It can be called only before first write. Calling this method after the first write + * will throw an error. + * @param name An extra HTTP header name. + * @param value An extra HTTP header value. + */ + setHeader(name: string, value: string): void; + /** + * @param name Specify an extra header name. + * @returns The value of a previously set extra header name. + */ + getHeader(name: string): string; + /** + * Removes a previously set extra header name. This method can be called only before first write. + * Trying to call it after the first write will throw an error. + * @param name Specify an extra header name. + */ + removeHeader(name: string): void; + /** + * Adds a chunk of data to the request body. The first write operation may cause the + * request headers to be issued on the wire. + * After the first write operation, it is not allowed to add or remove a custom header. + * @param chunk A chunk of the request body’s data. If it is a string, it is converted + * into a Buffer using the specified encoding. + * @param encoding Used to convert string chunks into Buffer objects. Defaults to ‘utf-8’. + * @param callback Called after the write operation ends. + */ + write(chunk: string | Buffer, encoding?: string, callback?: Function): boolean; + /** + * Sends the last chunk of the request data. Subsequent write or end operations will not be allowed. + * The finish event is emitted just after the end operation. + * @param chunk A chunk of the request body’s data. If it is a string, it is converted into + * a Buffer using the specified encoding. + * @param encoding Used to convert string chunks into Buffer objects. Defaults to ‘utf-8’. + * @param callback Called after the write operation ends. + * + */ + end(chunk?: string | Buffer, encoding?: string, callback?: Function): boolean; + /** + * Cancels an ongoing HTTP transaction. If the request has already emitted the close event, + * the abort operation will have no effect. + * Otherwise an ongoing event will emit abort and close events. + * Additionally, if there is an ongoing response object,it will emit the aborted event. + */ + abort(): void + } + + /** + * An IncomingMessage represents an HTTP response. + */ + interface IncomingMessage extends NodeJS.ReadableStream { + /** + * The data event is the usual method of transferring response data into applicative code. + */ + on(event: 'data', listener: (chunk: Buffer) => void): this; + /** + * Indicates that response body has ended. + */ + on(event: 'end', listener: () => void): this; + /** + * Emitted when a request has been canceled during an ongoing HTTP transaction. + */ + on(event: 'aborted', listener: () => void): this; + /** + * Emitted when an error was encountered while streaming response data events. + * For instance, if the server closes the underlying while the response is still + * streaming, an error event will be emitted on the response object and a close + * event will subsequently follow on the request object. + */ + on(event: 'error', listener: (error: Error) => void): this; + on(event: string, listener: Function): this; + /** + * An Integer indicating the HTTP response status code. + */ + statusCode: number; + /** + * A String representing the HTTP status message. + */ + statusMessage: string; + /** + * An object representing the response HTTP headers. The headers object is formatted as follows: + * - All header names are lowercased. + * - Each header name produces an array-valued property on the headers object. + * - Each header value is pushed into the array associated with its header name. + */ + headers: { + [key: string]: string[] + }; + /** + * A string indicating the HTTP protocol version number. Typical values are ‘1.0’ or ‘1.1’. + */ + httpVersion: string; + /** + * An integer-valued read-only property that returns the HTTP major version number. + */ + httpVersionMajor: number; + /** + * An integer-valued read-only property that returns the HTTP minor version number. + */ + httpVersionMinor: number; + } + // https://github.com/electron/electron/blob/master/docs/api/power-monitor.md /** @@ -2850,7 +3128,7 @@ declare namespace Electron { interface StringProtocolCallback extends ProtocolCallback { (str: string): void; (obj: { - data: Buffer, + data: string, mimeType: string, charset?: string }): void; @@ -3041,7 +3319,7 @@ declare namespace Electron { * * Calling setCertificateVerifyProc(null) will revert back to default certificate verify proc. */ - setCertificateVerifyProc(proc: (hostname: string, cert: Certificate, callback: (accepted: boolean) => void) => void): void; + setCertificateVerifyProc(proc: ((hostname: string, cert: Certificate, callback: (accepted: boolean) => void) => void) | null): void; /** * Sets the handler which can be used to respond to permission requests for the session. */ @@ -4152,8 +4430,10 @@ declare namespace Electron { /** * Evaluates code in page. * @param code Code to evaluate. + * + * @returns Promise */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void; + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; /** * Mute the audio on the current web page. */ @@ -4184,7 +4464,11 @@ declare namespace Electron { /** * Sets the maximum and minimum zoom level. */ - setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; + setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; + /** + * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. + */ + setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; /** * Executes the editing command undo in web page. */ @@ -4606,6 +4890,55 @@ declare namespace Electron { * Extra headers separated by "\n" */ extraHeaders?: string; + /** + * POST data + */ + postData?: (UploadRawData | UploadFileSystem | UploadBlob)[]; + } + + interface UploadRawData { + /** + * rawData + */ + type: 'rawData'; + /** + * Data to be uploaded. + */ + bytes: Buffer; + } + + interface UploadFileSystem { + /** + * fileSystem + */ + type: 'fileSystem'; + /** + * FileSystem url to read data for upload. + */ + fileSystemURL: string; + /** + * Defaults to 0. + */ + offset: number; + /** + * Number of bytes to read from offset. Defaults to 0. + */ + length: number; + /** + * Last Modification time in number of seconds sine the UNIX epoch. + */ + modificationTime: number; + } + + interface UploadBlob { + /** + * blob + */ + type: 'blob'; + /** + * UUID of blob data to upload. + */ + blobUUID: string; } interface PrintOptions { @@ -4657,10 +4990,22 @@ declare namespace Electron { * PEM encoded data. */ data: string; + /** + * Issuer principal + */ + issuer: CertificatePrincipal; /** * Issuer's Common Name. */ issuerName: string; + /** + * Issuer certificate (if not self-signed) + */ + issuerCert: Certificate; + /** + * Subject principal + */ + subject: CertificatePrincipal; /** * Subject's Common Name. */ @@ -4683,6 +5028,33 @@ declare namespace Electron { fingerprint: string; } + interface CertificatePrincipal { + /** + * Common Name + */ + commonName: string; + /** + * Organization names + */ + organizations: string[]; + /** + * Organization Unit names + */ + organizationUnits: string[]; + /** + * Locality + */ + locality: string; + /** + * State or province + */ + state: string; + /** + * Country or region + */ + country: string; + } + interface LoginRequest { method: string; url: string; @@ -4879,7 +5251,11 @@ declare namespace Electron { /** * Sets the maximum and minimum zoom level. */ - setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; + setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; + /** + * Sets the maximum and minimum layout-based (i.e. non-visual) zoom level. + */ + setLayoutZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; /** * Sets a provider for spell checking in input fields and text areas. */ @@ -4903,7 +5279,7 @@ declare namespace Electron { * Registers the scheme as secure, bypasses content security policy for resources, * allows registering ServiceWorker and supports fetch API. */ - registerURLSchemeAsPrivileged(scheme: string): void; + registerURLSchemeAsPrivileged(scheme: string, options?: RegisterURLSchemeOptions): void; /** * Inserts text to the focused element. */ @@ -4913,8 +5289,10 @@ declare namespace Electron { * In the browser window some HTML APIs like `requestFullScreen` can only be * invoked by a gesture from the user. Setting `userGesture` to `true` will remove * this limitation. + * + * @returns Promise */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void; + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; /** * @returns Object describing usage information of Blink’s internal memory caches. */ @@ -4943,6 +5321,14 @@ declare namespace Electron { size: number; } + interface RegisterURLSchemeOptions { + secure?: boolean; + bypassCSP?: boolean; + allowServiceWorkers?: boolean; + supportFetchAPI?: boolean; + corsEnabled?: boolean; + } + // https://github.com/electron/electron/blob/master/docs/api/web-view-tag.md /** @@ -5016,6 +5402,10 @@ declare namespace Electron { * If "on", the guest page will be allowed to open new windows. */ allowpopups: string; + /** + * A list of strings which specifies the web preferences to be set on the webview, separated by ,. + */ + webpreferences: string; /** * A list of strings which specifies the blink features to be enabled separated by ,. */ @@ -5124,8 +5514,10 @@ declare namespace Electron { /** * Evaluates code in page. If userGesture is set, it will create the user gesture context in the page. * HTML APIs like requestFullScreen, which require user action, can take advantage of this option for automation. + * + * @returns Promise */ - executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void; + executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): Promise; /** * Opens a DevTools window for guest page. */ @@ -5136,7 +5528,7 @@ declare namespace Electron { closeDevTools(): void; /** * @returns Whether guest page has a DevTools window attached. - */ + isDevToolsOpened(): boolean; /** * @returns Whether DevTools window of guest page is focused. @@ -5565,6 +5957,7 @@ declare namespace Electron { globalShortcut: Electron.GlobalShortcut; Menu: typeof Electron.Menu; MenuItem: typeof Electron.MenuItem; + net: Electron.Net; powerMonitor: Electron.PowerMonitor; powerSaveBlocker: Electron.PowerSaveBlocker; protocol: Electron.Protocol; diff --git a/electron/tsconfig.json b/electron/tsconfig.json index b7b5ba576e..89c5379095 100644 --- a/electron/tsconfig.json +++ b/electron/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/element-resize-event/tsconfig.json b/element-resize-event/tsconfig.json index 4ca1490e0e..2bc70f4e30 100644 --- a/element-resize-event/tsconfig.json +++ b/element-resize-event/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/elm/tsconfig.json b/elm/tsconfig.json index c268f493a4..0a92355f9b 100644 --- a/elm/tsconfig.json +++ b/elm/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/email-addresses/tsconfig.json b/email-addresses/tsconfig.json index 582fac495f..15c6adf404 100644 --- a/email-addresses/tsconfig.json +++ b/email-addresses/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/email-templates/tsconfig.json b/email-templates/tsconfig.json index df0d79adb5..3f68460991 100644 --- a/email-templates/tsconfig.json +++ b/email-templates/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/email-validator/tsconfig.json b/email-validator/tsconfig.json index bc59d7ab3a..bab531c452 100644 --- a/email-validator/tsconfig.json +++ b/email-validator/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ember/ember-1.11.3.d.ts b/ember/ember-1.11.3.d.ts index d19327ddb2..eef72fd87c 100644 --- a/ember/ember-1.11.3.d.ts +++ b/ember/ember-1.11.3.d.ts @@ -6,6 +6,8 @@ /// /// +/* this is an older file, do not lint */ +/* tslint:disable */ declare var Handlebars: HandlebarsStatic; declare namespace EmberStates { diff --git a/ember/ember-tests.ts b/ember/ember-tests.ts index 30156975b1..dda0e157c4 100644 --- a/ember/ember-tests.ts +++ b/ember/ember-tests.ts @@ -146,7 +146,7 @@ people2.everyProperty('isHappy', true); people2.someProperty('isHappy', true); // Examples taken from http://emberjs.com/api/classes/Em.RSVP.Promise.html -var promise = new Em.RSVP.Promise(function(resolve: Function, reject: Function) { +var promise = new Em.RSVP.Promise(function(resolve: Function, reject: Function) { // on success resolve('ok!'); @@ -159,3 +159,16 @@ promise.then(function(value: any) { }, function(reason: any) { // on rejection }); + +var mix1 = Ember.Mixin.create({ + foo: 1 +}); + +var mix2 = Ember.Mixin.create({ + bar: 2 +}); + +var component1 = Ember.Component.extend( mix1, mix2, { + lyft: Ember.inject.service(), + cars: Ember.computed.readOnly('lyft.cars') +}); diff --git a/ember/index.d.ts b/ember/index.d.ts index dad59a2fb1..df63a1312a 100644 --- a/ember/index.d.ts +++ b/ember/index.d.ts @@ -32,7 +32,7 @@ declare namespace EmberStates { Transition object can be externally `abort`ed, while the promise cannot. */ - promise: Ember.RSVP.Promise; + promise: Ember.RSVP.Promise; /** Custom state can be stored on a Transition's `data` object. @@ -56,7 +56,7 @@ declare namespace EmberStates { @arg {String} label optional string for labeling the promise. Useful for tooling. @return {Promise} */ - then(onFulfilled: Function, onRejected?: Function, label?: string): Ember.RSVP.Promise; + then(onFulfilled: Function, onRejected?: Function, label?: string): Ember.RSVP.Promise; /** Forwards to the internal `promise` property which you can @@ -69,7 +69,7 @@ declare namespace EmberStates { Useful for tooling. @return {Promise} */ - catch(onRejection: Function, label?: string): Ember.RSVP.Promise; + catch(onRejection: Function, label?: string): Ember.RSVP.Promise; /** Forwards to the internal `promise` property which you can @@ -82,7 +82,7 @@ declare namespace EmberStates { Useful for tooling. @return {Promise} */ - finally(callback: Function, label?: string): Ember.RSVP.Promise; + finally(callback: Function, label?: string): Ember.RSVP.Promise; /** Aborts the Transition. Note you can also implicitly abort a transition @@ -127,7 +127,7 @@ declare namespace EmberStates { @arg {Boolean} [ignoreFailure=false] a boolean specifying whether unhandled events throw an error @arg {String} name the name of the event to fire */ - trigger(ignoreFailure:boolean, eventName: string): void; + trigger(ignoreFailure: boolean, eventName: string): void; /** Fires an event on the current list of resolved/resolving handlers within this transition. Useful for firing events @@ -149,11 +149,14 @@ declare namespace EmberStates { @return {Promise} a promise that fulfills with the same value that the final redirecting transition fulfills with */ - followRedirects(): Ember.RSVP.Promise; + followRedirects(): Ember.RSVP.Promise; } } +// Get an alias to the global Array type to use in inner scope below. +type GlobalArray = T[]; + declare namespace EmberTesting { namespace Test { @@ -203,18 +206,9 @@ interface Array { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number): any; - enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: number): any; - enumerableContentDidChange(start: number, removing: number, adding: Ember.Enumerable): any; - enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: Ember.Enumerable): any; - enumerableContentDidChange(removing: number, adding: number): any; - enumerableContentDidChange(removing: Ember.Enumerable, adding: number): any; - enumerableContentDidChange(removing: number, adding: Ember.Enumerable): any; - enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable): any; - enumerableContentWillChange(removing: number, adding: number): any[]; - enumerableContentWillChange(removing: Ember.Enumerable, adding: number): any[]; - enumerableContentWillChange(removing: number, adding: Ember.Enumerable): any[]; - enumerableContentWillChange(removing: Ember.Enumerable, adding: Ember.Enumerable): any[]; + enumerableContentDidChange(start: number, removing: Ember.Enumerable | number, adding: Ember.Enumerable | number): any; + enumerableContentDidChange(removing: Ember.Enumerable | number, adding: Ember.Enumerable | number): any; + enumerableContentWillChange(removing: Ember.Enumerable | number, adding: Ember.Enumerable | number): Ember.Enumerable; every(callback: Function, target?: any): boolean; everyBy(key: string, value?: string): boolean; everyProperty(key: string, value?: any): boolean; @@ -301,8 +295,7 @@ interface Array { notifyPropertyChange(keyName: string): any[]; propertyDidChange(keyName: string): any[]; propertyWillChange(keyName: string): any[]; - removeObserver(key: string, target: any, method: string): Ember.Observable; - removeObserver(key: string, target: any, method: Function): Ember.Observable; + removeObserver(key: string, target: any, method: Function | string): Ember.Observable; set(keyName: string, value: any): any[]; setProperties(hash: {}): any[]; toggleProperty(keyName: string): any; @@ -326,15 +319,13 @@ interface ApplicationCreateArguments { LOG_TRANSITIONS_INTERNAL?: boolean; } +type ApplicationInitializerFunction = (container: Ember.Container, application: Ember.Application) => void; + interface ApplicationInitializerArguments { name?: string; initialize?: ApplicationInitializerFunction; } -interface ApplicationInitializerFunction { - (container: Ember.Container, application: Ember.Application): void; -} - interface CoreObjectArguments { /** An overridable method called when objects are instantiated. By default, does nothing unless it is @@ -356,17 +347,14 @@ interface EnumerableConfigurationOptions { didChange?: boolean ; } -interface ItemIndexEnumerableCallbackTarget { - (callback: ItemIndexEnumerableCallback, target?: any): any[]; -} +type ItemIndexEnumerableCallbackTarget = (callback: ItemIndexEnumerableCallback, target?: any) => any[]; -interface ItemIndexEnumerableCallback { - (item: any, index: number, enumerable: Ember.Enumerable): void; -} -interface ReduceCallback { - (previousValue: any, item: any, index: number, enumerable: Ember.Enumerable): void; -} +type ItemIndexEnumerableCallback = (item: any, index: number, enumerable: Ember.Enumerable) => void; + + +type ReduceCallback = (previousValue: any, item: any, index: number, enumerable: Ember.Enumerable) => void; + interface TransitionsHash { contexts: any[]; @@ -393,12 +381,7 @@ interface RenderOptions { view?: string; } -interface ModifyObserver { - (obj: any, path: string, target: any, method?: Function): void; - (obj: any, path: string, target: any, method?: string): void; - (obj: any, path: string, func: Function, method?: Function): void; - (obj: any, path: string, func: Function, method?: string): void; -} +type ModifyObserver = (obj: any, path: string | null, target: Function | any, method?: Function | string) => void; declare namespace Ember { /** @@ -543,18 +526,9 @@ declare namespace Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; - enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; - enumerableContentDidChange(removing: number, adding: number): any; - enumerableContentDidChange(removing: Enumerable, adding: number): any; - enumerableContentDidChange(removing: number, adding: Enumerable): any; - enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; - enumerableContentWillChange(removing: number, adding: number): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; - enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + enumerableContentDidChange(start: number, removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentDidChange(removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentWillChange(removing: Enumerable | number, adding: Enumerable | number): Enumerable; every(callback: Function, target?: any): boolean; everyBy(key: string, value?: string): boolean; everyProperty(key: string, value?: string): boolean; @@ -621,18 +595,9 @@ declare namespace Ember { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; - enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; - enumerableContentDidChange(removing: number, adding: number): any; - enumerableContentDidChange(removing: Enumerable, adding: number): any; - enumerableContentDidChange(removing: number, adding: Enumerable): any; - enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; - enumerableContentWillChange(removing: number, adding: number): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; - enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + enumerableContentDidChange(start: number, removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentDidChange(removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentWillChange(removing: Enumerable | number, adding: Enumerable | number): Enumerable; every(callback: Function, target?: any): boolean; everyBy(key: string, value?: string): boolean; everyProperty(key: string, value?: string): boolean; @@ -697,8 +662,7 @@ declare namespace Ember { copy(): Binding; disconnect(): Binding; from(path: string): Binding; - to(path: string): Binding; - to(pathTuple: any[]): Binding; + to(path: string | any[]): Binding; toString(): string; } class Button extends Component implements TargetActionSupport { @@ -750,7 +714,7 @@ declare namespace Ember { and actions are targeted at the view object. There is no access to the surrounding context or outer controller; all contextual information is passed in. **/ - class Component { + class Component extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -827,7 +791,7 @@ declare namespace Ember { replaceRoute(name: string, ...args: any[]): void; transitionToRoute(name: string, ...args: any[]): void; controllers: {}; - model : any; + model: any; needs: string[]; queryParams: any; target: any; @@ -902,13 +866,6 @@ declare namespace Ember { static isClass: boolean; static isMethod: boolean; - /** - Creates a new subclass. - @method extend - @static - @param {Object} [args] - Object containing values to use within the new class - **/ - static extend(args?: CoreObjectArguments): T; /** Creates a new subclass. @method extend @@ -916,15 +873,10 @@ declare namespace Ember { @param {Mixin} [mixins] - One or more Mixin classes @param {Object} [args] - Object containing values to use within the new class **/ - static extend(mixins?: Mixin, args?: CoreObjectArguments): T; + static extend(args?: CoreObjectArguments): T; + static extend(mixin1: Mixin, args?: CoreObjectArguments): T; + static extend(mixin1: Mixin, mixin2: Mixin, args?: CoreObjectArguments): T; - /** - Creates a new subclass. - @method extend - @param {Object} [args] - Object containing values to use within the new class - Non-static method because Ember classes aren't currently 'real' TypeScript classes. - **/ - extend(args ?: CoreObjectArguments): T; /** Creates a new subclass. @method extend @@ -932,7 +884,7 @@ declare namespace Ember { @param {Object} [args] - Object containing values to use within the new class Non-static method because Ember classes aren't currently 'real' TypeScript classes. **/ - extend(mixins ? : Mixin, args ?: CoreObjectArguments): T; + extend(mixin1 ?: Mixin, mixin2 ?: Mixin, args ?: CoreObjectArguments): T; /** Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. @@ -1062,18 +1014,9 @@ declare namespace Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; - enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; - enumerableContentDidChange(removing: number, adding: number): any; - enumerableContentDidChange(removing: Enumerable, adding: number): any; - enumerableContentDidChange(removing: number, adding: Enumerable): any; - enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; - enumerableContentWillChange(removing: number, adding: number): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; - enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + enumerableContentDidChange(start: number, removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentDidChange(removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentWillChange(removing: Enumerable | number, adding: Enumerable | number): Enumerable; every(callback: Function, target?: any): boolean; everyBy(key: string, value?: string): boolean; everyProperty(key: string, value?: string): boolean; @@ -1147,6 +1090,7 @@ declare namespace Ember { var GUID_KEY: string; namespace Handlebars { function compile(string: string): Function; + function compile(environment: any, options?: any, context?: any, asObject?: any): any; function precompile(string: string, options: any): void; class Compiler { } class JavaScriptCompiler { } @@ -1162,7 +1106,6 @@ declare namespace Ember { function print(ast: any): void; var logger: typeof Ember.Logger; function log(level: string, str: string): void; - function compile(environment: any, options?: any, context?: any, asObject?: any): any; } class HashLocation extends Object { static detect(obj: any): boolean; @@ -1198,6 +1141,15 @@ declare namespace Ember { rootURL: string; } var IS_BINDING: RegExp; + var inject: { + controller(name?: string): Controller; + service(name?: string): Service; + }; + class Helper extends Object { + static helper( h: (a: any) => any): Helper; + compute(params: any[], hash: any): any; + recompute(params: any[], hash: any): any; + } class Instrumentation { getProperties(obj: any, list: any[]): {}; getProperties(obj: any, ...args: string[]): {}; @@ -1258,18 +1210,9 @@ declare namespace Ember { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; - enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; - enumerableContentDidChange(removing: number, adding: number): any; - enumerableContentDidChange(removing: Enumerable, adding: number): any; - enumerableContentDidChange(removing: number, adding: Enumerable): any; - enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; - enumerableContentWillChange(removing: number, adding: number): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; - enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + enumerableContentDidChange(start: number, removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentDidChange(removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentWillChange(removing: Enumerable | number, adding: Enumerable | number): Enumerable; every(callback: Function, target?: any): boolean; everyBy(key: string, value?: string): boolean; everyProperty(key: string, value?: string): boolean; @@ -1330,18 +1273,9 @@ declare namespace Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; - enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; - enumerableContentDidChange(removing: number, adding: number): any; - enumerableContentDidChange(removing: Enumerable, adding: number): any; - enumerableContentDidChange(removing: number, adding: Enumerable): any; - enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; - enumerableContentWillChange(removing: number, adding: number): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; - enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + enumerableContentDidChange(start: number, removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentDidChange(removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentWillChange(removing: Enumerable | number, adding: Enumerable | number): Enumerable; every(callback: Function, target?: any): boolean; everyBy(key: string, value?: string): boolean; everyProperty(key: string, value?: string): boolean; @@ -1401,18 +1335,9 @@ declare namespace Ember { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; - enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; - enumerableContentDidChange(removing: number, adding: number): any; - enumerableContentDidChange(removing: Enumerable, adding: number): any; - enumerableContentDidChange(removing: number, adding: Enumerable): any; - enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; - enumerableContentWillChange(removing: number, adding: number): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; - enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; - enumerableContentWillChange(removing: Enumerable, adding: Enumerable): Enumerable; + enumerableContentDidChange(start: number, removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentDidChange(removing: Enumerable | number, adding: Enumerable | number): any; + enumerableContentWillChange(removing: Enumerable | number, adding: Enumerable | number): Enumerable; every(callback: Function, target?: any): boolean; everyBy(key: string, value?: string): boolean; everyProperty(key: string, value?: any): boolean; @@ -1477,8 +1402,7 @@ declare namespace Ember { notifyPropertyChange(keyName: string): Observable; propertyDidChange(keyName: string): Observable; propertyWillChange(keyName: string): Observable; - removeObserver(key: string, target: any, method: string): void; - removeObserver(key: string, target: any, method: Function): void; + removeObserver(key: string, target: any, method: Function | string): void; set(keyName: string, value: any): Observable; setProperties(hash: {}): Observable; toggleProperty(keyName: string): any; @@ -1531,8 +1455,7 @@ declare namespace Ember { notifyPropertyChange(keyName: string): Observable; propertyDidChange(keyName: string): Observable; propertyWillChange(keyName: string): Observable; - removeObserver(key: string, target: any, method: string): Observable; - removeObserver(key: string, target: any, method: Function): Observable; + removeObserver(key: string, target: any, method: Function | string): Observable; set(keyName: string, value: any): Observable; setProperties(hash: {}): Observable; toggleProperty(keyName: string): any; @@ -1572,8 +1495,7 @@ declare namespace Ember { notifyPropertyChange(keyName: string): Observable; propertyDidChange(keyName: string): Observable; propertyWillChange(keyName: string): Observable; - removeObserver(key: string, target: {}, method: string): void; - removeObserver(key: string, target: {}, method: Function): void; + removeObserver(key: string, target: {}, method: Function | string): void; set(keyName: string, value: any): Observable; setProperties(hash: {}): Observable; /** @@ -1598,17 +1520,16 @@ declare namespace Ember { // FYI - RSVP source comes from https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/promise.js namespace RSVP { - interface PromiseResolve { - (value?: any): void; - } - interface PromiseReject { - (reason?: any): void; - } - interface PromiseResolverFunction { - (resolve: PromiseResolve, reject: PromiseReject): void; + type PromiseResolve = (value?: T) => void; + type PromiseReject = (reason?: U) => void; + type PromiseResolverFunction = (resolve: PromiseResolve, reject: PromiseReject) => void; + + interface Thenable { + then(onFulfilled?: (value: T) => V | Thenable, onRejected?: (error: any) => X | Thenable): Thenable; + then(onFulfilled?: (value: T) => V | Thenable, onRejected?: (error: any) => void): Thenable; } - class Promise { + class Promise implements Thenable { /** Promise objects represent the eventual result of an asynchronous operation. The @@ -1621,7 +1542,7 @@ declare namespace Ember { Useful for tooling. @constructor */ - constructor(resolver: PromiseResolverFunction, label?: string); + constructor(resolver: PromiseResolverFunction, label?: string); /** The primary way of interacting with a promise is through its `then` method, @@ -1634,8 +1555,9 @@ declare namespace Ember { Useful for tooling. @return {Promise} */ - then(onFulfilled?: Function, onRejected?: Function): Promise; - + then(onFulfilled?: (value: T) => V | Thenable, onRejected?: (error: any) => X | Thenable): Promise; + // tslint:disable-next-line + then(onFulfilled?: (value: T) => V | Thenable, onRejected?: (error: any) => void): Promise; /** `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same as the catch block of a try/catch statement. @@ -1646,7 +1568,7 @@ declare namespace Ember { Useful for tooling. @return {Promise} */ - catch(onRejection: Function, label?: string): Promise; + catch(onRejection: (a: any) => U, label?: string): Promise; /** `finally` will be invoked regardless of the promise's fate just as native @@ -1658,8 +1580,10 @@ declare namespace Ember { Useful for tooling. @return {Promise} */ - finally(callback: Function, label?: string): Promise; + finally(callback: (a: T) => V, label?: string): Promise; } + + function all(promises: GlobalArray>): Promise; } /** @@ -1698,7 +1622,7 @@ declare namespace Ember { resolves. Otherwise, non-promise return values are not utilized in any way. */ - afterModel(resolvedModel: any, transition: EmberStates.Transition): RSVP.Promise; + afterModel(resolvedModel: any, transition: EmberStates.Transition): RSVP.Promise; /** This hook is the first of the route entry validation hooks @@ -1727,7 +1651,7 @@ declare namespace Ember { resolves. Otherwise, non-promise return values are not utilized in any way. */ - beforeModel(transition: EmberStates.Transition): RSVP.Promise; + beforeModel(transition: EmberStates.Transition): RSVP.Promise; /** The controller associated with this route. @@ -1840,7 +1764,7 @@ declare namespace Ember { the promise resolves, and the resolved value of the promise will be used as the model for this route. */ - model(params: {}, transition: EmberStates.Transition): any|RSVP.Promise; + model(params: {}, transition: EmberStates.Transition): any|RSVP.Promise; /** Returns the model of a parent (or any ancestor) route @@ -1863,7 +1787,7 @@ declare namespace Ember { @method paramsFor @param {String} name */ - paramsFor(name: string) : any; + paramsFor(name: string): any; /** Configuration hash for this route's queryParams. @@ -2174,7 +2098,7 @@ declare namespace Ember { @param {Function} method The function of the subscription @return this */ - off(name: string, target:any , method: Function): Evented; + off(name: string, target: any, method: Function): Evented; /** Checks to see if object has any subscriptions for named event. @@ -2211,6 +2135,28 @@ declare namespace Ember { router: Router; options: any; } + class Service extends CoreObject implements Observable { + /* Observable */ + addObserver: ModifyObserver; + beginPropertyChanges(): Observable; + cacheFor(keyName: string): any; + decrementProperty(keyName: string, decrement?: number): number; + endPropertyChanges(): Observable; + get(keyName: string): any; + getProperties(...args: string[]): {}; + getProperties(keys: string[]): {}; + getWithDefault(keyName: string, defaultValue: any): any; + hasObserverFor(key: string): boolean; + incrementProperty(keyName: string, increment?: number): number; + notifyPropertyChange(keyName: string): Observable; + propertyDidChange(keyName: string): Observable; + propertyWillChange(keyName: string): Observable; + removeObserver(key: string, target: {}, method: Function | string): void; + set(keyName: string, value: any): Observable; + setProperties(hash: {}): Observable; + toggleProperty(keyName: string): boolean; + /* /Observable */ + } var STRINGS: boolean; class State extends Object implements Evented { static detect(obj: any): boolean; @@ -2298,11 +2244,11 @@ declare namespace Ember { class Adapter extends Ember.Object { constructor (); } - class Promise extends Ember.RSVP.Promise { + class Promise extends Ember.RSVP.Promise { constructor (); } function oninjectHelpers(callback: Function): void; - function promise(resolver: Function, label: string): Ember.Test.Promise; + function promise(resolver: (a: T) => any, label: string): Ember.Test.Promise; function unregisterHelper(name: string): void; function registerHelper(name: string, helperMethod: Function): void; function registerAsyncHelper(name: string, helperMethod: Function): void; @@ -2315,7 +2261,7 @@ declare namespace Ember { function unregisterWaiter(callback: Function): void; function unregisterWaiter(context: any, callback: Function): void; - function resolve(result: any): Ember.Test.Promise; + function resolve(result: T): Ember.Test.Promise; } class TextArea extends Component implements TextSupport { static detect(obj: any): boolean; @@ -2385,10 +2331,7 @@ declare namespace Ember { actionContext: any; } var ViewUtils: {}; // TODO: define interface - function addListener(obj: any, eventName: string, target: any, method: Function, once?: boolean): void; - function addListener(obj: any, eventName: string, target: any, method: string, once?: boolean): void; - function addListener(obj: any, eventName: string, func: Function, method: Function, once?: boolean): void; - function addListener(obj: any, eventName: string, func: Function, method: string, once?: boolean): void; + function addListener(obj: any, eventName: string, target: Function | any, method: Function | string, once?: boolean): void; var addObserver: ModifyObserver; /** Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead. @@ -2423,6 +2366,7 @@ declare namespace Ember { notEmpty(dependentKey: string): ComputedProperty; oneWay(dependentKey: string): ComputedProperty; or(...args: string[]): ComputedProperty; + readOnly(dependentString: string): ComputedProperty; }; // ReSharper restore DuplicatingLocalDeclaration function controllerFor(container: Container, controllerName: string, lookupOptions?: {}): Controller; @@ -2495,35 +2439,25 @@ declare namespace Ember { function propertyIsEnumerable(prop: string): boolean; function propertyWillChange(obj: any, keyName: string): void; function removeChainWatcher(obj: any, keyName: string, node: any): void; - function removeListener(obj: any, eventName: string, target: any, method: Function): void; - function removeListener(obj: any, eventName: string, target: any, method: string): void; - function removeListener(obj: any, eventName: string, func: Function, method: Function): void; - function removeListener(obj: any, eventName: string, func: Function, method: string): void; + function removeListener(obj: any, eventName: string, target: Function | any, method: Function | string): void; function removeObserver(obj: any, path: string, target: any, method: Function): any; function required(): Descriptor; function rewatch(obj: any): void; var run: { + (method: Function): void; (target: any, method: Function): void; begin(): void; cancel(timer: any): void; - debounce(target: any, method: Function, ...args: any[]): void; - debounce(target: any, method: string, ...args: any[]): void; + debounce(target: any, method: Function | string, ...args: any[]): void; end(): void; - join(target: any, method: Function, ...args: any[]): any; - join(target: any, method: string, ...args: any[]): any; - later(target: any, method: Function, ...args: any[]): string; - later(target: any, method: string, ...args: any[]): string; - next(target: any, method: Function, ...args: any[]): number; - next(target: any, method: string, ...args: any[]): number; - once(target: any, method: Function, ...args: any[]): number; - once(target: any, method: string, ...args: any[]): number; - schedule(queue: string, target: any, method: Function, ...args: any[]): void; - schedule(queue: string, target: any, method: string, ...args: any[]): void; - scheduleOnce(queue: string, target: any, method: Function, ...args: any[]): void; - scheduleOnce(queue: string, target: any, method: string, ...args: any[]): void; + join(target: any, method: Function | string, ...args: any[]): any; + later(target: any, method: Function | string, ...args: any[]): string; + next(target: any, method: Function | string, ...args: any[]): number; + once(target: any, method: Function | string, ...args: any[]): number; + schedule(queue: string, target: any, method: Function | string, ...args: any[]): void; + scheduleOnce(queue: string, target: any, method: Function | string, ...args: any[]): void; sync(): void; - throttle(target: any, method: Function, ...args: any[]): void; - throttle(target: any, method: string, ...args: any[]): void; + throttle(target: any, method: Function | string, ...args: any[]): void; queues: any[]; }; function runLoadHooks(name: string, object: any): void; @@ -2557,230 +2491,22 @@ declare namespace Ember { function watchPath(obj: any, keyPath: string): void; function watchedEvents(obj: {}): any[]; function wrap(func: Function, superFunc: Function): Function; - var _ContainerProxyMixin : Mixin; + var _ContainerProxyMixin: Mixin; var _RegistryProxyMixin: Mixin; function getOwner(object: any): any; function setOwner(object: any, owner: any): void; - var testing : boolean; - var MODEL_FACTORY_INJECTIONS : boolean; + var testing: boolean; + var MODEL_FACTORY_INJECTIONS: boolean; function assign(original: any, ...sources: any[]): any; } -declare namespace Em { - var $: typeof Ember.$; - var A: typeof Ember.A; - class ActionHandlerMixin extends Ember.ActionHandlerMixin { } - class Application extends Ember.Application { } - class Array extends Ember.Array { } - class ArrayProxy extends Ember.ArrayProxy { } - var BOOTED: typeof Ember.BOOTED; - class Binding extends Ember.Binding { } - class Button extends Ember.Button { } - class Checkbox extends Ember.Checkbox { } - class Comparable extends Ember.Comparable { } - class Component extends Ember.Component { } - class ComputedProperty extends Ember.ComputedProperty { } - class Container extends Ember.Container { } - class Controller extends Ember.Controller { } - class ControllerMixin extends Ember.ControllerMixin { } - class Copyable extends Ember.Copyable {} - class CoreObject extends Ember.CoreObject { } - class DAG extends Ember.DAG {} - var DEFAULT_GETTER_FUNCTION : typeof Ember.DEFAULT_GETTER_FUNCTION; - class DefaultResolver extends Ember.DefaultResolver { } - class Descriptor extends Ember.Descriptor { } - var ENV: typeof Ember.ENV; - var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES; - class EachProxy extends Ember.EachProxy { } - class Enumerable extends Ember.Enumerable { } - var Error: typeof Ember.Error; - class EventDispatcher extends Ember.EventDispatcher { } - class Evented extends Ember.Evented { } - var FROZEN_ERROR: typeof Ember.FROZEN_ERROR; - class Freezable extends Ember.Freezable { } - var GUID_KEY: typeof Ember.GUID_KEY; - namespace Handlebars { - var compile: typeof Ember.Handlebars.compile; - var precompile: typeof Ember.Handlebars.precompile; - class Compiler extends Ember.Handlebars.Compiler { } - class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler{ } - var registerPartial: typeof Ember.Handlebars.registerPartial; - var K: typeof Ember.Handlebars.K; - var createFrame: typeof Ember.Handlebars.createFrame; - var Exception: typeof Ember.Handlebars.Exception; - class SafeString extends Ember.Handlebars.SafeString { } - var parse: typeof Ember.Handlebars.parse; - var print: typeof Ember.Handlebars.print; - var logger: typeof Ember.Handlebars.logger; - var log: typeof Ember.Handlebars.log; - } - class HashLocation extends Ember.HashLocation { } - class HistoryLocation extends Ember.HistoryLocation { } - var IS_BINDING: typeof Ember.IS_BINDING; - class Instrumentation extends Ember.Instrumentation { } - var K: typeof Ember.K; - var LOG_BINDINGS: typeof Ember.LOG_BINDINGS; - var LOG_STACKTRACE_ON_DEPRECATION: typeof Ember.LOG_STACKTRACE_ON_DEPRECATION; - var LOG_VERSION: typeof Ember.LOG_VERSION; - class Location extends Ember.Location {} - var Logger: typeof Ember.Logger; - var MANDATORY_SETTER_FUNCTION: typeof Ember.MANDATORY_SETTER_FUNCTION; - var META_KEY: typeof Ember.META_KEY; - class Map extends Ember.Map { } - class MapWithDefault extends Ember.MapWithDefault { } - class Mixin extends Ember.Mixin { } - class MutableArray extends Ember.MutableArray { } - class MutableEnumberable extends Ember.MutableEnumberable { } - var NAME_KEY: typeof Ember.NAME_KEY; - class Namespace extends Ember.Namespace { } - class NativeArray extends Ember.NativeArray { } - class NoneLocation extends Ember.NoneLocation { } - var ORDER_DEFINITION: typeof Ember.ORDER_DEFINITION; - class Object extends Ember.Object { } - class ObjectProxy extends Ember.ObjectProxy { } - class Observable extends Ember.Observable { } - class OrderedSet extends Ember.OrderedSet { } - class Registry extends Ember.Registry { } - namespace RSVP { - interface PromiseResolve extends Ember.RSVP.PromiseResolve { } - interface PromiseReject extends Ember.RSVP.PromiseReject { } - interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { } - class Promise extends Ember.RSVP.Promise { } - } - class Route extends Ember.Route {} - class Router extends Ember.Router { } - class RouterDSL extends Ember.RouterDSL { } - var STRINGS: typeof Ember.STRINGS; - class State extends Ember.State { } - class StateManager extends Ember.StateManager { } - var String : typeof Ember.String; - var TEMPLATES: typeof Ember.TEMPLATES; - class TargetActionSupport extends Ember.TargetActionSupport {} - namespace Test { - class Adapter extends Ember.Test.Adapter { } - class Promise extends Ember.Test.Promise { } - var oninjectHelpers: typeof Ember.Test.oninjectHelpers; - var promise: typeof Ember.Test.promise; - var unregisterHelper: typeof Ember.Test.unregisterHelper; - var registerHelper: typeof Ember.Test.registerHelper; - var registerAsyncHelper: typeof Ember.Test.registerAsyncHelper; - var adapter: typeof Ember.Test.adapter; - var QUnitAdapter: typeof Ember.Test.QUnitAdapter; - var registerWaiter: typeof Ember.Test.registerWaiter; - var unregisterWaiter: typeof Ember.Test.unregisterWaiter - var resolve: typeof Ember.Test.resolve; - } - class TextArea extends Ember.TextArea { } - class TextField extends Ember.TextField { } - class TextSupport extends Ember.TextSupport { } - var VERSION: typeof Ember.VERSION; - class ViewTargetActionSupport extends Ember.ViewTargetActionSupport { } - var ViewUtils: typeof Ember.ViewUtils; - var addListener: typeof Ember.addListener; - var addObserver: typeof Ember.addObserver; - var alias: typeof Ember.alias; - var aliasMethod: typeof Ember.aliasMethod; - var assert: typeof Ember.assert; - var beginPropertyChanges: typeof Ember.beginPropertyChanges; - var bind: typeof Ember.bind; - var cacheFor: typeof Ember.cacheFor; - var canInvoke: typeof Ember.canInvoke; - var changeProperties: typeof Ember.changeProperties; - var compare: typeof Ember.compare; - var computed: typeof Ember.computed; - var controllerFor: typeof Ember.controllerFor; - var copy: typeof Ember.copy; - var create: typeof Ember.create; - var debug: typeof Ember.debug; - var defineProperty: typeof Ember.defineProperty; - var deprecate: typeof Ember.deprecate; - var deprecateFunc: typeof Ember.deprecateFunc - var destroy: typeof Ember.destroy; - var empty: typeof Ember.empty; - var endPropertyChanges: typeof Ember.endPropertyChanges; - var finishChains: typeof Ember.finishChains; - var generateController: typeof Ember.generateController; - var generateGuid: typeof Ember.generateGuid; - var get: typeof Ember.get; - var getPath: typeof Ember.getPath; - var getWithDefault: typeof Ember.getWithDefault; - var guidFor: typeof Ember.guidFor; - var handleErrors: typeof Ember.handleErrors; - var hasListeners: typeof Ember.hasListeners; - var hasOwnProperty: typeof Ember.hasOwnProperty; - var immediateObserver: typeof Ember.immediateObserver; - var inspect: typeof Ember.inspect; - var instrument: typeof Ember.instrument; - var isArray: typeof Ember.isArray; - var isEmpty: typeof Ember.isEmpty; - var isEqual: typeof Ember.isEqual; - var isGlobalPath: typeof Ember.isGlobalPath; - var isNamespace: typeof Ember.isNamespace; - var isNone: typeof Ember.isNone; - var isPrototypeOf: typeof Ember.isPrototypeOf; - var isWatching: typeof Ember.isWatching; - var keys: typeof Ember.keys; - var listenersDiff: typeof Ember.listenersDiff; - var listenersFor: typeof Ember.listenersFor; - var listenersUnion: typeof Ember.listenersUnion; - var lookup: typeof Ember.lookup; - var makeArray: typeof Ember.makeArray; - var merge: typeof Ember.merge; - var meta: typeof Ember.meta; - var mixin: typeof Ember.mixin; - var none: typeof Ember.none; - var observer: typeof Ember.observer; - var observersFor: typeof Ember.observersFor; - var onLoad: typeof Ember.onLoad; - var onError: typeof Ember.onError; - var overrideChains: typeof Ember.overrideChains; - var platform: typeof Ember.platform; - var propertyDidChange: typeof Ember.propertyDidChange; - var propertyIsEnumerable: typeof Ember.propertyIsEnumerable; - var propertyWillChange: typeof Ember.propertyWillChange; - var removeChainWatcher: typeof Ember.removeChainWatcher; - var removeListener: typeof Ember.removeListener; - var removeObserver: typeof Ember.removeObserver; - var required: typeof Ember.required; - var rewatch: typeof Ember.rewatch; - var run: typeof Ember.run; - var runLoadHooks: typeof Ember.runLoadHooks; - var sendEvent: typeof Ember.sendEvent; - var set: typeof Ember.set; - var setPath: typeof Ember.setPath; - var setProperties: typeof Ember.setProperties; - var subscribe: typeof Ember.subscribe; - var toLocaleString: typeof Ember.toLocaleString; - var toString: typeof Ember.toString; - var tryCatchFinally: typeof Ember.tryCatchFinally; - var tryInvoke: typeof Ember.tryInvoke; - var trySet: typeof Ember.trySet; - var trySetPath: typeof Ember.trySetPath; - var typeOf: typeof Ember.typeOf; - var unwatch: typeof Ember.unwatch; - var unwatchKey: typeof Ember.unwatchKey; - var unwatchPath: typeof Ember.unwatchPath; - var uuid: typeof Ember.uuid; - var valueOf: typeof Ember.valueOf; - var warn: typeof Ember.warn; - var watch: typeof Ember.watch; - var watchKey: typeof Ember.watchKey; - var watchPath: typeof Ember.watchPath; - var watchedEvents: typeof Ember.watchedEvents; - var wrap: typeof Ember.wrap; - var _ContainerProxyMixin : typeof Ember._ContainerProxyMixin; - var _RegistryProxyMixin: typeof Ember._RegistryProxyMixin; - var getOwner: typeof Ember.getOwner; - var setOwner: typeof Ember.setOwner; - var testing: typeof Ember.testing; - var MODEL_FACTORY_INJECTIONS: typeof Ember.MODEL_FACTORY_INJECTIONS; - var assign: typeof Ember.assign; -} +import Em = Ember; + /** - * External ambient module - to allow "import Ember = require('Ember');" to work correctly + * External ambient module - to allow "import Ember from 'ember';" to work correctly */ -declare module "Ember" { - export = Ember; +declare module "ember" { + export default Ember; } diff --git a/ember/tsconfig.json b/ember/tsconfig.json index 0bfee35a23..d3d58eb3e6 100644 --- a/ember/tsconfig.json +++ b/ember/tsconfig.json @@ -3,7 +3,8 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "noImplicitThis": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/ember/tslint.json b/ember/tslint.json new file mode 100644 index 0000000000..e2cf959984 --- /dev/null +++ b/ember/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "../tslint.json", + "rules": { + // Heavy use of Function type in this older package. + "forbidden-types": false, + // not sure what this means + "no-single-declare-module": false + } +} diff --git a/emissary/tsconfig.json b/emissary/tsconfig.json index 67b7c8a925..61a5a39ea2 100644 --- a/emissary/tsconfig.json +++ b/emissary/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/emojione/emojione-tests.ts b/emojione/emojione-tests.ts new file mode 100644 index 0000000000..ea5d04e217 --- /dev/null +++ b/emojione/emojione-tests.ts @@ -0,0 +1,13 @@ +emojione.sprites = true; +emojione.imagePathPNG = 'foobar'; +emojione.imagePathSVG = 'foobar'; +emojione.imagePathSVGSprites = 'foobar'; +emojione.imageType = 'svg'; +emojione.unicodeAlt = false; +emojione.ascii = true; +emojione.unicodeRegexp = '123.*'; +emojione.cacheBustParam = 'asdf'; +const myShort: string = emojione.toShort('hi'); +const myImage1: string = emojione.toImage('hi'); +const myImage2: string = emojione.shortnameToImage('hi'); +const myImage3: string = emojione.unicodeToImage('hi'); diff --git a/emojione/index.d.ts b/emojione/index.d.ts new file mode 100644 index 0000000000..48b55e87cd --- /dev/null +++ b/emojione/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for emojione 2.2 +// Project: https://github.com/Ranks/emojione +// Definitions by: Danilo Bargen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace emojione; + +export var sprites: boolean; +export var imagePathPNG: string; +export var imagePathSVG: string; +export var imagePathSVGSprites: string; +export var imageType: 'png' | 'svg'; +export var unicodeAlt: boolean; +export var ascii: boolean; +export var unicodeRegexp: string; +export var cacheBustParam: string; +export function toShort(str: string): string; +export function toImage(str: string): string; +export function shortnameToImage(str: string): string; +export function unicodeToImage(str: string): string; diff --git a/emojione/tsconfig.json b/emojione/tsconfig.json new file mode 100644 index 0000000000..c0912932ac --- /dev/null +++ b/emojione/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "emojione-tests.ts" + ] +} \ No newline at end of file diff --git a/emojione/tslint.json b/emojione/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/emojione/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/empower/tsconfig.json b/empower/tsconfig.json index 9114c02e8c..fcf333f09b 100644 --- a/empower/tsconfig.json +++ b/empower/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/emscripten/tsconfig.json b/emscripten/tsconfig.json index 5184d82f18..64a903bfeb 100644 --- a/emscripten/tsconfig.json +++ b/emscripten/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/encoding-japanese/tsconfig.json b/encoding-japanese/tsconfig.json index 282c3c0d53..600268d208 100644 --- a/encoding-japanese/tsconfig.json +++ b/encoding-japanese/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/enhanced-resolve/enhanced-resolve-tests.ts b/enhanced-resolve/enhanced-resolve-tests.ts new file mode 100644 index 0000000000..6588bb125b --- /dev/null +++ b/enhanced-resolve/enhanced-resolve-tests.ts @@ -0,0 +1,42 @@ +import resolve = require('enhanced-resolve'); +import { Context } from 'enhanced-resolve/lib/concord'; +import { ResolveResult } from 'enhanced-resolve/lib/common-types' +import Resolver = require('enhanced-resolve/lib/Resolver') + +resolve('lib', 'string', function (err) { }); + +let context: Context = { + referrer: 'hi' +}; + +resolve(context, 'path', 'string', function () { }); + +let resolver: Resolver +resolver = resolve.ResolverFactory.createResolver({ + extensions: ['.js'], + fileSystem: {} +}); + +const nfs = new resolve.NodeJsInputFileSystem(); + +const snfs = new resolve.SyncNodeJsInputFileSystem(); + +const cfs = new resolve.CachedInputFileSystem(nfs, 4); +const cfs2 = new resolve.CachedInputFileSystem(snfs, 4); + +let result: ResolveResult + +result = resolve.sync(context, 'path', 'string'); +result = resolve.sync('path', 'string'); + +resolve.context('lib', 'string', function (err) { }); +resolve.context(context, 'path', 'string', function () { }); + +result = resolve.context.sync(context, 'path', 'string'); +result = resolve.context.sync('path', 'string'); + +resolve.create('lib', 'string', function (err) { }); +resolve.create(context, 'path', 'string', function () { }); + +result = resolve.create.sync(context, 'path', 'string'); +result = resolve.create.sync('path', 'string'); diff --git a/enhanced-resolve/index.d.ts b/enhanced-resolve/index.d.ts new file mode 100644 index 0000000000..142e644bd1 --- /dev/null +++ b/enhanced-resolve/index.d.ts @@ -0,0 +1,134 @@ +// Type definitions for enhanced-resolve v2.3.0 +// Project: http://github.com/webpack/enhanced-resolve.git +// Definitions by: e-cloud +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +import fs = require('fs'); +import { + ResolveResult, + LoggingCallbackWrapper, + ErrorCallback, + CommonFileSystemMethod, + BaseFileSystem, + ResolverRequest +} from './lib/common-types'; +import { Context } from './lib/concord'; +import Resolver = require('./lib/Resolver'); + +declare namespace Resolve { + function sync(path: string, request: string): ResolveResult; + function sync(context: Context, path: string, request: string): ResolveResult; + + function context(path: string, request: string, callback: LoggingCallbackWrapper): void; + function context(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void; + + namespace context { + function sync(path: string, request: string): ResolveResult; + function sync(context: Context, path: string, request: string): ResolveResult; + } + + function loader(path: string, request: string, callback: LoggingCallbackWrapper): void; + function loader(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void; + + namespace context { + function sync(path: string, request: string): ResolveResult; + function sync(context: Context, path: string, request: string): ResolveResult; + } + + function create(path: string, request: string, callback: LoggingCallbackWrapper): void; + function create(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void; + + export namespace create { + function sync(path: string, request: string): ResolveResult; + function sync(context: Context, path: string, request: string): ResolveResult; + } + + export namespace ResolverFactory { + interface ResolverOption { + modules?: string[]; + descriptionFiles?: string[]; + plugins?: any[]; + mainFields?: string[]; + aliasFields?: string[]; + mainFiles?: string[]; + extensions: string[]; + enforceExtension?: boolean; + moduleExtensions?: string[]; + enforceModuleExtension?: boolean; + alias?: AliasItem[] | {}; + symlinks?: string[] | boolean; + resolveToContext?: boolean; + unsafeCache?: boolean | {}; + cachePredicate?: (val: ResolverRequest) => boolean; + fileSystem: any; + resolver?: Resolver; + } + interface AliasItem { + name: string; + alias: string; + onlyModule: boolean; + } + function createResolver(options: ResolverOption): Resolver; + } + + class NodeJsInputFileSystem { + readdir(path: string, callback: (err: Error, files: string[]) => void): void; + + isSync(): boolean; + + stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: fs.Stats) => any): void; + + readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + + readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void; + } + + class SyncNodeJsInputFileSystem { + isSync(): boolean; + + stat: CommonFileSystemMethod; + readdir: CommonFileSystemMethod; + readFile(path: string, encoding?: string, callback?: (err: NodeJS.ErrnoException, result: Buffer) => void): void; + readFile(path: string, callback?: (err: NodeJS.ErrnoException, result: Buffer) => void): void; + readlink: CommonFileSystemMethod; + } + + class CachedInputFileSystem { + fileSystem: BaseFileSystem; + _statStorage: Storage; + _readdirStorage: Storage; + _readFileStorage: Storage; + _readJsonStorage: Storage; + _readlinkStorage: Storage; + _stat: CommonFileSystemMethod; + _readdir: CommonFileSystemMethod; + _readFile: CommonFileSystemMethod; + _readJson: CommonFileSystemMethod; + _readlink: CommonFileSystemMethod; + + constructor(fileSystem: BaseFileSystem, duration: number); + + isSync(): boolean; + + stat(path: string, callback: ErrorCallback): void; + + readdir(path: string, callback: ErrorCallback): void; + + readFile(path: string, callback: ErrorCallback): void; + + readJson(path: string, callback: ErrorCallback): void; + + readlink(path: string, callback: ErrorCallback): void; + + purge(what?: string | string[]): void; + } +} + +declare function Resolve(path: string, request: string, callback: LoggingCallbackWrapper): void; +declare function Resolve(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): void; + +export = Resolve; diff --git a/enhanced-resolve/lib/AliasFieldPlugin.d.ts b/enhanced-resolve/lib/AliasFieldPlugin.d.ts new file mode 100644 index 0000000000..d49ba745b8 --- /dev/null +++ b/enhanced-resolve/lib/AliasFieldPlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class AliasFieldPlugin { + source: string; + field: string; + target: string; + + constructor(source: string, field: string, target: string); + + apply(resolver: Resolver): void; +} +export = AliasFieldPlugin; diff --git a/enhanced-resolve/lib/AliasPlugin.d.ts b/enhanced-resolve/lib/AliasPlugin.d.ts new file mode 100644 index 0000000000..4d9635f1c5 --- /dev/null +++ b/enhanced-resolve/lib/AliasPlugin.d.ts @@ -0,0 +1,17 @@ +import Resolver = require('./Resolver'); +import Resolve = require('../'); + +declare class AliasPlugin { + source: string; + options: Resolve.ResolverFactory.AliasItem; + target: string; + name: string; + alias: string; + onlyModule: boolean; + + constructor(source: string, options: Resolve.ResolverFactory.AliasItem, target: string); + + apply(resolver: Resolver): void; +} + +export = AliasPlugin; diff --git a/enhanced-resolve/lib/AppendPlugin.d.ts b/enhanced-resolve/lib/AppendPlugin.d.ts new file mode 100644 index 0000000000..7a5f7e1a62 --- /dev/null +++ b/enhanced-resolve/lib/AppendPlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class AppendPlugin { + source: string; + appending: string; + target: string; + + constructor(source: string, appending: string, target: string); + + apply(resolver: Resolver): void; +} +export = AppendPlugin; diff --git a/enhanced-resolve/lib/CloneBasenamePlugin.d.ts b/enhanced-resolve/lib/CloneBasenamePlugin.d.ts new file mode 100644 index 0000000000..8a4483902e --- /dev/null +++ b/enhanced-resolve/lib/CloneBasenamePlugin.d.ts @@ -0,0 +1,10 @@ +import Resolver = require('./Resolver'); +declare class CloneBasenamePlugin { + source: string; + target: string; + + constructor(source: string, target: string); + + apply(resolver: Resolver): void; +} +export = CloneBasenamePlugin; diff --git a/enhanced-resolve/lib/ConcordExtensionsPlugin.d.ts b/enhanced-resolve/lib/ConcordExtensionsPlugin.d.ts new file mode 100644 index 0000000000..89d0880350 --- /dev/null +++ b/enhanced-resolve/lib/ConcordExtensionsPlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class ConcordExtensionsPlugin { + source: string; + options: {}; + target: string; + + constructor(source: string, options: {}, target: string); + + apply(resolver: Resolver): void; +} +export = ConcordExtensionsPlugin; diff --git a/enhanced-resolve/lib/ConcordMainPlugin.d.ts b/enhanced-resolve/lib/ConcordMainPlugin.d.ts new file mode 100644 index 0000000000..9d2fdf3d44 --- /dev/null +++ b/enhanced-resolve/lib/ConcordMainPlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class ConcordMainPlugin { + source: string; + options: {}; + target: string; + + constructor(source: string, options: {}, target: string); + + apply(resolver: Resolver): void; +} +export = ConcordMainPlugin; diff --git a/enhanced-resolve/lib/ConcordModulesPlugin.d.ts b/enhanced-resolve/lib/ConcordModulesPlugin.d.ts new file mode 100644 index 0000000000..3afbd32a9c --- /dev/null +++ b/enhanced-resolve/lib/ConcordModulesPlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class ConcordModulesPlugin { + source: string; + options: {}; + target: string; + + constructor(source: string, options: {}, target: string); + + apply(resolver: Resolver): void; +} +export = ConcordModulesPlugin; diff --git a/enhanced-resolve/lib/DescriptionFilePlugin.d.ts b/enhanced-resolve/lib/DescriptionFilePlugin.d.ts new file mode 100644 index 0000000000..f9f560de46 --- /dev/null +++ b/enhanced-resolve/lib/DescriptionFilePlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class DescriptionFilePlugin { + source: string; + target: string; + filenames: string[]; + + constructor(source: string, filenames: string[] | string, target: string); + + apply(resolver: Resolver): void; +} +export = DescriptionFilePlugin; diff --git a/enhanced-resolve/lib/DescriptionFileUtils.d.ts b/enhanced-resolve/lib/DescriptionFileUtils.d.ts new file mode 100644 index 0000000000..db7cd77723 --- /dev/null +++ b/enhanced-resolve/lib/DescriptionFileUtils.d.ts @@ -0,0 +1,8 @@ +import Resolver = require('./Resolver'); +declare function loadDescriptionFile( + resolver: Resolver, directory: string, filenames: string[], + callback: (...args: any[]) => any +): void; +declare function getField(content: any, field: string): any; +declare function cdUp(directory: string): string | null; +export { loadDescriptionFile, getField, cdUp }; diff --git a/enhanced-resolve/lib/DirectoryExistsPlugin.d.ts b/enhanced-resolve/lib/DirectoryExistsPlugin.d.ts new file mode 100644 index 0000000000..d4483985ab --- /dev/null +++ b/enhanced-resolve/lib/DirectoryExistsPlugin.d.ts @@ -0,0 +1,10 @@ +import Resolver = require('./Resolver'); +declare class DirectoryExistsPlugin { + source: string; + target: string; + + constructor(source: string, target: string); + + apply(resolver: Resolver): void; +} +export = DirectoryExistsPlugin; diff --git a/enhanced-resolve/lib/FileExistsPlugin.d.ts b/enhanced-resolve/lib/FileExistsPlugin.d.ts new file mode 100644 index 0000000000..061a8475c2 --- /dev/null +++ b/enhanced-resolve/lib/FileExistsPlugin.d.ts @@ -0,0 +1,10 @@ +import Resolver = require('./Resolver'); +declare class FileExistsPlugin { + source: string; + target: string; + + constructor(source: string, target: string); + + apply(resolver: Resolver): void; +} +export = FileExistsPlugin; diff --git a/enhanced-resolve/lib/FileKindPlugin.d.ts b/enhanced-resolve/lib/FileKindPlugin.d.ts new file mode 100644 index 0000000000..86c0e68543 --- /dev/null +++ b/enhanced-resolve/lib/FileKindPlugin.d.ts @@ -0,0 +1,10 @@ +import Resolver = require('./Resolver'); +declare class FileKindPlugin { + source: string; + target: string; + + constructor(source: string, target: string); + + apply(resolver: Resolver): void; +} +export = FileKindPlugin; diff --git a/enhanced-resolve/lib/JoinRequestPlugin.d.ts b/enhanced-resolve/lib/JoinRequestPlugin.d.ts new file mode 100644 index 0000000000..66238fddb9 --- /dev/null +++ b/enhanced-resolve/lib/JoinRequestPlugin.d.ts @@ -0,0 +1,10 @@ +import Resolver = require('./Resolver'); +declare class JoinRequestPlugin { + source: string; + target: string; + + constructor(source: string, target: string); + + apply(resolver: Resolver): void; +} +export = JoinRequestPlugin; diff --git a/enhanced-resolve/lib/LogInfoPlugin.d.ts b/enhanced-resolve/lib/LogInfoPlugin.d.ts new file mode 100644 index 0000000000..26dcecac87 --- /dev/null +++ b/enhanced-resolve/lib/LogInfoPlugin.d.ts @@ -0,0 +1,9 @@ +import Resolver = require('./Resolver'); +declare class LogInfoPlugin { + source: string; + + constructor(source: string); + + apply(resolver: Resolver): void; +} +export = LogInfoPlugin; diff --git a/enhanced-resolve/lib/MainFieldPlugin.d.ts b/enhanced-resolve/lib/MainFieldPlugin.d.ts new file mode 100644 index 0000000000..8a8882d6f0 --- /dev/null +++ b/enhanced-resolve/lib/MainFieldPlugin.d.ts @@ -0,0 +1,19 @@ +import Resolver = require('./Resolver'); +declare class MainFieldPlugin { + source: string; + options: { + name: string; + forceRelative: boolean; + }; + target: string; + + constructor( + source: string, options: { + name: string; + forceRelative: boolean; + }, target: string + ); + + apply(resolver: Resolver): void; +} +export = MainFieldPlugin; diff --git a/enhanced-resolve/lib/ModuleAppendPlugin.d.ts b/enhanced-resolve/lib/ModuleAppendPlugin.d.ts new file mode 100644 index 0000000000..3380d33622 --- /dev/null +++ b/enhanced-resolve/lib/ModuleAppendPlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class ModuleAppendPlugin { + source: string; + appending: string; + target: string; + + constructor(source: string, appending: string, target: string); + + apply(resolver: Resolver): void; +} +export = ModuleAppendPlugin; diff --git a/enhanced-resolve/lib/ModuleKindPlugin.d.ts b/enhanced-resolve/lib/ModuleKindPlugin.d.ts new file mode 100644 index 0000000000..a4b945a09d --- /dev/null +++ b/enhanced-resolve/lib/ModuleKindPlugin.d.ts @@ -0,0 +1,10 @@ +import Resolver = require('./Resolver'); +declare class ModuleKindPlugin { + source: string; + target: string; + + constructor(source: string, target: string); + + apply(resolver: Resolver): void; +} +export = ModuleKindPlugin; diff --git a/enhanced-resolve/lib/ModulesInHierachicDirectoriesPlugin.d.ts b/enhanced-resolve/lib/ModulesInHierachicDirectoriesPlugin.d.ts new file mode 100644 index 0000000000..d744870022 --- /dev/null +++ b/enhanced-resolve/lib/ModulesInHierachicDirectoriesPlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class ModulesInHierachicDirectoriesPlugin { + source: string; + target: string; + directories: string[]; + + constructor(source: string, directories: string[], target: string); + + apply(resolver: Resolver): void; +} +export = ModulesInHierachicDirectoriesPlugin; diff --git a/enhanced-resolve/lib/ModulesInRootPlugin.d.ts b/enhanced-resolve/lib/ModulesInRootPlugin.d.ts new file mode 100644 index 0000000000..87654ce919 --- /dev/null +++ b/enhanced-resolve/lib/ModulesInRootPlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class ModulesInRootPlugin { + source: string; + path: string; + target: string; + + constructor(source: string, path: string, target: string); + + apply(resolver: Resolver): void; +} +export = ModulesInRootPlugin; diff --git a/enhanced-resolve/lib/NextPlugin.d.ts b/enhanced-resolve/lib/NextPlugin.d.ts new file mode 100644 index 0000000000..7ffbefa643 --- /dev/null +++ b/enhanced-resolve/lib/NextPlugin.d.ts @@ -0,0 +1,10 @@ +import Resolver = require('./Resolver'); +declare class NextPlugin { + source: string; + target: string; + + constructor(source: string, target: string); + + apply(resolver: Resolver): void; +} +export = NextPlugin; diff --git a/enhanced-resolve/lib/ParsePlugin.d.ts b/enhanced-resolve/lib/ParsePlugin.d.ts new file mode 100644 index 0000000000..933d6d50ff --- /dev/null +++ b/enhanced-resolve/lib/ParsePlugin.d.ts @@ -0,0 +1,10 @@ +import Resolver = require('./Resolver'); +declare class ParsePlugin { + source: string; + target: string; + + constructor(source: string, target: string); + + apply(resolver: Resolver): void; +} +export = ParsePlugin; diff --git a/enhanced-resolve/lib/Resolver.d.ts b/enhanced-resolve/lib/Resolver.d.ts new file mode 100644 index 0000000000..4d2f3ee477 --- /dev/null +++ b/enhanced-resolve/lib/Resolver.d.ts @@ -0,0 +1,26 @@ +/// +import Tapable = require('tapable'); +import { ResolveParseResult, ResolverRequest, LoggingCallbackWrapper, BaseFileSystem } from './common-types'; +import { Context } from './concord'; +declare class Resolver extends Tapable { + fileSystem: BaseFileSystem; + + constructor(fileSystem: BaseFileSystem); + + resolveSync(context: Context, path: string, request: string): null; + + resolve(context: Context, path: string, request: string, callback: LoggingCallbackWrapper): any; + + doResolve(type: string, request: ResolverRequest, message: string | null, callback: LoggingCallbackWrapper): any; + + parse(identifier: string): ResolveParseResult | null; + + isModule(path: string): boolean; + + isDirectory(path: string): boolean; + + join(path: string, request: string): string; + + normalize(path: string): string; +} +export = Resolver; diff --git a/enhanced-resolve/lib/ResultPlugin.d.ts b/enhanced-resolve/lib/ResultPlugin.d.ts new file mode 100644 index 0000000000..47e5b2324a --- /dev/null +++ b/enhanced-resolve/lib/ResultPlugin.d.ts @@ -0,0 +1,9 @@ +import Resolver = require('./Resolver'); +declare class ResultPlugin { + source: string; + + constructor(source: string); + + apply(resolver: Resolver): void; +} +export = ResultPlugin; diff --git a/enhanced-resolve/lib/Storage.d.ts b/enhanced-resolve/lib/Storage.d.ts new file mode 100644 index 0000000000..4260b42ee7 --- /dev/null +++ b/enhanced-resolve/lib/Storage.d.ts @@ -0,0 +1,34 @@ +/// +import { CommonFileSystemMethod } from './common-types'; + +declare class Storage { + duration: number; + running: { + [name: string]: ((...args: any[]) => any)[] + }; + data: { + [name: string]: any[] + }; + levels: string[][]; + count: number; + interval: NodeJS.Timer | null; + needTickCheck: boolean; + nextTick: number | null; + passive: boolean; + + constructor(duration: number); + + ensureTick(): void; + + finished(name: string): void; + + provide(name: string, provider: CommonFileSystemMethod, callback: (...args: any[]) => any): any; + + tick(): true | undefined; + + checkTicks(): void; + + purge(what?: string | string[]): void; +} + +export default Storage; diff --git a/enhanced-resolve/lib/SymlinkPlugin.d.ts b/enhanced-resolve/lib/SymlinkPlugin.d.ts new file mode 100644 index 0000000000..e5f500637b --- /dev/null +++ b/enhanced-resolve/lib/SymlinkPlugin.d.ts @@ -0,0 +1,10 @@ +import Resolver = require('./Resolver'); +declare class SymlinkPlugin { + source: string; + target: string; + + constructor(source: string, target: string); + + apply(resolver: Resolver): void; +} +export = SymlinkPlugin; diff --git a/enhanced-resolve/lib/TryNextPlugin.d.ts b/enhanced-resolve/lib/TryNextPlugin.d.ts new file mode 100644 index 0000000000..eeb4d1e795 --- /dev/null +++ b/enhanced-resolve/lib/TryNextPlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class TryNextPlugin { + source: string; + message: string | null; + target: string; + + constructor(source: string, message: string | null, target: string); + + apply(resolver: Resolver): void; +} +export = TryNextPlugin; diff --git a/enhanced-resolve/lib/UnsafeCachePlugin.d.ts b/enhanced-resolve/lib/UnsafeCachePlugin.d.ts new file mode 100644 index 0000000000..8b8c8f5f09 --- /dev/null +++ b/enhanced-resolve/lib/UnsafeCachePlugin.d.ts @@ -0,0 +1,13 @@ +import Resolver = require('./Resolver'); +import { ResolverRequest } from './common-types'; +declare class UnsafeCachePlugin { + source: string; + filterPredicate: (str: ResolverRequest) => boolean; + cache: {}; + target: string; + + constructor(source: string, filterPredicate: (str: ResolverRequest) => boolean, cache: {}, target: string); + + apply(resolver: Resolver): void; +} +export = UnsafeCachePlugin; diff --git a/enhanced-resolve/lib/UseFilePlugin.d.ts b/enhanced-resolve/lib/UseFilePlugin.d.ts new file mode 100644 index 0000000000..c7d23c7b8d --- /dev/null +++ b/enhanced-resolve/lib/UseFilePlugin.d.ts @@ -0,0 +1,11 @@ +import Resolver = require('./Resolver'); +declare class UseFilePlugin { + source: string; + filename: string; + target: string; + + constructor(source: string, filename: string, target: string); + + apply(resolver: Resolver): void; +} +export = UseFilePlugin; diff --git a/enhanced-resolve/lib/common-types.d.ts b/enhanced-resolve/lib/common-types.d.ts new file mode 100644 index 0000000000..30c39d1210 --- /dev/null +++ b/enhanced-resolve/lib/common-types.d.ts @@ -0,0 +1,63 @@ +import { Context } from './concord'; + +export interface ResolveError extends Error { + details: string; + missing: string[]; + recursion: boolean; +} + +export interface ResolveParseResult { + request: string; + query: string; + module: boolean; + directory: boolean; + file: boolean; +} + +export interface ResolveResult { + path: boolean | string; + query: string; +} + +export interface ResolverRequest { + request: string; + relativePath?: string; + descriptionFileData?: any; + descriptionFileRoot?: string; + descriptionFilePath?: string; + context: Context; + path: string; + query?: string; + directory?: boolean; + module?: boolean; +} + +export interface LoggingCallbackTools { + log?(msg: string): void; + stack?: string[]; + missing?: string[] | { + push: (item: string) => void; + }; +} + +export interface LoggingCallbackWrapper extends LoggingCallbackTools { + (err?: Error | null, ...args: any[]): any; +} + +export interface ErrorCallback { + (err: Error | null, ...args: any[]): any; +} + +export interface CommonFileSystemMethod { + (name: string, callback: (err: Error | null, ...args: any[]) => void): void; +} + +export interface BaseFileSystem { + stat: CommonFileSystemMethod; + readdir?: CommonFileSystemMethod; + readFile?(path: string, encoding: string, callback: ErrorCallback): void; + readFile?(path: string, callback: ErrorCallback): void; + readJson?: CommonFileSystemMethod; + readlink?: CommonFileSystemMethod; + isSync: () => boolean; +} diff --git a/enhanced-resolve/lib/concord.d.ts b/enhanced-resolve/lib/concord.d.ts new file mode 100644 index 0000000000..d11f1047df --- /dev/null +++ b/enhanced-resolve/lib/concord.d.ts @@ -0,0 +1,38 @@ +export interface Type { + type: string | null | undefined; + features: string[]; +} + +export interface Context { + supportedResourceTypes?: string[]; + environments?: string[]; + referrer: string; +} + +declare function parseType(type: string): Type; +declare function isTypeMatched(baseType: string | Type, testedType: string | Type): boolean; +declare function isResourceTypeSupported(context: Context, type: string): boolean | undefined; +declare function isEnvironment(context: Context, env: string | Type): boolean | undefined; +declare function isGlobMatched(glob: string, relativePath: string): boolean; +declare function isConditionMatched(context: Context, condition: string): boolean; +declare function isKeyMatched(context: Context, key: string): string | boolean; +declare function getField(context: Context, configuration: any, field: string): undefined; +declare function getMain(context: Context, configuration: any): undefined; +declare function getExtensions(context: Context, configuration: any): undefined; +declare function matchModule(context: Context, configuration: any, request: string): any; +declare function matchType(context: Context, configuration: any, relativePath: string): undefined; + +export { + parseType, + isTypeMatched, + isResourceTypeSupported, + isEnvironment, + isGlobMatched, + isConditionMatched, + isKeyMatched, + getField, + getMain, + getExtensions, + matchModule, + matchType +}; diff --git a/enhanced-resolve/lib/getPaths.d.ts b/enhanced-resolve/lib/getPaths.d.ts new file mode 100644 index 0000000000..abc2754510 --- /dev/null +++ b/enhanced-resolve/lib/getPaths.d.ts @@ -0,0 +1,5 @@ +export default function getPaths(path: string): { + paths: string[]; + seqments: string[]; +}; +export declare function basename(path: string): string | null; diff --git a/enhanced-resolve/lib/globToRegExp.d.ts b/enhanced-resolve/lib/globToRegExp.d.ts new file mode 100644 index 0000000000..8fc134e6a8 --- /dev/null +++ b/enhanced-resolve/lib/globToRegExp.d.ts @@ -0,0 +1,2 @@ +declare function globToRegExp(glob: string): RegExp; +export { globToRegExp }; diff --git a/enhanced-resolve/lib/lib-tests.ts b/enhanced-resolve/lib/lib-tests.ts new file mode 100644 index 0000000000..a41e5d9aeb --- /dev/null +++ b/enhanced-resolve/lib/lib-tests.ts @@ -0,0 +1,149 @@ +import AliasFieldPlugin = require('enhanced-resolve/lib/AliasFieldPlugin'); + +import AliasPlugin = require('enhanced-resolve/lib/AliasPlugin'); + +import AppendPlugin = require('enhanced-resolve/lib/AppendPlugin'); + +import CloneBasenamePlugin = require('enhanced-resolve/lib/CloneBasenamePlugin'); + +import ConcordExtensionsPlugin = require('enhanced-resolve/lib/ConcordExtensionsPlugin'); + +import ConcordMainPlugin = require('enhanced-resolve/lib/ConcordMainPlugin'); + +import ConcordModulesPlugin = require('enhanced-resolve/lib/ConcordModulesPlugin'); + +import DescriptionFilePlugin = require('enhanced-resolve/lib/DescriptionFilePlugin'); + +import DescriptionFileUtils = require('enhanced-resolve/lib/DescriptionFileUtils'); + +import DirectoryExistsPlugin = require('enhanced-resolve/lib/DirectoryExistsPlugin'); + +import FileExistsPlugin = require('enhanced-resolve/lib/FileExistsPlugin'); + +import FileKindPlugin = require('enhanced-resolve/lib/FileKindPlugin'); + +import getPaths, { basename } from 'enhanced-resolve/lib/getPaths'; + +import { globToRegExp } from 'enhanced-resolve/lib/globToRegExp'; + +import JoinRequestPlugin = require('enhanced-resolve/lib/JoinRequestPlugin'); + +import LogInfoPlugin = require('enhanced-resolve/lib/LogInfoPlugin'); + +import MainFieldPlugin = require('enhanced-resolve/lib/MainFieldPlugin'); + +import ModuleAppendPlugin = require('enhanced-resolve/lib/ModuleAppendPlugin'); + +import ModuleKindPlugin = require('enhanced-resolve/lib/ModuleKindPlugin'); + +import ModulesInHierachicDirectoriesPlugin = require('enhanced-resolve/lib/ModulesInHierachicDirectoriesPlugin'); + +import ModulesInRootPlugin = require('enhanced-resolve/lib/ModulesInRootPlugin'); + +import NextPlugin = require('enhanced-resolve/lib/NextPlugin'); + +import ParsePlugin = require('enhanced-resolve/lib/ParsePlugin'); + +import Resolver = require('enhanced-resolve/lib/Resolver'); + +import ResultPlugin = require('enhanced-resolve/lib/ResultPlugin'); + +import Storage from 'enhanced-resolve/lib/Storage' + +import SymlinkPlugin = require('enhanced-resolve/lib/SymlinkPlugin'); + +import TryNextPlugin = require('enhanced-resolve/lib/TryNextPlugin'); + +import UnsafeCachePlugin = require('enhanced-resolve/lib/UnsafeCachePlugin'); + +import UseFilePlugin = require('enhanced-resolve/lib/UseFilePlugin'); + +import resolve = require('../'); + +import { BaseFileSystem } from 'enhanced-resolve/lib/common-types' + +const aplugin = new AliasFieldPlugin('a', 'b', 'c'); + +const aplugin2 = new AliasPlugin('a', { + onlyModule: false, + name: 'a', + alias: 'b' +}, 'string') + +const aplugin3 = new AppendPlugin('a', 'b', 'c'); + +const cplugin = new CloneBasenamePlugin('a', 'c'); + +const cplugin2 = new ConcordExtensionsPlugin('a', { + any: 'string', + right: false +}, 'b'); + +const cplugin3 = new ConcordMainPlugin('string', { + any: 'string', + right: false +}, 'string'); + +const cplugin4 = new ConcordModulesPlugin('string', { + any: 'string', + right: false +}, 'string'); + +const dplugin = new DescriptionFilePlugin('string', 'string', 'string'); + +DescriptionFileUtils.cdUp('./lib'); +DescriptionFileUtils.getField({}, 'hi'); +DescriptionFileUtils.loadDescriptionFile(resolve.ResolverFactory.createResolver({ + extensions: [''], + fileSystem: {} +}), './lib', ['file'], function () { }); + +const dplugin1 = new DirectoryExistsPlugin('string', 'string'); + +const fplugin = new FileExistsPlugin('string', 's'); + +const fplugin2 = new FileKindPlugin('string', 's'); + +getPaths('./lib'); + +basename('./lib'); + +globToRegExp('lib/**'); + +const jplugin = new JoinRequestPlugin('string', 's'); + +const lplugin = new LogInfoPlugin('string'); + +const mplugin = new MainFieldPlugin('string', { + name: 'hi', + forceRelative: false +}, 's'); + +const mplugin2 = new ModuleAppendPlugin('string', 'ap', 's'); + +const mplugin3 = new ModuleKindPlugin('string', 's'); + +const mplugin4 = new ModulesInHierachicDirectoriesPlugin('string', ['arr'], 's'); + +const mplugin5 = new ModulesInRootPlugin('string', 'ap', 's'); + +const nplugin = new NextPlugin('string', 'ap'); + +const pplugin = new ParsePlugin('string', 'ap'); + +const resolver = new Resolver({} as BaseFileSystem); + +const rplugin = new ResultPlugin('string'); + +const splugin = new SymlinkPlugin('string', 's'); + +const tplugin = new TryNextPlugin('string', 'ap', 's'); + +const uplugin = new UnsafeCachePlugin('string', function (e) { return false }, { + hi: 'string', + hello: true +}, 's'); + +const uplugin2 = new UseFilePlugin('string', 'ap', 's'); + +const s = new Storage(4); diff --git a/enhanced-resolve/tsconfig.json b/enhanced-resolve/tsconfig.json new file mode 100644 index 0000000000..11f69c0a9f --- /dev/null +++ b/enhanced-resolve/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "include": [ + "index.d.ts", + "enhanced-resolve-tests.ts", + "lib/*.ts" + ] +} \ No newline at end of file diff --git a/ent/tsconfig.json b/ent/tsconfig.json index 469af5853a..0944ccffd7 100644 --- a/ent/tsconfig.json +++ b/ent/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/envify/tsconfig.json b/envify/tsconfig.json index 6a01eb04a9..9d42c2c3b8 100644 --- a/envify/tsconfig.json +++ b/envify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/enzyme/enzyme-1.2.0.d.ts b/enzyme/enzyme-1.2.0.d.ts index c135267e95..865331529b 100644 --- a/enzyme/enzyme-1.2.0.d.ts +++ b/enzyme/enzyme-1.2.0.d.ts @@ -253,9 +253,9 @@ declare module "enzyme" { * * Returns itself. * @param fn A callback to be run for every node in the collection. Should expect a ShallowWrapper as the first - * argument, and will be run with a context of the original instance. + * argument, index as a second, and will be run with a context of the original instance. */ - forEach(fn: (wrapper: this) => any): this; + forEach(fn: (wrapper: this, index?: number) => any): this; /** * Maps the current array of nodes to another array. Each node is passed in as a ShallowWrapper to the map @@ -470,4 +470,4 @@ declare module "enzyme" { export function describeWithDOM(description: String, fn: Function): void; export function spyLifecycle(component: typeof Component): void; -} \ No newline at end of file +} diff --git a/enzyme/enzyme-tests.tsx b/enzyme/enzyme-tests.tsx index 490b708011..a97c33051e 100644 --- a/enzyme/enzyme-tests.tsx +++ b/enzyme/enzyme-tests.tsx @@ -1,4 +1,3 @@ -/* import { shallow, mount, render, describeWithDOM, spyLifecycle } from "enzyme"; import * as React from "react"; import {Component, ReactElement, HTMLAttributes} from "react"; @@ -39,7 +38,8 @@ namespace ShallowWrapperTest { objectVal: Object, boolVal: Boolean, stringVal: String, - elementWrapper: ShallowWrapper + numOrStringVal: number | string, + elementWrapper: ShallowWrapper, {}> function test_shallow_options() { shallow(, { @@ -201,7 +201,7 @@ namespace ShallowWrapperTest { } function test_state() { - shallowWrapper.state(); + const state: MyComponentState = shallowWrapper.state(); shallowWrapper.state('key'); const tmp: String = shallowWrapper.state('key'); } @@ -307,6 +307,10 @@ namespace ShallowWrapperTest { function test_isEmptyRender() { boolVal = shallowWrapper.isEmptyRender(); } + + function test_svg() { + numOrStringVal = shallowWrapper.find('svg').props().strokeWidth; + } } @@ -319,7 +323,7 @@ namespace ReactWrapperTest { objectVal: Object, boolVal: Boolean, stringVal: String, - elementWrapper: ReactWrapper + elementWrapper: ReactWrapper, {}> function test_unmount() { reactWrapper = reactWrapper.unmount(); @@ -593,7 +597,7 @@ namespace CheerioWrapperTest { objectVal: Object, boolVal: Boolean, stringVal: String, - elementWrapper: CheerioWrapper + elementWrapper: CheerioWrapper, {}> function test_find() { elementWrapper = cheerioWrapper.find('.selector'); @@ -821,4 +825,4 @@ namespace CheerioWrapperTest { function test_everyWhere() { boolVal = cheerioWrapper.everyWhere((aCheerioWrapper: CheerioWrapper) => true); } -}*/ \ No newline at end of file +} diff --git a/enzyme/index.d.ts b/enzyme/index.d.ts index ddbee13c28..63907a5c58 100644 --- a/enzyme/index.d.ts +++ b/enzyme/index.d.ts @@ -3,9 +3,9 @@ // Definitions by: Marian Palkus , Cap3 , Ivo Stratev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import { ReactElement, Component, StatelessComponent, ComponentClass, HTMLAttributes as ReactHTMLAttributes } from "react"; +import { ReactElement, Component, StatelessComponent, ComponentClass, HTMLAttributes as ReactHTMLAttributes, SVGAttributes as ReactSVGAttributes } from "react"; -type HTMLAttributes = ReactHTMLAttributes<{}>; +type HTMLAttributes = ReactHTMLAttributes<{}> & ReactSVGAttributes<{}>; export class ElementClass extends Component { } @@ -202,8 +202,9 @@ interface CommonWrapper { * Returns the state hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value. * @param [key] */ - state(key?: string): any; - state(key?: string): T; + state(): S; + state(key: string): any; + state(key: string): T; /** * Returns the context hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value. diff --git a/enzyme/tsconfig.json b/enzyme/tsconfig.json index eaac932c3d..36e7c95f0e 100644 --- a/enzyme/tsconfig.json +++ b/enzyme/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "jsx": "react", diff --git a/eonasdan-bootstrap-datetimepicker/tsconfig.json b/eonasdan-bootstrap-datetimepicker/tsconfig.json index 6820fa9d96..4f52c9b6ca 100644 --- a/eonasdan-bootstrap-datetimepicker/tsconfig.json +++ b/eonasdan-bootstrap-datetimepicker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/epiceditor/tsconfig.json b/epiceditor/tsconfig.json index 2a5571d66b..bd8de147cf 100644 --- a/epiceditor/tsconfig.json +++ b/epiceditor/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/epub/epub-tests.ts b/epub/epub-tests.ts index 6e61a26634..a69c543908 100644 --- a/epub/epub-tests.ts +++ b/epub/epub-tests.ts @@ -1,4 +1,3 @@ -/// import EPub = require("epub"); var epub = new EPub("./file.epub"); diff --git a/epub/epub.d.ts b/epub/index.d.ts similarity index 100% rename from epub/epub.d.ts rename to epub/index.d.ts diff --git a/epub/tsconfig.json b/epub/tsconfig.json index eda2b3868b..b94ee8f415 100644 --- a/epub/tsconfig.json +++ b/epub/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "epub.d.ts", + "index.d.ts", "epub-tests.ts" ] } \ No newline at end of file diff --git a/eq.js/tsconfig.json b/eq.js/tsconfig.json index 60aa90fe0c..5d9487eb7c 100644 --- a/eq.js/tsconfig.json +++ b/eq.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/error-stack-parser/tsconfig.json b/error-stack-parser/tsconfig.json index 9a7572784c..6c63c0e6fb 100644 --- a/error-stack-parser/tsconfig.json +++ b/error-stack-parser/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/errorhandler/tsconfig.json b/errorhandler/tsconfig.json index 5e9e29ac08..c22376c116 100644 --- a/errorhandler/tsconfig.json +++ b/errorhandler/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/es6-collections/tsconfig.json b/es6-collections/tsconfig.json index 784e334513..d793e9ed90 100644 --- a/es6-collections/tsconfig.json +++ b/es6-collections/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es5", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/es6-error/es6-error-tests.ts b/es6-error/es6-error-tests.ts new file mode 100644 index 0000000000..26ed7b6677 --- /dev/null +++ b/es6-error/es6-error-tests.ts @@ -0,0 +1,9 @@ +import * as ExtendableError from "es6-error" + +class TestError extends ExtendableError { + constructor (message: string = "TestError") { + super(message) + } +} + +throw new TestError("Test Message") diff --git a/es6-error/index.d.ts b/es6-error/index.d.ts new file mode 100644 index 0000000000..c1d3d5ce21 --- /dev/null +++ b/es6-error/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for es6-error v4.0.0 +// Project: https://github.com/bjyoungblood/es6-error +// Definitions by: Karol Janyst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = Error; diff --git a/es6-error/tsconfig.json b/es6-error/tsconfig.json new file mode 100644 index 0000000000..4a23838b2d --- /dev/null +++ b/es6-error/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "es6-error-tests.ts" + ] +} \ No newline at end of file diff --git a/es6-promise/tsconfig.json b/es6-promise/tsconfig.json index a78fa03c7b..72707cbc0e 100644 --- a/es6-promise/tsconfig.json +++ b/es6-promise/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es5", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/es6-shim/tsconfig.json b/es6-shim/tsconfig.json index 8e617f32a4..d295d24675 100644 --- a/es6-shim/tsconfig.json +++ b/es6-shim/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es5", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/escape-html/tsconfig.json b/escape-html/tsconfig.json index 52ef5bb749..d52ca70250 100644 --- a/escape-html/tsconfig.json +++ b/escape-html/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/escape-latex/tsconfig.json b/escape-latex/tsconfig.json index 446dc8a221..138ebb37fd 100644 --- a/escape-latex/tsconfig.json +++ b/escape-latex/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/escape-string-regexp/tsconfig.json b/escape-string-regexp/tsconfig.json index b37b33887a..6b780ce2d5 100644 --- a/escape-string-regexp/tsconfig.json +++ b/escape-string-regexp/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/escodegen/tsconfig.json b/escodegen/tsconfig.json index 29d35effcc..aaed59a511 100644 --- a/escodegen/tsconfig.json +++ b/escodegen/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/esprima-walk/tsconfig.json b/esprima-walk/tsconfig.json index 53ed459f2d..a4610b542b 100644 --- a/esprima-walk/tsconfig.json +++ b/esprima-walk/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/esprima/tsconfig.json b/esprima/tsconfig.json index 8f12c7ac38..90209d69d5 100644 --- a/esprima/tsconfig.json +++ b/esprima/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/estraverse/tsconfig.json b/estraverse/tsconfig.json index 805a458f73..75f8ac7884 100644 --- a/estraverse/tsconfig.json +++ b/estraverse/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ diff --git a/estree/tsconfig.json b/estree/tsconfig.json index a49a438bd5..94cc3546b6 100644 --- a/estree/tsconfig.json +++ b/estree/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "index.d.ts", "estree-tests.ts" ] -} +} \ No newline at end of file diff --git a/evaporate/tsconfig.json b/evaporate/tsconfig.json index fd68653b78..2a877b9fd5 100644 --- a/evaporate/tsconfig.json +++ b/evaporate/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/event-kit/event-kit-tests.ts b/event-kit/event-kit-tests.ts index 8c5969f756..4b4a0d4e7c 100644 --- a/event-kit/event-kit-tests.ts +++ b/event-kit/event-kit-tests.ts @@ -24,6 +24,7 @@ class User { } destroy(): void { + this.emitter.clear(); this.emitter.dispose(); } } @@ -39,6 +40,7 @@ var user = new User(); var subscription = user.onDidChangeName((name: string) => { console.log('User name change to: ' + name); }); +if(Disposable.isDisposable(subscription)) {} subscription.dispose(); // CompositeDisposable diff --git a/event-kit/index.d.ts b/event-kit/index.d.ts index de4e7a485c..0e2efc1e65 100644 --- a/event-kit/index.d.ts +++ b/event-kit/index.d.ts @@ -14,6 +14,10 @@ declare namespace AtomEventKit { interface DisposableStatic { prototype: Disposable; new (disposalAction: Function): Disposable; + /** + * Ensure that Object correctly implements the Disposable. + */ + isDisposable(object: Object): boolean; } /** Instance side of the Disposable class. */ @@ -59,6 +63,13 @@ declare namespace AtomEventKit { isDisposed: boolean; constructor: EmitterStatic; + /** + * Clear out any existing subscribers. + */ + clear(): void; + /** + * Unsubscribe all handlers. + */ dispose(): void; /** * Registers a handler to be invoked whenever the given event is emitted. diff --git a/event-kit/tsconfig.json b/event-kit/tsconfig.json index 981caf60ad..143f34bc08 100644 --- a/event-kit/tsconfig.json +++ b/event-kit/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/event-loop-lag/tsconfig.json b/event-loop-lag/tsconfig.json index c516a156ae..4a4a41de47 100644 --- a/event-loop-lag/tsconfig.json +++ b/event-loop-lag/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/event-stream/index.d.ts b/event-stream/index.d.ts index 6b78d7fc9a..55624833b4 100644 --- a/event-stream/index.d.ts +++ b/event-stream/index.d.ts @@ -1,39 +1,49 @@ -// Type definitions for event-stream v3.3.2 +// Type definitions for event-stream v3.3.2 // Project: https://github.com/dominictarr/event-stream // Definitions by: David Gardiner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// - import * as stream from 'stream'; +interface MapStream extends stream.Stream { + writable: boolean; + readable: boolean; + + destroy: () => void; + end: any; + pause: () => void; + resume: () => void; + write: any; +} + /** * Create a through stream from an asynchronous function * * @param asyncFunction */ -export declare function map(asyncFunction: Function): stream.Stream; +export declare function map(asyncFunction: Function): MapStream; /** * Same as map, but the callback is called synchronously. Based on es.through * @param syncFunction */ -export declare function mapSync(syncFunction: Function): stream.Stream; +export declare function mapSync(syncFunction: Function): MapStream; /** * Break up a stream and reassemble it so that each line is a chunk. matcher may be a String, or a RegExp * * @param matcher */ -export declare function split(matcher: string | RegExp): stream.Stream; +export declare function split(matcher: string | RegExp): MapStream; /** * Create a through stream that emits separator between each chunk, just like Array#join * * @param separator */ -export declare function join(separator: string): stream.Stream; +export declare function join(separator: string): MapStream; /** * Merges streams into one and returns it. Incoming data will be emitted as soon it comes into - no ordering will be applied @@ -42,7 +52,7 @@ export declare function join(separator: string): stream.Stream; * * @param stream */ -export declare function concat(...stream: stream.Stream[]): stream.Stream; +export declare function concat(...stream: MapStream[]): MapStream; /** * Merges streams into one and returns it. Incoming data will be emitted as soon it comes into - no ordering will be applied @@ -51,7 +61,7 @@ export declare function concat(...stream: stream.Stream[]): stream.Stream; * * @param stream */ -export declare function concat(streamArray: stream.Stream[]): stream.Stream; +export declare function concat(streamArray: MapStream[]): MapStream; /** * Merges streams into one and returns it. Incoming data will be emitted as soon it comes into - no ordering will be applied @@ -60,7 +70,7 @@ export declare function concat(streamArray: stream.Stream[]): stream.Stream; * * @param stream */ -export declare function merge(...stream: stream.Stream[]): stream.Stream; +export declare function merge(...stream: MapStream[]): MapStream; /** * Merges streams into one and returns it. Incoming data will be emitted as soon it comes into - no ordering will be applied @@ -69,14 +79,14 @@ export declare function merge(...stream: stream.Stream[]): stream.Stream; * * @param stream */ -export declare function merge(streamArray: stream.Stream[]): stream.Stream; +export declare function merge(streamArray: MapStream[]): MapStream; /** * Replace all occurrences of from with to * @param from * @param to */ -export declare function replace(from: string | RegExp, to: string | RegExp): stream.Stream; +export declare function replace(from: string | RegExp, to: string | RegExp): MapStream; /** * Convenience function for parsing JSON chunks. For newline separated JSON, use with es.split. @@ -88,33 +98,33 @@ export declare function parse(): any; /** * convert javascript objects into lines of text. The text will have whitespace escaped and have a \n appended, so it will be compatible with es.parse */ -export declare function stringify(): stream.Stream; +export declare function stringify(): MapStream; /** * create a readable stream (that respects pause) from an async function. * * @param asyncFunction */ -export declare function readable(asyncFunction: Function): stream.Stream; +export declare function readable(asyncFunction: Function): MapStream; /** * Create a readable stream from an Array. * * @param array */ -export declare function readArray(array: any[]): stream.Stream; +export declare function readArray(array: any[]): MapStream; /** * create a writeable stream from a callback * * @param callback */ -export declare function writeArray(callback: Function): stream.Stream; +export declare function writeArray(callback: Function): MapStream; /** * A stream that buffers all chunks when paused */ -export declare function pause(): stream.Stream | void; +export declare function pause(): MapStream | void; /** * Takes a writable stream and a readable stream and makes them appear as a readable writable stream. @@ -122,14 +132,14 @@ export declare function pause(): stream.Stream | void; * @param writeStream * @param readStream */ -export declare function duplex(writeStream: stream.Writable, readStream: stream.Readable): stream.Stream; +export declare function duplex(writeStream: stream.Writable, readStream: stream.Readable): MapStream; /** * Create a through stream from a child process * * @param child_process */ -export declare function child(child_process: any): stream.Stream; +export declare function child(child_process: any): MapStream; /** * waits for stream to emit 'end'. joins chunks of a stream into a single string or buffer. @@ -137,4 +147,4 @@ export declare function child(child_process: any): stream.Stream; * * @param callback */ -export declare function wait(callback: Function): stream.Stream; +export declare function wait(callback: Function): MapStream; diff --git a/event-stream/tsconfig.json b/event-stream/tsconfig.json index 46c3759724..8f749d93b5 100644 --- a/event-stream/tsconfig.json +++ b/event-stream/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/event-to-promise/event-to-promise-tests.ts b/event-to-promise/event-to-promise-tests.ts new file mode 100644 index 0000000000..2b99ddc62f --- /dev/null +++ b/event-to-promise/event-to-promise-tests.ts @@ -0,0 +1,21 @@ +import { EventEmitter } from 'events' + +import * as eventToPromise from 'event-to-promise' + + +{ + const ee = new EventEmitter() + const ep = eventToPromise(ee, 'custom') + + ep.then(console.log) + ee.emit('custom') +} + + +{ + const et = new EventTarget() + const tp = eventToPromise.multi(et, ['custom']) + + tp.then(console.log) + et.dispatchEvent(new Event('custom')) +} diff --git a/event-to-promise/index.d.ts b/event-to-promise/index.d.ts new file mode 100644 index 0000000000..aa491f0b0e --- /dev/null +++ b/event-to-promise/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for event-to-promise v0.7.0 +// Project: https://github.com/JsCommunity/event-to-promise +// Definitions by: flying-sheep +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { EventEmitter } from 'events' + +type EventSource = EventEmitter | EventTarget + +interface EventToPromiseOptions { + /** If true, all parameters of the emitted events are put in an array which is used to resolve/reject the promise. (default: `false`) */ + array?: boolean, + /** The name of the event which rejects the promise. (default: `'error'`) */ + error?: string, + /** Whether the error event should be ignored and not reject the promise. (default: `false`) */ + ignoreErrors?: boolean, +} + +/** + * Wait for one event. The first parameter of the emitted event is used to resolve/reject the promise. + * + * @param emitter The event emitter you want to watch an event on. + * @param event The name of the event you want to watch. + * @param options An `Object` controlling advanced options. + * @return The returned promise has a `cancel()` method which can be used to remove the event listeners. Note that the promise will never settled if canceled. + */ +declare function eventToPromise(emitter: EventSource, event: string, options?: EventToPromiseOptions): Promise; + +declare namespace eventToPromise { + /** + * Wait for one of multiple events. The array of all the parameters of the emitted event is used to resolve/reject the promise. + * + * The array also has an event property indicating which event has been emitted. + * + * @param emitter The event emitter you want to watch an event on. + * @param successEvents The names of the events which resolve the promise. + * @param errorEvents The names of the events which reject the promise. (default: `['error']`) + * @return The returned promise has a `cancel()` method which can be used to remove the event listeners. Note that the promise will never settled if canceled. + */ + export function multi(emitter: EventSource, successEvents: string[], errorEvents?: string[]): Promise; +} + +export = eventToPromise diff --git a/event-to-promise/tsconfig.json b/event-to-promise/tsconfig.json new file mode 100644 index 0000000000..64f14351b5 --- /dev/null +++ b/event-to-promise/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "event-to-promise-tests.ts" + ] +} \ No newline at end of file diff --git a/eventemitter2/eventemitter2-tests.ts b/eventemitter2/eventemitter2-tests.ts index 936366c0b9..8a7849abfa 100644 --- a/eventemitter2/eventemitter2-tests.ts +++ b/eventemitter2/eventemitter2-tests.ts @@ -18,7 +18,8 @@ function testConfiguration() { wildcard: true, delimiter: '::', newListener: false, - maxListeners: 20 + maxListeners: 20, + verboseMemoryLeak: true }); var bar = new EventEmitter2({}); var bazz = new EventEmitter2(); diff --git a/eventemitter2/index.d.ts b/eventemitter2/index.d.ts index de1be0d064..33ffe20b09 100644 --- a/eventemitter2/index.d.ts +++ b/eventemitter2/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for EventEmitter2 v0.14.4 +// Type definitions for EventEmitter2 v2.2.0 // Project: https://github.com/asyncly/EventEmitter2 // Definitions by: ryiwamoto // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -23,6 +23,11 @@ interface EventEmitter2Configuration { * max listeners that can be assigned to an event, default 10. */ maxListeners?: number; + + /** + * show event name in memory leak message when more than maximum amount of listeners is assigned, default false + */ + verboseMemoryLeak?: boolean; } declare class EventEmitter2 { diff --git a/eventemitter2/tsconfig.json b/eventemitter2/tsconfig.json index 546295a979..81724e58e7 100644 --- a/eventemitter2/tsconfig.json +++ b/eventemitter2/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/eventemitter3/eventemitter3-tests.ts b/eventemitter3/eventemitter3-tests.ts index c0a532fc87..9c8e379ec9 100644 --- a/eventemitter3/eventemitter3-tests.ts +++ b/eventemitter3/eventemitter3-tests.ts @@ -1,585 +1,116 @@ -/// -/// 'use strict'; -import EventEmitter = require('eventemitter3'); -import util = require('util'); -import * as EventEmitter3ImportedAsES6Module from 'eventemitter3'; +import * as EventEmitter from 'eventemitter3'; -declare namespace Assume { - interface Class { - new(...args: any[]): T; - } - - interface Assume { - equals(compare: T): Assume; - equal(compare: T): Assume; - eqls(compare: T): Assume; - is: Assume; - deep: Assume; - to: Assume; - either(arr: T[]): Assume; - instanceOf(clazz: Class): Assume; - a(typeofString: string): Assume; - } - - export function assume(input: T): Assume; -} - -let assume = Assume.assume; - -class EventEmitterTest { - v: any; +const eventName = 'test'; +const eventSymbol: symbol = Symbol('test'); +const fn = () => console.log(1); +// Extending EventEmitter +class TestEmitter extends EventEmitter { constructor() { - this.v = new EventEmitter(); - this.v = new EventEmitter3ImportedAsES6Module(); - - // Some methods are missing or incompatible with current implementation (v4.2.x) of NodeJS.EventEmitter - // (e.g. getMaxListenters or listeners) - // var n: NodeJS.EventEmitter = this.v; + super(); } - listeners() { - var v1: Function[] = this.v.listeners('click'); - } - - emit() { - var v1: boolean = this.v.emit('click'); - var v2: boolean = this.v.emit('click', 1); - var v3: boolean = this.v.emit('click', 1, '1'); - var v4: boolean = this.v.emit('click', 1, '1', true); - var v5: boolean = this.v.emit('click', 1, '1', true, new Date()); - } - - on() { - var fn = () => console.log(1); - var v1 = this.v.on('click', fn); - var v2 = this.v.on('click', fn, this); - } - - once() { - var fn = () => console.log(1); - var v1 = this.v.once('click', fn); - var v2 = this.v.once('click', fn, this); - } - - removeListener() { - var fn = () => console.log(1); - var v1 = this.v.removeListener('click', fn); - var v2 = this.v.removeListener('click', fn, true); - } - - removeAllListeners() { - var v1 = this.v.removeAllListeners('click'); - } - - off() { - var fn = () => console.log(1); - var v1 = this.v.off('click', fn); - var v2 = this.v.off('click', fn, true); - } - - addListener() { - var fn = () => console.log(1); - var v1 = this.v.addListener('click', fn); - var v2 = this.v.addListener('click', fn, this); - } - - setMaxListeners() { - var v1 = this.v.setMaxListeners(); + test() { + return this; } } +const ee: TestEmitter = new TestEmitter(); -describe('EventEmitter', function tests() { - 'use strict'; +// EventEmitter.prefixed +// should be boolean or string static property +const prefix = EventEmitter.prefixed; +if (typeof prefix === 'boolean') { + console.log(prefix.valueOf()); +} else { + console.log(prefix.length); +} - it('exposes a `prefixed` property', function () { - assume(EventEmitter.prefixed).is.either([false, '~']); - }); - - it('inherits when used with require(util).inherits', function () { - class Beast extends EventEmitter { - /* rawr, i'm a beast */ +// EventEmitter.eventNames() +// should return array of strings or symbols +ee.eventNames().every((event) => { + if (typeof event === 'symbol') { + return false; + } else { + return event.length > 0; } - - class BeastES6 extends EventEmitter3ImportedAsES6Module { - /* rawr, i'm a beast */ - } - - util.inherits(Beast, EventEmitter); - - var moop = new Beast() - , meap = new Beast(); - - assume(moop).is.instanceOf(Beast); - assume(moop).is.instanceOf(EventEmitter); - - moop.listeners(); - meap.listeners(); - - moop.on('data', function () { - throw new Error('I should not emit'); - }); - - meap.emit('data', 'rawr'); - meap.removeListener('foo'); - meap.removeAllListeners(); - }); - - describe('EventEmitter#emit', function () { - it('should return false when there are not events to emit', function () { - var e = new EventEmitter(); - - assume(e.emit('foo')).equals(false); - assume(e.emit('bar')).equals(false); - }); - - it('emits with context', function (done) { - var context = { bar: 'baz' } - , e = new EventEmitter(); - - e.on('foo', function (bar: string) { - assume(bar).equals('bar'); - assume(this).equals(context); - - done(); - }, context).emit('foo', 'bar'); - }); - - it('emits with context, multiple arguments (force apply)', function (done) { - var context = { bar: 'baz' } - , e = new EventEmitter(); - - e.on('foo', function (bar: string) { - assume(bar).equals('bar'); - assume(this).equals(context); - - done(); - }, context).emit('foo', 'bar', 1,2,3,4,5,6,7,8,9,0); - }); - - it('can emit the function with multiple arguments', function () { - var e = new EventEmitter(); - - for(var i = 0; i < 100; i++) { - (function (j: number) { - for (var i = 0, args: number[] = []; i < j; i++) { - args.push(j); - } - - e.once('args', function () { - assume(arguments.length).equals(args.length); - }); - - e.emit.apply(e, (['args'] as any[]).concat(args)); - })(i); - } - }); - - it('can emit the function with multiple arguments, multiple listeners', function () { - var e = new EventEmitter(); - - for(var i = 0; i < 100; i++) { - (function (j: number) { - for (var i = 0, args: number[] = []; i < j; i++) { - args.push(j); - } - - e.once('args', function () { - assume(arguments.length).equals(args.length); - }); - - e.once('args', function () { - assume(arguments.length).equals(args.length); - }); - - e.once('args', function () { - assume(arguments.length).equals(args.length); - }); - - e.once('args', function () { - assume(arguments.length).equals(args.length); - }); - - e.emit.apply(e, (['args'] as any[]).concat(args)); - })(i); - } - }); - - it('emits with context, multiple listeners (force loop)', function () { - var e = new EventEmitter(); - - e.on('foo', function (bar: string) { - assume(this).eqls({ foo: 'bar' }); - assume(bar).equals('bar'); - }, { foo: 'bar' }); - - e.on('foo', function (bar: string) { - assume(this).eqls({ bar: 'baz' }); - assume(bar).equals('bar'); - }, { bar: 'baz' }); - - e.emit('foo', 'bar'); - }); - - it('emits with different contexts', function () { - var e = new EventEmitter() - , pattern = ''; - - function writer() { - pattern += this; - } - - e.on('write', writer, 'foo'); - e.on('write', writer, 'baz'); - e.once('write', writer, 'bar'); - e.once('write', writer, 'banana'); - - e.emit('write'); - assume(pattern).equals('foobazbarbanana'); - }); - - it('should return true when there are events to emit', function (done) { - var e = new EventEmitter(); - - e.on('foo', function () { - process.nextTick(done); - }); - - assume(e.emit('foo')).equals(true); - assume(e.emit('foob')).equals(false); - }); - - it('receives the emitted events', function (done) { - var e = new EventEmitter(); - - e.on('data', function (a: string, b: any, c: Date, d: void, undef: void) { - assume(a).equals('foo'); - assume(b).equals(e); - assume(c).is.instanceOf(Date); - assume(undef).equals(undefined); - assume(arguments.length).equals(3); - - done(); - }); - - e.emit('data', 'foo', e, new Date()); - }); - - it('emits to all event listeners', function () { - var e = new EventEmitter() - , pattern: string[] = []; - - e.on('foo', function () { - pattern.push('foo1'); - }); - - e.on('foo', function () { - pattern.push('foo2'); - }); - - e.emit('foo'); - - assume(pattern.join(';')).equals('foo1;foo2'); - }); - - (function each(keys: string[]) { - var key = keys.shift(); - - if (!key) return; - - it('can store event which is a known property: '+ key, function (next) { - var e = new EventEmitter(); - - e.on(key, function (key: string) { - assume(key).equals(key); - next(); - }).emit(key, key); - }); - - each(keys); - })([ - 'hasOwnProperty', - 'constructor', - '__proto__', - 'toString', - 'toValue', - 'unwatch', - 'watch' - ]); - }); - - describe('EventEmitter#listeners', function () { - it('returns an empty array if no listeners are specified', function () { - var e = new EventEmitter(); - - assume(e.listeners('foo')).is.a('array'); - assume(e.listeners('foo').length).equals(0); - }); - - it('returns an array of function', function () { - var e = new EventEmitter(); - - function foo() {} - - e.on('foo', foo); - assume(e.listeners('foo')).is.a('array'); - assume(e.listeners('foo').length).equals(1); - assume(e.listeners('foo')).deep.equals([foo]); - }); - - it('is not vulnerable to modifications', function () { - var e = new EventEmitter(); - - function foo() {} - - e.on('foo', foo); - - assume(e.listeners('foo')).deep.equals([foo]); - - e.listeners('foo').length = 0; - assume(e.listeners('foo')).deep.equals([foo]); - }); - - it('can return a boolean as indication if listeners exist', function () { - var e = new EventEmitter(); - - function foo() {} - - e.once('once', foo); - e.once('multiple', foo); - e.once('multiple', foo); - e.on('on', foo); - e.on('multi', foo); - e.on('multi', foo); - - assume(e.listeners('foo', true)).equals(false); - assume(e.listeners('multiple', true)).equals(true); - assume(e.listeners('on', true)).equals(true); - assume(e.listeners('multi', true)).equals(true); - - e.removeAllListeners(); - - assume(e.listeners('multiple', true)).equals(false); - assume(e.listeners('on', true)).equals(false); - assume(e.listeners('multi', true)).equals(false); - }); - }); - - describe('EventEmitter#once', function () { - it('only emits it once', function () { - var e = new EventEmitter() - , calls = 0; - - e.once('foo', function () { - calls++; - }); - - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - - assume(e.listeners('foo').length).equals(0); - assume(calls).equals(1); - }); - - it('only emits once if emits are nested inside the listener', function () { - var e = new EventEmitter() - , calls = 0; - - e.once('foo', function () { - calls++; - e.emit('foo'); - }); - - e.emit('foo'); - assume(e.listeners('foo').length).equals(0); - assume(calls).equals(1); - }); - - it('only emits once for multiple events', function () { - var e = new EventEmitter() - , multi = 0 - , foo = 0 - , bar = 0; - - e.once('foo', function () { - foo++; - }); - - e.once('foo', function () { - bar++; - }); - - e.on('foo', function () { - multi++; - }); - - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - e.emit('foo'); - - assume(e.listeners('foo').length).equals(1); - assume(multi).equals(5); - assume(foo).equals(1); - assume(bar).equals(1); - }); - - it('only emits once with context', function (done) { - var context = { foo: 'bar' } - , e = new EventEmitter(); - - e.once('foo', function (bar: string) { - assume(this).equals(context); - assume(bar).equals('bar'); - - done(); - }, context).emit('foo', 'bar'); - }); - }); - - describe('EventEmitter#removeListener', function () { - it('should only remove the event with the specified function', function () { - var e = new EventEmitter(); - - function bar() {} - e.on('foo', function () {}); - e.on('bar', function () {}); - e.on('bar', bar); - - assume(e.removeListener('foo', bar)).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.listeners('bar').length).equals(2); - - assume(e.removeListener('foo')).equals(e); - assume(e.listeners('foo').length).equals(0); - assume(e.listeners('bar').length).equals(2); - - assume(e.removeListener('bar', bar)).equals(e); - assume(e.listeners('bar').length).equals(1); - assume(e.removeListener('bar')).equals(e); - assume(e.listeners('bar').length).equals(0); - }); - - it('should only remove once events when using the once flag', function () { - var e = new EventEmitter(); - - function foo() {} - e.on('foo', foo); - - assume(e.removeListener('foo', function () {}, undefined, true)).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.removeListener('foo', foo, undefined, true)).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.removeListener('foo', foo)).equals(e); - assume(e.listeners('foo').length).equals(0); - - e.on('foo', foo); - e.once('foo', foo); - - assume(e.removeListener('foo', function () {}, undefined, true)).equals(e); - assume(e.listeners('foo').length).equals(2); - assume(e.removeListener('foo', foo, undefined, true)).equals(e); - assume(e.listeners('foo').length).equals(1); - - e.once('foo', foo); - - assume(e.removeListener('foo', foo)).equals(e); - assume(e.listeners('foo').length).equals(0); - }); - - it('should only remove listeners matching the correct context', function () { - var e = new EventEmitter() - , context = { foo: 'bar' }; - - function foo() {} - function bar() {} - e.on('foo', foo, context); - - assume(e.listeners('foo').length).equals(1); - assume(e.removeListener('foo', function () {}, context)).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.removeListener('foo', foo, { baz: 'quux' })).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.removeListener('foo', foo, context)).equals(e); - assume(e.listeners('foo').length).equals(0); - - e.on('foo', foo, context); - e.on('foo', bar); - - assume(e.listeners('foo').length).equals(2); - assume(e.removeListener('foo', foo, { baz: 'quux' })).equals(e); - assume(e.listeners('foo').length).equals(2); - assume(e.removeListener('foo', foo, context)).equals(e); - assume(e.listeners('foo').length).equals(1); - assume(e.listeners('foo')[0]).equals(bar); - - e.on('foo', foo, context); - - assume(e.listeners('foo').length).equals(2); - assume(e.removeAllListeners('foo')).equals(e); - assume(e.listeners('foo').length).equals(0); - }); - }); - - describe('EventEmitter#removeAllListeners', function () { - it('removes all events for the specified events', function () { - var e = new EventEmitter(); - - e.on('foo', function () { throw new Error('oops'); }); - e.on('foo', function () { throw new Error('oops'); }); - e.on('bar', function () { throw new Error('oops'); }); - e.on('aaa', function () { throw new Error('oops'); }); - - assume(e.removeAllListeners('foo')).equals(e); - assume(e.listeners('foo').length).equals(0); - assume(e.listeners('bar').length).equals(1); - assume(e.listeners('aaa').length).equals(1); - - assume(e.removeAllListeners('bar')).equals(e); - assume(e.removeAllListeners('aaa')).equals(e); - - assume(e.emit('foo')).equals(false); - assume(e.emit('bar')).equals(false); - assume(e.emit('aaa')).equals(false); - }); - - it('just nukes the fuck out of everything', function () { - var e = new EventEmitter(); - - e.on('foo', function () { throw new Error('oops'); }); - e.on('foo', function () { throw new Error('oops'); }); - e.on('bar', function () { throw new Error('oops'); }); - e.on('aaa', function () { throw new Error('oops'); }); - - assume(e.removeAllListeners()).equals(e); - assume(e.listeners('foo').length).equals(0); - assume(e.listeners('bar').length).equals(0); - assume(e.listeners('aaa').length).equals(0); - - assume(e.emit('foo')).equals(false); - assume(e.emit('bar')).equals(false); - assume(e.emit('aaa')).equals(false); - }); - }); - - describe('#setMaxListeners', function () { - it('is a function', function () { - var e = new EventEmitter(); - - assume(e.setMaxListeners).is.a('function'); - }); - - it('returns self when called', function () { - var e = new EventEmitter(); - - assume(e.setMaxListeners()).to.equal(e); - }); - }); }); + +// EventEmitter.listeners() +// should return array of functions +ee.listeners(eventName).map((listener) => { + return listener.bind(this); +}); +// should accept symbol as event name +ee.listeners(eventSymbol).map((listener) => { + return listener.bind(this); +}); +// should return boolean with 'exists' flag +const hasListeners: boolean = ee.listeners(eventName, true); + +// EventEmitter.emit() +// should support any number of arguments +ee.emit(eventName, 1, true, {}, [], 'test', Symbol(), null); +// should accept symbol as event name +ee.emit(eventSymbol); + +// EventEmitter.addListener() and EventEmitter.on() +// should accept function +ee.on(eventName, fn); +ee.addListener(eventName, fn); +// should accept optional context argument +ee.on(eventName, fn, this); +ee.addListener(eventName, fn, this); +// should accept symbol as event name +ee.on(eventSymbol, fn); +ee.addListener(eventSymbol, fn); +// should support fluent interface +ee.on(eventSymbol, fn).test(); +ee.addListener(eventSymbol, fn).test(); + +// EventEmitter.once() +// should accept event name and function +ee.once(eventName, fn); +// should accept optional context argument +ee.once(eventName, fn, this); +ee.once(eventName, fn, {}); +// should accept symbol as event name +ee.once(eventSymbol, fn); +// should support fluent interface +ee.once(eventSymbol, fn).test(); + +// EventEmitter.removeListener() and EventEmitter.off() +// should accept event name +ee.removeListener(eventName); +ee.off(eventName); +// should accept optional function +ee.removeListener(eventName, fn); +ee.off(eventName, fn); +// should accept optional context argument +ee.removeListener(eventName, fn, {}); +ee.off(eventName, fn, {}); +// should accept optional boolean flag for removing listeners added with `EventEmitter.once()` +ee.removeListener(eventName, fn, null, true); +ee.off(eventName, fn, null, true); +// should accept symbol as event name +ee.removeListener(eventSymbol); +ee.off(eventSymbol); +// should support fluent interface +ee.removeListener(eventName).test(); +ee.off(eventName).test(); + +// EventEmitter.removeAllListeners() +// should not require any arguments +ee.removeAllListeners(); +// should accept optional event name +ee.removeAllListeners(eventName); +// should accept symbol as event name +ee.removeAllListeners(eventSymbol); +// should support fluent interface +ee.removeAllListeners(eventName).test(); + +// EventEmitter.setMaxListeners() +// should support fluent interface +ee.setMaxListeners().test(); \ No newline at end of file diff --git a/eventemitter3/eventemitter3-tests.ts.tscparams b/eventemitter3/eventemitter3-tests.ts.tscparams new file mode 100644 index 0000000000..30c9419a57 --- /dev/null +++ b/eventemitter3/eventemitter3-tests.ts.tscparams @@ -0,0 +1 @@ +-m commonjs diff --git a/eventemitter3/index.d.ts b/eventemitter3/index.d.ts index 31ede80c21..9c1fe2397e 100644 --- a/eventemitter3/index.d.ts +++ b/eventemitter3/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for EventEmitter3 1.1.1 +// Type definitions for EventEmitter3 1.2.0 // Project: https://github.com/primus/eventemitter3 -// Definitions by: Yuichi Murata , Leon Yu +// Definitions by: Yuichi Murata , Leon Yu , Boriss Nazarovs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = EventEmitter; @@ -10,6 +10,10 @@ declare namespace EventEmitter { } type self = EventEmitter; +/** + * Minimal EventEmitter interface that is molded against the Node.js + * EventEmitter interface. + */ declare class EventEmitter { static prefixed: string | boolean; @@ -28,96 +32,91 @@ declare class EventEmitter { constructor(); /** - * Return a list of assigned event listeners. + * Return an array listing the events for which the emitter has registered listeners. * - * @param {String} event The events that should be listed. - * @returns {Array} - * @api public + * @returns {(string | symbol)[]} */ - listeners(event?: string): Function[]; + eventNames(): (string | symbol)[]; /** - * Return a list of assigned event listeners. + * Return the listeners registered for a given event. * - * @param {String} event The events that should be listed. - * @param {Boolean} exists We only need to know if there are listeners. - * @returns {Boolean} - * @api public + * @param {(string | symbol)} event The event name. + * @returns {Function[]} */ - listeners(event: string, param: boolean): boolean; + listeners(event: string | symbol): Function[]; /** - * Emit an event to all registered event listeners. + * Check if there listeners for a given event. + * If `exists` argument is not `true` lists listeners. * - * @param {String} event The name of the event. - * @returns {Boolean} Indication if we've emitted an event. - * @api public + * @param {(string | symbol)} event The event name. + * @param {boolean} exists Only check if there are listeners. + * @returns {boolean} */ - emit(event: string, ...args: any[]): boolean; + listeners(event: string | symbol, exists: boolean): boolean; /** - * Register a new EventListener for the given event. + * Calls each of the listeners registered for a given event. * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} [context=this] The context of the function. - * @api public + * @param {(string | symbol)} event The event name. + * @param {...*} args Arguments that are passed to registered listeners + * @returns {boolean} `true` if the event had listeners, else `false`. */ - on(event: string, fn: Function, context?: any): EventEmitter; + emit(event: string | symbol, ...args: any[]): boolean; /** - * Add an EventListener that's only called once. + * Add a listener for a given event. * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} [context=this] The context of the function. - * @api public + * @param {(string | symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. */ - once(event: string, fn: Function, context?: any): EventEmitter; + on(event: string | symbol, fn: Function, context?: any): this; /** - * Remove event listeners. + * Add a one-time listener for a given event. * - * @param {String} event The event we want to remove. - * @param {Function} fn The listener that we need to find. - * @param {Mixed} context Only remove listeners matching this context. - * @param {Boolean} once Only remove once listeners. - * @api public + * @param {(string | symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. */ - removeListener(event: string, fn?: Function, context?: any, once?: boolean): EventEmitter; + once(event: string | symbol, fn: Function, context?: any): this; /** - * Remove all listeners or only the listeners for the specified event. + * Remove the listeners of a given event. * - * @param {String} event The event want to remove all listeners for. - * @api public + * @param {(string | symbol)} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {*} context Only remove the listeners that have this context. + * @param {boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. */ - removeAllListeners(event?: string): EventEmitter; + removeListener(event: string | symbol, fn?: Function, context?: any, once?: boolean): this; /** - * Remove event listeners. + * Remove all listeners, or those of the specified event. * - * @param {String} event The event we want to remove. - * @param {Function} fn The listener that we need to find. - * @param {Mixed} context Only remove listeners matching this context. - * @param {Boolean} once Only remove once listeners. - * @api public + * @param {(string | symbol)} event The event name. + * @returns {EventEmitter} `this`. */ - off(event: string, fn?: Function, context?: any, once?: boolean): EventEmitter; + removeAllListeners(event?: string | symbol): this; /** - * Register a new EventListener for the given event. - * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} [context=this] The context of the function. - * @api public + * Alias method for `removeListener` */ - addListener(event: string, fn: Function, context?: any): EventEmitter; + off(event: string | symbol, fn?: Function, context?: any, once?: boolean): this; + + /** + * Alias method for `on` + */ + addListener(event: string | symbol, fn: Function, context?: any): this; /** * This function doesn't apply anymore. * @deprecated */ - setMaxListeners(): EventEmitter; + setMaxListeners(): this; } diff --git a/eventemitter3/tsconfig.json b/eventemitter3/tsconfig.json index 318c6be4c5..5714fe51bd 100644 --- a/eventemitter3/tsconfig.json +++ b/eventemitter3/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/evernote/tsconfig.json b/evernote/tsconfig.json index e583e75556..3724b2ac71 100644 --- a/evernote/tsconfig.json +++ b/evernote/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/exit/tsconfig.json b/exit/tsconfig.json index 54d3780938..1546c4e44c 100644 --- a/exit/tsconfig.json +++ b/exit/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/exorcist/exorcist-tests.ts b/exorcist/exorcist-tests.ts index 26a1be0e07..3ac0d35c28 100644 --- a/exorcist/exorcist-tests.ts +++ b/exorcist/exorcist-tests.ts @@ -1,5 +1,3 @@ -/// - import exorcist = require("exorcist"); module ExorcistTest { diff --git a/exorcist/exorcist.d.ts b/exorcist/index.d.ts similarity index 100% rename from exorcist/exorcist.d.ts rename to exorcist/index.d.ts diff --git a/exorcist/tsconfig.json b/exorcist/tsconfig.json index e0ca3628a8..20b19e5baa 100644 --- a/exorcist/tsconfig.json +++ b/exorcist/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "exorcist.d.ts", + "index.d.ts", "exorcist-tests.ts" ] } \ No newline at end of file diff --git a/expect.js/tsconfig.json b/expect.js/tsconfig.json index a6f3c8297f..5a50085673 100644 --- a/expect.js/tsconfig.json +++ b/expect.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/expect/expect-tests.ts b/expect/expect-tests.ts index 09277eec1f..69ed58b956 100644 --- a/expect/expect-tests.ts +++ b/expect/expect-tests.ts @@ -1,9 +1,9 @@ /// -import expect, - {Expectation, Extension, Spy, createSpy, isSpy, assert, spyOn, extend, restoreSpies} +import {Expectation, Extension, Spy, createSpy, isSpy, assert, spyOn, extend, restoreSpies} from 'expect'; +import * as expect from 'expect'; describe('chaining assertions', function () { it('should allow chaining for array-like applications', function () { diff --git a/expect/index.d.ts b/expect/index.d.ts index f2c25f6225..d43bcda98a 100644 --- a/expect/index.d.ts +++ b/expect/index.d.ts @@ -3,68 +3,70 @@ // Definitions by: Justin Reidy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare namespace expect { + export class Expectation { + constructor(actual: any); + toExist(message?: string): Expectation; + toBeTruthy(message?: string): Expectation; + toNotExist(message?: string): Expectation; + toBeFalsy(message?: string): Expectation; + toBe(value: any, message?: string): Expectation; + toNotBe(value: any, message?: string): Expectation; + toEqual(value: any, message?: string): Expectation; + toNotEqual(value: any, message?: string): Expectation; + toThrow(value?: any, message?: string): Expectation; + toNotThrow(value?: any, message?: string): Expectation; + toBeA(value: any, message?: string): Expectation; + toBeAn(value: any, message?: string): Expectation; + toNotBeA(value: any, message?: string): Expectation; + toNotBeAn(value: any, message?: string): Expectation; + toMatch(value: any, message?: string): Expectation; + toNotMatch(value: any, message?: string): Expectation; + toBeLessThan(value: any, message?: string): Expectation; + toBeFewerThan(value: any, message?: string): Expectation; + toBeGreaterThan(value: any, message?: string): Expectation; + toBeMoreThan(value: any, message?: string): Expectation; + toInclude(value: any, compareValues?: any, message?: string): Expectation; + toContain(value: any, compareValues?: any, message?: string): Expectation; + toExclude(value: any, compareValues?: any, message?: string): Expectation; + toNotContain(value: any, compareValues?: any, message?: string): Expectation; + toHaveBeenCalled(message?: string): Expectation; + toHaveBeenCalledWith(...args: Array): Expectation; + toNotHaveBeenCalled(message?: string): Expectation; + withContext(context: any): Expectation; + withArgs(...args: Array): Expectation; + } + + export interface Extension { + [name: string]: (args?: Array) => void; + } + + export interface Call { + context: Spy; + arguments: Array; + } + + export interface Spy { + __isSpy: Boolean; + calls: Array; + andCall(fn: Function): Spy; + andCallThrough(): Spy; + andThrow(object: Object): Spy; + andReturn(value: any): Spy; + getLastCall(): Call; + restore(): void; + destroy(): void; + } + + + export function createSpy(fn?: Function, restore?: Function): Spy; + export function spyOn(object: Object, methodName: string): Spy; + export function isSpy(object: any): Boolean; + export function restoreSpies(): void; + export function assert(condition: any, messageFormat: string, ...extraArgs: Array): void; + export function extend(extension: Extension): void; -export declare class Expectation { - constructor(actual: any); - toExist(message?: string): Expectation; - toBeTruthy(message?: string): Expectation; - toNotExist(message?: string): Expectation; - toBeFalsy(message?: string): Expectation; - toBe(value: any, message?: string): Expectation; - toNotBe(value: any, message?: string): Expectation; - toEqual(value: any, message?: string): Expectation; - toNotEqual(value: any, message?: string): Expectation; - toThrow(value?: any, message?: string): Expectation; - toNotThrow(value?: any, message?: string): Expectation; - toBeA(value: any, message?: string): Expectation; - toBeAn(value: any, message?: string): Expectation; - toNotBeA(value: any, message?: string): Expectation; - toNotBeAn(value: any, message?: string): Expectation; - toMatch(value: any, message?: string): Expectation; - toNotMatch(value: any, message?: string): Expectation; - toBeLessThan(value: any, message?: string): Expectation; - toBeFewerThan(value: any, message?: string): Expectation; - toBeGreaterThan(value: any, message?: string): Expectation; - toBeMoreThan(value: any, message?: string): Expectation; - toInclude(value: any, compareValues?: any, message?: string): Expectation; - toContain(value: any, compareValues?: any, message?: string): Expectation; - toExclude(value: any, compareValues?: any, message?: string): Expectation; - toNotContain(value: any, compareValues?: any, message?: string): Expectation; - toHaveBeenCalled(message?: string): Expectation; - toHaveBeenCalledWith(...args: Array): Expectation; - toNotHaveBeenCalled(message?: string): Expectation; - withContext(context: any): Expectation; - withArgs(...args: Array): Expectation; } +declare function expect(actual: any): expect.Expectation; -export interface Extension { - [name: string]: (args?: Array) => void; -} - -export interface Call { - context: Spy; - arguments: Array; -} - -export interface Spy { - __isSpy: Boolean; - calls: Array; - andCall(fn: Function): Spy; - andCallThrough(): Spy; - andThrow(object: Object): Spy; - andReturn(value: any): Spy; - getLastCall(): Call; - restore(): void; - destroy(): void; -} - -declare function expect(actual: any): Expectation; - -export declare function createSpy(fn?: Function, restore?: Function): Spy; -export declare function spyOn(object: Object, methodName: string): Spy; -export declare function isSpy(object: any): Boolean; -export declare function restoreSpies(): void; -export declare function assert(condition: any, messageFormat: string, ...extraArgs: Array): void; -export declare function extend(extension: Extension): void; - -export default expect; +export = expect; diff --git a/expect/tsconfig.json b/expect/tsconfig.json index 4104b4dd8f..d0951714c3 100644 --- a/expect/tsconfig.json +++ b/expect/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/expectations/tsconfig.json b/expectations/tsconfig.json index be2bd60783..2bba50037a 100644 --- a/expectations/tsconfig.json +++ b/expectations/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-brute-memcached/tsconfig.json b/express-brute-memcached/tsconfig.json index 35d65101c2..d8b35dcfa4 100644 --- a/express-brute-memcached/tsconfig.json +++ b/express-brute-memcached/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-brute-mongo/tsconfig.json b/express-brute-mongo/tsconfig.json index 38fc174e95..a420e9ac53 100644 --- a/express-brute-mongo/tsconfig.json +++ b/express-brute-mongo/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-brute/index.d.ts b/express-brute/index.d.ts index 3f0c3927b9..b6a60d4247 100644 --- a/express-brute/index.d.ts +++ b/express-brute/index.d.ts @@ -7,58 +7,6 @@ import express = require("express"); -/** - * @summary Options for {@link MemoryStore} class. - * @interface - */ -interface MemoryStoreOptions { - /** - * @summary Key prefix. - * @type {string} - */ - prefix: string; -} - -/** - * @summary Options for {@link ExpressBrute#getMiddleware} class. - * @interface - */ -interface ExpressBruteMiddleware { - /** - * @summary Allows you to override the value of failCallback for this middleware. - * @type {Function} - */ - failCallback: Function; - - /** - * @summary Disregard IP address when matching requests if set to true. Defaults to false. - * @type {boolean} - */ - ignoreIP: boolean; - - /** - * @summary Key. - * @type {any} - */ - key: any; -} - -/** - * @summary Options for {@link ExpressBrute} class. - * @interface - */ -interface ExpressBruteOptions { - freeRetries?: number; - proxyDepth?: number; - attachResetToRequest?: boolean; - refreshTimeoutOnRequest?: boolean; - minWait?: number; - maxWait?: number; - lifetime?: number; - failCallback?: (req: express.Request, res: express.Response, next: Function, nextValidRequestDate: any) => void; - handleStoreError?: any; -} - /** * @summary Middleware. * @class @@ -69,20 +17,13 @@ declare class ExpressBrute { * @constructor * @param {any} store The store. */ - constructor(store: any, options?: ExpressBruteOptions); + constructor(store: any, options?: ExpressBrute.Options); /** * @summary Generates middleware that will bounce requests with the same key and IP address that happen faster than the current wait time by calling failCallback. * @param {Object} options The options. */ - getMiddleware(options: ExpressBruteMiddleware): express.RequestHandler; - - /** - * @summary Uses the current proxy trust settings to get the current IP from a request object. - * @param {Request} request The HTTP request. - * @return {RequestHandler} The Request handler. - */ - getIPFromRequest(request: express.Request): express.RequestHandler; + getMiddleware(options: ExpressBrute.Middleware): express.RequestHandler; /** * @summary Middleware that will bounce requests that happen faster than the current wait time by calling failCallback. @@ -104,6 +45,81 @@ declare class ExpressBrute { } declare namespace ExpressBrute { + /** + * @summary Options for {@link MemoryStore} class. + * @interface + */ + export interface MemoryStoreOptions { + /** + * @summary Key prefix. + * @type {string} + */ + prefix: string; + } + + /** + * @summary Options for {@link ExpressBrute#getMiddleware} class. + * @interface + */ + export interface Middleware { + /** + * @summary Allows you to override the value of failCallback for this middleware. + * @type {Function} + */ + failCallback: Function; + + /** + * @summary Disregard IP address when matching requests if set to true. Defaults to false. + * @type {boolean} + */ + ignoreIP: boolean; + + /** + * @summary Key. + * @type {any} + */ + key: any; + } + + /** + * @summary Options for {@link ExpressBrute} class. + * @interface + */ + export interface Options { + /** + * @summary The number of retires the user has before they need to start waiting (default: 2) + */ + freeRetries?: number; + /** + * @summary Specify whether or not a simplified reset method should be attached at req.brute.reset. The simplified method takes only a callback, and resets all ExpressBrute middleware that was called on the current request. If multiple instances of ExpressBrute have middleware on the same request, only those with attachResetToRequest set to true will be reset (default: true) + */ + attachResetToRequest?: boolean; + /** + * @summary Defines whether the lifetime counts from the time of the last request that ExpressBrute didn't prevent for a given IP (true) or from of that IP's first request (false). Useful for allowing limits over fixed periods of time, for example: a limited number of requests per day. (Default: true). + */ + refreshTimeoutOnRequest?: boolean; + /** + * @summary The initial wait time (in milliseconds) after the user runs out of retries (default: 500 milliseconds) + */ + minWait?: number; + /** + * @summary The maximum amount of time (in milliseconds) between requests the user needs to wait (default: 15 minutes). The wait for a given request is determined by adding the time the user needed to wait for the previous two requests. + */ + maxWait?: number; + /** + * @summary The length of time (in seconds since the last request) to remember the number of requests that have been made by an IP. By default it will be set to maxWait * the number of attempts before you hit maxWait to discourage simply waiting for the lifetime to expire before resuming an attack. With default values this is about 6 hours. + */ + lifetime?: number; + /** + * @summary Gets called with (req, res, next, nextValidRequestDate) when a request is rejected (default: ExpressBrute.FailForbidden) + */ + failCallback?: (req: express.Request, res: express.Response, next: Function, nextValidRequestDate: any) => void; + /** + * @summary Gets called whenever an error occurs with the persistent store from which ExpressBrute cannot recover. It is passed an object containing the properties message (a description of the message), parent (the error raised by the session store), and [key, ip] or [req, res, next] depending on whether or the error occurs during reset or in the middleware itself. + */ + handleStoreError?: any; + } + /** * @summary In-memory store. * @class diff --git a/express-brute/tsconfig.json b/express-brute/tsconfig.json index 1f567e59c6..3b9c199b3a 100644 --- a/express-brute/tsconfig.json +++ b/express-brute/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-debug/index.d.ts b/express-debug/index.d.ts index 2a0fbd6d51..546e26fbf4 100644 --- a/express-debug/index.d.ts +++ b/express-debug/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for express-debug 1.1.1 +// Type definitions for express-debug 1.1.1 // Project: https://github.com/devoidfury/express-debug // Definitions by: Federico Bond // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/express-debug/tsconfig.json b/express-debug/tsconfig.json index bdf56f354d..826a832751 100644 --- a/express-debug/tsconfig.json +++ b/express-debug/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-domain-middleware/express-domain-middleware-tests.ts b/express-domain-middleware/express-domain-middleware-tests.ts index 446b732353..b506726ada 100644 --- a/express-domain-middleware/express-domain-middleware-tests.ts +++ b/express-domain-middleware/express-domain-middleware-tests.ts @@ -1,2 +1 @@ -/// import fn = require('express-domain-middleware'); diff --git a/express-domain-middleware/express-domain-middleware.d.ts b/express-domain-middleware/index.d.ts similarity index 100% rename from express-domain-middleware/express-domain-middleware.d.ts rename to express-domain-middleware/index.d.ts diff --git a/express-domain-middleware/tsconfig.json b/express-domain-middleware/tsconfig.json index 456e26404a..c3a9ab1a66 100644 --- a/express-domain-middleware/tsconfig.json +++ b/express-domain-middleware/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "express-domain-middleware.d.ts", + "index.d.ts", "express-domain-middleware-tests.ts" ] } \ No newline at end of file diff --git a/express-formidable/express-formidable-tests.ts b/express-formidable/express-formidable-tests.ts new file mode 100644 index 0000000000..91f9e34519 --- /dev/null +++ b/express-formidable/express-formidable-tests.ts @@ -0,0 +1,16 @@ +import express = require("express"); +import expform = require("express-formidable"); + +const app = express(); + +app.use("/form1", expform()); +app.use("/form2", expform({ + encoding: "utf-8", + uploadDir: "./uploads", + keepExtensions: true, + type: "multipart", + maxFieldsSize: 3 * 1024 * 1024, + maxFields: 50, + hash: "sha1", + multiples: true +})); diff --git a/express-formidable/index.d.ts b/express-formidable/index.d.ts new file mode 100644 index 0000000000..57342521c2 --- /dev/null +++ b/express-formidable/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for express-formidable 1.0.0 +// Project: https://github.com/noraesae/express-formidable +// Definitions by: Torkild Dyvik Olsen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { RequestHandler } from "express"; + +interface ExpressFormidableOptions { + encoding?: string; + uploadDir?: string; + keepExtensions?: boolean; + type?: "multipart" | "urlencoded"; + maxFieldsSize?: number; + maxFields?: number; + hash?: boolean | "sha1" | "md5"; + multiples?: boolean; +} + +declare function ExpressFormidable(options?: ExpressFormidableOptions): RequestHandler; + +export = ExpressFormidable; diff --git a/express-formidable/tsconfig.json b/express-formidable/tsconfig.json new file mode 100644 index 0000000000..6fc2b97031 --- /dev/null +++ b/express-formidable/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "express-formidable-tests.ts" + ] +} \ No newline at end of file diff --git a/express-graphql/tsconfig.json b/express-graphql/tsconfig.json index da54b5b932..2cbe212ca0 100644 --- a/express-graphql/tsconfig.json +++ b/express-graphql/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-handlebars/tsconfig.json b/express-handlebars/tsconfig.json index eb75d51daf..42c08f6a57 100644 --- a/express-handlebars/tsconfig.json +++ b/express-handlebars/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-jwt/tsconfig.json b/express-jwt/tsconfig.json index 8a0394afe8..041a2dbedf 100644 --- a/express-jwt/tsconfig.json +++ b/express-jwt/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-less/tsconfig.json b/express-less/tsconfig.json index 58cba4c862..40a9e40fa3 100644 --- a/express-less/tsconfig.json +++ b/express-less/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-minify/tsconfig.json b/express-minify/tsconfig.json index 22ea0211a9..f7dfdebee8 100644 --- a/express-minify/tsconfig.json +++ b/express-minify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-mung/tsconfig.json b/express-mung/tsconfig.json index 94a428f3e6..4e798d527c 100644 --- a/express-mung/tsconfig.json +++ b/express-mung/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-myconnection/tsconfig.json b/express-myconnection/tsconfig.json index e8c9a41f1e..262ba970d4 100644 --- a/express-myconnection/tsconfig.json +++ b/express-myconnection/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-openapi/tsconfig.json b/express-openapi/tsconfig.json index 299f0341a8..95627f6d01 100644 --- a/express-openapi/tsconfig.json +++ b/express-openapi/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-partials/tsconfig.json b/express-partials/tsconfig.json index 66d16771da..59f2db277d 100644 --- a/express-partials/tsconfig.json +++ b/express-partials/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-route-fs/tsconfig.json b/express-route-fs/tsconfig.json index a502dd4df4..7af2cf8650 100644 --- a/express-route-fs/tsconfig.json +++ b/express-route-fs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-serve-static-core/index.d.ts b/express-serve-static-core/index.d.ts index 92f27d5df8..932b8075b1 100644 --- a/express-serve-static-core/index.d.ts +++ b/express-serve-static-core/index.d.ts @@ -5,1101 +5,1101 @@ // This extracts the core definitions from express to prevent a circular dependency between express and serve-static /// -declare namespace Express { - - // These open interfaces may be extended in an application-specific manner via declaration merging. - // See for example method-override.d.ts (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/method-override/method-override.d.ts) - export interface Request { } - export interface Response { } - export interface Application { } -} - -declare module "express-serve-static-core" { - import * as http from "http"; - - interface NextFunction { - (err?: any): void; - } - - interface RequestHandler { - (req: Request, res: Response, next: NextFunction): any; - } - - interface ErrorRequestHandler { - (err: any, req: Request, res: Response, next: NextFunction): any; - } - - type PathParams = string | RegExp | (string | RegExp)[]; - - type RequestHandlerParams = RequestHandler | ErrorRequestHandler | (RequestHandler | ErrorRequestHandler)[]; - - interface IRouterMatcher { - (path: PathParams, ...handlers: RequestHandler[]): T; - (path: PathParams, ...handlers: RequestHandlerParams[]): T; - } - - interface IRouterHandler { - (...handlers: RequestHandler[]): T; - (...handlers: RequestHandlerParams[]): T; - } - - interface IRouter extends RequestHandler { - /** - * Map the given param placeholder `name`(s) to the given callback(s). - * - * Parameter mapping is used to provide pre-conditions to routes - * which use normalized placeholders. For example a _:user_id_ parameter - * could automatically load a user's information from the database without - * any additional code, - * - * The callback uses the samesignature as middleware, the only differencing - * being that the value of the placeholder is passed, in this case the _id_ - * of the user. Once the `next()` function is invoked, just like middleware - * it will continue on to execute the route, or subsequent parameter functions. - * - * app.param('user_id', function(req, res, next, id){ - * User.find(id, function(err, user){ - * if (err) { - * next(err); - * } else if (user) { - * req.user = user; - * next(); - * } else { - * next(new Error('failed to load user')); - * } - * }); - * }); - * - * @param name - * @param fn - */ - param(name: string, handler: RequestParamHandler): this; - // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API - // deprecated since express 4.11.0 - param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; - - /** - * Special-cased "all" method, applying the given route `path`, - * middleware, and callback to _every_ HTTP method. - * - * @param path - * @param fn - */ - all: IRouterMatcher; - get: IRouterMatcher; - post: IRouterMatcher; - put: IRouterMatcher; - delete: IRouterMatcher; - patch: IRouterMatcher; - options: IRouterMatcher; - head: IRouterMatcher; - - checkout: IRouterMatcher; - copy: IRouterMatcher; - lock: IRouterMatcher; - merge: IRouterMatcher; - mkactivity: IRouterMatcher; - mkcol: IRouterMatcher; - move: IRouterMatcher; - "m-search": IRouterMatcher; - notify: IRouterMatcher; - purge: IRouterMatcher; - report: IRouterMatcher; - search: IRouterMatcher; - subscribe: IRouterMatcher; - trace: IRouterMatcher; - unlock: IRouterMatcher; - unsubscribe: IRouterMatcher; - - use: IRouterHandler & IRouterMatcher; - - route(prefix: PathParams): IRoute; - /** - * Stack of configured routes - */ - stack: any[]; - } - - interface IRoute { - path: string; - stack: any; - all: IRouterHandler; - get: IRouterHandler; - post: IRouterHandler; - put: IRouterHandler; - delete: IRouterHandler; - patch: IRouterHandler; - options: IRouterHandler; - head: IRouterHandler; - - checkout: IRouterHandler; - copy: IRouterHandler; - lock: IRouterHandler; - merge: IRouterHandler; - mkactivity: IRouterHandler; - mkcol: IRouterHandler; - move: IRouterHandler; - "m-search": IRouterHandler; - notify: IRouterHandler; - purge: IRouterHandler; - report: IRouterHandler; - search: IRouterHandler; - subscribe: IRouterHandler; - trace: IRouterHandler; - unlock: IRouterHandler; - unsubscribe: IRouterHandler - } - - export interface Router extends IRouter { } - - interface CookieOptions { - maxAge?: number; - signed?: boolean; - expires?: Date | boolean; - httpOnly?: boolean; - path?: string; - domain?: string; - secure?: boolean | 'auto'; - } - - interface Errback { (err: Error): void; } - - interface Request extends http.IncomingMessage, Express.Request { - - /** - * Return request header. - * - * The `Referrer` header field is special-cased, - * both `Referrer` and `Referer` are interchangeable. - * - * Examples: - * - * req.get('Content-Type'); - * // => "text/plain" - * - * req.get('content-type'); - * // => "text/plain" - * - * req.get('Something'); - * // => undefined - * - * Aliased as `req.header()`. - * - * @param name - */ - get(name: string): string; - - header(name: string): string; - - headers: { [key: string]: string; }; - - /** - * Check if the given `type(s)` is acceptable, returning - * the best match when true, otherwise `undefined`, in which - * case you should respond with 406 "Not Acceptable". - * - * The `type` value may be a single mime type string - * such as "application/json", the extension name - * such as "json", a comma-delimted list such as "json, html, text/plain", - * or an array `["json", "html", "text/plain"]`. When a list - * or array is given the _best_ match, if any is returned. - * - * Examples: - * - * // Accept: text/html - * req.accepts('html'); - * // => "html" - * - * // Accept: text/*, application/json - * req.accepts('html'); - * // => "html" - * req.accepts('text/html'); - * // => "text/html" - * req.accepts('json, text'); - * // => "json" - * req.accepts('application/json'); - * // => "application/json" - * - * // Accept: text/*, application/json - * req.accepts('image/png'); - * req.accepts('png'); - * // => undefined - * - * // Accept: text/*;q=.5, application/json - * req.accepts(['html', 'json']); - * req.accepts('html, json'); - * // => "json" - */ - accepts(): string[]; - accepts(type: string): string | boolean; - accepts(type: string[]): string | boolean; - accepts(...type: string[]): string | boolean; - - /** - * Returns the first accepted charset of the specified character sets, - * based on the request's Accept-Charset HTTP header field. - * If none of the specified charsets is accepted, returns false. - * - * For more information, or if you have issues or concerns, see accepts. - * @param charset - */ - acceptsCharsets(): string[]; - acceptsCharsets(charset: string): string | boolean; - acceptsCharsets(charset: string[]): string | boolean; - acceptsCharsets(...charset: string[]): string | boolean; - - /** - * Returns the first accepted encoding of the specified encodings, - * based on the request's Accept-Encoding HTTP header field. - * If none of the specified encodings is accepted, returns false. - * - * For more information, or if you have issues or concerns, see accepts. - * @param encoding - */ - acceptsEncodings(): string[]; - acceptsEncodings(encoding: string): string | boolean; - acceptsEncodings(encoding: string[]): string | boolean; - acceptsEncodings(...encoding: string[]): string | boolean; - - /** - * Returns the first accepted language of the specified languages, - * based on the request's Accept-Language HTTP header field. - * If none of the specified languages is accepted, returns false. - * - * For more information, or if you have issues or concerns, see accepts. - * - * @param lang - */ - acceptsLanguages(): string[]; - acceptsLanguages(lang: string): string | boolean; - acceptsLanguages(lang: string[]): string | boolean; - acceptsLanguages(...lang: string[]): string | boolean; - - /** - * Parse Range header field, - * capping to the given `size`. - * - * Unspecified ranges such as "0-" require - * knowledge of your resource length. In - * the case of a byte range this is of course - * the total number of bytes. If the Range - * header field is not given `null` is returned, - * `-1` when unsatisfiable, `-2` when syntactically invalid. - * - * NOTE: remember that ranges are inclusive, so - * for example "Range: users=0-3" should respond - * with 4 users when available, not 3. - * - * @param size - */ - range(size: number): any[]; - - /** - * Return an array of Accepted media types - * ordered from highest quality to lowest. - */ - accepted: MediaType[]; - - /** - * @deprecated Use either req.params, req.body or req.query, as applicable. - * - * Return the value of param `name` when present or `defaultValue`. - * - * - Checks route placeholders, ex: _/user/:id_ - * - Checks body params, ex: id=12, {"id":12} - * - Checks query string params, ex: ?id=12 - * - * To utilize request bodies, `req.body` - * should be an object. This can be done by using - * the `connect.bodyParser()` middleware. - * - * @param name - * @param defaultValue - */ - param(name: string, defaultValue?: any): string; - - /** - * Check if the incoming request contains the "Content-Type" - * header field, and it contains the give mime `type`. - * - * Examples: - * - * // With Content-Type: text/html; charset=utf-8 - * req.is('html'); - * req.is('text/html'); - * req.is('text/*'); - * // => true - * - * // When Content-Type is application/json - * req.is('json'); - * req.is('application/json'); - * req.is('application/*'); - * // => true - * - * req.is('html'); - * // => false - * - * @param type - */ - is(type: string): boolean; - - /** - * Return the protocol string "http" or "https" - * when requested with TLS. When the "trust proxy" - * setting is enabled the "X-Forwarded-Proto" header - * field will be trusted. If you're running behind - * a reverse proxy that supplies https for you this - * may be enabled. - */ - protocol: string; - - /** - * Short-hand for: - * - * req.protocol == 'https' - */ - secure: boolean; - - /** - * Return the remote address, or when - * "trust proxy" is `true` return - * the upstream addr. - */ - ip: string; - - /** - * When "trust proxy" is `true`, parse - * the "X-Forwarded-For" ip address list. - * - * For example if the value were "client, proxy1, proxy2" - * you would receive the array `["client", "proxy1", "proxy2"]` - * where "proxy2" is the furthest down-stream. - */ - ips: string[]; - - /** - * Return subdomains as an array. - * - * Subdomains are the dot-separated parts of the host before the main domain of - * the app. By default, the domain of the app is assumed to be the last two - * parts of the host. This can be changed by setting "subdomain offset". - * - * For example, if the domain is "tobi.ferrets.example.com": - * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`. - * If "subdomain offset" is 3, req.subdomains is `["tobi"]`. - */ - subdomains: string[]; - - /** - * Short-hand for `url.parse(req.url).pathname`. - */ - path: string; - - /** - * Parse the "Host" header field hostname. - */ - hostname: string; - - /** - * @deprecated Use hostname instead. - */ - host: string; - - /** - * Check if the request is fresh, aka - * Last-Modified and/or the ETag - * still match. - */ - fresh: boolean; - - /** - * Check if the request is stale, aka - * "Last-Modified" and / or the "ETag" for the - * resource has changed. - */ - stale: boolean; - - /** - * Check if the request was an _XMLHttpRequest_. - */ - xhr: boolean; - - //body: { username: string; password: string; remember: boolean; title: string; }; - body: any; - - //cookies: { string; remember: boolean; }; - cookies: any; - - method: string; - - params: any; - - /** - * Clear cookie `name`. - * - * @param name - * @param options - */ - clearCookie(name: string, options?: any): Response; - - query: any; - - route: any; - - signedCookies: any; - - originalUrl: string; - - url: string; - - baseUrl: string; - - app: Application; - } - - interface MediaType { - value: string; - quality: number; - type: string; - subtype: string; - } - - interface Send { - (status: number, body?: any): Response; - (body?: any): Response; - } - - interface Response extends http.ServerResponse, Express.Response { - /** - * Set status `code`. - * - * @param code - */ - status(code: number): Response; - - /** - * Set the response HTTP status code to `statusCode` and send its string representation as the response body. - * @link http://expressjs.com/4x/api.html#res.sendStatus - * - * Examples: - * - * res.sendStatus(200); // equivalent to res.status(200).send('OK') - * res.sendStatus(403); // equivalent to res.status(403).send('Forbidden') - * res.sendStatus(404); // equivalent to res.status(404).send('Not Found') - * res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error') - * - * @param code - */ - sendStatus(code: number): Response; - - /** - * Set Link header field with the given `links`. - * - * Examples: - * - * res.links({ - * next: 'http://api.example.com/users?page=2', - * last: 'http://api.example.com/users?page=5' - * }); - * - * @param links - */ - links(links: any): Response; - - /** - * Send a response. - * - * Examples: - * - * res.send(new Buffer('wahoo')); - * res.send({ some: 'json' }); - * res.send('

some html

'); - * res.send(404, 'Sorry, cant find that'); - * res.send(404); - */ - send: Send; - - /** - * Send JSON response. - * - * Examples: - * - * res.json(null); - * res.json({ user: 'tj' }); - * res.json(500, 'oh noes!'); - * res.json(404, 'I dont have that'); - */ - json: Send; - - /** - * Send JSON response with JSONP callback support. - * - * Examples: - * - * res.jsonp(null); - * res.jsonp({ user: 'tj' }); - * res.jsonp(500, 'oh noes!'); - * res.jsonp(404, 'I dont have that'); - */ - jsonp: Send; - - /** - * Transfer the file at the given `path`. - * - * Automatically sets the _Content-Type_ response header field. - * The callback `fn(err)` is invoked when the transfer is complete - * or when an error occurs. Be sure to check `res.sentHeader` - * if you wish to attempt responding, as the header and some data - * may have already been transferred. - * - * Options: - * - * - `maxAge` defaulting to 0 (can be string converted by `ms`) - * - `root` root directory for relative filenames - * - `headers` object of headers to serve with file - * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them - * - * Other options are passed along to `send`. - * - * Examples: - * - * The following example illustrates how `res.sendFile()` may - * be used as an alternative for the `static()` middleware for - * dynamic situations. The code backing `res.sendFile()` is actually - * the same code, so HTTP cache support etc is identical. - * - * app.get('/user/:uid/photos/:file', function(req, res){ - * var uid = req.params.uid - * , file = req.params.file; - * - * req.user.mayViewFilesFrom(uid, function(yes){ - * if (yes) { - * res.sendFile('/uploads/' + uid + '/' + file); - * } else { - * res.send(403, 'Sorry! you cant see that.'); - * } - * }); - * }); - * - * @api public - */ - sendFile(path: string): void; - sendFile(path: string, options: any): void; - sendFile(path: string, fn: Errback): void; - sendFile(path: string, options: any, fn: Errback): void; - - /** - * @deprecated Use sendFile instead. - */ - sendfile(path: string): void; - /** - * @deprecated Use sendFile instead. - */ - sendfile(path: string, options: any): void; - /** - * @deprecated Use sendFile instead. - */ - sendfile(path: string, fn: Errback): void; - /** - * @deprecated Use sendFile instead. - */ - sendfile(path: string, options: any, fn: Errback): void; - - /** - * Transfer the file at the given `path` as an attachment. - * - * Optionally providing an alternate attachment `filename`, - * and optional callback `fn(err)`. The callback is invoked - * when the data transfer is complete, or when an error has - * ocurred. Be sure to check `res.headerSent` if you plan to respond. - * - * This method uses `res.sendfile()`. - */ - download(path: string): void; - download(path: string, filename: string): void; - download(path: string, fn: Errback): void; - download(path: string, filename: string, fn: Errback): void; - - /** - * Set _Content-Type_ response header with `type` through `mime.lookup()` - * when it does not contain "/", or set the Content-Type to `type` otherwise. - * - * Examples: - * - * res.type('.html'); - * res.type('html'); - * res.type('json'); - * res.type('application/json'); - * res.type('png'); - * - * @param type - */ - contentType(type: string): Response; - - /** - * Set _Content-Type_ response header with `type` through `mime.lookup()` - * when it does not contain "/", or set the Content-Type to `type` otherwise. - * - * Examples: - * - * res.type('.html'); - * res.type('html'); - * res.type('json'); - * res.type('application/json'); - * res.type('png'); - * - * @param type - */ - type(type: string): Response; - - /** - * Respond to the Acceptable formats using an `obj` - * of mime-type callbacks. - * - * This method uses `req.accepted`, an array of - * acceptable types ordered by their quality values. - * When "Accept" is not present the _first_ callback - * is invoked, otherwise the first match is used. When - * no match is performed the server responds with - * 406 "Not Acceptable". - * - * Content-Type is set for you, however if you choose - * you may alter this within the callback using `res.type()` - * or `res.set('Content-Type', ...)`. - * - * res.format({ - * 'text/plain': function(){ - * res.send('hey'); - * }, - * - * 'text/html': function(){ - * res.send('

hey

'); - * }, - * - * 'appliation/json': function(){ - * res.send({ message: 'hey' }); - * } - * }); - * - * In addition to canonicalized MIME types you may - * also use extnames mapped to these types: - * - * res.format({ - * text: function(){ - * res.send('hey'); - * }, - * - * html: function(){ - * res.send('

hey

'); - * }, - * - * json: function(){ - * res.send({ message: 'hey' }); - * } - * }); - * - * By default Express passes an `Error` - * with a `.status` of 406 to `next(err)` - * if a match is not made. If you provide - * a `.default` callback it will be invoked - * instead. - * - * @param obj - */ - format(obj: any): Response; - - /** - * Set _Content-Disposition_ header to _attachment_ with optional `filename`. - * - * @param filename - */ - attachment(filename?: string): Response; - - /** - * Set header `field` to `val`, or pass - * an object of header fields. - * - * Examples: - * - * res.set('Foo', ['bar', 'baz']); - * res.set('Accept', 'application/json'); - * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' }); - * - * Aliased as `res.header()`. - */ - set(field: any): Response; - set(field: string, value?: string): Response; - - header(field: any): Response; - header(field: string, value?: string): Response; - - // Property indicating if HTTP headers has been sent for the response. - headersSent: boolean; - - /** - * Get value for header `field`. - * - * @param field - */ - get(field: string): string; - - /** - * Clear cookie `name`. - * - * @param name - * @param options - */ - clearCookie(name: string, options?: any): Response; - - /** - * Set cookie `name` to `val`, with the given `options`. - * - * Options: - * - * - `maxAge` max-age in milliseconds, converted to `expires` - * - `signed` sign the cookie - * - `path` defaults to "/" - * - * Examples: - * - * // "Remember Me" for 15 minutes - * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true }); - * - * // save as above - * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true }) - */ - cookie(name: string, val: string, options: CookieOptions): Response; - cookie(name: string, val: any, options: CookieOptions): Response; - cookie(name: string, val: any): Response; - - /** - * Set the location header to `url`. - * - * The given `url` can also be the name of a mapped url, for - * example by default express supports "back" which redirects - * to the _Referrer_ or _Referer_ headers or "/". - * - * Examples: - * - * res.location('/foo/bar').; - * res.location('http://example.com'); - * res.location('../login'); // /blog/post/1 -> /blog/login - * - * Mounting: - * - * When an application is mounted and `res.location()` - * is given a path that does _not_ lead with "/" it becomes - * relative to the mount-point. For example if the application - * is mounted at "/blog", the following would become "/blog/login". - * - * res.location('login'); - * - * While the leading slash would result in a location of "/login": - * - * res.location('/login'); - * - * @param url - */ - location(url: string): Response; - - /** - * Redirect to the given `url` with optional response `status` - * defaulting to 302. - * - * The resulting `url` is determined by `res.location()`, so - * it will play nicely with mounted apps, relative paths, - * `"back"` etc. - * - * Examples: - * - * res.redirect('/foo/bar'); - * res.redirect('http://example.com'); - * res.redirect(301, 'http://example.com'); - * res.redirect('http://example.com', 301); - * res.redirect('../login'); // /blog/post/1 -> /blog/login - */ - redirect(url: string): void; - redirect(status: number, url: string): void; - redirect(url: string, status: number): void; - - /** - * Render `view` with the given `options` and optional callback `fn`. - * When a callback function is given a response will _not_ be made - * automatically, otherwise a response of _200_ and _text/html_ is given. - * - * Options: - * - * - `cache` boolean hinting to the engine it should cache - * - `filename` filename of the view being rendered - */ - render(view: string, options?: Object, callback?: (err: Error, html: string) => void): void; - render(view: string, callback?: (err: Error, html: string) => void): void; - - locals: any; - - charset: string; - - /** - * Adds the field to the Vary response header, if it is not there already. - * Examples: - * - * res.vary('User-Agent').render('docs'); - * - */ - vary(field: string): Response; - } - - interface Handler extends RequestHandler { } - - interface RequestParamHandler { - (req: Request, res: Response, next: NextFunction, value: any, name: string): any; - } - - interface Application extends IRouter, Express.Application { - /** - * Express instance itself is a request handler, which could be invoked without - * third argument. - */ - (req: Request, res: Response): any; - - /** - * Initialize the server. - * - * - setup default configuration - * - setup default middleware - * - setup route reflection methods - */ - init(): void; - - /** - * Initialize application configuration. - */ - defaultConfiguration(): void; - - /** - * Register the given template engine callback `fn` - * as `ext`. - * - * By default will `require()` the engine based on the - * file extension. For example if you try to render - * a "foo.jade" file Express will invoke the following internally: - * - * app.engine('jade', require('jade').__express); - * - * For engines that do not provide `.__express` out of the box, - * or if you wish to "map" a different extension to the template engine - * you may use this method. For example mapping the EJS template engine to - * ".html" files: - * - * app.engine('html', require('ejs').renderFile); - * - * In this case EJS provides a `.renderFile()` method with - * the same signature that Express expects: `(path, options, callback)`, - * though note that it aliases this method as `ejs.__express` internally - * so if you're using ".ejs" extensions you dont need to do anything. - * - * Some template engines do not follow this convention, the - * [Consolidate.js](https://github.com/visionmedia/consolidate.js) - * library was created to map all of node's popular template - * engines to follow this convention, thus allowing them to - * work seamlessly within Express. - */ - engine(ext: string, fn: Function): Application; - - /** - * Assign `setting` to `val`, or return `setting`'s value. - * - * app.set('foo', 'bar'); - * app.get('foo'); - * // => "bar" - * app.set('foo', ['bar', 'baz']); - * app.get('foo'); - * // => ["bar", "baz"] - * - * Mounted servers inherit their parent server's settings. - * - * @param setting - * @param val - */ - set(setting: string, val: any): Application; - get: {(name: string): any;} & IRouterMatcher; - - param(name: string | string[], handler: RequestParamHandler): this; - // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API - param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; - - /** - * Return the app's absolute pathname - * based on the parent(s) that have - * mounted it. - * - * For example if the application was - * mounted as "/admin", which itself - * was mounted as "/blog" then the - * return value would be "/blog/admin". - */ - path(): string; - - /** - * Check if `setting` is enabled (truthy). - * - * app.enabled('foo') - * // => false - * - * app.enable('foo') - * app.enabled('foo') - * // => true - */ - enabled(setting: string): boolean; - - /** - * Check if `setting` is disabled. - * - * app.disabled('foo') - * // => true - * - * app.enable('foo') - * app.disabled('foo') - * // => false - * - * @param setting - */ - disabled(setting: string): boolean; - - /** - * Enable `setting`. - * - * @param setting - */ - enable(setting: string): Application; - - /** - * Disable `setting`. - * - * @param setting - */ - disable(setting: string): Application; - - /** - * Configure callback for zero or more envs, - * when no `env` is specified that callback will - * be invoked for all environments. Any combination - * can be used multiple times, in any order desired. - * - * Examples: - * - * app.configure(function(){ - * // executed for all envs - * }); - * - * app.configure('stage', function(){ - * // executed staging env - * }); - * - * app.configure('stage', 'production', function(){ - * // executed for stage and production - * }); - * - * Note: - * - * These callbacks are invoked immediately, and - * are effectively sugar for the following: - * - * var env = process.env.NODE_ENV || 'development'; - * - * switch (env) { - * case 'development': - * ... - * break; - * case 'stage': - * ... - * break; - * case 'production': - * ... - * break; - * } - * - * @param env - * @param fn - */ - configure(fn: Function): Application; - configure(env0: string, fn: Function): Application; - configure(env0: string, env1: string, fn: Function): Application; - configure(env0: string, env1: string, env2: string, fn: Function): Application; - configure(env0: string, env1: string, env2: string, env3: string, fn: Function): Application; - configure(env0: string, env1: string, env2: string, env3: string, env4: string, fn: Function): Application; - - /** - * Render the given view `name` name with `options` - * and a callback accepting an error and the - * rendered template string. - * - * Example: - * - * app.render('email', { name: 'Tobi' }, function(err, html){ - * // ... - * }) - * - * @param name - * @param options or fn - * @param fn - */ - render(name: string, options?: Object, callback?: (err: Error, html: string) => void): void; - render(name: string, callback: (err: Error, html: string) => void): void; - - - /** - * Listen for connections. - * - * A node `http.Server` is returned, with this - * application (which is a `Function`) as its - * callback. If you wish to create both an HTTP - * and HTTPS server you may do so with the "http" - * and "https" modules as shown here: - * - * var http = require('http') - * , https = require('https') - * , express = require('express') - * , app = express(); - * - * http.createServer(app).listen(80); - * https.createServer({ ... }, app).listen(443); - */ - listen(port: number, hostname: string, backlog: number, callback?: Function): http.Server; - listen(port: number, hostname: string, callback?: Function): http.Server; - listen(port: number, callback?: Function): http.Server; - listen(path: string, callback?: Function): http.Server; - listen(handle: any, listeningListener?: Function): http.Server; - - router: string; - - settings: any; - - resource: any; - - map: any; - - locals: any; - - /** - * The app.routes object houses all of the routes defined mapped by the - * associated HTTP verb. This object may be used for introspection - * capabilities, for example Express uses this internally not only for - * routing but to provide default OPTIONS behaviour unless app.options() - * is used. Your application or framework may also remove routes by - * simply by removing them from this object. - */ - routes: any; - - /** - * Used to get all registered routes in Express Application - */ - _router: any; - } - - interface Express extends Application { - request: Request; - - response: Response; +declare global { + namespace Express { + + // These open interfaces may be extended in an application-specific manner via declaration merging. + // See for example method-override.d.ts (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/method-override/method-override.d.ts) + export interface Request { } + export interface Response { } + export interface Application { } } } + +import * as http from "http"; + +interface NextFunction { + (err?: any): void; +} + +interface RequestHandler { + (req: Request, res: Response, next: NextFunction): any; +} + +interface ErrorRequestHandler { + (err: any, req: Request, res: Response, next: NextFunction): any; +} + +type PathParams = string | RegExp | (string | RegExp)[]; + +type RequestHandlerParams = RequestHandler | ErrorRequestHandler | (RequestHandler | ErrorRequestHandler)[]; + +interface IRouterMatcher { + (path: PathParams, ...handlers: RequestHandler[]): T; + (path: PathParams, ...handlers: RequestHandlerParams[]): T; +} + +interface IRouterHandler { + (...handlers: RequestHandler[]): T; + (...handlers: RequestHandlerParams[]): T; +} + +interface IRouter extends RequestHandler { + /** + * Map the given param placeholder `name`(s) to the given callback(s). + * + * Parameter mapping is used to provide pre-conditions to routes + * which use normalized placeholders. For example a _:user_id_ parameter + * could automatically load a user's information from the database without + * any additional code, + * + * The callback uses the samesignature as middleware, the only differencing + * being that the value of the placeholder is passed, in this case the _id_ + * of the user. Once the `next()` function is invoked, just like middleware + * it will continue on to execute the route, or subsequent parameter functions. + * + * app.param('user_id', function(req, res, next, id){ + * User.find(id, function(err, user){ + * if (err) { + * next(err); + * } else if (user) { + * req.user = user; + * next(); + * } else { + * next(new Error('failed to load user')); + * } + * }); + * }); + * + * @param name + * @param fn + */ + param(name: string, handler: RequestParamHandler): this; + // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API + // deprecated since express 4.11.0 + param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; + + /** + * Special-cased "all" method, applying the given route `path`, + * middleware, and callback to _every_ HTTP method. + * + * @param path + * @param fn + */ + all: IRouterMatcher; + get: IRouterMatcher; + post: IRouterMatcher; + put: IRouterMatcher; + delete: IRouterMatcher; + patch: IRouterMatcher; + options: IRouterMatcher; + head: IRouterMatcher; + + checkout: IRouterMatcher; + copy: IRouterMatcher; + lock: IRouterMatcher; + merge: IRouterMatcher; + mkactivity: IRouterMatcher; + mkcol: IRouterMatcher; + move: IRouterMatcher; + "m-search": IRouterMatcher; + notify: IRouterMatcher; + purge: IRouterMatcher; + report: IRouterMatcher; + search: IRouterMatcher; + subscribe: IRouterMatcher; + trace: IRouterMatcher; + unlock: IRouterMatcher; + unsubscribe: IRouterMatcher; + + use: IRouterHandler & IRouterMatcher; + + route(prefix: PathParams): IRoute; + /** + * Stack of configured routes + */ + stack: any[]; +} + +interface IRoute { + path: string; + stack: any; + all: IRouterHandler; + get: IRouterHandler; + post: IRouterHandler; + put: IRouterHandler; + delete: IRouterHandler; + patch: IRouterHandler; + options: IRouterHandler; + head: IRouterHandler; + + checkout: IRouterHandler; + copy: IRouterHandler; + lock: IRouterHandler; + merge: IRouterHandler; + mkactivity: IRouterHandler; + mkcol: IRouterHandler; + move: IRouterHandler; + "m-search": IRouterHandler; + notify: IRouterHandler; + purge: IRouterHandler; + report: IRouterHandler; + search: IRouterHandler; + subscribe: IRouterHandler; + trace: IRouterHandler; + unlock: IRouterHandler; + unsubscribe: IRouterHandler +} + +export interface Router extends IRouter { } + +interface CookieOptions { + maxAge?: number; + signed?: boolean; + expires?: Date | boolean; + httpOnly?: boolean; + path?: string; + domain?: string; + secure?: boolean | 'auto'; +} + +interface Errback { (err: Error): void; } + +interface Request extends http.IncomingMessage, Express.Request { + + /** + * Return request header. + * + * The `Referrer` header field is special-cased, + * both `Referrer` and `Referer` are interchangeable. + * + * Examples: + * + * req.get('Content-Type'); + * // => "text/plain" + * + * req.get('content-type'); + * // => "text/plain" + * + * req.get('Something'); + * // => undefined + * + * Aliased as `req.header()`. + * + * @param name + */ + get(name: string): string; + + header(name: string): string; + + headers: { [key: string]: string; }; + + /** + * Check if the given `type(s)` is acceptable, returning + * the best match when true, otherwise `undefined`, in which + * case you should respond with 406 "Not Acceptable". + * + * The `type` value may be a single mime type string + * such as "application/json", the extension name + * such as "json", a comma-delimted list such as "json, html, text/plain", + * or an array `["json", "html", "text/plain"]`. When a list + * or array is given the _best_ match, if any is returned. + * + * Examples: + * + * // Accept: text/html + * req.accepts('html'); + * // => "html" + * + * // Accept: text/*, application/json + * req.accepts('html'); + * // => "html" + * req.accepts('text/html'); + * // => "text/html" + * req.accepts('json, text'); + * // => "json" + * req.accepts('application/json'); + * // => "application/json" + * + * // Accept: text/*, application/json + * req.accepts('image/png'); + * req.accepts('png'); + * // => undefined + * + * // Accept: text/*;q=.5, application/json + * req.accepts(['html', 'json']); + * req.accepts('html, json'); + * // => "json" + */ + accepts(): string[]; + accepts(type: string): string | boolean; + accepts(type: string[]): string | boolean; + accepts(...type: string[]): string | boolean; + + /** + * Returns the first accepted charset of the specified character sets, + * based on the request's Accept-Charset HTTP header field. + * If none of the specified charsets is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. + * @param charset + */ + acceptsCharsets(): string[]; + acceptsCharsets(charset: string): string | boolean; + acceptsCharsets(charset: string[]): string | boolean; + acceptsCharsets(...charset: string[]): string | boolean; + + /** + * Returns the first accepted encoding of the specified encodings, + * based on the request's Accept-Encoding HTTP header field. + * If none of the specified encodings is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. + * @param encoding + */ + acceptsEncodings(): string[]; + acceptsEncodings(encoding: string): string | boolean; + acceptsEncodings(encoding: string[]): string | boolean; + acceptsEncodings(...encoding: string[]): string | boolean; + + /** + * Returns the first accepted language of the specified languages, + * based on the request's Accept-Language HTTP header field. + * If none of the specified languages is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. + * + * @param lang + */ + acceptsLanguages(): string[]; + acceptsLanguages(lang: string): string | boolean; + acceptsLanguages(lang: string[]): string | boolean; + acceptsLanguages(...lang: string[]): string | boolean; + + /** + * Parse Range header field, + * capping to the given `size`. + * + * Unspecified ranges such as "0-" require + * knowledge of your resource length. In + * the case of a byte range this is of course + * the total number of bytes. If the Range + * header field is not given `null` is returned, + * `-1` when unsatisfiable, `-2` when syntactically invalid. + * + * NOTE: remember that ranges are inclusive, so + * for example "Range: users=0-3" should respond + * with 4 users when available, not 3. + * + * @param size + */ + range(size: number): any[]; + + /** + * Return an array of Accepted media types + * ordered from highest quality to lowest. + */ + accepted: MediaType[]; + + /** + * @deprecated Use either req.params, req.body or req.query, as applicable. + * + * Return the value of param `name` when present or `defaultValue`. + * + * - Checks route placeholders, ex: _/user/:id_ + * - Checks body params, ex: id=12, {"id":12} + * - Checks query string params, ex: ?id=12 + * + * To utilize request bodies, `req.body` + * should be an object. This can be done by using + * the `connect.bodyParser()` middleware. + * + * @param name + * @param defaultValue + */ + param(name: string, defaultValue?: any): string; + + /** + * Check if the incoming request contains the "Content-Type" + * header field, and it contains the give mime `type`. + * + * Examples: + * + * // With Content-Type: text/html; charset=utf-8 + * req.is('html'); + * req.is('text/html'); + * req.is('text/*'); + * // => true + * + * // When Content-Type is application/json + * req.is('json'); + * req.is('application/json'); + * req.is('application/*'); + * // => true + * + * req.is('html'); + * // => false + * + * @param type + */ + is(type: string): boolean; + + /** + * Return the protocol string "http" or "https" + * when requested with TLS. When the "trust proxy" + * setting is enabled the "X-Forwarded-Proto" header + * field will be trusted. If you're running behind + * a reverse proxy that supplies https for you this + * may be enabled. + */ + protocol: string; + + /** + * Short-hand for: + * + * req.protocol == 'https' + */ + secure: boolean; + + /** + * Return the remote address, or when + * "trust proxy" is `true` return + * the upstream addr. + */ + ip: string; + + /** + * When "trust proxy" is `true`, parse + * the "X-Forwarded-For" ip address list. + * + * For example if the value were "client, proxy1, proxy2" + * you would receive the array `["client", "proxy1", "proxy2"]` + * where "proxy2" is the furthest down-stream. + */ + ips: string[]; + + /** + * Return subdomains as an array. + * + * Subdomains are the dot-separated parts of the host before the main domain of + * the app. By default, the domain of the app is assumed to be the last two + * parts of the host. This can be changed by setting "subdomain offset". + * + * For example, if the domain is "tobi.ferrets.example.com": + * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`. + * If "subdomain offset" is 3, req.subdomains is `["tobi"]`. + */ + subdomains: string[]; + + /** + * Short-hand for `url.parse(req.url).pathname`. + */ + path: string; + + /** + * Parse the "Host" header field hostname. + */ + hostname: string; + + /** + * @deprecated Use hostname instead. + */ + host: string; + + /** + * Check if the request is fresh, aka + * Last-Modified and/or the ETag + * still match. + */ + fresh: boolean; + + /** + * Check if the request is stale, aka + * "Last-Modified" and / or the "ETag" for the + * resource has changed. + */ + stale: boolean; + + /** + * Check if the request was an _XMLHttpRequest_. + */ + xhr: boolean; + + //body: { username: string; password: string; remember: boolean; title: string; }; + body: any; + + //cookies: { string; remember: boolean; }; + cookies: any; + + method: string; + + params: any; + + /** + * Clear cookie `name`. + * + * @param name + * @param options + */ + clearCookie(name: string, options?: any): Response; + + query: any; + + route: any; + + signedCookies: any; + + originalUrl: string; + + url: string; + + baseUrl: string; + + app: Application; +} + +interface MediaType { + value: string; + quality: number; + type: string; + subtype: string; +} + +interface Send { + (status: number, body?: any): Response; + (body?: any): Response; +} + +interface Response extends http.ServerResponse, Express.Response { + /** + * Set status `code`. + * + * @param code + */ + status(code: number): Response; + + /** + * Set the response HTTP status code to `statusCode` and send its string representation as the response body. + * @link http://expressjs.com/4x/api.html#res.sendStatus + * + * Examples: + * + * res.sendStatus(200); // equivalent to res.status(200).send('OK') + * res.sendStatus(403); // equivalent to res.status(403).send('Forbidden') + * res.sendStatus(404); // equivalent to res.status(404).send('Not Found') + * res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error') + * + * @param code + */ + sendStatus(code: number): Response; + + /** + * Set Link header field with the given `links`. + * + * Examples: + * + * res.links({ + * next: 'http://api.example.com/users?page=2', + * last: 'http://api.example.com/users?page=5' + * }); + * + * @param links + */ + links(links: any): Response; + + /** + * Send a response. + * + * Examples: + * + * res.send(new Buffer('wahoo')); + * res.send({ some: 'json' }); + * res.send('

some html

'); + * res.send(404, 'Sorry, cant find that'); + * res.send(404); + */ + send: Send; + + /** + * Send JSON response. + * + * Examples: + * + * res.json(null); + * res.json({ user: 'tj' }); + * res.json(500, 'oh noes!'); + * res.json(404, 'I dont have that'); + */ + json: Send; + + /** + * Send JSON response with JSONP callback support. + * + * Examples: + * + * res.jsonp(null); + * res.jsonp({ user: 'tj' }); + * res.jsonp(500, 'oh noes!'); + * res.jsonp(404, 'I dont have that'); + */ + jsonp: Send; + + /** + * Transfer the file at the given `path`. + * + * Automatically sets the _Content-Type_ response header field. + * The callback `fn(err)` is invoked when the transfer is complete + * or when an error occurs. Be sure to check `res.sentHeader` + * if you wish to attempt responding, as the header and some data + * may have already been transferred. + * + * Options: + * + * - `maxAge` defaulting to 0 (can be string converted by `ms`) + * - `root` root directory for relative filenames + * - `headers` object of headers to serve with file + * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them + * + * Other options are passed along to `send`. + * + * Examples: + * + * The following example illustrates how `res.sendFile()` may + * be used as an alternative for the `static()` middleware for + * dynamic situations. The code backing `res.sendFile()` is actually + * the same code, so HTTP cache support etc is identical. + * + * app.get('/user/:uid/photos/:file', function(req, res){ + * var uid = req.params.uid + * , file = req.params.file; + * + * req.user.mayViewFilesFrom(uid, function(yes){ + * if (yes) { + * res.sendFile('/uploads/' + uid + '/' + file); + * } else { + * res.send(403, 'Sorry! you cant see that.'); + * } + * }); + * }); + * + * @api public + */ + sendFile(path: string): void; + sendFile(path: string, options: any): void; + sendFile(path: string, fn: Errback): void; + sendFile(path: string, options: any, fn: Errback): void; + + /** + * @deprecated Use sendFile instead. + */ + sendfile(path: string): void; + /** + * @deprecated Use sendFile instead. + */ + sendfile(path: string, options: any): void; + /** + * @deprecated Use sendFile instead. + */ + sendfile(path: string, fn: Errback): void; + /** + * @deprecated Use sendFile instead. + */ + sendfile(path: string, options: any, fn: Errback): void; + + /** + * Transfer the file at the given `path` as an attachment. + * + * Optionally providing an alternate attachment `filename`, + * and optional callback `fn(err)`. The callback is invoked + * when the data transfer is complete, or when an error has + * ocurred. Be sure to check `res.headerSent` if you plan to respond. + * + * This method uses `res.sendfile()`. + */ + download(path: string): void; + download(path: string, filename: string): void; + download(path: string, fn: Errback): void; + download(path: string, filename: string, fn: Errback): void; + + /** + * Set _Content-Type_ response header with `type` through `mime.lookup()` + * when it does not contain "/", or set the Content-Type to `type` otherwise. + * + * Examples: + * + * res.type('.html'); + * res.type('html'); + * res.type('json'); + * res.type('application/json'); + * res.type('png'); + * + * @param type + */ + contentType(type: string): Response; + + /** + * Set _Content-Type_ response header with `type` through `mime.lookup()` + * when it does not contain "/", or set the Content-Type to `type` otherwise. + * + * Examples: + * + * res.type('.html'); + * res.type('html'); + * res.type('json'); + * res.type('application/json'); + * res.type('png'); + * + * @param type + */ + type(type: string): Response; + + /** + * Respond to the Acceptable formats using an `obj` + * of mime-type callbacks. + * + * This method uses `req.accepted`, an array of + * acceptable types ordered by their quality values. + * When "Accept" is not present the _first_ callback + * is invoked, otherwise the first match is used. When + * no match is performed the server responds with + * 406 "Not Acceptable". + * + * Content-Type is set for you, however if you choose + * you may alter this within the callback using `res.type()` + * or `res.set('Content-Type', ...)`. + * + * res.format({ + * 'text/plain': function(){ + * res.send('hey'); + * }, + * + * 'text/html': function(){ + * res.send('

hey

'); + * }, + * + * 'appliation/json': function(){ + * res.send({ message: 'hey' }); + * } + * }); + * + * In addition to canonicalized MIME types you may + * also use extnames mapped to these types: + * + * res.format({ + * text: function(){ + * res.send('hey'); + * }, + * + * html: function(){ + * res.send('

hey

'); + * }, + * + * json: function(){ + * res.send({ message: 'hey' }); + * } + * }); + * + * By default Express passes an `Error` + * with a `.status` of 406 to `next(err)` + * if a match is not made. If you provide + * a `.default` callback it will be invoked + * instead. + * + * @param obj + */ + format(obj: any): Response; + + /** + * Set _Content-Disposition_ header to _attachment_ with optional `filename`. + * + * @param filename + */ + attachment(filename?: string): Response; + + /** + * Set header `field` to `val`, or pass + * an object of header fields. + * + * Examples: + * + * res.set('Foo', ['bar', 'baz']); + * res.set('Accept', 'application/json'); + * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' }); + * + * Aliased as `res.header()`. + */ + set(field: any): Response; + set(field: string, value?: string): Response; + + header(field: any): Response; + header(field: string, value?: string): Response; + + // Property indicating if HTTP headers has been sent for the response. + headersSent: boolean; + + /** + * Get value for header `field`. + * + * @param field + */ + get(field: string): string; + + /** + * Clear cookie `name`. + * + * @param name + * @param options + */ + clearCookie(name: string, options?: any): Response; + + /** + * Set cookie `name` to `val`, with the given `options`. + * + * Options: + * + * - `maxAge` max-age in milliseconds, converted to `expires` + * - `signed` sign the cookie + * - `path` defaults to "/" + * + * Examples: + * + * // "Remember Me" for 15 minutes + * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true }); + * + * // save as above + * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true }) + */ + cookie(name: string, val: string, options: CookieOptions): Response; + cookie(name: string, val: any, options: CookieOptions): Response; + cookie(name: string, val: any): Response; + + /** + * Set the location header to `url`. + * + * The given `url` can also be the name of a mapped url, for + * example by default express supports "back" which redirects + * to the _Referrer_ or _Referer_ headers or "/". + * + * Examples: + * + * res.location('/foo/bar').; + * res.location('http://example.com'); + * res.location('../login'); // /blog/post/1 -> /blog/login + * + * Mounting: + * + * When an application is mounted and `res.location()` + * is given a path that does _not_ lead with "/" it becomes + * relative to the mount-point. For example if the application + * is mounted at "/blog", the following would become "/blog/login". + * + * res.location('login'); + * + * While the leading slash would result in a location of "/login": + * + * res.location('/login'); + * + * @param url + */ + location(url: string): Response; + + /** + * Redirect to the given `url` with optional response `status` + * defaulting to 302. + * + * The resulting `url` is determined by `res.location()`, so + * it will play nicely with mounted apps, relative paths, + * `"back"` etc. + * + * Examples: + * + * res.redirect('/foo/bar'); + * res.redirect('http://example.com'); + * res.redirect(301, 'http://example.com'); + * res.redirect('http://example.com', 301); + * res.redirect('../login'); // /blog/post/1 -> /blog/login + */ + redirect(url: string): void; + redirect(status: number, url: string): void; + redirect(url: string, status: number): void; + + /** + * Render `view` with the given `options` and optional callback `fn`. + * When a callback function is given a response will _not_ be made + * automatically, otherwise a response of _200_ and _text/html_ is given. + * + * Options: + * + * - `cache` boolean hinting to the engine it should cache + * - `filename` filename of the view being rendered + */ + render(view: string, options?: Object, callback?: (err: Error, html: string) => void): void; + render(view: string, callback?: (err: Error, html: string) => void): void; + + locals: any; + + charset: string; + + /** + * Adds the field to the Vary response header, if it is not there already. + * Examples: + * + * res.vary('User-Agent').render('docs'); + * + */ + vary(field: string): Response; +} + +interface Handler extends RequestHandler { } + +interface RequestParamHandler { + (req: Request, res: Response, next: NextFunction, value: any, name: string): any; +} + +interface Application extends IRouter, Express.Application { + /** + * Express instance itself is a request handler, which could be invoked without + * third argument. + */ + (req: Request, res: Response): any; + + /** + * Initialize the server. + * + * - setup default configuration + * - setup default middleware + * - setup route reflection methods + */ + init(): void; + + /** + * Initialize application configuration. + */ + defaultConfiguration(): void; + + /** + * Register the given template engine callback `fn` + * as `ext`. + * + * By default will `require()` the engine based on the + * file extension. For example if you try to render + * a "foo.jade" file Express will invoke the following internally: + * + * app.engine('jade', require('jade').__express); + * + * For engines that do not provide `.__express` out of the box, + * or if you wish to "map" a different extension to the template engine + * you may use this method. For example mapping the EJS template engine to + * ".html" files: + * + * app.engine('html', require('ejs').renderFile); + * + * In this case EJS provides a `.renderFile()` method with + * the same signature that Express expects: `(path, options, callback)`, + * though note that it aliases this method as `ejs.__express` internally + * so if you're using ".ejs" extensions you dont need to do anything. + * + * Some template engines do not follow this convention, the + * [Consolidate.js](https://github.com/visionmedia/consolidate.js) + * library was created to map all of node's popular template + * engines to follow this convention, thus allowing them to + * work seamlessly within Express. + */ + engine(ext: string, fn: Function): Application; + + /** + * Assign `setting` to `val`, or return `setting`'s value. + * + * app.set('foo', 'bar'); + * app.get('foo'); + * // => "bar" + * app.set('foo', ['bar', 'baz']); + * app.get('foo'); + * // => ["bar", "baz"] + * + * Mounted servers inherit their parent server's settings. + * + * @param setting + * @param val + */ + set(setting: string, val: any): Application; + get: { (name: string): any; } & IRouterMatcher; + + param(name: string | string[], handler: RequestParamHandler): this; + // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API + param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; + + /** + * Return the app's absolute pathname + * based on the parent(s) that have + * mounted it. + * + * For example if the application was + * mounted as "/admin", which itself + * was mounted as "/blog" then the + * return value would be "/blog/admin". + */ + path(): string; + + /** + * Check if `setting` is enabled (truthy). + * + * app.enabled('foo') + * // => false + * + * app.enable('foo') + * app.enabled('foo') + * // => true + */ + enabled(setting: string): boolean; + + /** + * Check if `setting` is disabled. + * + * app.disabled('foo') + * // => true + * + * app.enable('foo') + * app.disabled('foo') + * // => false + * + * @param setting + */ + disabled(setting: string): boolean; + + /** + * Enable `setting`. + * + * @param setting + */ + enable(setting: string): Application; + + /** + * Disable `setting`. + * + * @param setting + */ + disable(setting: string): Application; + + /** + * Configure callback for zero or more envs, + * when no `env` is specified that callback will + * be invoked for all environments. Any combination + * can be used multiple times, in any order desired. + * + * Examples: + * + * app.configure(function(){ + * // executed for all envs + * }); + * + * app.configure('stage', function(){ + * // executed staging env + * }); + * + * app.configure('stage', 'production', function(){ + * // executed for stage and production + * }); + * + * Note: + * + * These callbacks are invoked immediately, and + * are effectively sugar for the following: + * + * var env = process.env.NODE_ENV || 'development'; + * + * switch (env) { + * case 'development': + * ... + * break; + * case 'stage': + * ... + * break; + * case 'production': + * ... + * break; + * } + * + * @param env + * @param fn + */ + configure(fn: Function): Application; + configure(env0: string, fn: Function): Application; + configure(env0: string, env1: string, fn: Function): Application; + configure(env0: string, env1: string, env2: string, fn: Function): Application; + configure(env0: string, env1: string, env2: string, env3: string, fn: Function): Application; + configure(env0: string, env1: string, env2: string, env3: string, env4: string, fn: Function): Application; + + /** + * Render the given view `name` name with `options` + * and a callback accepting an error and the + * rendered template string. + * + * Example: + * + * app.render('email', { name: 'Tobi' }, function(err, html){ + * // ... + * }) + * + * @param name + * @param options or fn + * @param fn + */ + render(name: string, options?: Object, callback?: (err: Error, html: string) => void): void; + render(name: string, callback: (err: Error, html: string) => void): void; + + + /** + * Listen for connections. + * + * A node `http.Server` is returned, with this + * application (which is a `Function`) as its + * callback. If you wish to create both an HTTP + * and HTTPS server you may do so with the "http" + * and "https" modules as shown here: + * + * var http = require('http') + * , https = require('https') + * , express = require('express') + * , app = express(); + * + * http.createServer(app).listen(80); + * https.createServer({ ... }, app).listen(443); + */ + listen(port: number, hostname: string, backlog: number, callback?: Function): http.Server; + listen(port: number, hostname: string, callback?: Function): http.Server; + listen(port: number, callback?: Function): http.Server; + listen(path: string, callback?: Function): http.Server; + listen(handle: any, listeningListener?: Function): http.Server; + + router: string; + + settings: any; + + resource: any; + + map: any; + + locals: any; + + /** + * The app.routes object houses all of the routes defined mapped by the + * associated HTTP verb. This object may be used for introspection + * capabilities, for example Express uses this internally not only for + * routing but to provide default OPTIONS behaviour unless app.options() + * is used. Your application or framework may also remove routes by + * simply by removing them from this object. + */ + routes: any; + + /** + * Used to get all registered routes in Express Application + */ + _router: any; +} + +interface Express extends Application { + request: Request; + + response: Response; +} \ No newline at end of file diff --git a/express-serve-static-core/tsconfig.json b/express-serve-static-core/tsconfig.json index 1f00a50111..72a8a8dd93 100644 --- a/express-serve-static-core/tsconfig.json +++ b/express-serve-static-core/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-session/tsconfig.json b/express-session/tsconfig.json index 919160244b..3ad3026c09 100644 --- a/express-session/tsconfig.json +++ b/express-session/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-unless/tsconfig.json b/express-unless/tsconfig.json index 9c8ae96ecf..c212effc16 100644 --- a/express-unless/tsconfig.json +++ b/express-unless/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-useragent/tsconfig.json b/express-useragent/tsconfig.json index 8d9a5ca3f9..e55d2ea819 100644 --- a/express-useragent/tsconfig.json +++ b/express-useragent/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express-validator/tsconfig.json b/express-validator/tsconfig.json index 405198935f..da1f6bbf71 100644 --- a/express-validator/tsconfig.json +++ b/express-validator/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/express/express-tests.ts b/express/express-tests.ts index fdcd85801f..e643ba208b 100644 --- a/express/express-tests.ts +++ b/express/express-tests.ts @@ -29,8 +29,7 @@ namespace express_tests { res.send('hello world'); }); - const router = express.Router(); - + const router = express.Router({ caseSensitive: true, mergeParams: true, strict: true }); const pathStr: string = 'test'; const pathRE: RegExp = /test/; diff --git a/express/index.d.ts b/express/index.d.ts index b1a618b79e..7222c8d3d9 100644 --- a/express/index.d.ts +++ b/express/index.d.ts @@ -28,7 +28,28 @@ declare namespace e { */ var static: typeof serveStatic; - export function Router(options?: any): core.Router; + export function Router(options?: RouterOptions): core.Router; + + interface RouterOptions { + /** + * Enable case sensitivity. + */ + caseSensitive?: boolean; + + /** + * Preserve the req.params values from the parent router. + * If the parent and the child have conflicting param names, the child’s value take precedence. + * + * @default false + * @since 4.5.0 + */ + mergeParams?: boolean; + + /** + * Enable strict routing. + */ + strict?: boolean; + } interface Application extends core.Application { } interface CookieOptions extends core.CookieOptions { } diff --git a/express/tsconfig.json b/express/tsconfig.json index 1a8c1d2c36..e1c7f66b8a 100644 --- a/express/tsconfig.json +++ b/express/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/extend/tsconfig.json b/extend/tsconfig.json index fc7ae25185..ef9142e834 100644 --- a/extend/tsconfig.json +++ b/extend/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/extended-listbox/tsconfig.json b/extended-listbox/tsconfig.json index b4f9268cb9..ff03fe4555 100644 --- a/extended-listbox/tsconfig.json +++ b/extended-listbox/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/extjs/ExtJS-tests.ts b/extjs/extjs-tests.ts similarity index 100% rename from extjs/ExtJS-tests.ts rename to extjs/extjs-tests.ts diff --git a/extjs/tsconfig.json b/extjs/tsconfig.json index 44cf118c81..5c9476a7d1 100644 --- a/extjs/tsconfig.json +++ b/extjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts b/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts new file mode 100644 index 0000000000..62e522a348 --- /dev/null +++ b/extract-text-webpack-plugin/extract-text-webpack-plugin-tests.ts @@ -0,0 +1,97 @@ +import { optimize, Configuration, Plugin } from 'webpack' + +import * as ExtractTextPlugin from 'extract-text-webpack-plugin' + + +let configuration: Configuration + + +configuration = { + // The standard entry point and output config + entry: { + posts: "./posts", + post: "./post", + about: "./about" + }, + output: { + filename: "[name].js", + chunkFilename: "[id].js" + }, + module: { + rules: [ + // Extract css files + { + test: /\.css$/, + loader: ExtractTextPlugin.extract({ + fallbackLoader: "style-loader", + loader: "css-loader", + }) + }, + // Optionally extract less files + // or any other compile-to-css language + { + test: /\.less$/, + loader: ExtractTextPlugin.extract({ + fallbackLoader: "style-loader", + loader: ["css-loader", "less-loader"], + }) + } + // You could also use other loaders the same way. I. e. the autoprefixer-loader + ] + }, + // Use the plugin to specify the resulting filename (and add needed behavior to the compiler) + plugins: [ + new ExtractTextPlugin("[name].css") + ] +}; + +configuration = { + // ... + plugins: [ + new ExtractTextPlugin({ + filename: "style.css", + allChunks: true, + }) + ] +}; + +configuration = { + // ... + plugins: [ + new optimize.CommonsChunkPlugin("commons", "commons.js"), + new ExtractTextPlugin("[name].css") + ] +}; + +configuration = { + // ... + module: { + rules: [ + { test: /\.css$/, loader: ExtractTextPlugin.extract({ + fallbackLoader: "style-loader", + loader: "css-loader" + }) } + ] + }, + plugins: [ + new ExtractTextPlugin("styles.css") + ], +}; + +// multiple extract instances +let extractCSS = new ExtractTextPlugin('stylesheets/[name].css'); +let extractLESS = new ExtractTextPlugin('stylesheets/[name].less'); + +configuration = { + // ... + module: { + rules: [ + { test: /\.scss$/i, loader: extractCSS.extract(['css','sass']) }, + { test: /\.less$/i, loader: extractLESS.extract(['css','less']) }, + ] + }, + plugins: [ + extractCSS, + extractLESS, + ], +}; diff --git a/extract-text-webpack-plugin/index.d.ts b/extract-text-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..21052b08c1 --- /dev/null +++ b/extract-text-webpack-plugin/index.d.ts @@ -0,0 +1,49 @@ +// Type definitions for extract-text-webpack-plugin 2.0.0 +// Project: https://github.com/webpack/extract-text-webpack-plugin +// Definitions by: flying-sheep +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Plugin, OldLoader } from 'webpack' + +/** + * extract-text-webpack-plugin has no support for .options instead of .query yet. + * See https://github.com/webpack/extract-text-webpack-plugin/issues/281 + */ +type Loader = string | OldLoader + +interface ExtractPluginOptions { + /** the filename of the result file. May contain `[name]`, `[id]` and `[contenthash]` */ + filename: string + /** extract from all additional chunks too (by default it extracts only from the initial chunk(s)) */ + allChunks?: boolean + /** disables the plugin */ + disable?: boolean + /** Unique ident for this plugin instance. (For advanced usage only, by default automatically generated) */ + id?: string +} + +interface ExtractOptions { + /** the loader(s) that should be used for converting the resource to a css exporting module */ + loader: Loader | Loader[] + /** the loader(s) that should be used when the css is not extracted (i.e. in an additional chunk when `allChunks: false`) */ + fallbackLoader?: Loader | Loader[] + /** override the `publicPath` setting for this loader */ + publicPath?: string +} + +/** + * Use an `ExtractTextPlugin` instance and a loader returned by `extract` in concert to write files to disk instead of loading them into others. + * Usage example at https://github.com/webpack/extract-text-webpack-plugin#usage-example-with-css + */ +interface ExtractTextPlugin extends Plugin { + /** Create a plugin instance defining the extraction target file(s) for the files loaded by `extract` */ + new (options: string | ExtractPluginOptions): ExtractTextPlugin + /** + * Creates an extracting loader from an existing loader. + * Use the resulting loader in `module.rules`/`module.loaders`. + */ + extract: (loader: Loader | Loader[] | ExtractOptions) => Loader +} + +declare const extractTextPlugin: ExtractTextPlugin +export = extractTextPlugin diff --git a/extract-text-webpack-plugin/tsconfig.json b/extract-text-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..1b4a6c1b1b --- /dev/null +++ b/extract-text-webpack-plugin/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "extract-text-webpack-plugin-tests.ts" + ] +} \ No newline at end of file diff --git a/eyes/tsconfig.json b/eyes/tsconfig.json index 416e3d130a..f5b822508b 100644 --- a/eyes/tsconfig.json +++ b/eyes/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/f1/f1-tests.ts b/f1/f1-tests.ts new file mode 100644 index 0000000000..8bfbbfb080 --- /dev/null +++ b/f1/f1-tests.ts @@ -0,0 +1,31 @@ +import F1 = require("f1"); +var ui = F1(); + +ui.states({ + out: { + itemToAnimate1: { + variableToAnimate: 0 + }, + + itemToAnimate2: { + variableToAnimate: 0 + } + }, + + idle: { + itemToAnimate1: { + variableToAnimate: 1 + }, + + itemToAnimate2: { + variableToAnimate: 2 + } + } +}); + + + +ui.transitions( [ + { from: 'idle', to: 'rollOver', animation: { duration: 0.25 } }, + { from: 'rollOver', to: 'idle', animation: { duration: 0.1 } } +]); diff --git a/f1/index.d.ts b/f1/index.d.ts new file mode 100644 index 0000000000..82c5cf8c4d --- /dev/null +++ b/f1/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for f1 8.0 +// Project: https://github.com/jam3/f1 +// Definitions by: Neo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface F1Options { + onState?: (...args: any[]) => void; + onUpdate?: (...args: any[]) => void; + + name: string; + + targets: any; + states: any; + transitions: any[]; + parsers: any; +} + +interface F1 extends NodeJS.EventEmitter { + targets(targets: any): F1; + states(states: any): F1; + transitions(transitions: any[]): F1; + parsers(parser: any): F1; + init(initState: string): F1; + + destroy(): void; + apply(pathToTarget: string, target: any, parserDefinition: any): void; + + go(state: string, callback?: (state: any, currentState: any) => void): F1; + set(state: string): F1; + step(deltaTime: number): F1; + update(): F1; +} + +declare function F1(settings?: F1Options): F1; + +export = F1; diff --git a/f1/tsconfig.json b/f1/tsconfig.json new file mode 100644 index 0000000000..4cefcd6495 --- /dev/null +++ b/f1/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "f1-tests.ts" + ] +} \ No newline at end of file diff --git a/f1/tslint.json b/f1/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/f1/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/fabric/tsconfig.json b/fabric/tsconfig.json index 6ffce6218f..fe93e260b9 100644 --- a/fabric/tsconfig.json +++ b/fabric/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/facebook-js-sdk/tsconfig.json b/facebook-js-sdk/tsconfig.json index 84cccbb237..4fed5f6bc7 100644 --- a/facebook-js-sdk/tsconfig.json +++ b/facebook-js-sdk/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/facebook-pixel/tsconfig.json b/facebook-pixel/tsconfig.json index 54c0392cc2..14d6b995f9 100644 --- a/facebook-pixel/tsconfig.json +++ b/facebook-pixel/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/faker/tsconfig.json b/faker/tsconfig.json index 83964e50b2..1b623c5290 100644 --- a/faker/tsconfig.json +++ b/faker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/falcor-express/tsconfig.json b/falcor-express/tsconfig.json index 2e24c800fe..c6c66a09f0 100644 --- a/falcor-express/tsconfig.json +++ b/falcor-express/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/falcor-http-datasource/tsconfig.json b/falcor-http-datasource/tsconfig.json index 4f56be1094..d523fb551e 100644 --- a/falcor-http-datasource/tsconfig.json +++ b/falcor-http-datasource/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/falcor-json-graph/tsconfig.json b/falcor-json-graph/tsconfig.json index 0c2cf43ad5..14f3efe18d 100644 --- a/falcor-json-graph/tsconfig.json +++ b/falcor-json-graph/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/falcor-router/tsconfig.json b/falcor-router/tsconfig.json index c00ba9ae86..b9407dadfd 100644 --- a/falcor-router/tsconfig.json +++ b/falcor-router/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/falcor/tsconfig.json b/falcor/tsconfig.json index 40bca880f3..2e31c3c971 100644 --- a/falcor/tsconfig.json +++ b/falcor/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/famous/tsconfig.json b/famous/tsconfig.json index 24b7e2c86c..f07754f5e5 100644 --- a/famous/tsconfig.json +++ b/famous/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fancybox/tsconfig.json b/fancybox/tsconfig.json index 80829fcef6..788886ea04 100644 --- a/fancybox/tsconfig.json +++ b/fancybox/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/farbtastic/tsconfig.json b/farbtastic/tsconfig.json index 9ac643d4b2..1b83bfff38 100644 --- a/farbtastic/tsconfig.json +++ b/farbtastic/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fast-json-patch/tsconfig.json b/fast-json-patch/tsconfig.json index f0651d6e40..8d4e7e0bd4 100644 --- a/fast-json-patch/tsconfig.json +++ b/fast-json-patch/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fast-levenshtein/tsconfig.json b/fast-levenshtein/tsconfig.json index f6643f3bf8..03f965ea2e 100644 --- a/fast-levenshtein/tsconfig.json +++ b/fast-levenshtein/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} +} \ No newline at end of file diff --git a/fast-simplex-noise/tsconfig.json b/fast-simplex-noise/tsconfig.json index fd793168ab..cef3ce6c6f 100644 --- a/fast-simplex-noise/tsconfig.json +++ b/fast-simplex-noise/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fast-stats/index.d.ts b/fast-stats/index.d.ts index d1c4ae9620..1bfe4ad737 100644 --- a/fast-stats/index.d.ts +++ b/fast-stats/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for fast-stats 0.0.2 +// Type definitions for fast-stats 0.0.2 // Project: https://github.com/bluesmoon/node-faststats // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/fast-stats/tsconfig.json b/fast-stats/tsconfig.json index 3e65a0b115..b6f3121d84 100644 --- a/fast-stats/tsconfig.json +++ b/fast-stats/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fastclick/tsconfig.json b/fastclick/tsconfig.json index 787f551e58..faf920a449 100644 --- a/fastclick/tsconfig.json +++ b/fastclick/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/favico.js/tsconfig.json b/favico.js/tsconfig.json index b589934d41..2ea17650d1 100644 --- a/favico.js/tsconfig.json +++ b/favico.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fb/index.d.ts b/fb/index.d.ts index f641fa9820..a968d9f3c0 100644 --- a/fb/index.d.ts +++ b/fb/index.d.ts @@ -29,13 +29,13 @@ interface PageTabDialogParams { interface RequestsDialogParams { method: string; // "apprequests" - app_id: string; + app_id?: string; redirect_uri?: string; to?: string; message: string; action_type?: string; // "send" | "askfor" | "turn" object_id?: string; - filters: string /* "app_users" | "app_non_users" */ | { + filters: string[] | { name: string; user_ids: string[]; }; diff --git a/fb/tsconfig.json b/fb/tsconfig.json index 6816fc86bb..f99ae7bb46 100644 --- a/fb/tsconfig.json +++ b/fb/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fbemitter/fbemitter-tests.ts b/fbemitter/fbemitter-tests.ts index 11e1ce74a5..2085f9ac51 100644 --- a/fbemitter/fbemitter-tests.ts +++ b/fbemitter/fbemitter-tests.ts @@ -2,6 +2,7 @@ /// /// /// + 'use strict'; /** diff --git a/fbemitter/tsconfig.json b/fbemitter/tsconfig.json index a2cde60f5a..e29b52781a 100644 --- a/fbemitter/tsconfig.json +++ b/fbemitter/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/featherlight/tsconfig.json b/featherlight/tsconfig.json index 5826ab22c4..d49d7a1bb4 100644 --- a/featherlight/tsconfig.json +++ b/featherlight/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fetch-mock/tsconfig.json b/fetch-mock/tsconfig.json index 011ddc149b..208d05e2d8 100644 --- a/fetch-mock/tsconfig.json +++ b/fetch-mock/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "index.d.ts", "fetch-mock-tests.ts" ] -} +} \ No newline at end of file diff --git a/ffi/tsconfig.json b/ffi/tsconfig.json index 266b5c193d..5824401d8d 100644 --- a/ffi/tsconfig.json +++ b/ffi/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fhir/tsconfig.json b/fhir/tsconfig.json index c8a101c727..8b57b20bc7 100644 --- a/fhir/tsconfig.json +++ b/fhir/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fibers/tsconfig.json b/fibers/tsconfig.json index c76bade803..222ecea383 100644 --- a/fibers/tsconfig.json +++ b/fibers/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/field/tsconfig.json b/field/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/field/tsconfig.json +++ b/field/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/filesaver/FileSaver-tests.ts b/file-saver/FileSaver-tests.ts similarity index 100% rename from filesaver/FileSaver-tests.ts rename to file-saver/FileSaver-tests.ts diff --git a/filesaver/index.d.ts b/file-saver/index.d.ts similarity index 79% rename from filesaver/index.d.ts rename to file-saver/index.d.ts index 534ce4fe1c..31188a0c7a 100644 --- a/filesaver/index.d.ts +++ b/file-saver/index.d.ts @@ -20,13 +20,13 @@ interface FileSaver { * @summary File name. * @type {DOMString} */ - filename: string, + filename: string, - /** - * @summary Disable Unicode text encoding hints or not. - * @type {boolean} - */ - disableAutoBOM?: boolean + /** + * @summary Disable Unicode text encoding hints or not. + * @type {boolean} + */ + disableAutoBOM?: boolean ): void } diff --git a/filesaver/tsconfig.json b/file-saver/tsconfig.json similarity index 92% rename from filesaver/tsconfig.json rename to file-saver/tsconfig.json index 10dcc20685..0ff18d9918 100644 --- a/filesaver/tsconfig.json +++ b/file-saver/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/file-type/tsconfig.json b/file-type/tsconfig.json index 52468981c7..a04df3cada 100644 --- a/file-type/tsconfig.json +++ b/file-type/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/file-url/tsconfig.json b/file-url/tsconfig.json index bd70961ab2..66a6554ad9 100644 --- a/file-url/tsconfig.json +++ b/file-url/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/filesize/tsconfig.json b/filesize/tsconfig.json index 8f21077125..a61f301d7e 100644 --- a/filesize/tsconfig.json +++ b/filesize/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/filesystem/tsconfig.json b/filesystem/tsconfig.json index bcbc493c7d..5add2dc74a 100644 --- a/filesystem/tsconfig.json +++ b/filesystem/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/filewriter/tsconfig.json b/filewriter/tsconfig.json index e2cebb3a2c..27d1d8d844 100644 --- a/filewriter/tsconfig.json +++ b/filewriter/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fill-pdf/fill-pdf-tests.ts b/fill-pdf/fill-pdf-tests.ts index e5b34cd943..44b4f23531 100644 --- a/fill-pdf/fill-pdf-tests.ts +++ b/fill-pdf/fill-pdf-tests.ts @@ -1,5 +1,3 @@ -/// - import * as fillPdf from 'fill-pdf'; var formData: fillPdf.FormData = { FieldName: 'Text to put into form field' }; diff --git a/fill-pdf/fill-pdf.d.ts b/fill-pdf/index.d.ts similarity index 100% rename from fill-pdf/fill-pdf.d.ts rename to fill-pdf/index.d.ts diff --git a/fill-pdf/tsconfig.json b/fill-pdf/tsconfig.json index 51c99ab9de..5cb4dd9a57 100644 --- a/fill-pdf/tsconfig.json +++ b/fill-pdf/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "fill-pdf.d.ts", + "index.d.ts", "fill-pdf-tests.ts" ] } \ No newline at end of file diff --git a/finalhandler/index.d.ts b/finalhandler/index.d.ts index 07bbe63c91..a238c0d2a5 100644 --- a/finalhandler/index.d.ts +++ b/finalhandler/index.d.ts @@ -5,7 +5,6 @@ /// - import {ServerRequest, ServerResponse} from "http"; declare function finalHandler(req: ServerRequest, res: ServerResponse, options?: finalHandler.Options): (err: any) => void; diff --git a/finalhandler/tsconfig.json b/finalhandler/tsconfig.json index 0abfc4e180..78020869fe 100644 --- a/finalhandler/tsconfig.json +++ b/finalhandler/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/finch/tsconfig.json b/finch/tsconfig.json index e0ed199ffb..990f0265d9 100644 --- a/finch/tsconfig.json +++ b/finch/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/findup-sync/tsconfig.json b/findup-sync/tsconfig.json index b3c0dcf18d..4628d9646f 100644 --- a/findup-sync/tsconfig.json +++ b/findup-sync/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fingerprintjs/tsconfig.json b/fingerprintjs/tsconfig.json index b90f8ba99b..c1a7922d8f 100644 --- a/fingerprintjs/tsconfig.json +++ b/fingerprintjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/firebase-client/tsconfig.json b/firebase-client/tsconfig.json index 5f986ab77e..96073d0f7c 100644 --- a/firebase-client/tsconfig.json +++ b/firebase-client/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/firebase-token-generator/tsconfig.json b/firebase-token-generator/tsconfig.json index 3f06b4db21..fba33ed898 100644 --- a/firebase-token-generator/tsconfig.json +++ b/firebase-token-generator/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/firebase/tsconfig.json b/firebase/tsconfig.json index 5005d92b44..4f16288a22 100644 --- a/firebase/tsconfig.json +++ b/firebase/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/firefox/tsconfig.json b/firefox/tsconfig.json index 717d3959ef..529f297f77 100644 --- a/firefox/tsconfig.json +++ b/firefox/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/first-mate/tsconfig.json b/first-mate/tsconfig.json index 252077e92f..d699e09ee4 100644 --- a/first-mate/tsconfig.json +++ b/first-mate/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fixed-data-table/tsconfig.json b/fixed-data-table/tsconfig.json index 811e641a1f..3962b759bd 100644 --- a/fixed-data-table/tsconfig.json +++ b/fixed-data-table/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "jsx": "react", diff --git a/flake-idgen/tsconfig.json b/flake-idgen/tsconfig.json index da016194a6..f3c63b048c 100644 --- a/flake-idgen/tsconfig.json +++ b/flake-idgen/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/flat/tsconfig.json b/flat/tsconfig.json index e71af432e9..cb1cb66858 100644 --- a/flat/tsconfig.json +++ b/flat/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/flexslider/tsconfig.json b/flexslider/tsconfig.json index 5dabe5216c..c34db7d4d9 100644 --- a/flexslider/tsconfig.json +++ b/flexslider/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/flickity/index.d.ts b/flickity/index.d.ts index febb09b525..16b5b7c96f 100644 --- a/flickity/index.d.ts +++ b/flickity/index.d.ts @@ -161,13 +161,7 @@ declare class Flickity { * @param eventName name of event (@see FlickityEvents class for filckity supported events) * @param callback callback funtion to execute when event fires */ - on(eventname: string, callback: (eventt?: Event, cellElement?: Element) => any) : void; - /** - * bind event listener - * @param eventName name of event (@see FlickityEvents class for filckity supported events) - * @param callback callback funtion to execute when event fires - */ - on(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void; + on(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void; /** * bind event listener * @param eventName name of event (@see FlickityEvents class for filckity supported events) @@ -179,7 +173,27 @@ declare class Flickity { * @param eventName name of event (@see FlickityEvents class for filckity supported events) * @param callback callback funtion to execute when event fires */ - on(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void; + on(eventname: string, callback: (eventt?: Event, cellElement?: Element) => any) : void; + /** + * bind event listener + * @param eventName name of event (@see FlickityEvents class for filckity supported events) + * @param callback callback funtion to execute when event fires + */ + on(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void; + + /** + * Remove event listener + * @param eventName name of event (@see FlickityEvents class for filckity supported events) + * @param callback callback funtion to execute when event fires + */ + off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void; + + /** + * Remove event listener + * @param eventName name of event (@see FlickityEvents class for filckity supported events) + * @param callback callback funtion to execute when event fires + */ + off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void; /** * Remove event listener @@ -195,20 +209,20 @@ declare class Flickity { */ off(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void; + /** - * Remove event listener + * one time event handler * @param eventName name of event (@see FlickityEvents class for filckity supported events) * @param callback callback funtion to execute when event fires */ - off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void; + once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void; /** - * Remove event listener + * one time event handler * @param eventName name of event (@see FlickityEvents class for filckity supported events) * @param callback callback funtion to execute when event fires */ - off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void; - + once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void; /** * one time event handler @@ -223,22 +237,6 @@ declare class Flickity { * @param callback callback funtion to execute when event fires */ once(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void; - - /** - * one time event handler - * @param eventName name of event (@see FlickityEvents class for filckity supported events) - * @param callback callback funtion to execute when event fires - */ - once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void; - - /** - * one time event handler - * @param eventName name of event (@see FlickityEvents class for filckity supported events) - * @param callback callback funtion to execute when event fires - */ - once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void; - - } interface FlickityOptions { diff --git a/flickity/tsconfig.json b/flickity/tsconfig.json index d85bd08802..56c8d7db2d 100644 --- a/flickity/tsconfig.json +++ b/flickity/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/flight/tsconfig.json b/flight/tsconfig.json index ae118d43f5..62a00ba844 100644 --- a/flight/tsconfig.json +++ b/flight/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/flightplan/tsconfig.json b/flightplan/tsconfig.json index cf29b63cdd..51a9aec6a9 100644 --- a/flightplan/tsconfig.json +++ b/flightplan/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/flipsnap/tsconfig.json b/flipsnap/tsconfig.json index 1b4a3242b8..bdddbbb098 100644 --- a/flipsnap/tsconfig.json +++ b/flipsnap/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/flot/tsconfig.json b/flot/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/flot/tsconfig.json +++ b/flot/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/flowjs/tsconfig.json b/flowjs/tsconfig.json index 33ba1d015a..eaccd331ab 100644 --- a/flowjs/tsconfig.json +++ b/flowjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fluent-ffmpeg/fluent-ffmpeg-tests.ts b/fluent-ffmpeg/fluent-ffmpeg-tests.ts index 8b1031ff58..112d6de09b 100644 --- a/fluent-ffmpeg/fluent-ffmpeg-tests.ts +++ b/fluent-ffmpeg/fluent-ffmpeg-tests.ts @@ -1,5 +1,3 @@ -/// - import ffmpeg = require("fluent-ffmpeg") let source: string, format: string, output: string diff --git a/fluent-ffmpeg/fluent-ffmpeg.d.ts b/fluent-ffmpeg/index.d.ts similarity index 100% rename from fluent-ffmpeg/fluent-ffmpeg.d.ts rename to fluent-ffmpeg/index.d.ts diff --git a/fluent-ffmpeg/tsconfig.json b/fluent-ffmpeg/tsconfig.json index 3e2fd3a624..8708980874 100644 --- a/fluent-ffmpeg/tsconfig.json +++ b/fluent-ffmpeg/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "fluent-ffmpeg.d.ts", + "index.d.ts", "fluent-ffmpeg-tests.ts" ] } \ No newline at end of file diff --git a/flux-standard-action/tsconfig.json b/flux-standard-action/tsconfig.json index 5a6b659c15..c565bfcd85 100644 --- a/flux-standard-action/tsconfig.json +++ b/flux-standard-action/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/flux/index.d.ts b/flux/index.d.ts index 8f51cfb1e5..252d1c7920 100644 --- a/flux/index.d.ts +++ b/flux/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Flux +// Type definitions for Flux // Project: http://facebook.github.io/flux/ // Definitions by: Steve Baker , Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/flux/tsconfig.json b/flux/tsconfig.json index 07ef395eab..f5dd865c2f 100644 --- a/flux/tsconfig.json +++ b/flux/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fluxxor/tsconfig.json b/fluxxor/tsconfig.json index 2905f00cfa..df0b373267 100644 --- a/fluxxor/tsconfig.json +++ b/fluxxor/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fontfaceobserver/tsconfig.json b/fontfaceobserver/tsconfig.json index d6b4d33f8a..2d114b86cf 100644 --- a/fontfaceobserver/tsconfig.json +++ b/fontfaceobserver/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fontoxml/tsconfig.json b/fontoxml/tsconfig.json index 0da5dec88f..408ea0539f 100644 --- a/fontoxml/tsconfig.json +++ b/fontoxml/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/forge-di/tsconfig.json b/forge-di/tsconfig.json index a02668aeaf..dc34b4d365 100644 --- a/forge-di/tsconfig.json +++ b/forge-di/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/form-data/form-data-tests.ts b/form-data/form-data-tests.ts index 2df21510c0..6d1b9d6cb9 100644 --- a/form-data/form-data-tests.ts +++ b/form-data/form-data-tests.ts @@ -132,3 +132,10 @@ import * as ImportUsingES6Syntax from 'form-data'; console.log(json); }); } + +() => { + var form = new FormData(); + form.getLength((err: Error, length: number): void => { + // nothing + }); +} diff --git a/form-data/index.d.ts b/form-data/index.d.ts index 606ffdbd4a..e4bd6ca2e1 100644 --- a/form-data/index.d.ts +++ b/form-data/index.d.ts @@ -5,15 +5,18 @@ // Imported from: https://github.com/soywiz/typescript-node-definitions/form-data.d.ts +/// + export = FormData; -declare class FormData { +import * as stream from "stream"; + +declare class FormData extends stream.Readable { append(key: string, value: any, options?: any): void; getHeaders(): FormData.Dictionary; - // TODO expand pipe - pipe(to: any): any; submit(params: string | Object, callback: (error: any, response: any) => void): any; getBoundary(): string; + getLength(callback: (err: Error, length: number) => void): void; } declare namespace FormData { diff --git a/form-data/tsconfig.json b/form-data/tsconfig.json index 39e5216635..8b65885995 100644 --- a/form-data/tsconfig.json +++ b/form-data/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/form-serializer/tsconfig.json b/form-serializer/tsconfig.json index 640f0ead68..f980ae551c 100644 --- a/form-serializer/tsconfig.json +++ b/form-serializer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/format-unicorn/tsconfig.json b/format-unicorn/tsconfig.json index 2b9c44d3e7..265f92ffe4 100644 --- a/format-unicorn/tsconfig.json +++ b/format-unicorn/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/formidable/tsconfig.json b/formidable/tsconfig.json index 2622e7f64f..3552db0714 100644 --- a/formidable/tsconfig.json +++ b/formidable/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fossil-delta/fossil-delta-tests.ts b/fossil-delta/fossil-delta-tests.ts index 113757c677..f3a7635a7c 100644 --- a/fossil-delta/fossil-delta-tests.ts +++ b/fossil-delta/fossil-delta-tests.ts @@ -1,4 +1,3 @@ -/// import * as fossilDelta from "fossil-delta"; var origin = new Array(1,2,3); diff --git a/fossil-delta/fossil-delta.d.ts b/fossil-delta/fossil-delta.d.ts deleted file mode 100644 index fddb8f50af..0000000000 --- a/fossil-delta/fossil-delta.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Type definitions for fossil-delta 0.2.5 -// Project: https://github.com/dchest/fossil-delta-js -// Definitions by: Endel Dreyer -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -declare module "fossil-delta" { - type ByteArray = Array | Uint8Array | Buffer; - - export function create(origin: ByteArray, target: ByteArray): Array; - export function apply(origin: ByteArray, delta: Array): Array; - export function outputSize(delta: Array): number; -} diff --git a/fossil-delta/index.d.ts b/fossil-delta/index.d.ts new file mode 100644 index 0000000000..c72e914df6 --- /dev/null +++ b/fossil-delta/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for fossil-delta 0.2.5 +// Project: https://github.com/dchest/fossil-delta-js +// Definitions by: Endel Dreyer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +type ByteArray = Array | Uint8Array | Buffer; + +export function create(origin: ByteArray, target: ByteArray): Array; +export function apply(origin: ByteArray, delta: Array): Array; +export function outputSize(delta: Array): number; diff --git a/fossil-delta/tsconfig.json b/fossil-delta/tsconfig.json new file mode 100644 index 0000000000..0e1c6bcfd8 --- /dev/null +++ b/fossil-delta/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "fossil-delta-tests.ts" + ] +} \ No newline at end of file diff --git a/foundation-sites/tsconfig.json b/foundation-sites/tsconfig.json index debb56f66e..e648a90133 100644 --- a/foundation-sites/tsconfig.json +++ b/foundation-sites/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/foundation/tsconfig.json b/foundation/tsconfig.json index 7286110268..9fe7c2aff4 100644 --- a/foundation/tsconfig.json +++ b/foundation/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fpsmeter/tsconfig.json b/fpsmeter/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/fpsmeter/tsconfig.json +++ b/fpsmeter/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/freedom/tsconfig.json b/freedom/tsconfig.json index 76c6f24840..dcd0c4fba3 100644 --- a/freedom/tsconfig.json +++ b/freedom/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/freeport/tsconfig.json b/freeport/tsconfig.json index 859a812706..36066e65e6 100644 --- a/freeport/tsconfig.json +++ b/freeport/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/from/tsconfig.json b/from/tsconfig.json index b9a8839c41..5d7082a7b7 100644 --- a/from/tsconfig.json +++ b/from/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fromjs/index.d.ts b/fromjs/index.d.ts index b023e24bea..d2de8cc024 100644 --- a/fromjs/index.d.ts +++ b/fromjs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for fromjs v2.1.6.1 +// Type definitions for fromjs v2.1.6.1 // Project: https://github.com/suckgamony/fromjs // Definitions by: Glenn Dierckx // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -32,9 +32,8 @@ declare namespace FromJS { contains(item: T): boolean; first(predicate: (item: T) => boolean): T; firstOrDefault(): T; - each(action: (item: T) => void): void; each(action: (value: T, key: TKey) => void): void; - each(action: (item: T) => void, a: boolean): void; + each(action: (item: T) => void, a?: boolean): void; toArray(): Array; concat(second: Array): IQueryable; sum(): T; diff --git a/fromjs/tsconfig.json b/fromjs/tsconfig.json index 2f222ab744..78f1ca510c 100644 --- a/fromjs/tsconfig.json +++ b/fromjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fromnow/tsconfig.json b/fromnow/tsconfig.json index c0a2aa0e09..f72b744eca 100644 --- a/fromnow/tsconfig.json +++ b/fromnow/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fs-ext/tsconfig.json b/fs-ext/tsconfig.json index 7a29b5af1e..2c664cc7a4 100644 --- a/fs-ext/tsconfig.json +++ b/fs-ext/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fs-extra-promise-es6/tsconfig.json b/fs-extra-promise-es6/tsconfig.json index a0bda21ebe..a21cc4aac2 100644 --- a/fs-extra-promise-es6/tsconfig.json +++ b/fs-extra-promise-es6/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fs-extra-promise/tsconfig.json b/fs-extra-promise/tsconfig.json index ecbbde6903..7a4832b918 100644 --- a/fs-extra-promise/tsconfig.json +++ b/fs-extra-promise/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fs-extra/index.d.ts b/fs-extra/index.d.ts index 5d53a4d28f..c24ee5a49d 100644 --- a/fs-extra/index.d.ts +++ b/fs-extra/index.d.ts @@ -18,6 +18,9 @@ export declare function copySync(src: string, dest: string): void; export declare function copySync(src: string, dest: string, filter: CopyFilter): void; export declare function copySync(src: string, dest: string, options: CopyOptions): void; +export declare function move(src: string, dest: string, callback?: (err: Error) => void): void; +export declare function move(src: string, dest: string, options: MoveOptions, callback?: (err: Error) => void): void; + export declare function createFile(file: string, callback?: (err: Error) => void): void; export declare function createFileSync(file: string): void; @@ -89,6 +92,11 @@ export interface CopyOptions { limit?: number; } +export interface MoveOptions { + clobber? : boolean; + limit?: number; +} + export interface OpenOptions { encoding?: string; flag?: string; diff --git a/fs-extra/tsconfig.json b/fs-extra/tsconfig.json index d039b216f6..e7c5d7aa25 100644 --- a/fs-extra/tsconfig.json +++ b/fs-extra/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fs-finder/tsconfig.json b/fs-finder/tsconfig.json index af5cb7ae6e..c2bb43bac1 100644 --- a/fs-finder/tsconfig.json +++ b/fs-finder/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fs-mock/index.d.ts b/fs-mock/index.d.ts index ffab4b94eb..25c6fc3e0f 100644 --- a/fs-mock/index.d.ts +++ b/fs-mock/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for fs-mock 1.1.3 +// Type definitions for fs-mock 1.1.3 // Project: https://github.com/sakren/node-fs-mock // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/fs-mock/tsconfig.json b/fs-mock/tsconfig.json index 57fda9bafb..2074406fdc 100644 --- a/fs-mock/tsconfig.json +++ b/fs-mock/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fs-promise/fs-promise-tests.ts b/fs-promise/fs-promise-tests.ts new file mode 100644 index 0000000000..4469ea5c22 --- /dev/null +++ b/fs-promise/fs-promise-tests.ts @@ -0,0 +1,51 @@ +import * as fs from "fs-promise"; + +var src: string; +var dst: string; +var dir: string; +var path: string; +var data: any; +var writeOptions: fs.WriteOptions; +var writeJsonOptions: fs.WriteJsonOptions; +var readJsonOptions: fs.ReadJsonOptions; + +async function test() { + await fs.copy(src, dst); + await fs.emptyDir(dir); + await fs.emptydir(dir); + await fs.ensureFile(path); + await fs.createFile(path); + await fs.ensureDir(dir); + await fs.ensureLink(src, dst); + await fs.createLink(src, dst); + await fs.ensureSymlink(src, dst); + await fs.ensureSymlink(src, dst, "dir"); + await fs.ensureSymlink(src, dst, "file"); + await fs.ensureSymlink(src, dst, "junction"); + await fs.createSymlink(src, dst, "dir"); + await fs.mkdirs(dir); + await fs.mkdirp(dir); + await fs.move(src, dst); + await fs.outputFile(path, "test"); + await fs.outputFile(path, "test", writeOptions); + await fs.outputFile(path, new Buffer([1,2])); + await fs.outputFile(path, new Buffer([1,2]), writeOptions); + await fs.outputJson(path, data); + await fs.outputJson(path, data, writeJsonOptions); + await fs.outputJSON(path, data, writeJsonOptions); + let json = await fs.readJson(path); + json = await fs.readJson(path, readJsonOptions); + json = await fs.readJSON(path, readJsonOptions); + await fs.remove(path); + let dirs: string[] = await fs.walk(dir); + await fs.writeJson(path, data); + await fs.writeJson(path, data, writeJsonOptions); + await fs.writeJSON(path, data, writeJsonOptions); + return dirs; +} + +test().then((dirs: string[]) => { + console.log(dirs); +}).catch((err) => { + console.log(err); +}); diff --git a/fs-promise/index.d.ts b/fs-promise/index.d.ts new file mode 100644 index 0000000000..09b6ec4b9c --- /dev/null +++ b/fs-promise/index.d.ts @@ -0,0 +1,58 @@ +// Type definitions for fs-promise 1.0 +// Project: https://github.com/kevinbeaty/fs-promise#readme +// Definitions by: Thiago de Arruda +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export * from "mz/fs"; + +export interface WriteOptions { + encoding?: string; + mode?: number; + flag?: string; +} + +type JsonReplacerArray = Array; + +type JsonReplacerFunction = (key: any, value: any) => any; + +type JsonReplacer = JsonReplacerArray | JsonReplacerFunction; + +export interface WriteJsonOptions extends WriteOptions { + spaces?: number; + replacer?: JsonReplacer; +} + +export interface ReadJsonOptions { + encoding: string; + flag?: string; + reviver: (key: any, value: any) => any; +} + +export function copy(src: string, dst: string): Promise; +export function emptyDir(dir: string): Promise; +export function ensureFile(file: string): Promise; +export function ensureDir(dir: string): Promise; +export function ensureLink(srcpath: string, dstpath: string): Promise; +export function ensureSymlink(srcpath: string, dstpath: string, type?: "dir" | "file" | "junction"): Promise; +export function mkdirs(dir: string): Promise; +export function move(src: string, dst: string): Promise; +export function outputFile(file: string, data: string | Buffer, options?: WriteOptions): Promise; +export function outputJson(file: string, data: any, options?: WriteJsonOptions): Promise; +export function readJson(file: string, options?: ReadJsonOptions): Promise; +export function remove(path: string): Promise; +export function walk(dir: string): Promise; +export function writeJson(file: string, data: any, options?: WriteJsonOptions): Promise; + +// aliases +export { + emptyDir as emptydir, + ensureFile as createFile, + ensureLink as createLink, + ensureSymlink as createSymlink, + mkdirs as mkdirp, + outputJson as outputJSON, + readJson as readJSON, + writeJson as writeJSON +}; diff --git a/fs-promise/tsconfig.json b/fs-promise/tsconfig.json new file mode 100644 index 0000000000..0b76206679 --- /dev/null +++ b/fs-promise/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "fs-promise-tests.ts" + ] +} \ No newline at end of file diff --git a/fs-promise/tslint.json b/fs-promise/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/fs-promise/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/ftdomdelegate/tsconfig.json b/ftdomdelegate/tsconfig.json index f15a4c3bcd..7753ff59f3 100644 --- a/ftdomdelegate/tsconfig.json +++ b/ftdomdelegate/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ftp/index.d.ts b/ftp/index.d.ts index 9411367229..07d3ebc45a 100644 --- a/ftp/index.d.ts +++ b/ftp/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ftp 0.3.8 +// Type definitions for ftp 0.3.8 // Project: https://github.com/mscdex/node-ftp // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/ftp/tsconfig.json b/ftp/tsconfig.json index d2eaae10ac..3dae56f613 100644 --- a/ftp/tsconfig.json +++ b/ftp/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ftpd/ftpd-tests.ts b/ftpd/ftpd-tests.ts index 8942dedcb7..671ccf7053 100644 --- a/ftpd/ftpd-tests.ts +++ b/ftpd/ftpd-tests.ts @@ -9,7 +9,8 @@ var options: ftpd.FtpServerOptions = { }, getRoot: function(connection: ftpd.FtpConnection): string { return '/'; - } + }, + logLevel: ftpd.LogLevel.ERROR }; var host: string = '10.0.0.42'; @@ -21,11 +22,12 @@ server.on('client:connected', function(conn: ftpd.FtpConnection): void { success(); }); conn.on('command:pass', function( - pass: string, - success: (username: string, fs?: ftpd.FtpFileSystem) => void, + pass: string, + success: (username: string, fs?: ftpd.FtpFileSystem) => void, failure: () => void) { success("Rogier"); }); }); +server.debugging = ftpd.LogLevel.TRACE; server.listen(21); diff --git a/ftpd/index.d.ts b/ftpd/index.d.ts index 7aee0bb578..cd325109ee 100644 --- a/ftpd/index.d.ts +++ b/ftpd/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ftpd 0.2.11 +// Type definitions for ftpd 0.2.11 // Project: https://github.com/sstur/nodeftpd // Definitions by: Rogier Schouten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,6 +12,14 @@ import fs = require("fs"); import net = require("net"); import tls = require("tls"); +export const enum LogLevel { + ERROR = 0, + WARN = 1, + INFO = 2, + DEBUG = 3, + TRACE = 4 +} + /** * Options for FtpServer constructor */ @@ -85,6 +93,11 @@ export interface FtpServerOptions { * Integer, specifies the upper-bound port (max port) for creating PASV connections */ pasvPortRangeEnd?: number; + /** + * Integer from 0-4 representing the Log Level to show. + */ + logLevel?: LogLevel; + } /** @@ -195,4 +208,9 @@ export declare class FtpServer extends events.EventEmitter { * Stop listening */ public close(callback?: () => void): void; + + /** + * Change/Retrieve logLevel at runtime. + */ + public debugging: LogLevel; } diff --git a/ftpd/tsconfig.json b/ftpd/tsconfig.json index 4a700a848e..273ec70eec 100644 --- a/ftpd/tsconfig.json +++ b/ftpd/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fullcalendar/index.d.ts b/fullcalendar/index.d.ts index fc687696f1..0c55872014 100644 --- a/fullcalendar/index.d.ts +++ b/fullcalendar/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for FullCalendar 2.7.2 +// Type definitions for FullCalendar 2.7.2 // Project: http://fullcalendar.io/ // Definitions by: Neil Stalker , Marcelo Camargo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -136,7 +136,13 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr eventAfterAllRender?: (view: ViewObject) => void; eventDestroy?: (event: EventObject, element: JQuery, view: ViewObject) => void; - //scheduler options + //scheduler options + resourceAreaWidth?:number, + schedulerLicenseKey?:string, + customButtons?:any, + resourceLabelText?:any, + resourceColumns?:any, + displayEventTime?:any, } /** diff --git a/fullcalendar/tsconfig.json b/fullcalendar/tsconfig.json index 8add172748..b8ea18f909 100644 --- a/fullcalendar/tsconfig.json +++ b/fullcalendar/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fullname/tsconfig.json b/fullname/tsconfig.json index b612be3299..775f24a542 100644 --- a/fullname/tsconfig.json +++ b/fullname/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fullpage.js/fullpage.js-tests.ts b/fullpage.js/fullpage.js-tests.ts index 31e66fdd60..b8990ea9c8 100644 --- a/fullpage.js/fullpage.js-tests.ts +++ b/fullpage.js/fullpage.js-tests.ts @@ -1,5 +1,3 @@ -/// - function test_public_methods() { $(() => { $('#fullpage').fullpage({ diff --git a/fullpage.js/fullpage.js.d.ts b/fullpage.js/index.d.ts similarity index 100% rename from fullpage.js/fullpage.js.d.ts rename to fullpage.js/index.d.ts diff --git a/fullpage.js/tsconfig.json b/fullpage.js/tsconfig.json index 0e6588b0f4..f0a258d175 100644 --- a/fullpage.js/tsconfig.json +++ b/fullpage.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "fullpage.js.d.ts", + "index.d.ts", "fullpage.js-tests.ts" ] } \ No newline at end of file diff --git a/fuse/index.d.ts b/fuse/index.d.ts index 9f1de6ff03..5376144e22 100644 --- a/fuse/index.d.ts +++ b/fuse/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Fuse.js 2.2.0 +// Type definitions for Fuse.js 2.5.0 // Project: https://github.com/krisk/Fuse // Definitions by: Greg Smith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -9,7 +9,8 @@ declare class Fuse { } declare namespace fuse { - interface IFuseOptions extends ISearchOptions { + interface IFuseOptions { + id?: string; caseSensitive?: boolean; include?: string[]; shouldSort?: boolean; @@ -18,9 +19,9 @@ declare namespace fuse { getFn?: (obj: any, path: string) => any; keys?: string[] | { name:string; weight:number} []; verbose?:boolean; - } - - interface ISearchOptions { + tokenize?: boolean; + tokenSeparator? : RegExp; + matchAllTokens?: boolean; location?: number; distance?: number; threshold?: number; diff --git a/fuse/tsconfig.json b/fuse/tsconfig.json index cfeec8f126..b3f6b4c7d5 100644 --- a/fuse/tsconfig.json +++ b/fuse/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/fusioncharts/fusioncharts-tests.ts b/fusioncharts/fusioncharts-tests.ts new file mode 100644 index 0000000000..9bbf640225 --- /dev/null +++ b/fusioncharts/fusioncharts-tests.ts @@ -0,0 +1,49 @@ +FusionCharts.addEventListener('ready',(eventObject)=>{ + eventObject.stopPropagation(); +}); + +FusionCharts.ready((fusioncharts)=>{ + +}); + +FusionCharts.version; + +FusionCharts('chartId').render();; + +FusionCharts["debugger"].enable(true); + +let chartData ={ + type: 'column2d', + renderAt: 'chart-container', + width: '450', + height: '200', + dataFormat: 'json', + dataSource: { + "chart": { + "caption": "Monthly revenue for last year", + "subCaption": "Harry's SuperMart", + }, + "data": [{ + "label": "Jan", + "value": "420000" + }, { + "label": "Feb", + "value": "810000" + } + ] + } +}; + +let chart = new FusionCharts(chartData); +chart.render(); +chart.isActive(); +chart.addEventListener('ready',function(eventObject){ + eventObject.type; +}); +chart.chartType(); +chart.addVariable(); +chart.clone(); +chart.zoomTo(0,3); +chart.zoomOut(); +chart.setJSONData(chartData); +chart.ref; \ No newline at end of file diff --git a/fusioncharts/index.d.ts b/fusioncharts/index.d.ts new file mode 100644 index 0000000000..dc053859b9 --- /dev/null +++ b/fusioncharts/index.d.ts @@ -0,0 +1,297 @@ +// Type definitions for FusionCharts 3.11.2 +// Project: http://www.fusioncharts.com +// Definitions by: Shivaraj KV +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare namespace FusionCharts { + + type ChartDataFormats = 'json' | 'jsonurl' | 'csv' | 'xml' | 'xmlurl'; + + type ImageHAlign = 'left' | 'right' | 'middle'; + + type ImageVAlign = 'top' | 'bottom' | 'middle'; + + interface EventObject { + type: string; + + eventId: number; + + sender: FusionCharts; + + cancelled: boolean; + + stopPropagation: () => void; + + prevented: boolean; + + preventDefault: () => void; + + detached: boolean; + + detachHandler: () => void; + } + + interface ChartObject { + + type?: string; + + id?: string; + + width?: number | string; + + height?: number | string; + + renderAt?: string; + + dataFormat?: ChartDataFormats; + + dataSource?: string | {}; + + events?: {}; + + link?: {}; + + showDataLoadingMessage?: boolean; + + showChartLoadingMessage?: boolean; + + baseChartMessageFont?: string; + + baseChartMessageFontSize?: string; + + baseChartMessageColor?: string; + + dataLoadStartMessage?: string; + + dataLoadErrorMessage?: string; + + dataInvalidMessage?: string; + + dataEmptyMessage?: string; + + typeNotSupportedMessage?: string; + + loadMessage?: string; + + renderErrorMessage?: string; + + containerBackgroundColor?: string; + + containerBackgroundOpacity?: number; + + containerClassName?: string; + + baseChartMessageImageHAlign?: ImageHAlign; + + dataLoadErrorMessageImageVAlign?: ImageVAlign; + + dataLoadErrorMessageImageAlpha?: number; + + dataLoadErrorMessageImageScale?: number; + + dataLoadStartMessageImageHAlign?: ImageHAlign; + + dataLoadStartMessageImageVAlign?: ImageVAlign; + + dataLoadStartMessageImageAlpha?: number; + + dataLoadStartMessageImageScale?: number; + + dataInvalidMessageImageHAlign?: ImageHAlign; + + dataInvalidMessageImageVAlign?: ImageVAlign; + + dataInvalidMessageImageAlpha?: number; + + dataInvalidMessageImageScale?: number; + + dataEmptyMessageImageHAlign?: ImageHAlign; + + dataEmptyMessageImageVAlign?: ImageVAlign; + + dataEmptyMessageImageAlpha?: number; + + dataEmptyMessageImageScale?: number; + + renderErrorMessageImageHAlign?: ImageHAlign; + + renderErrorMessageImageVAlign?: ImageVAlign; + + renderErrorMessageImageAlpha?: number; + + renderErrorMessageImageScale?: number; + + loadMessageImageHAlign?: ImageHAlign; + + loadMessageImageVAlign?: ImageVAlign; + + loadMessageImageAlpha?: number; + + loadMessageImageScale?: number; + } + + interface Debugger { + outputFormat(format: any): void; + + outputTo(callback: (message: any) => any): void; + + enable(state:any,outputTo?:(message: any) =>any,outputFormat?:any):void + + enableFirebugLite():any; + } + + interface FusionCharts { + clone(overrides?: {}, argsOnly?: boolean): any; + + isActive(): boolean; + + chartType(value?: string, options?: any): string; + + addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void; + + removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void; + + configureLink(param: {} | any[], level?: number): void; + + setChartAttribute(attributes: ChartObject | String, value?: string): void; + + getChartAttribute(attribute?: string | string[]): ChartObject; + + getXMLData(): any; + + setXMLData(data: string | {}): void; + + setXMLUrl(url: string): void; + + setChartDataUrl(url: string, format: ChartDataFormats): void; + + setChartData(data: string | {}, format: ChartDataFormats): void; + + getChartData(format: ChartDataFormats): any; + + dataReady(available?: boolean): boolean; + + feedData(stream: string): void; + + getData(): any; + + getDataWithId(): any; + + setData(value: number, label: string): void; + + stopUpdate(): void; + + restartUpdate(): void; + + isUpdateActive(): boolean; + + clearChart(): void; + + getSWFHTML(): any; + + addVariable(): void; + + getXML(): any; + + setDataXML(data: string | {}): void; + + setDataURL(url: string): void; + + hasRendered(): boolean; + + setTransparent(transparency?: boolean): void; + + isPlotItemSliced(index: number): boolean; + + slicePlotItem(index: number, slice: boolean): void; + + centerLabel(labelText: string, options?: {}): void; + + startingAngle(angle?: number, relative?: boolean): void; + + zoomOut(): void; + + zoomTo(startIndex: number, endIndex: number): void; + + resetChart(): void; + + setZoomMode(yes: boolean): void; + + getViewStartIndex(): number; + + getViewEndIndex(): number; + + print(options?: {}): void; + + exportChart(options?: {}): void; + + getSVGString(): string; + + lockResize(state: boolean): boolean; + + showChartMessage(text: string, modal?: boolean, cancelable?: boolean): void; + + getJSONData(): JSON; + + setJSONData(data: string | {}): void; + + setJSONUrl(url: string): void; + + getCSVData(): any; + + getDataAsCSV(): any; + + render(containerElement?: string | Element, insertMode?: string, callback?: () => any): FusionCharts; + + resizeTo(width: number | string, height: number | string): any; + + dispose(): void; + + configure(options: {}): void; + + ref: {}; + + } + + interface FusionChartStatic { + new (chartObject: ChartObject|{}): FusionCharts; + + (chartId: string): FusionCharts; + + getObjectReference(elementId: string): Element; + + addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void; + + removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void; + + ready(callback: (fusionChartStatic?: FusionChartStatic) => any, context?: any): FusionChartStatic; + + transcodeData(data: string | {}, source: ChartDataFormats, target: ChartDataFormats, advanced: boolean): any; + + batchExport(options: {}): void; + + formatNumber(num: number, type?: string, config?: {}): Element; + + setCurrentRenderer(name: string): void + + getCurrentRenderer(): string; + + render(options?: ChartObject, callback?: () => any): FusionCharts; + + version: string[]; + + items: {}; + + options: {}; + + debugger:Debugger; + + + } + +} + +declare var FusionCharts: FusionCharts.FusionChartStatic; +export = FusionCharts; +export as namespace FusionCharts; diff --git a/fusioncharts/tsconfig.json b/fusioncharts/tsconfig.json new file mode 100644 index 0000000000..e7ffb46dd1 --- /dev/null +++ b/fusioncharts/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "fusioncharts-tests.ts" + ] +} \ No newline at end of file diff --git a/fuzzaldrin-plus/tsconfig.json b/fuzzaldrin-plus/tsconfig.json index ce458c2f00..d1862e59bc 100644 --- a/fuzzaldrin-plus/tsconfig.json +++ b/fuzzaldrin-plus/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -16,4 +17,4 @@ "index.d.ts", "fuzzaldrin-plus-tests.ts" ] -} +} \ No newline at end of file diff --git a/fxn/index.d.ts b/fxn/index.d.ts new file mode 100644 index 0000000000..228a7e934a --- /dev/null +++ b/fxn/index.d.ts @@ -0,0 +1,64 @@ +// Type definitions for fxn 0.0.4 +// Project: https://github.com/poly/fxn +// Definitions by: Adam Charron +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS'; + +export interface HttpHeaders { + [item: string]: string; +} + +export abstract class Controller { + + protected _method: HttpMethod; + protected _path: string; + protected _requestHeaders: Object; + protected _headers: Object; + protected _status: number; + protected _responder: Function; + protected _securityPolicies: Object; + protected params: any; + + constructor(path: string, method: string, requestHeaders: Object, params: Object, responder: Function); + convertMethod(method: HttpMethod, id: number): string; + run(): void; + notImplemented(msg: string, details: Object): boolean; + before(): void; + after(): void; + get(): void; + put(): void; + post(): void; + del(): void; + options(): void; + index(): void; + show(): void; + update(): void; + create(): void; + destroy(): void; + status(value: number): boolean; + setHeaders(): HttpHeaders; + setHeader(key: string, value: string): string; + appendHeader(key: string, value: string): string; + getHeader(key: string, value: string): string; + code(code: number): number; + getStatus(): number; + render(data: Buffer | String | Object): void; + allowOrigin(value: string): this; + securityPolicy(directive: string, src: string): string; + redirect(location: string): void; +} + +export abstract class Daemon { + constructor(string: string); +} + +export abstract class Application { + constructor(string: string); + send: Function; +} + +export abstract class Router {} +export abstract class Scheduler {} diff --git a/fxn/tsconfig.json b/fxn/tsconfig.json new file mode 100644 index 0000000000..a1a40d7393 --- /dev/null +++ b/fxn/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/gae.channel.api/tsconfig.json b/gae.channel.api/tsconfig.json index c756f0465a..00bc44f6a7 100644 --- a/gae.channel.api/tsconfig.json +++ b/gae.channel.api/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gamepad/tsconfig.json b/gamepad/tsconfig.json index 1ad5261300..51357155f8 100644 --- a/gamepad/tsconfig.json +++ b/gamepad/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gamequery/tsconfig.json b/gamequery/tsconfig.json index f6640de737..da24a150cd 100644 --- a/gamequery/tsconfig.json +++ b/gamequery/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gandi-livedns/tsconfig.json b/gandi-livedns/tsconfig.json index 1f48c58aed..c7921932ad 100644 --- a/gandi-livedns/tsconfig.json +++ b/gandi-livedns/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gapi.analytics/gapi.analytics-tests.ts b/gapi.analytics/gapi.analytics-tests.ts new file mode 100644 index 0000000000..2c35403d10 --- /dev/null +++ b/gapi.analytics/gapi.analytics-tests.ts @@ -0,0 +1,63 @@ +// Type definitions for Google Analytics API + +function test_namespace() { + var analytics : boolean = gapi.client.analytics instanceof Object; + + var provisioning : boolean = gapi.client.analytics.provisioning.createAccountTicket instanceof Function; + analytics = analytics && provisioning; + + var data : boolean = gapi.client.analytics.data.ga.get instanceof Function; + data = data && gapi.client.analytics.data.mcf.get instanceof Function; + data = data && gapi.client.analytics.data.realtime.get instanceof Function; + analytics = analytics && data; + + interface AnalyticsParameter { + "type" ?: string; + "description" ?: string; + "default" ?: string; + "enum" ?: string[]; + "enumDescriptions" ?: string[]; + "location" ?: string; + } + var kBI : AnalyticsParameter = gapi.client.analytics.kB.parameters.alt; + var kB = !!kBI; + kBI = gapi.client.analytics.kB.parameters.fields; + kB = kB && !!kBI; + kBI = gapi.client.analytics.kB.parameters.key; + kB = kB && !!kBI; + kBI = gapi.client.analytics.kB.parameters.oauth_token; + kB = kB && !!kBI; + kBI = gapi.client.analytics.kB.parameters.prettyPrint; + kB = kB && !!kBI; + kBI = gapi.client.analytics.kB.parameters.quotaUser; + kB = kB && !!kBI; + kBI = gapi.client.analytics.kB.parameters.userIP; + kB = kB && !!kBI; + analytics = analytics && kB; + + var management : boolean = gapi.client.analytics.management.accountSummaries.list instanceof Function; + management = management && gapi.client.analytics.management.accountUserLinks.list instanceof Function; + management = management && gapi.client.analytics.management.accounts.list instanceof Function; + management = management && gapi.client.analytics.management.customDataSources.list instanceof Function; + management = management && gapi.client.analytics.management.customDimensions.list instanceof Function; + management = management && gapi.client.analytics.management.customMetrics.list instanceof Function; + management = management && gapi.client.analytics.management.experiments.list instanceof Function; + management = management && gapi.client.analytics.management.filters.list instanceof Function; + management = management && gapi.client.analytics.management.goals.list instanceof Function; + management = management && gapi.client.analytics.management.profileFilterLinks.list instanceof Function; + management = management && gapi.client.analytics.management.profileUserLinks.list instanceof Function; + management = management && gapi.client.analytics.management.profiles.list instanceof Function; + management = management && gapi.client.analytics.management.remarketingAudience.list instanceof Function; + management = management && gapi.client.analytics.management.segments.list instanceof Function; + management = management && gapi.client.analytics.management.unsampledReports.list instanceof Function; + management = management && gapi.client.analytics.management.uploads.list instanceof Function; + management = management && gapi.client.analytics.management.webPropertyAdWordsLinks.list instanceof Function; + management = management && gapi.client.analytics.management.webproperties.list instanceof Function; + management = management && gapi.client.analytics.management.webpropertyUserLinks.list instanceof Function; + analytics = analytics && management; + + var metadata : boolean = gapi.client.analytics.metadata.column.list instanceof Function; + analytics = analytics && metadata; + + return analytics; +} diff --git a/gapi.analytics/index.d.ts b/gapi.analytics/index.d.ts new file mode 100644 index 0000000000..31bbd1a83b --- /dev/null +++ b/gapi.analytics/index.d.ts @@ -0,0 +1,126 @@ +// Type definitions for Google Analytics API +// Project: https://developers.google.com/analytics/devguides/reporting/core/v4/ +// Definitions by: César Costas +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace gapi.client.analytics {} +declare namespace gapi.client.analytics.provisioning { + export function createAccountTicket() : Promise; +} + +interface DataQuery { + "ids" ?: string; + "start-date" ?: string; + "30daysAgo" ?: string; + "end-date" ?: string; + "yesterday" ?: string; + "metrics" ?: string; + "dimensions" ?: string; + "sort" ?: string; + "filters" ?: string; + "segment" ?: string; + "samplingLevel" ?: string; + "include-empty-rows" ?: string; + "start-index" ?: string; + "max-results" ?: string; +} +declare namespace gapi.client.analytics.data {} +declare namespace gapi.client.analytics.data.ga { + export function get(data ?: DataQuery) : Promise; +} +declare namespace gapi.client.analytics.data.mcf { + export function get(data ?: DataQuery) : Promise; +} +declare namespace gapi.client.analytics.data.realtime { + export function get(data ?: DataQuery) : Promise; +} + +declare namespace gapi.client.analytics.kB {} +declare namespace gapi.client.analytics.kB.parameters { + export interface AnalyticsParameter { + "type" ?: string; + "description" ?: string; + "default" ?: string; + "enum" ?: string[]; + "enumDescriptions" ?: string[]; + "location" ?: string; + } + export class alt implements AnalyticsParameter {} + export class fields implements AnalyticsParameter {} + export class key implements AnalyticsParameter {} + export class oauth_token implements AnalyticsParameter {} + export class prettyPrint implements AnalyticsParameter {} + export class quotaUser implements AnalyticsParameter {} + export class userIP implements AnalyticsParameter {} +} + +interface View { + accountId ?: string; + webPropertyId ?: string; + webViewId ?: string; +} +declare namespace gapi.client.analytics.management {} +declare namespace gapi.client.analytics.management.accountSummaries { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.accountUserLinks { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.accounts { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.customDataSources { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.customDimensions { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.customMetrics { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.experiments { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.filters { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.goals { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.profileFilterLinks { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.profileUserLinks { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.profiles { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.remarketingAudience { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.segments { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.unsampledReports { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.uploads { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.webPropertyAdWordsLinks { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.webproperties { + export function list(view ?: View) : Promise; +} +declare namespace gapi.client.analytics.management.webpropertyUserLinks { + export function list(view ?: View) : Promise; +} + +declare namespace gapi.client.analytics.metadata {} +declare namespace gapi.client.analytics.metadata.column { + export function list() : Promise; +} diff --git a/gapi.analytics/tsconfig.json b/gapi.analytics/tsconfig.json new file mode 100644 index 0000000000..8fd78b3902 --- /dev/null +++ b/gapi.analytics/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "gapi.analytics-tests.ts" + ] +} \ No newline at end of file diff --git a/gapi.auth2/index.d.ts b/gapi.auth2/index.d.ts index 3613febb09..593cae78d8 100644 --- a/gapi.auth2/index.d.ts +++ b/gapi.auth2/index.d.ts @@ -103,6 +103,8 @@ declare namespace gapi.auth2 { export interface BasicProfile { getId(): string; getName(): string; + getGivenName(): string; + getFamilyName(): string; getImageUrl(): string; getEmail(): string; } diff --git a/gapi.auth2/tsconfig.json b/gapi.auth2/tsconfig.json index daad8ef260..c29ced0df3 100644 --- a/gapi.auth2/tsconfig.json +++ b/gapi.auth2/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gapi.pagespeedonline/tsconfig.json b/gapi.pagespeedonline/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/gapi.pagespeedonline/tsconfig.json +++ b/gapi.pagespeedonline/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gapi.translate/index.d.ts b/gapi.translate/index.d.ts index 0fa655b0f3..66bb1719ae 100644 --- a/gapi.translate/index.d.ts +++ b/gapi.translate/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Google Translate API +// Type definitions for Google Translate API // Project: https://developers.google.com/translate/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/gapi.translate/tsconfig.json b/gapi.translate/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/gapi.translate/tsconfig.json +++ b/gapi.translate/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gapi.urlshortener/index.d.ts b/gapi.urlshortener/index.d.ts index e9fc5e4305..a7cdcb1364 100644 --- a/gapi.urlshortener/index.d.ts +++ b/gapi.urlshortener/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Google Url Shortener API +// Type definitions for Google Url Shortener API // Project: https://developers.google.com/url-shortener/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/gapi.urlshortener/tsconfig.json b/gapi.urlshortener/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/gapi.urlshortener/tsconfig.json +++ b/gapi.urlshortener/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gapi.youtube/tsconfig.json b/gapi.youtube/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/gapi.youtube/tsconfig.json +++ b/gapi.youtube/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gapi.youtubeanalytics/index.d.ts b/gapi.youtubeanalytics/index.d.ts index 0466da2cc2..6595cad721 100644 --- a/gapi.youtubeanalytics/index.d.ts +++ b/gapi.youtubeanalytics/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for YouTube Analytics API +// Type definitions for YouTube Analytics API // Project: https://developers.google.com/youtube/analytics/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/gapi.youtubeanalytics/tsconfig.json b/gapi.youtubeanalytics/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/gapi.youtubeanalytics/tsconfig.json +++ b/gapi.youtubeanalytics/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gapi/index.d.ts b/gapi/index.d.ts index 6d7e18a12e..28d5c990bc 100644 --- a/gapi/index.d.ts +++ b/gapi/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Google API Client +// Type definitions for Google API Client // Project: https://code.google.com/p/google-api-javascript-client/ // Definitions by: Frank M // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -127,27 +127,7 @@ declare namespace gapi.auth { } declare namespace gapi.client { - /** - * Loads the client library interface to a particular API. If a callback is not provided, a promise is returned. - * @param name The name of the API to load. - * @param version The version of the API to load. - * @return promise The promise that get's resolved after the request is finished. - */ - export function load(name: string, version: string): Promise - - /** - * Loads the client library interface to a particular API. The new API interface will be in the form gapi.client.api.collection.method. - * @param name The name of the API to load. - * @param version The version of the API to load - * @param callback the function that is called once the API interface is loaded - * @param url optional, the url of your app - if using Google's APIs, don't set it - */ - export function load(name: string, version: string, callback: () => any, url?: string): void; - /** - * Creates a HTTP request for making RESTful requests. - * An object encapsulating the various arguments for this method. - */ - export function request(args: { + interface RequestOptions { /** * The URL to handle the request */ @@ -172,7 +152,29 @@ declare namespace gapi.client { * If supplied, the request is executed immediately and no gapi.client.HttpRequest object is returned */ callback?: () => any; - }): HttpRequest; + } + + /** + * Loads the client library interface to a particular API. If a callback is not provided, a promise is returned. + * @param name The name of the API to load. + * @param version The version of the API to load. + * @return promise The promise that get's resolved after the request is finished. + */ + export function load(name: string, version: string): Promise + + /** + * Loads the client library interface to a particular API. The new API interface will be in the form gapi.client.api.collection.method. + * @param name The name of the API to load. + * @param version The version of the API to load + * @param callback the function that is called once the API interface is loaded + * @param url optional, the url of your app - if using Google's APIs, don't set it + */ + export function load(name: string, version: string, callback: () => any, url?: string): void; + /** + * Creates a HTTP request for making RESTful requests. + * An object encapsulating the various arguments for this method. + */ + export function request(args: RequestOptions): HttpRequest; /** * Creates an RPC Request directly. The method name and version identify the method to be executed and the RPC params are provided upon RPC creation. * @param method The method to be executed. diff --git a/gapi/tsconfig.json b/gapi/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/gapi/tsconfig.json +++ b/gapi/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/generic-functions/tsconfig.json b/generic-functions/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/generic-functions/tsconfig.json +++ b/generic-functions/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gently/tsconfig.json b/gently/tsconfig.json index 99e767e058..91afbecd77 100644 --- a/gently/tsconfig.json +++ b/gently/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/geoip-lite/tsconfig.json b/geoip-lite/tsconfig.json index bf312493a4..7029421649 100644 --- a/geoip-lite/tsconfig.json +++ b/geoip-lite/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/geojson/tsconfig.json b/geojson/tsconfig.json index d0edb7805b..b2ff67d2ae 100644 --- a/geojson/tsconfig.json +++ b/geojson/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/geojson2osm/tsconfig.json b/geojson2osm/tsconfig.json index 310959268e..5ba7c9065b 100644 --- a/geojson2osm/tsconfig.json +++ b/geojson2osm/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/geometry-dom/tsconfig.json b/geometry-dom/tsconfig.json index 125fc6f5e7..669f02023b 100644 --- a/geometry-dom/tsconfig.json +++ b/geometry-dom/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/get-port/tsconfig.json b/get-port/tsconfig.json index 82925a477d..db99c113ee 100644 --- a/get-port/tsconfig.json +++ b/get-port/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/get-stdin/index-tests.ts b/get-stdin/index-tests.ts new file mode 100644 index 0000000000..d5b720234f --- /dev/null +++ b/get-stdin/index-tests.ts @@ -0,0 +1,9 @@ +import getStdin = require("get-stdin"); + +getStdin().then(str => { + console.log(str.toLowerCase()); +}); + +getStdin.buffer().then(buffer => { + console.log("Length " + buffer.length + buffer.toString()); +}) \ No newline at end of file diff --git a/get-stdin/index.d.ts b/get-stdin/index.d.ts new file mode 100644 index 0000000000..9539b520b9 --- /dev/null +++ b/get-stdin/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for get-stdin 5.0 +// Project: https://github.com/sindresorhus/get-stdin +// Definitions by: Daniel Rosenwasser +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare function getStdin(): Promise; +declare namespace getStdin { + export function buffer(): Promise; +} + +export = getStdin; diff --git a/get-stdin/tsconfig.json b/get-stdin/tsconfig.json new file mode 100644 index 0000000000..3d8c032420 --- /dev/null +++ b/get-stdin/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "index-tests.ts" + ] +} \ No newline at end of file diff --git a/get-stdin/tslint.json b/get-stdin/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/get-stdin/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/gijgo/tsconfig.json b/gijgo/tsconfig.json index 0c8ef828b4..b6c04e62bb 100644 --- a/gijgo/tsconfig.json +++ b/gijgo/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/giraffe/tsconfig.json b/giraffe/tsconfig.json index 851623eb34..1c0e13a97a 100644 --- a/giraffe/tsconfig.json +++ b/giraffe/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/git-config/tsconfig.json b/git-config/tsconfig.json index 391edd9502..0cf2078ca0 100644 --- a/git-config/tsconfig.json +++ b/git-config/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/git/tsconfig.json b/git/tsconfig.json index 6b1fbc274c..0bc0ff5fe6 100644 --- a/git/tsconfig.json +++ b/git/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gl-matrix/gl-matrix-tests.ts b/gl-matrix/gl-matrix-tests.ts index a7ea76f353..6325ff5cd4 100644 --- a/gl-matrix/gl-matrix-tests.ts +++ b/gl-matrix/gl-matrix-tests.ts @@ -1,5 +1,3 @@ - - // common import {vec2, mat2, mat3, mat4, vec3, vec4, mat2d, quat} from "gl-matrix"; @@ -35,6 +33,11 @@ let outMat3 = mat3.create(); let outMat4 = mat4.create(); let outQuat = quat.create(); +let outMat2Null: mat2 | null; +let outMat2dNull: mat2d | null; +let outMat3Null: mat3 | null; +let outMat4Null: mat4 | null; + // vec2 outVec2 = vec2.create(); outVec2 = vec2.clone(vec2A); @@ -182,7 +185,7 @@ outMat2 = mat2.identity(outMat2); outMat2 = mat2.fromValues(1, 2, 3, 4); outMat2 = mat2.set(outMat2, 1, 2, 3, 4); outMat2 = mat2.transpose(outMat2, mat2A); -outMat2 = mat2.invert(outMat2, mat2A); +outMat2Null = mat2.invert(outMat2, mat2A); outMat2 = mat2.adjoint(outMat2, mat2A); outVal = mat2.determinant(mat2A); outMat2 = mat2.multiply(outMat2, mat2A, mat2B); @@ -212,7 +215,7 @@ outMat2d = mat2d.copy(outMat2d, mat2dA); outMat2d = mat2d.identity(outMat2d); outMat2d = mat2d.fromValues(1, 2, 3, 4, 5, 6); outMat2d = mat2d.set(outMat2d, 1, 2, 3, 4, 5, 6); -outMat2d = mat2d.invert(outMat2d, mat2dA); +outMat2dNull = mat2d.invert(outMat2d, mat2dA); outVal = mat2d.determinant(mat2dA); outMat2d = mat2d.multiply(outMat2d, mat2dA, mat2dB); outMat2d = mat2d.mul(outMat2d, mat2dA, mat2dB); @@ -241,7 +244,7 @@ outMat3 = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9); outMat3 = mat3.set(outMat3, 1, 2, 3, 4, 5, 6, 7, 8, 9); outMat3 = mat3.identity(outMat3); outMat3 = mat3.transpose(outMat3, mat3A); -outMat3 = mat3.invert(outMat3, mat3A); +outMat3Null = mat3.invert(outMat3, mat3A); outMat3 = mat3.adjoint(outMat3, mat3A); outVal = mat3.determinant(mat3A); outMat3 = mat3.multiply(outMat3, mat3A, mat3B); @@ -254,7 +257,7 @@ outMat3 = mat3.fromRotation(outMat3, Math.PI); outMat3 = mat3.fromScaling(outMat3, vec2A); outMat3 = mat3.fromMat2d(outMat3, mat2dA); outMat3 = mat3.fromQuat(outMat3, quatA); -outMat3 = mat3.normalFromMat4(outMat3, mat4A); +outMat3Null = mat3.normalFromMat4(outMat3, mat4A); outStr = mat3.str(mat3A); outVal = mat3.frob(mat3A); outMat3 = mat3.add(outMat3, mat3A, mat3B); @@ -273,19 +276,19 @@ outMat4 = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) outMat4 = mat4.set(outMat4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); outMat4 = mat4.identity(outMat4); outMat4 = mat4.transpose(outMat4, mat4A); -outMat4 = mat4.invert(outMat4, mat4A); +outMat4Null = mat4.invert(outMat4, mat4A); outMat4 = mat4.adjoint(outMat4, mat4A); outVal = mat4.determinant(mat4A); outMat4 = mat4.multiply(outMat4, mat4A, mat4B); outMat4 = mat4.mul(outMat4, mat4A, mat4B); outMat4 = mat4.translate(outMat4, mat4A, vec3A); outMat4 = mat4.scale(outMat4, mat4A, vec3A); -outMat4 = mat4.rotate(outMat4, mat4A, Math.PI, vec3A); +outMat4Null = mat4.rotate(outMat4, mat4A, Math.PI, vec3A); outMat4 = mat4.rotateX(outMat4, mat4A, Math.PI); outMat4 = mat4.rotateY(outMat4, mat4A, Math.PI); outMat4 = mat4.rotateZ(outMat4, mat4A, Math.PI); outMat4 = mat4.fromTranslation(outMat4, vec3A); -outMat4 = mat4.fromRotation(outMat4, Math.PI, vec3A); +outMat4Null = mat4.fromRotation(outMat4, Math.PI, vec3A); outMat4 = mat4.fromScaling(outMat4, vec3A); outMat4 = mat4.fromXRotation(outMat4, Math.PI); outMat4 = mat4.fromYRotation(outMat4, Math.PI); @@ -345,3 +348,352 @@ outQuat = quat.fromMat3(outQuat, mat3A); outQuat = quat.calculateW(outQuat, quatA); outBool = quat.exactEquals(quatA, quatB); outBool = quat.equals(quatA, quatB); + +// common +import _vec2 = require('gl-matrix/src/gl-matrix/vec2'); +import _vec3 = require('gl-matrix/src/gl-matrix/vec3'); +import _vec4 = require('gl-matrix/src/gl-matrix/vec4'); +import _mat2 = require('gl-matrix/src/gl-matrix/mat2'); +import _mat2d = require('gl-matrix/src/gl-matrix/mat2d'); +import _mat3 = require('gl-matrix/src/gl-matrix/mat3'); +import _mat4 = require('gl-matrix/src/gl-matrix/mat4'); +import _quat = require('gl-matrix/src/gl-matrix/quat'); + +vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); + +vec2A = _vec2.fromValues(1, 2); +vec2B = _vec2.fromValues(3, 4); +vec3A = _vec3.fromValues(1, 2, 3); +vec3B = _vec3.fromValues(3, 4, 5); +vec4A = _vec4.fromValues(1, 2, 3, 4); +vec4B = _vec4.fromValues(3, 4, 5, 6); +mat2A = _mat2.fromValues(1, 2, 3, 4); +mat2B = _mat2.fromValues(1, 2, 3, 4); +mat2dA = _mat2d.fromValues(1, 2, 3, 4, 5, 6); +mat2dB = _mat2d.fromValues(1, 2, 3, 4, 5, 6); +mat3A = _mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9); +mat3B = _mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9); +mat4A = _mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +mat4B = _mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +quatA = _quat.fromValues(1, 2, 3, 4); +quatB = _quat.fromValues(5, 6, 7, 8); + +outVec2 = _vec2.create(); +outVec3 = _vec3.create(); +outVec4 = _vec4.create(); +outMat2 = _mat2.create(); +outMat2d = _mat2d.create(); +outMat3 = _mat3.create(); +outMat4 = _mat4.create(); +outQuat = _quat.create(); + +// _vec2 +outVec2 = _vec2.create(); +outVec2 = _vec2.clone(vec2A); +outVec2 = _vec2.fromValues(1, 2); +outVec2 = _vec2.copy(outVec2, vec2A); +outVec2 = _vec2.set(outVec2, 1, 2); +outVec2 = _vec2.add(outVec2, vec2A, vec2B); +outVec2 = _vec2.subtract(outVec2, vec2A, vec2B); +outVec2 = _vec2.sub(outVec2, vec2A, vec2B); +outVec2 = _vec2.multiply(outVec2, vec2A, vec2B); +outVec2 = _vec2.mul(outVec2, vec2A, vec2B); +outVec2 = _vec2.divide(outVec2, vec2A, vec2B); +outVec2 = _vec2.div(outVec2, vec2A, vec2B); +outVec2 = _vec2.ceil(outVec2, vec2A); +outVec2 = _vec2.floor(outVec2, vec2A); +outVec2 = _vec2.min(outVec2, vec2A, vec2B); +outVec2 = _vec2.max(outVec2, vec2A, vec2B); +outVec2 = _vec2.round(outVec2, vec2A); +outVec2 = _vec2.scale(outVec2, vec2A, 2); +outVec2 = _vec2.scaleAndAdd(outVec2, vec2A, vec2B, 0.5); +outVal = _vec2.distance(vec2A, vec2B); +outVal = _vec2.dist(vec2A, vec2B); +outVal = _vec2.squaredDistance(vec2A, vec2B); +outVal = _vec2.sqrDist(vec2A, vec2B); +outVal = _vec2.length(vec2A); +outVal = _vec2.len(vec2A); +outVal = _vec2.squaredLength(vec2A); +outVal = _vec2.sqrLen(vec2A); +outVec2 = _vec2.negate(outVec2, vec2A); +outVec2 = _vec2.inverse(outVec2, vec2A); +outVec2 = _vec2.normalize(outVec2, vec2A); +outVal = _vec2.dot(vec2A, vec2B); +outVec2 = _vec2.cross(outVec2, vec2A, vec2B); +outVec2 = _vec2.lerp(outVec2, vec2A, vec2B, 0.5); +outVec2 = _vec2.random(outVec2); +outVec2 = _vec2.random(outVec2, 5.0); +outVec2 = _vec2.transformMat2(outVec2, vec2A, mat2A); +outVec2 = _vec2.transformMat2d(outVec2, vec2A, mat2dA); +outVec2 = _vec2.transformMat3(outVec2, vec2A, mat3A); +outVec2 = _vec2.transformMat4(outVec2, vec2A, mat4A); +vecArray = _vec2.forEach(vecArray, 0, 0, 0, _vec2.normalize); +outStr = _vec2.str(vec2A); +outBool = _vec2.exactEquals(vec2A, vec2B); +outBool = _vec2.equals(vec2A, vec2B); +outVec2 = _vec2.add(outVec2, [0, 1], [2, 3]); // test one method with number array input + +// _vec3 +outVec3 = _vec3.create(); +outVec3 = _vec3.clone(vec3A); +outVec3 = _vec3.fromValues(1, 2, 3); +outVec3 = _vec3.copy(outVec3, vec3A); +outVec3 = _vec3.set(outVec3, 1, 2, 3); +outVec3 = _vec3.add(outVec3, vec3A, vec3B); +outVec3 = _vec3.subtract(outVec3, vec3A, vec3B); +outVec3 = _vec3.sub(outVec3, vec3A, vec3B); +outVec3 = _vec3.multiply(outVec3, vec3A, vec3B); +outVec3 = _vec3.mul(outVec3, vec3A, vec3B); +outVec3 = _vec3.divide(outVec3, vec3A, vec3B); +outVec3 = _vec3.div(outVec3, vec3A, vec3B); +outVec3 = _vec3.ceil(outVec3, vec3A); +outVec3 = _vec3.floor(outVec3, vec3A); +outVec3 = _vec3.min(outVec3, vec3A, vec3B); +outVec3 = _vec3.max(outVec3, vec3A, vec3B); +outVec3 = _vec3.round(outVec3, vec3A); +outVec3 = _vec3.scale(outVec3, vec3A, 2); +outVec3 = _vec3.scaleAndAdd(outVec3, vec3A, vec3B, 0.5); +outVal = _vec3.distance(vec3A, vec3B); +outVal = _vec3.dist(vec3A, vec3B); +outVal = _vec3.squaredDistance(vec3A, vec3B); +outVal = _vec3.sqrDist(vec3A, vec3B); +outVal = _vec3.length(vec3A); +outVal = _vec3.len(vec3A); +outVal = _vec3.squaredLength(vec3A); +outVal = _vec3.sqrLen(vec3A); +outVec3 = _vec3.negate(outVec3, vec3A); +outVec3 = _vec3.inverse(outVec3, vec3A); +outVec3 = _vec3.normalize(outVec3, vec3A); +outVal = _vec3.dot(vec3A, vec3B); +outVec3 = _vec3.cross(outVec3, vec3A, vec3B); +outVec3 = _vec3.lerp(outVec3, vec3A, vec3B, 0.5); +outVec3 = _vec3.hermite(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5); +outVec3 = _vec3.bezier(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5); +outVec3 = _vec3.random(outVec3); +outVec3 = _vec3.random(outVec3, 5.0); +outVec3 = _vec3.transformMat3(outVec3, vec3A, mat3A); +outVec3 = _vec3.transformMat4(outVec3, vec3A, mat4A); +outVec3 = _vec3.transformQuat(outVec3, vec3A, quatA); +outVec3 = _vec3.rotateX(outVec3, vec3A, vec3B, Math.PI); +outVec3 = _vec3.rotateY(outVec3, vec3A, vec3B, Math.PI); +outVec3 = _vec3.rotateZ(outVec3, vec3A, vec3B, Math.PI); +vecArray = _vec3.forEach(vecArray, 0, 0, 0, _vec3.normalize); +outVal = _vec3.angle(vec3A, vec3B); +outStr = _vec3.str(vec3A); +outBool = _vec3.exactEquals(vec3A, vec3B); +outBool = _vec3.equals(vec3A, vec3B); +outVec3 = _vec3.add(outVec3, [0, 1, 2], [3, 4, 5]); // test one method with number array input + +// _vec4 +outVec4 = _vec4.create(); +outVec4 = _vec4.clone(vec4A); +outVec4 = _vec4.fromValues(1, 2, 3, 4); +outVec4 = _vec4.copy(outVec4, vec4A); +outVec4 = _vec4.set(outVec4, 1, 2, 3, 4); +outVec4 = _vec4.add(outVec4, vec4A, vec4B); +outVec4 = _vec4.subtract(outVec4, vec4A, vec4B); +outVec4 = _vec4.sub(outVec4, vec4A, vec4B); +outVec4 = _vec4.multiply(outVec4, vec4A, vec4B); +outVec4 = _vec4.mul(outVec4, vec4A, vec4B); +outVec4 = _vec4.divide(outVec4, vec4A, vec4B); +outVec4 = _vec4.div(outVec4, vec4A, vec4B); +outVec4 = _vec4.ceil(outVec4, vec4A); +outVec4 = _vec4.floor(outVec4, vec4A); +outVec4 = _vec4.min(outVec4, vec4A, vec4B); +outVec4 = _vec4.max(outVec4, vec4A, vec4B); +outVec4 = _vec4.scale(outVec4, vec4A, 2); +outVec4 = _vec4.scaleAndAdd(outVec4, vec4A, vec4B, 0.5); +outVal = _vec4.distance(vec4A, vec4B); +outVal = _vec4.dist(vec4A, vec4B); +outVal = _vec4.squaredDistance(vec4A, vec4B); +outVal = _vec4.sqrDist(vec4A, vec4B); +outVal = _vec4.length(vec4A); +outVal = _vec4.len(vec4A); +outVal = _vec4.squaredLength(vec4A); +outVal = _vec4.sqrLen(vec4A); +outVec4 = _vec4.negate(outVec4, vec4A); +outVec4 = _vec4.inverse(outVec4, vec4A); +outVec4 = _vec4.normalize(outVec4, vec4A); +outVal = _vec4.dot(vec4A, vec4B); +outVec4 = _vec4.lerp(outVec4, vec4A, vec4B, 0.5); +outVec4 = _vec4.random(outVec4); +outVec4 = _vec4.random(outVec4, 5.0); +outVec4 = _vec4.transformMat4(outVec4, vec4A, mat4A); +outVec4 = _vec4.transformQuat(outVec4, vec4A, quatA); +vecArray = _vec4.forEach(vecArray, 0, 0, 0, _vec4.normalize); +outStr = _vec4.str(vec4A); +outBool = _vec4.exactEquals(vec4A, vec4B); +outBool = _vec4.equals(vec4A, vec4B); +outVec4 = _vec4.add(outVec4, [0, 1, 2, 3], [4, 5, 6, 7]); // test one method with number array input + +// _mat2 +outMat2 = _mat2.create(); +outMat2 = _mat2.clone(mat2A); +outMat2 = _mat2.copy(outMat2, mat2A); +outMat2 = _mat2.identity(outMat2); +outMat2 = _mat2.fromValues(1, 2, 3, 4); +outMat2 = _mat2.set(outMat2, 1, 2, 3, 4); +outMat2 = _mat2.transpose(outMat2, mat2A); +outMat2Null = _mat2.invert(outMat2, mat2A); +outMat2 = _mat2.adjoint(outMat2, mat2A); +outVal = _mat2.determinant(mat2A); +outMat2 = _mat2.multiply(outMat2, mat2A, mat2B); +outMat2 = _mat2.mul(outMat2, mat2A, mat2B); +outMat2 = _mat2.rotate(outMat2, mat2A, Math.PI * 0.5); +outMat2 = _mat2.scale(outMat2, mat2A, vec2A); +outMat2 = _mat2.fromRotation(outMat2, 0.5); +outMat2 = _mat2.fromScaling(outMat2, vec2A); +outStr = _mat2.str(mat2A); +outVal = _mat2.frob(mat2A); +var L = _mat2.create(); +var D = _mat2.create(); +var U = _mat2.create(); +outMat2 = _mat2.LDU(L, D, U, mat2A); +outMat2 = _mat2.add(outMat2, mat2A, mat2B); +outMat2 = _mat2.subtract(outMat2, mat2A, mat2B); +outMat2 = _mat2.sub(outMat2, mat2A, mat2B); +outBool = _mat2.exactEquals(mat2A, mat2B); +outBool = _mat2.equals(mat2A, mat2B); +outMat2 = _mat2.multiplyScalar (outMat2, mat2A, 2); +outMat2 = _mat2.multiplyScalarAndAdd (outMat2, mat2A, mat2B, 2); + +// _mat2d +outMat2d = _mat2d.create(); +outMat2d = _mat2d.clone(mat2dA); +outMat2d = _mat2d.copy(outMat2d, mat2dA); +outMat2d = _mat2d.identity(outMat2d); +outMat2d = _mat2d.fromValues(1, 2, 3, 4, 5, 6); +outMat2d = _mat2d.set(outMat2d, 1, 2, 3, 4, 5, 6); +outMat2dNull = _mat2d.invert(outMat2d, mat2dA); +outVal = _mat2d.determinant(mat2dA); +outMat2d = _mat2d.multiply(outMat2d, mat2dA, mat2dB); +outMat2d = _mat2d.mul(outMat2d, mat2dA, mat2dB); +outMat2d = _mat2d.rotate(outMat2d, mat2dA, Math.PI * 0.5); +outMat2d = _mat2d.scale(outMat2d, mat2dA, vec2A); +outMat2d = _mat2d.translate(outMat2d, mat2dA, vec2A); +outMat2d = _mat2d.fromRotation(outMat2d, 0.5); +outMat2d = _mat2d.fromScaling(outMat2d, vec2A); +outMat2d = _mat2d.fromTranslation(outMat2d, vec2A); +outStr = _mat2d.str(mat2dA); +outVal = _mat2d.frob(mat2dA); +outMat2d = _mat2d.add(outMat2d, mat2dA, mat2dB); +outMat2d = _mat2d.subtract(outMat2d, mat2dA, mat2dB); +outMat2d = _mat2d.sub(outMat2d, mat2dA, mat2dB); +outMat2d = _mat2d.multiplyScalar (outMat2d, mat2dA, 2); +outMat2d = _mat2d.multiplyScalarAndAdd (outMat2d, mat2dA, mat2dB, 2); +outBool = _mat2d.exactEquals(mat2dA, mat2dB); +outBool = _mat2d.equals(mat2dA, mat2dB); + +// _mat3 +outMat3 = _mat3.create(); +outMat3 = _mat3.fromMat4(outMat3, mat4A); +outMat3 = _mat3.clone(mat3A); +outMat3 = _mat3.copy(outMat3, mat3A); +outMat3 = _mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9); +outMat3 = _mat3.set(outMat3, 1, 2, 3, 4, 5, 6, 7, 8, 9); +outMat3 = _mat3.identity(outMat3); +outMat3 = _mat3.transpose(outMat3, mat3A); +outMat3Null = _mat3.invert(outMat3, mat3A); +outMat3 = _mat3.adjoint(outMat3, mat3A); +outVal = _mat3.determinant(mat3A); +outMat3 = _mat3.multiply(outMat3, mat3A, mat3B); +outMat3 = _mat3.mul(outMat3, mat3A, mat3B); +outMat3 = _mat3.translate(outMat3, mat3A, vec3A); +outMat3 = _mat3.rotate(outMat3, mat3A, Math.PI/2); +outMat3 = _mat3.scale(outMat3, mat3A, vec2A); +outMat3 = _mat3.fromTranslation(outMat3, vec2A); +outMat3 = _mat3.fromRotation(outMat3, Math.PI); +outMat3 = _mat3.fromScaling(outMat3, vec2A); +outMat3 = _mat3.fromMat2d(outMat3, mat2dA); +outMat3 = _mat3.fromQuat(outMat3, quatA); +outMat3Null = _mat3.normalFromMat4(outMat3, mat4A); +outStr = _mat3.str(mat3A); +outVal = _mat3.frob(mat3A); +outMat3 = _mat3.add(outMat3, mat3A, mat3B); +outMat3 = _mat3.subtract(outMat3, mat3A, mat3B); +outMat3 = _mat3.sub(outMat3, mat3A, mat3B); +outMat3 = _mat3.multiplyScalar (outMat3, mat3A, 2); +outMat3 = _mat3.multiplyScalarAndAdd (outMat3, mat3A, mat3B, 2); +outBool = _mat3.exactEquals(mat3A, mat3B); +outBool = _mat3.equals(mat3A, mat3B); + +//_mat4 +outMat4 = _mat4.create(); +outMat4 = _mat4.clone(mat4A); +outMat4 = _mat4.copy(outMat4, mat4A); +outMat4 = _mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +outMat4 = _mat4.set(outMat4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); +outMat4 = _mat4.identity(outMat4); +outMat4 = _mat4.transpose(outMat4, mat4A); +outMat4Null = _mat4.invert(outMat4, mat4A); +outMat4 = _mat4.adjoint(outMat4, mat4A); +outVal = _mat4.determinant(mat4A); +outMat4 = _mat4.multiply(outMat4, mat4A, mat4B); +outMat4 = _mat4.mul(outMat4, mat4A, mat4B); +outMat4 = _mat4.translate(outMat4, mat4A, vec3A); +outMat4 = _mat4.scale(outMat4, mat4A, vec3A); +outMat4Null = _mat4.rotate(outMat4, mat4A, Math.PI, vec3A); +outMat4 = _mat4.rotateX(outMat4, mat4A, Math.PI); +outMat4 = _mat4.rotateY(outMat4, mat4A, Math.PI); +outMat4 = _mat4.rotateZ(outMat4, mat4A, Math.PI); +outMat4 = _mat4.fromTranslation(outMat4, vec3A); +outMat4Null = _mat4.fromRotation(outMat4, Math.PI, vec3A); +outMat4 = _mat4.fromScaling(outMat4, vec3A); +outMat4 = _mat4.fromXRotation(outMat4, Math.PI); +outMat4 = _mat4.fromYRotation(outMat4, Math.PI); +outMat4 = _mat4.fromZRotation(outMat4, Math.PI); +outMat4 = _mat4.fromRotationTranslation(outMat4, quatA, vec3A); +outVec3 = _mat4.getTranslation(outVec3, mat4A) +outQuat = _mat4.getRotation(outQuat, mat4A) +outMat4 = _mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B); +outMat4 = _mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A); +outMat4 = _mat4.fromQuat(outMat4, quatB); +outMat4 = _mat4.frustum(outMat4, -1, 1, -1, 1, -1, 1); +outMat4 = _mat4.perspective(outMat4, Math.PI, 1, 0, 1); +outMat4 = _mat4.perspectiveFromFieldOfView(outMat4, {upDegrees:Math.PI, downDegrees:-Math.PI, leftDegrees:-Math.PI, rightDegrees:Math.PI}, 1, 0); +outMat4 = _mat4.ortho(outMat4, -1, 1, -1, 1, -1, 1); +outMat4 = _mat4.lookAt(outMat4, vec3A, vec3B, vec3A); +outStr = _mat4.str(mat4A); +outVal = _mat4.frob(mat4A); +outMat4 = _mat4.add(outMat4, mat4A, mat4B); +outMat4 = _mat4.subtract(outMat4, mat4A, mat4B); +outMat4 = _mat4.sub(outMat4, mat4A, mat4B); +outMat4 = _mat4.multiplyScalar (outMat4, mat4A, 2); +outMat4 = _mat4.multiplyScalarAndAdd (outMat4, mat4A, mat4B, 2); +outBool = _mat4.exactEquals(mat4A, mat4B); +outBool = _mat4.equals(mat4A, mat4B); + +// _quat +var deg90 = Math.PI / 2; +outQuat = _quat.create(); +outQuat = _quat.clone(quatA); +outQuat = _quat.fromValues(1, 2, 3, 4); +outQuat = _quat.copy(outQuat, quatA); +outQuat = _quat.set(outQuat, 1, 2, 3, 4); +outQuat = _quat.identity(outQuat); +outQuat = _quat.rotationTo(outQuat, vec3A, vec3B); +outQuat = _quat.setAxes(outQuat, vec3A, vec3B, vec3A); +outQuat = _quat.setAxisAngle(outQuat, vec3A, Math.PI * 0.5); +outVal = _quat.getAxisAngle (outVec3, quatA); +outQuat = _quat.add(outQuat, quatA, quatB); +outQuat = _quat.multiply(outQuat, quatA, quatB); +outQuat = _quat.mul(outQuat, quatA, quatB); +outQuat = _quat.scale(outQuat, quatA, 2); +outVal = _quat.length(quatA); +outVal = _quat.len(quatA); +outVal = _quat.squaredLength(quatA); +outVal = _quat.sqrLen(quatA); +outQuat = _quat.normalize(outQuat, quatA); +outVal = _quat.dot(quatA, quatB); +outQuat = _quat.lerp(outQuat, quatA, quatB, 0.5); +outQuat = _quat.slerp(outQuat, quatA, quatB, 0.5); +outQuat = _quat.invert(outQuat, quatA); +outQuat = _quat.conjugate(outQuat, quatA); +outStr = _quat.str(quatA); +outQuat = _quat.rotateX(outQuat, quatA, deg90); +outQuat = _quat.rotateY(outQuat, quatA, deg90); +outQuat = _quat.rotateZ(outQuat, quatA, deg90); +outQuat = _quat.fromMat3(outQuat, mat3A); +outQuat = _quat.calculateW(outQuat, quatA); +outBool = _quat.exactEquals(quatA, quatB); +outBool = _quat.equals(quatA, quatB); diff --git a/gl-matrix/index.d.ts b/gl-matrix/index.d.ts index 2edbbd8bb5..89f28934b8 100644 --- a/gl-matrix/index.d.ts +++ b/gl-matrix/index.d.ts @@ -3,3042 +3,3084 @@ // Definitions by: Mattijs Kneppers , based on definitions by Tat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// vec2 -export class vec2 extends Float32Array { - private typeVec2: number; +declare module 'gl-matrix' { + // vec2 + export class vec2 extends Float32Array { + private typeVec2: number; - /** - * Creates a new, empty vec2 - * - * @returns a new 2D vector - */ - public static create(): vec2; + /** + * Creates a new, empty vec2 + * + * @returns a new 2D vector + */ + public static create(): vec2; - /** - * Creates a new vec2 initialized with values from an existing vector - * - * @param a a vector to clone - * @returns a new 2D vector - */ - public static clone(a: vec2 | number[]): vec2; + /** + * Creates a new vec2 initialized with values from an existing vector + * + * @param a a vector to clone + * @returns a new 2D vector + */ + public static clone(a: vec2 | number[]): vec2; - /** - * Creates a new vec2 initialized with the given values - * - * @param x X component - * @param y Y component - * @returns a new 2D vector - */ - public static fromValues(x: number, y: number): vec2; + /** + * Creates a new vec2 initialized with the given values + * + * @param x X component + * @param y Y component + * @returns a new 2D vector + */ + public static fromValues(x: number, y: number): vec2; - /** - * Copy the values from one vec2 to another - * - * @param out the receiving vector - * @param a the source vector - * @returns out - */ - public static copy(out: vec2, a: vec2 | number[]): vec2; + /** + * Copy the values from one vec2 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ + public static copy(out: vec2, a: vec2 | number[]): vec2; - /** - * Set the components of a vec2 to the given values - * - * @param out the receiving vector - * @param x X component - * @param y Y component - * @returns out - */ - public static set(out: vec2, x: number, y: number): vec2; + /** + * Set the components of a vec2 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @returns out + */ + public static set(out: vec2, x: number, y: number): vec2; - /** - * Adds two vec2's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static add(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; + /** + * Adds two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static add(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; - /** - * Subtracts vector b from vector a - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static subtract(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static subtract(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; - /** - * Subtracts vector b from vector a - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static sub(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static sub(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; - /** - * Multiplies two vec2's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static multiply(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; + /** + * Multiplies two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; - /** - * Multiplies two vec2's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static mul(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; + /** + * Multiplies two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; - /** - * Divides two vec2's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static divide(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; + /** + * Divides two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static divide(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; - /** - * Divides two vec2's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static div(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; + /** + * Divides two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static div(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; - /** - * Math.ceil the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {vec2} a vector to ceil - * @returns {vec2} out - */ - public static ceil(out: vec2, a: vec2 | number[]): vec2; + /** + * Math.ceil the components of a vec2 + * + * @param {vec2} out the receiving vector + * @param {vec2} a vector to ceil + * @returns {vec2} out + */ + public static ceil(out: vec2, a: vec2 | number[]): vec2; - /** - * Math.floor the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {vec2} a vector to floor - * @returns {vec2} out - */ - public static floor (out: vec2, a: vec2 | number[]): vec2; + /** + * Math.floor the components of a vec2 + * + * @param {vec2} out the receiving vector + * @param {vec2} a vector to floor + * @returns {vec2} out + */ + public static floor (out: vec2, a: vec2 | number[]): vec2; - /** - * Returns the minimum of two vec2's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static min(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; + /** + * Returns the minimum of two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static min(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; - /** - * Returns the maximum of two vec2's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static max(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; + /** + * Returns the maximum of two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static max(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; - /** - * Math.round the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {vec2} a vector to round - * @returns {vec2} out - */ - public static round(out: vec2, a: vec2 | number[]): vec2; + /** + * Math.round the components of a vec2 + * + * @param {vec2} out the receiving vector + * @param {vec2} a vector to round + * @returns {vec2} out + */ + public static round(out: vec2, a: vec2 | number[]): vec2; - /** - * Scales a vec2 by a scalar number - * - * @param out the receiving vector - * @param a the vector to scale - * @param b amount to scale the vector by - * @returns out - */ - public static scale(out: vec2, a: vec2 | number[], b: number): vec2; + /** + * Scales a vec2 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ + public static scale(out: vec2, a: vec2 | number[], b: number): vec2; - /** - * Adds two vec2's after scaling the second operand by a scalar value - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @param scale the amount to scale b by before adding - * @returns out - */ - public static scaleAndAdd(out: vec2, a: vec2 | number[], b: vec2 | number[], scale: number): vec2; + /** + * Adds two vec2's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ + public static scaleAndAdd(out: vec2, a: vec2 | number[], b: vec2 | number[], scale: number): vec2; - /** - * Calculates the euclidian distance between two vec2's - * - * @param a the first operand - * @param b the second operand - * @returns distance between a and b - */ - public static distance(a: vec2 | number[], b: vec2 | number[]): number; + /** + * Calculates the euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static distance(a: vec2 | number[], b: vec2 | number[]): number; - /** - * Calculates the euclidian distance between two vec2's - * - * @param a the first operand - * @param b the second operand - * @returns distance between a and b - */ - public static dist(a: vec2 | number[], b: vec2 | number[]): number; + /** + * Calculates the euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static dist(a: vec2 | number[], b: vec2 | number[]): number; - /** - * Calculates the squared euclidian distance between two vec2's - * - * @param a the first operand - * @param b the second operand - * @returns squared distance between a and b - */ - public static squaredDistance(a: vec2 | number[], b: vec2 | number[]): number; + /** + * Calculates the squared euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static squaredDistance(a: vec2 | number[], b: vec2 | number[]): number; - /** - * Calculates the squared euclidian distance between two vec2's - * - * @param a the first operand - * @param b the second operand - * @returns squared distance between a and b - */ - public static sqrDist(a: vec2 | number[], b: vec2 | number[]): number; + /** + * Calculates the squared euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static sqrDist(a: vec2 | number[], b: vec2 | number[]): number; - /** - * Calculates the length of a vec2 - * - * @param a vector to calculate length of - * @returns length of a - */ - public static length(a: vec2 | number[]): number; + /** + * Calculates the length of a vec2 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static length(a: vec2 | number[]): number; - /** - * Calculates the length of a vec2 - * - * @param a vector to calculate length of - * @returns length of a - */ - public static len(a: vec2 | number[]): number; + /** + * Calculates the length of a vec2 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static len(a: vec2 | number[]): number; - /** - * Calculates the squared length of a vec2 - * - * @param a vector to calculate squared length of - * @returns squared length of a - */ - public static squaredLength(a: vec2 | number[]): number; + /** + * Calculates the squared length of a vec2 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static squaredLength(a: vec2 | number[]): number; - /** - * Calculates the squared length of a vec2 - * - * @param a vector to calculate squared length of - * @returns squared length of a - */ - public static sqrLen(a: vec2 | number[]): number; + /** + * Calculates the squared length of a vec2 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static sqrLen(a: vec2 | number[]): number; - /** - * Negates the components of a vec2 - * - * @param out the receiving vector - * @param a vector to negate - * @returns out - */ - public static negate(out: vec2, a: vec2 | number[]): vec2; + /** + * Negates the components of a vec2 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ + public static negate(out: vec2, a: vec2 | number[]): vec2; - /** - * Returns the inverse of the components of a vec2 - * - * @param out the receiving vector - * @param a vector to invert - * @returns out - */ - public static inverse(out: vec2, a: vec2 | number[]): vec2; + /** + * Returns the inverse of the components of a vec2 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ + public static inverse(out: vec2, a: vec2 | number[]): vec2; - /** - * Normalize a vec2 - * - * @param out the receiving vector - * @param a vector to normalize - * @returns out - */ - public static normalize(out: vec2, a: vec2 | number[]): vec2; + /** + * Normalize a vec2 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ + public static normalize(out: vec2, a: vec2 | number[]): vec2; - /** - * Calculates the dot product of two vec2's - * - * @param a the first operand - * @param b the second operand - * @returns dot product of a and b - */ - public static dot(a: vec2 | number[], b: vec2 | number[]): number; + /** + * Calculates the dot product of two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ + public static dot(a: vec2 | number[], b: vec2 | number[]): number; - /** - * Computes the cross product of two vec2's - * Note that the cross product must by definition produce a 3D vector - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static cross(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; + /** + * Computes the cross product of two vec2's + * Note that the cross product must by definition produce a 3D vector + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static cross(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2; - /** - * Performs a linear interpolation between two vec2's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @param t interpolation amount between the two inputs - * @returns out - */ - public static lerp(out: vec2, a: vec2 | number[], b: vec2 | number[], t: number): vec2; + /** + * Performs a linear interpolation between two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + public static lerp(out: vec2, a: vec2 | number[], b: vec2 | number[], t: number): vec2; - /** - * Generates a random unit vector - * - * @param out the receiving vector - * @returns out - */ - public static random(out: vec2): vec2; + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ + public static random(out: vec2): vec2; - /** - * Generates a random vector with the given scale - * - * @param out the receiving vector - * @param scale Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns out - */ - public static random(out: vec2, scale: number): vec2; + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param scale Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns out + */ + public static random(out: vec2, scale: number): vec2; - /** - * Transforms the vec2 with a mat2 - * - * @param out the receiving vector - * @param a the vector to transform - * @param m matrix to transform with - * @returns out - */ - public static transformMat2(out: vec2, a: vec2 | number[], m: mat2): vec2; + /** + * Transforms the vec2 with a mat2 + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat2(out: vec2, a: vec2 | number[], m: mat2): vec2; - /** - * Transforms the vec2 with a mat2d - * - * @param out the receiving vector - * @param a the vector to transform - * @param m matrix to transform with - * @returns out - */ - public static transformMat2d(out: vec2, a: vec2 | number[], m: mat2d): vec2; + /** + * Transforms the vec2 with a mat2d + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat2d(out: vec2, a: vec2 | number[], m: mat2d): vec2; - /** - * Transforms the vec2 with a mat3 - * 3rd vector component is implicitly '1' - * - * @param out the receiving vector - * @param a the vector to transform - * @param m matrix to transform with - * @returns out - */ - public static transformMat3(out: vec2, a: vec2 | number[], m: mat3): vec2; + /** + * Transforms the vec2 with a mat3 + * 3rd vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat3(out: vec2, a: vec2 | number[], m: mat3): vec2; - /** - * Transforms the vec2 with a mat4 - * 3rd vector component is implicitly '0' - * 4th vector component is implicitly '1' - * - * @param out the receiving vector - * @param a the vector to transform - * @param m matrix to transform with - * @returns out - */ - public static transformMat4(out: vec2, a: vec2 | number[], m: mat4): vec2; + /** + * Transforms the vec2 with a mat4 + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat4(out: vec2, a: vec2 | number[], m: mat4): vec2; - /** - * Perform some operation over an array of vec2s. - * - * @param a the array of vectors to iterate over - * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed - * @param offset Number of elements to skip at the beginning of the array - * @param count Number of vec2s to iterate over. If 0 iterates over entire array - * @param fn Function to call for each vector in the array - * @param arg additional argument to pass to fn - * @returns a - */ - public static forEach(a: Float32Array, stride: number, offset: number, count: number, - fn: (a: vec2 | number[], b: vec2 | number[], arg: any) => void, arg: any): Float32Array; + /** + * Perform some operation over an array of vec2s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec2s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param arg additional argument to pass to fn + * @returns a + */ + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec2 | number[], b: vec2 | number[], arg: any) => void, arg: any): Float32Array; - /** - * Perform some operation over an array of vec2s. - * - * @param a the array of vectors to iterate over - * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed - * @param offset Number of elements to skip at the beginning of the array - * @param count Number of vec2s to iterate over. If 0 iterates over entire array - * @param fn Function to call for each vector in the array - * @returns a - */ - public static forEach(a: Float32Array, stride: number, offset: number, count: number, - fn: (a: vec2 | number[], b: vec2 | number[]) => void): Float32Array; + /** + * Perform some operation over an array of vec2s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec2s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + */ + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec2 | number[], b: vec2 | number[]) => void): Float32Array; - /** - * Returns a string representation of a vector - * - * @param a vector to represent as a string - * @returns string representation of the vector - */ - public static str(a: vec2 | number[]): string; + /** + * Returns a string representation of a vector + * + * @param a vector to represent as a string + * @returns string representation of the vector + */ + public static str(a: vec2 | number[]): string; - /** - * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) - * - * @param {vec2} a The first vector. - * @param {vec2} b The second vector. - * @returns {boolean} True if the vectors are equal, false otherwise. - */ - public static exactEquals (a: vec2 | number[], b: vec2 | number[]): boolean; + /** + * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) + * + * @param {vec2} a The first vector. + * @param {vec2} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static exactEquals (a: vec2 | number[], b: vec2 | number[]): boolean; - /** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {vec2} a The first vector. - * @param {vec2} b The second vector. - * @returns {boolean} True if the vectors are equal, false otherwise. - */ - public static equals (a: vec2 | number[], b: vec2 | number[]): boolean; + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {vec2} a The first vector. + * @param {vec2} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static equals (a: vec2 | number[], b: vec2 | number[]): boolean; + } + + // vec3 + export class vec3 extends Float32Array { + private typeVec3: number; + + /** + * Creates a new, empty vec3 + * + * @returns a new 3D vector + */ + public static create(): vec3; + + /** + * Creates a new vec3 initialized with values from an existing vector + * + * @param a vector to clone + * @returns a new 3D vector + */ + public static clone(a: vec3 | number[]): vec3; + + /** + * Creates a new vec3 initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @returns a new 3D vector + */ + public static fromValues(x: number, y: number, z: number): vec3; + + /** + * Copy the values from one vec3 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ + public static copy(out: vec3, a: vec3 | number[]): vec3; + + /** + * Set the components of a vec3 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @param z Z component + * @returns out + */ + public static set(out: vec3, x: number, y: number, z: number): vec3; + + /** + * Adds two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static add(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static subtract(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static sub(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3 + + /** + * Multiplies two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; + + /** + * Multiplies two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; + + /** + * Divides two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static divide(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; + + /** + * Divides two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static div(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; + + /** + * Math.ceil the components of a vec3 + * + * @param {vec3} out the receiving vector + * @param {vec3} a vector to ceil + * @returns {vec3} out + */ + public static ceil (out: vec3, a: vec3 | number[]): vec3; + + /** + * Math.floor the components of a vec3 + * + * @param {vec3} out the receiving vector + * @param {vec3} a vector to floor + * @returns {vec3} out + */ + public static floor (out: vec3, a: vec3 | number[]): vec3; + + /** + * Returns the minimum of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static min(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; + + /** + * Returns the maximum of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static max(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; + + /** + * Math.round the components of a vec3 + * + * @param {vec3} out the receiving vector + * @param {vec3} a vector to round + * @returns {vec3} out + */ + public static round (out: vec3, a: vec3 | number[]): vec3 + + /** + * Scales a vec3 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ + public static scale(out: vec3, a: vec3 | number[], b: number): vec3; + + /** + * Adds two vec3's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ + public static scaleAndAdd(out: vec3, a: vec3 | number[], b: vec3 | number[], scale: number): vec3; + + /** + * Calculates the euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static distance(a: vec3 | number[], b: vec3 | number[]): number; + + /** + * Calculates the euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static dist(a: vec3 | number[], b: vec3 | number[]): number; + + /** + * Calculates the squared euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static squaredDistance(a: vec3 | number[], b: vec3 | number[]): number; + + /** + * Calculates the squared euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static sqrDist(a: vec3 | number[], b: vec3 | number[]): number; + + /** + * Calculates the length of a vec3 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static length(a: vec3 | number[]): number; + + /** + * Calculates the length of a vec3 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static len(a: vec3 | number[]): number; + + /** + * Calculates the squared length of a vec3 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static squaredLength(a: vec3 | number[]): number; + + /** + * Calculates the squared length of a vec3 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static sqrLen(a: vec3 | number[]): number; + + /** + * Negates the components of a vec3 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ + public static negate(out: vec3, a: vec3 | number[]): vec3; + + /** + * Returns the inverse of the components of a vec3 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ + public static inverse(out: vec3, a: vec3 | number[]): vec3; + + /** + * Normalize a vec3 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ + public static normalize(out: vec3, a: vec3 | number[]): vec3; + + /** + * Calculates the dot product of two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ + public static dot(a: vec3 | number[], b: vec3 | number[]): number; + + /** + * Computes the cross product of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static cross(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; + + /** + * Performs a linear interpolation between two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + public static lerp(out: vec3, a: vec3 | number[], b: vec3 | number[], t: number): vec3; + + /** + * Performs a hermite interpolation with two control points + * + * @param {vec3} out the receiving vector + * @param {vec3} a the first operand + * @param {vec3} b the second operand + * @param {vec3} c the third operand + * @param {vec3} d the fourth operand + * @param {number} t interpolation amount between the two inputs + * @returns {vec3} out + */ + public static hermite (out: vec3, a: vec3 | number[], b: vec3 | number[], c: vec3 | number[], d: vec3 | number[], t: number): vec3; + + /** + * Performs a bezier interpolation with two control points + * + * @param {vec3} out the receiving vector + * @param {vec3} a the first operand + * @param {vec3} b the second operand + * @param {vec3} c the third operand + * @param {vec3} d the fourth operand + * @param {number} t interpolation amount between the two inputs + * @returns {vec3} out + */ + public static bezier (out: vec3, a: vec3 | number[], b: vec3 | number[], c: vec3 | number[], d: vec3 | number[], t: number): vec3; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ + public static random(out: vec3): vec3; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param [scale] Length of the resulting vector. If omitted, a unit vector will be returned + * @returns out + */ + public static random(out: vec3, scale: number): vec3; + + /** + * Transforms the vec3 with a mat3. + * + * @param out the receiving vector + * @param a the vector to transform + * @param m the 3x3 matrix to transform with + * @returns out + */ + public static transformMat3(out: vec3, a: vec3 | number[], m: mat3): vec3; + + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat4(out: vec3, a: vec3 | number[], m: mat4): vec3; + + /** + * Transforms the vec3 with a quat + * + * @param out the receiving vector + * @param a the vector to transform + * @param q quaternion to transform with + * @returns out + */ + public static transformQuat(out: vec3, a: vec3 | number[], q: quat): vec3; + + + /** + * Rotate a 3D vector around the x-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + public static rotateX(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3; + + /** + * Rotate a 3D vector around the y-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + public static rotateY(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3; + + /** + * Rotate a 3D vector around the z-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + public static rotateZ(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3; + + /** + * Perform some operation over an array of vec3s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec3s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param arg additional argument to pass to fn + * @returns a + * @function + */ + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec3 | number[], b: vec3 | number[], arg: any) => void, arg: any): Float32Array; + + /** + * Perform some operation over an array of vec3s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec3s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + * @function + */ + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec3 | number[], b: vec3 | number[]) => void): Float32Array; + + /** + * Get the angle between two 3D vectors + * @param a The first operand + * @param b The second operand + * @returns The angle in radians + */ + public static angle(a: vec3 | number[], b: vec3 | number[]): number; + + /** + * Returns a string representation of a vector + * + * @param a vector to represent as a string + * @returns string representation of the vector + */ + public static str(a: vec3 | number[]): string; + + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * + * @param {vec3} a The first vector. + * @param {vec3} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static exactEquals (a: vec3 | number[], b: vec3 | number[]): boolean + + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {vec3} a The first vector. + * @param {vec3} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static equals (a: vec3 | number[], b: vec3 | number[]): boolean + } + + // vec4 + export class vec4 extends Float32Array { + private typeVec3: number; + + /** + * Creates a new, empty vec4 + * + * @returns a new 4D vector + */ + public static create(): vec4; + + /** + * Creates a new vec4 initialized with values from an existing vector + * + * @param a vector to clone + * @returns a new 4D vector + */ + public static clone(a: vec4 | number[]): vec4; + + /** + * Creates a new vec4 initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns a new 4D vector + */ + public static fromValues(x: number, y: number, z: number, w: number): vec4; + + /** + * Copy the values from one vec4 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ + public static copy(out: vec4, a: vec4 | number[]): vec4; + + /** + * Set the components of a vec4 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns out + */ + public static set(out: vec4, x: number, y: number, z: number, w: number): vec4; + + /** + * Adds two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static add(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static subtract(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static sub(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; + + /** + * Multiplies two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; + + /** + * Multiplies two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; + + /** + * Divides two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static divide(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; + + /** + * Divides two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static div(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; + + /** + * Math.ceil the components of a vec4 + * + * @param {vec4} out the receiving vector + * @param {vec4} a vector to ceil + * @returns {vec4} out + */ + public static ceil (out: vec4, a: vec4 | number[]): vec4; + + /** + * Math.floor the components of a vec4 + * + * @param {vec4} out the receiving vector + * @param {vec4} a vector to floor + * @returns {vec4} out + */ + public static floor (out: vec4, a: vec4 | number[]): vec4; + + /** + * Returns the minimum of two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static min(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; + + /** + * Returns the maximum of two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static max(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; + + /** + * Math.round the components of a vec4 + * + * @param {vec4} out the receiving vector + * @param {vec4} a vector to round + * @returns {vec4} out + */ + public static round (out: vec4, a: vec4 | number[]): vec4; + + /** + * Scales a vec4 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ + public static scale(out: vec4, a: vec4 | number[], b: number): vec4; + + /** + * Adds two vec4's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ + public static scaleAndAdd(out: vec4, a: vec4 | number[], b: vec4 | number[], scale: number): vec4; + + /** + * Calculates the euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static distance(a: vec4 | number[], b: vec4 | number[]): number; + + /** + * Calculates the euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ + public static dist(a: vec4 | number[], b: vec4 | number[]): number; + + /** + * Calculates the squared euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static squaredDistance(a: vec4 | number[], b: vec4 | number[]): number; + + /** + * Calculates the squared euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ + public static sqrDist(a: vec4 | number[], b: vec4 | number[]): number; + + /** + * Calculates the length of a vec4 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static length(a: vec4 | number[]): number; + + /** + * Calculates the length of a vec4 + * + * @param a vector to calculate length of + * @returns length of a + */ + public static len(a: vec4 | number[]): number; + + /** + * Calculates the squared length of a vec4 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static squaredLength(a: vec4 | number[]): number; + + /** + * Calculates the squared length of a vec4 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ + public static sqrLen(a: vec4 | number[]): number; + + /** + * Negates the components of a vec4 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ + public static negate(out: vec4, a: vec4 | number[]): vec4; + + /** + * Returns the inverse of the components of a vec4 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ + public static inverse(out: vec4, a: vec4 | number[]): vec4; + + /** + * Normalize a vec4 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ + public static normalize(out: vec4, a: vec4 | number[]): vec4; + + /** + * Calculates the dot product of two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ + public static dot(a: vec4 | number[], b: vec4 | number[]): number; + + /** + * Performs a linear interpolation between two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + public static lerp(out: vec4, a: vec4 | number[], b: vec4 | number[], t: number): vec4; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ + public static random(out: vec4): vec4; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param scale length of the resulting vector. If ommitted, a unit vector will be returned + * @returns out + */ + public static random(out: vec4, scale: number): vec4; + + /** + * Transforms the vec4 with a mat4. + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + public static transformMat4(out: vec4, a: vec4 | number[], m: mat4): vec4; + + /** + * Transforms the vec4 with a quat + * + * @param out the receiving vector + * @param a the vector to transform + * @param q quaternion to transform with + * @returns out + */ + + public static transformQuat(out: vec4, a: vec4 | number[], q: quat): vec4; + + /** + * Perform some operation over an array of vec4s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec4s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param arg additional argument to pass to fn + * @returns a + * @function + */ + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec4 | number[], b: vec4 | number[], arg: any) => void, arg: any): Float32Array; + + /** + * Perform some operation over an array of vec4s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec4s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + * @function + */ + public static forEach(a: Float32Array, stride: number, offset: number, count: number, + fn: (a: vec4 | number[], b: vec4 | number[]) => void): Float32Array; + + /** + * Returns a string representation of a vector + * + * @param a vector to represent as a string + * @returns string representation of the vector + */ + public static str(a: vec4 | number[]): string; + + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * + * @param {vec4} a The first vector. + * @param {vec4} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static exactEquals (a: vec4 | number[], b: vec4 | number[]): boolean; + + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {vec4} a The first vector. + * @param {vec4} b The second vector. + * @returns {boolean} True if the vectors are equal, false otherwise. + */ + public static equals (a: vec4 | number[], b: vec4 | number[]): boolean; + } + + // mat2 + export class mat2 extends Float32Array { + private typeMat2: number; + + /** + * Creates a new identity mat2 + * + * @returns a new 2x2 matrix + */ + public static create(): mat2; + + /** + * Creates a new mat2 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 2x2 matrix + */ + public static clone(a: mat2): mat2; + + /** + * Copy the values from one mat2 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static copy(out: mat2, a: mat2): mat2; + + /** + * Set a mat2 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + public static identity(out: mat2): mat2; + + /** + * Create a new mat2 with the given values + * + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m10 Component in column 1, row 0 position (index 2) + * @param {number} m11 Component in column 1, row 1 position (index 3) + * @returns {mat2} out A new 2x2 matrix + */ + public static fromValues(m00: number, m01: number, m10: number, m11: number): mat2; + + /** + * Set the components of a mat2 to the given values + * + * @param {mat2} out the receiving matrix + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m10 Component in column 1, row 0 position (index 2) + * @param {number} m11 Component in column 1, row 1 position (index 3) + * @returns {mat2} out + */ + public static set(out: mat2, m00: number, m01: number, m10: number, m11: number): mat2; + + /** + * Transpose the values of a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static transpose(out: mat2, a: mat2): mat2; + + /** + * Inverts a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static invert(out: mat2, a: mat2): mat2 | null; + + /** + * Calculates the adjugate of a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static adjoint(out: mat2, a: mat2): mat2; + + /** + * Calculates the determinant of a mat2 + * + * @param a the source matrix + * @returns determinant of a + */ + public static determinant(a: mat2): number; + + /** + * Multiplies two mat2's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: mat2, a: mat2, b: mat2): mat2; + + /** + * Multiplies two mat2's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: mat2, a: mat2, b: mat2): mat2; + + /** + * Rotates a mat2 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotate(out: mat2, a: mat2, rad: number): mat2; + + /** + * Scales the mat2 by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param v the vec2 to scale the matrix by + * @returns out + **/ + public static scale(out: mat2, a: mat2, v: vec2 | number[]): mat2; + + /** + * Creates a matrix from a given angle + * This is equivalent to (but much faster than): + * + * mat2.identity(dest); + * mat2.rotate(dest, dest, rad); + * + * @param {mat2} out mat2 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat2} out + */ + public static fromRotation(out: mat2, rad: number): mat2; + + /** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat2.identity(dest); + * mat2.scale(dest, dest, vec); + * + * @param {mat2} out mat2 receiving operation result + * @param {vec2} v Scaling vector + * @returns {mat2} out + */ + public static fromScaling(out: mat2, v: vec2 | number[]): mat2; + + /** + * Returns a string representation of a mat2 + * + * @param a matrix to represent as a string + * @returns string representation of the matrix + */ + public static str(a: mat2): string; + + /** + * Returns Frobenius norm of a mat2 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + public static frob(a: mat2): number; + + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @param L the lower triangular matrix + * @param D the diagonal matrix + * @param U the upper triangular matrix + * @param a the input matrix to factorize + */ + public static LDU(L: mat2, D: mat2, U: mat2, a: mat2): mat2; + + /** + * Adds two mat2's + * + * @param {mat2} out the receiving matrix + * @param {mat2} a the first operand + * @param {mat2} b the second operand + * @returns {mat2} out + */ + public static add(out: mat2, a: mat2, b: mat2): mat2; + + /** + * Subtracts matrix b from matrix a + * + * @param {mat2} out the receiving matrix + * @param {mat2} a the first operand + * @param {mat2} b the second operand + * @returns {mat2} out + */ + public static subtract (out: mat2, a: mat2, b: mat2): mat2; + + /** + * Subtracts matrix b from matrix a + * + * @param {mat2} out the receiving matrix + * @param {mat2} a the first operand + * @param {mat2} b the second operand + * @returns {mat2} out + */ + public static sub (out: mat2, a: mat2, b: mat2): mat2; + + /** + * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) + * + * @param {mat2} a The first matrix. + * @param {mat2} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static exactEquals (a: mat2, b: mat2): boolean; + + /** + * Returns whether or not the matrices have approximately the same elements in the same position. + * + * @param {mat2} a The first matrix. + * @param {mat2} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static equals (a: mat2, b: mat2): boolean; + + /** + * Multiply each element of the matrix by a scalar. + * + * @param {mat2} out the receiving matrix + * @param {mat2} a the matrix to scale + * @param {number} b amount to scale the matrix's elements by + * @returns {mat2} out + */ + public static multiplyScalar (out: mat2, a: mat2, b: number): mat2 + + /** + * Adds two mat2's after multiplying each element of the second operand by a scalar value. + * + * @param {mat2} out the receiving vector + * @param {mat2} a the first operand + * @param {mat2} b the second operand + * @param {number} scale the amount to scale b's elements by before adding + * @returns {mat2} out + */ + public static multiplyScalarAndAdd (out: mat2, a: mat2, b: mat2, scale: number): mat2 + + + + } + + // mat2d + export class mat2d extends Float32Array { + private typeMat2d: number; + + /** + * Creates a new identity mat2d + * + * @returns a new 2x3 matrix + */ + public static create(): mat2d; + + /** + * Creates a new mat2d initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 2x3 matrix + */ + public static clone(a: mat2d): mat2d; + + /** + * Copy the values from one mat2d to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static copy(out: mat2d, a: mat2d): mat2d; + + /** + * Set a mat2d to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + public static identity(out: mat2d): mat2d; + + /** + * Create a new mat2d with the given values + * + * @param {number} a Component A (index 0) + * @param {number} b Component B (index 1) + * @param {number} c Component C (index 2) + * @param {number} d Component D (index 3) + * @param {number} tx Component TX (index 4) + * @param {number} ty Component TY (index 5) + * @returns {mat2d} A new mat2d + */ + public static fromValues (a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d + + + /** + * Set the components of a mat2d to the given values + * + * @param {mat2d} out the receiving matrix + * @param {number} a Component A (index 0) + * @param {number} b Component B (index 1) + * @param {number} c Component C (index 2) + * @param {number} d Component D (index 3) + * @param {number} tx Component TX (index 4) + * @param {number} ty Component TY (index 5) + * @returns {mat2d} out + */ + public static set (out: mat2d, a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d + + /** + * Inverts a mat2d + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static invert(out: mat2d, a: mat2d): mat2d | null; + + /** + * Calculates the determinant of a mat2d + * + * @param a the source matrix + * @returns determinant of a + */ + public static determinant(a: mat2d): number; + + /** + * Multiplies two mat2d's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: mat2d, a: mat2d, b: mat2d): mat2d; + + /** + * Multiplies two mat2d's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: mat2d, a: mat2d, b: mat2d): mat2d; + + /** + * Rotates a mat2d by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotate(out: mat2d, a: mat2d, rad: number): mat2d; + + /** + * Scales the mat2d by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v the vec2 to scale the matrix by + * @returns out + **/ + public static scale(out: mat2d, a: mat2d, v: vec2 | number[]): mat2d; + + /** + * Translates the mat2d by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v the vec2 to translate the matrix by + * @returns out + **/ + public static translate(out: mat2d, a: mat2d, v: vec2 | number[]): mat2d; + + /** + * Creates a matrix from a given angle + * This is equivalent to (but much faster than): + * + * mat2d.identity(dest); + * mat2d.rotate(dest, dest, rad); + * + * @param {mat2d} out mat2d receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat2d} out + */ + public static fromRotation (out: mat2d, rad: number): mat2d; + + /** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat2d.identity(dest); + * mat2d.scale(dest, dest, vec); + * + * @param {mat2d} out mat2d receiving operation result + * @param {vec2} v Scaling vector + * @returns {mat2d} out + */ + public static fromScaling (out: mat2d, v: vec2 | number[]): mat2d; + + /** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat2d.identity(dest); + * mat2d.translate(dest, dest, vec); + * + * @param {mat2d} out mat2d receiving operation result + * @param {vec2} v Translation vector + * @returns {mat2d} out + */ + public static fromTranslation (out: mat2d, v: vec2 | number[]): mat2d + + /** + * Returns a string representation of a mat2d + * + * @param a matrix to represent as a string + * @returns string representation of the matrix + */ + public static str(a: mat2d): string; + + /** + * Returns Frobenius norm of a mat2d + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + public static frob(a: mat2d): number; + + /** + * Adds two mat2d's + * + * @param {mat2d} out the receiving matrix + * @param {mat2d} a the first operand + * @param {mat2d} b the second operand + * @returns {mat2d} out + */ + public static add (out: mat2d, a: mat2d, b: mat2d): mat2d + + /** + * Subtracts matrix b from matrix a + * + * @param {mat2d} out the receiving matrix + * @param {mat2d} a the first operand + * @param {mat2d} b the second operand + * @returns {mat2d} out + */ + public static subtract(out: mat2d, a: mat2d, b: mat2d): mat2d + + /** + * Subtracts matrix b from matrix a + * + * @param {mat2d} out the receiving matrix + * @param {mat2d} a the first operand + * @param {mat2d} b the second operand + * @returns {mat2d} out + */ + public static sub(out: mat2d, a: mat2d, b: mat2d): mat2d + + /** + * Multiply each element of the matrix by a scalar. + * + * @param {mat2d} out the receiving matrix + * @param {mat2d} a the matrix to scale + * @param {number} b amount to scale the matrix's elements by + * @returns {mat2d} out + */ + public static multiplyScalar (out: mat2d, a: mat2d, b: number): mat2d; + + /** + * Adds two mat2d's after multiplying each element of the second operand by a scalar value. + * + * @param {mat2d} out the receiving vector + * @param {mat2d} a the first operand + * @param {mat2d} b the second operand + * @param {number} scale the amount to scale b's elements by before adding + * @returns {mat2d} out + */ + public static multiplyScalarAndAdd (out: mat2d, a: mat2d, b: mat2d, scale: number): mat2d + + /** + * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) + * + * @param {mat2d} a The first matrix. + * @param {mat2d} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static exactEquals (a: mat2d, b: mat2d): boolean; + + /** + * Returns whether or not the matrices have approximately the same elements in the same position. + * + * @param {mat2d} a The first matrix. + * @param {mat2d} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static equals (a: mat2d, b: mat2d): boolean + } + + // mat3 + export class mat3 extends Float32Array { + private typeMat3: number; + + /** + * Creates a new identity mat3 + * + * @returns a new 3x3 matrix + */ + public static create(): mat3; + + /** + * Copies the upper-left 3x3 values into the given mat3. + * + * @param {mat3} out the receiving 3x3 matrix + * @param {mat4} a the source 4x4 matrix + * @returns {mat3} out + */ + public static fromMat4(out: mat3, a: mat4): mat3 + + /** + * Creates a new mat3 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 3x3 matrix + */ + public static clone(a: mat3): mat3; + + /** + * Copy the values from one mat3 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static copy(out: mat3, a: mat3): mat3; + + /** + * Create a new mat3 with the given values + * + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m02 Component in column 0, row 2 position (index 2) + * @param {number} m10 Component in column 1, row 0 position (index 3) + * @param {number} m11 Component in column 1, row 1 position (index 4) + * @param {number} m12 Component in column 1, row 2 position (index 5) + * @param {number} m20 Component in column 2, row 0 position (index 6) + * @param {number} m21 Component in column 2, row 1 position (index 7) + * @param {number} m22 Component in column 2, row 2 position (index 8) + * @returns {mat3} A new mat3 + */ + public static fromValues(m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3; + + + /** + * Set the components of a mat3 to the given values + * + * @param {mat3} out the receiving matrix + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m02 Component in column 0, row 2 position (index 2) + * @param {number} m10 Component in column 1, row 0 position (index 3) + * @param {number} m11 Component in column 1, row 1 position (index 4) + * @param {number} m12 Component in column 1, row 2 position (index 5) + * @param {number} m20 Component in column 2, row 0 position (index 6) + * @param {number} m21 Component in column 2, row 1 position (index 7) + * @param {number} m22 Component in column 2, row 2 position (index 8) + * @returns {mat3} out + */ + public static set(out: mat3, m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3 + + /** + * Set a mat3 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + public static identity(out: mat3): mat3; + + /** + * Transpose the values of a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static transpose(out: mat3, a: mat3): mat3; + + /** + * Inverts a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static invert(out: mat3, a: mat3): mat3 | null; + + /** + * Calculates the adjugate of a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static adjoint(out: mat3, a: mat3): mat3; + + /** + * Calculates the determinant of a mat3 + * + * @param a the source matrix + * @returns determinant of a + */ + public static determinant(a: mat3): number; + + /** + * Multiplies two mat3's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: mat3, a: mat3, b: mat3): mat3; + + /** + * Multiplies two mat3's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: mat3, a: mat3, b: mat3): mat3; + + + /** + * Translate a mat3 by the given vector + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v vector to translate by + * @returns out + */ + public static translate(out: mat3, a: mat3, v: vec3 | number[]): mat3; + + /** + * Rotates a mat3 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotate(out: mat3, a: mat3, rad: number): mat3; + + /** + * Scales the mat3 by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param v the vec2 to scale the matrix by + * @returns out + **/ + public static scale(out: mat3, a: mat3, v: vec2 | number[]): mat3; + + /** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.translate(dest, dest, vec); + * + * @param {mat3} out mat3 receiving operation result + * @param {vec2} v Translation vector + * @returns {mat3} out + */ + public static fromTranslation(out: mat3, v: vec2 | number[]): mat3 + + /** + * Creates a matrix from a given angle + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.rotate(dest, dest, rad); + * + * @param {mat3} out mat3 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat3} out + */ + public static fromRotation(out: mat3, rad: number): mat3 + + /** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat3.identity(dest); + * mat3.scale(dest, dest, vec); + * + * @param {mat3} out mat3 receiving operation result + * @param {vec2} v Scaling vector + * @returns {mat3} out + */ + public static fromScaling(out: mat3, v: vec2 | number[]): mat3 + + /** + * Copies the values from a mat2d into a mat3 + * + * @param out the receiving matrix + * @param {mat2d} a the matrix to copy + * @returns out + **/ + public static fromMat2d(out: mat3, a: mat2d): mat3; + + /** + * Calculates a 3x3 matrix from the given quaternion + * + * @param out mat3 receiving operation result + * @param q Quaternion to create matrix from + * + * @returns out + */ + public static fromQuat(out: mat3, q: quat): mat3; + + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * + * @param out mat3 receiving operation result + * @param a Mat4 to derive the normal matrix from + * + * @returns out + */ + public static normalFromMat4(out: mat3, a: mat4): mat3 | null; + + /** + * Returns a string representation of a mat3 + * + * @param mat matrix to represent as a string + * @returns string representation of the matrix + */ + public static str(mat: mat3): string; + + /** + * Returns Frobenius norm of a mat3 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + public static frob(a: mat3): number; + + /** + * Adds two mat3's + * + * @param {mat3} out the receiving matrix + * @param {mat3} a the first operand + * @param {mat3} b the second operand + * @returns {mat3} out + */ + public static add(out: mat3, a: mat3, b: mat3): mat3 + + /** + * Subtracts matrix b from matrix a + * + * @param {mat3} out the receiving matrix + * @param {mat3} a the first operand + * @param {mat3} b the second operand + * @returns {mat3} out + */ + public static subtract(out: mat3, a: mat3, b: mat3): mat3 + + /** + * Subtracts matrix b from matrix a + * + * @param {mat3} out the receiving matrix + * @param {mat3} a the first operand + * @param {mat3} b the second operand + * @returns {mat3} out + */ + public static sub(out: mat3, a: mat3, b: mat3): mat3 + + /** + * Multiply each element of the matrix by a scalar. + * + * @param {mat3} out the receiving matrix + * @param {mat3} a the matrix to scale + * @param {number} b amount to scale the matrix's elements by + * @returns {mat3} out + */ + public static multiplyScalar(out: mat3, a: mat3, b: number): mat3 + + /** + * Adds two mat3's after multiplying each element of the second operand by a scalar value. + * + * @param {mat3} out the receiving vector + * @param {mat3} a the first operand + * @param {mat3} b the second operand + * @param {number} scale the amount to scale b's elements by before adding + * @returns {mat3} out + */ + public static multiplyScalarAndAdd(out: mat3, a: mat3, b: mat3, scale: number): mat3 + + /** + * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) + * + * @param {mat3} a The first matrix. + * @param {mat3} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static exactEquals(a: mat3, b: mat3): boolean; + + /** + * Returns whether or not the matrices have approximately the same elements in the same position. + * + * @param {mat3} a The first matrix. + * @param {mat3} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static equals(a: mat3, b: mat3): boolean + } + + // mat4 + export class mat4 extends Float32Array { + private typeMat4: number; + + /** + * Creates a new identity mat4 + * + * @returns a new 4x4 matrix + */ + public static create(): mat4; + + /** + * Creates a new mat4 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 4x4 matrix + */ + public static clone(a: mat4): mat4; + + /** + * Copy the values from one mat4 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static copy(out: mat4, a: mat4): mat4; + + + /** + * Create a new mat4 with the given values + * + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m02 Component in column 0, row 2 position (index 2) + * @param {number} m03 Component in column 0, row 3 position (index 3) + * @param {number} m10 Component in column 1, row 0 position (index 4) + * @param {number} m11 Component in column 1, row 1 position (index 5) + * @param {number} m12 Component in column 1, row 2 position (index 6) + * @param {number} m13 Component in column 1, row 3 position (index 7) + * @param {number} m20 Component in column 2, row 0 position (index 8) + * @param {number} m21 Component in column 2, row 1 position (index 9) + * @param {number} m22 Component in column 2, row 2 position (index 10) + * @param {number} m23 Component in column 2, row 3 position (index 11) + * @param {number} m30 Component in column 3, row 0 position (index 12) + * @param {number} m31 Component in column 3, row 1 position (index 13) + * @param {number} m32 Component in column 3, row 2 position (index 14) + * @param {number} m33 Component in column 3, row 3 position (index 15) + * @returns {mat4} A new mat4 + */ + public static fromValues(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): mat4; + + /** + * Set the components of a mat4 to the given values + * + * @param {mat4} out the receiving matrix + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m02 Component in column 0, row 2 position (index 2) + * @param {number} m03 Component in column 0, row 3 position (index 3) + * @param {number} m10 Component in column 1, row 0 position (index 4) + * @param {number} m11 Component in column 1, row 1 position (index 5) + * @param {number} m12 Component in column 1, row 2 position (index 6) + * @param {number} m13 Component in column 1, row 3 position (index 7) + * @param {number} m20 Component in column 2, row 0 position (index 8) + * @param {number} m21 Component in column 2, row 1 position (index 9) + * @param {number} m22 Component in column 2, row 2 position (index 10) + * @param {number} m23 Component in column 2, row 3 position (index 11) + * @param {number} m30 Component in column 3, row 0 position (index 12) + * @param {number} m31 Component in column 3, row 1 position (index 13) + * @param {number} m32 Component in column 3, row 2 position (index 14) + * @param {number} m33 Component in column 3, row 3 position (index 15) + * @returns {mat4} out + */ + public static set(out: mat4, m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): mat4; + + /** + * Set a mat4 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + public static identity(out: mat4): mat4; + + /** + * Transpose the values of a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static transpose(out: mat4, a: mat4): mat4; + + /** + * Inverts a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static invert(out: mat4, a: mat4): mat4 | null; + + /** + * Calculates the adjugate of a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ + public static adjoint(out: mat4, a: mat4): mat4; + + /** + * Calculates the determinant of a mat4 + * + * @param a the source matrix + * @returns determinant of a + */ + public static determinant(a: mat4): number; + + /** + * Multiplies two mat4's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: mat4, a: mat4, b: mat4): mat4; + + /** + * Multiplies two mat4's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: mat4, a: mat4, b: mat4): mat4; + + /** + * Translate a mat4 by the given vector + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v vector to translate by + * @returns out + */ + public static translate(out: mat4, a: mat4, v: vec3 | number[]): mat4; + + /** + * Scales the mat4 by the dimensions in the given vec3 + * + * @param out the receiving matrix + * @param a the matrix to scale + * @param v the vec3 to scale the matrix by + * @returns out + **/ + public static scale(out: mat4, a: mat4, v: vec3 | number[]): mat4; + + /** + * Rotates a mat4 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @param axis the axis to rotate around + * @returns out + */ + public static rotate(out: mat4, a: mat4, rad: number, axis: vec3 | number[]): mat4; + + /** + * Rotates a matrix by the given angle around the X axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotateX(out: mat4, a: mat4, rad: number): mat4; + + /** + * Rotates a matrix by the given angle around the Y axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotateY(out: mat4, a: mat4, rad: number): mat4; + + /** + * Rotates a matrix by the given angle around the Z axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + public static rotateZ(out: mat4, a: mat4, rad: number): mat4; + + /** + * Creates a matrix from a vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Translation vector + * @returns {mat4} out + */ + public static fromTranslation(out: mat4, v: vec3 | number[]): mat4 + + /** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * + * @param {mat4} out mat4 receiving operation result + * @param {vec3} v Scaling vector + * @returns {mat4} out + */ + public static fromScaling(out: mat4, v: vec3 | number[]): mat4 + + /** + * Creates a matrix from a given angle around a given axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotate(dest, dest, rad, axis); + * + * @param {mat4} out mat4 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @param {vec3} axis the axis to rotate around + * @returns {mat4} out + */ + public static fromRotation(out: mat4, rad: number, axis: vec3 | number[]): mat4 + + /** + * Creates a matrix from the given angle around the X axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotateX(dest, dest, rad); + * + * @param {mat4} out mat4 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ + public static fromXRotation(out: mat4, rad: number): mat4 + + /** + * Creates a matrix from the given angle around the Y axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotateY(dest, dest, rad); + * + * @param {mat4} out mat4 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ + public static fromYRotation(out: mat4, rad: number): mat4 + + + /** + * Creates a matrix from the given angle around the Z axis + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.rotateZ(dest, dest, rad); + * + * @param {mat4} out mat4 receiving operation result + * @param {number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ + public static fromZRotation(out: mat4, rad: number): mat4 + + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param out mat4 receiving operation result + * @param q Rotation quaternion + * @param v Translation vector + * @returns out + */ + public static fromRotationTranslation(out: mat4, q: quat, v: vec3 | number[]): mat4; + + /** + * Returns the translation vector component of a transformation + * matrix. If a matrix is built with fromRotationTranslation, + * the returned vector will be the same as the translation vector + * originally supplied. + * @param {vec3} out Vector to receive translation component + * @param {mat4} mat Matrix to be decomposed (input) + * @return {vec3} out + */ + public static getTranslation(out: vec3, mat: mat4): vec3; + + /** + * Returns a quaternion representing the rotational component + * of a transformation matrix. If a matrix is built with + * fromRotationTranslation, the returned quaternion will be the + * same as the quaternion originally supplied. + * @param {quat} out Quaternion to receive the rotation component + * @param {mat4} mat Matrix to be decomposed (input) + * @return {quat} out + */ + public static getRotation(out: quat, mat: mat4): quat; + + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * + * @param out mat4 receiving operation result + * @param q Rotation quaternion + * @param v Translation vector + * @param s Scaling vector + * @returns out + */ + public static fromRotationTranslationScale(out: mat4, q: quat, v: vec3 | number[], s: vec3 | number[]): mat4; + + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * mat4.translate(dest, origin); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * mat4.scale(dest, scale) + * mat4.translate(dest, negativeOrigin); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat} q Rotation quaternion + * @param {vec3} v Translation vector + * @param {vec3} s Scaling vector + * @param {vec3} o The origin vector around which to scale and rotate + * @returns {mat4} out + */ + public static fromRotationTranslationScaleOrigin(out: mat4, q: quat, v: vec3 | number[], s: vec3 | number[], o: vec3 | number[]): mat4 + + /** + * Calculates a 4x4 matrix from the given quaternion + * + * @param {mat4} out mat4 receiving operation result + * @param {quat} q Quaternion to create matrix from + * + * @returns {mat4} out + */ + public static fromQuat(out: mat4, q: quat): mat4 + + /** + * Generates a frustum matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param left Left bound of the frustum + * @param right Right bound of the frustum + * @param bottom Bottom bound of the frustum + * @param top Top bound of the frustum + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ + public static frustum(out: mat4, left: number, right: number, + bottom: number, top: number, near: number, far: number): mat4; + + /** + * Generates a perspective projection matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param fovy Vertical field of view in radians + * @param aspect Aspect ratio. typically viewport width/height + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ + public static perspective(out: mat4, fovy: number, aspect: number, + near: number, far: number): mat4; + + /** + * Generates a perspective projection matrix with the given field of view. + * This is primarily useful for generating projection matrices to be used + * with the still experimental WebVR API. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ + public static perspectiveFromFieldOfView(out: mat4, + fov:{upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number}, + near: number, far: number): mat4 + + /** + * Generates a orthogonal projection matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param left Left bound of the frustum + * @param right Right bound of the frustum + * @param bottom Bottom bound of the frustum + * @param top Top bound of the frustum + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ + public static ortho(out: mat4, left: number, right: number, + bottom: number, top: number, near: number, far: number): mat4; + + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param out mat4 frustum matrix will be written into + * @param eye Position of the viewer + * @param center Point the viewer is looking at + * @param up vec3 pointing up + * @returns out + */ + public static lookAt(out: mat4, eye: vec3 | number[], center: vec3 | number[], up: vec3 | number[]): mat4; + + /** + * Returns a string representation of a mat4 + * + * @param mat matrix to represent as a string + * @returns string representation of the matrix + */ + public static str(mat: mat4): string; + + /** + * Returns Frobenius norm of a mat4 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ + public static frob(a: mat4): number; + + /** + * Adds two mat4's + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ + public static add(out: mat4, a: mat4, b: mat4): mat4 + + /** + * Subtracts matrix b from matrix a + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ + public static subtract(out: mat4, a: mat4, b: mat4): mat4 + + /** + * Subtracts matrix b from matrix a + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ + public static sub(out: mat4, a: mat4, b: mat4): mat4 + + /** + * Multiply each element of the matrix by a scalar. + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to scale + * @param {number} b amount to scale the matrix's elements by + * @returns {mat4} out + */ + public static multiplyScalar(out: mat4, a: mat4, b: number): mat4 + + /** + * Adds two mat4's after multiplying each element of the second operand by a scalar value. + * + * @param {mat4} out the receiving vector + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @param {number} scale the amount to scale b's elements by before adding + * @returns {mat4} out + */ + public static multiplyScalarAndAdd (out: mat4, a: mat4, b: mat4, scale: number): mat4 + + /** + * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) + * + * @param {mat4} a The first matrix. + * @param {mat4} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static exactEquals (a: mat4, b: mat4): boolean + + /** + * Returns whether or not the matrices have approximately the same elements in the same position. + * + * @param {mat4} a The first matrix. + * @param {mat4} b The second matrix. + * @returns {boolean} True if the matrices are equal, false otherwise. + */ + public static equals (a: mat4, b: mat4): boolean + + } + + // quat + export class quat extends Float32Array { + private typeQuat: number; + + /** + * Creates a new identity quat + * + * @returns a new quaternion + */ + public static create(): quat; + + /** + * Creates a new quat initialized with values from an existing quaternion + * + * @param a quaternion to clone + * @returns a new quaternion + * @function + */ + public static clone(a: quat): quat; + + /** + * Creates a new quat initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns a new quaternion + * @function + */ + public static fromValues(x: number, y: number, z: number, w: number): quat; + + /** + * Copy the values from one quat to another + * + * @param out the receiving quaternion + * @param a the source quaternion + * @returns out + * @function + */ + public static copy(out: quat, a: quat): quat; + + /** + * Set the components of a quat to the given values + * + * @param out the receiving quaternion + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns out + * @function + */ + public static set(out: quat, x: number, y: number, z: number, w: number): quat; + + /** + * Set a quat to the identity quaternion + * + * @param out the receiving quaternion + * @returns out + */ + public static identity(out: quat): quat; + + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * + * @param {quat} out the receiving quaternion. + * @param {vec3} a the initial vector + * @param {vec3} b the destination vector + * @returns {quat} out + */ + public static rotationTo (out: quat, a: vec3 | number[], b: vec3 | number[]): quat; + + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * + * @param {vec3} view the vector representing the viewing direction + * @param {vec3} right the vector representing the local "right" direction + * @param {vec3} up the vector representing the local "up" direction + * @returns {quat} out + */ + public static setAxes (out: quat, view: vec3 | number[], right: vec3 | number[], up: vec3 | number[]): quat + + + + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * + * @param out the receiving quaternion + * @param axis the axis around which to rotate + * @param rad the angle in radians + * @returns out + **/ + public static setAxisAngle(out: quat, axis: vec3 | number[], rad: number): quat; + + /** + * Gets the rotation axis and angle for a given + * quaternion. If a quaternion is created with + * setAxisAngle, this method will return the same + * values as providied in the original parameter list + * OR functionally equivalent values. + * Example: The quaternion formed by axis [0, 0, 1] and + * angle -90 is the same as the quaternion formed by + * [0, 0, 1] and 270. This method favors the latter. + * @param {vec3} out_axis Vector receiving the axis of rotation + * @param {quat} q Quaternion to be decomposed + * @return {number} Angle, in radians, of the rotation + */ + public static getAxisAngle (out_axis: vec3 | number[], q: quat): number + + /** + * Adds two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + * @function + */ + public static add(out: quat, a: quat, b: quat): quat; + + /** + * Multiplies two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static multiply(out: quat, a: quat, b: quat): quat; + + /** + * Multiplies two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + */ + public static mul(out: quat, a: quat, b: quat): quat; + + /** + * Scales a quat by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + * @function + */ + public static scale(out: quat, a: quat, b: number): quat; + + /** + * Calculates the length of a quat + * + * @param a vector to calculate length of + * @returns length of a + * @function + */ + public static length(a: quat): number; + + /** + * Calculates the length of a quat + * + * @param a vector to calculate length of + * @returns length of a + * @function + */ + public static len(a: quat): number; + + /** + * Calculates the squared length of a quat + * + * @param a vector to calculate squared length of + * @returns squared length of a + * @function + */ + public static squaredLength(a: quat): number; + + /** + * Calculates the squared length of a quat + * + * @param a vector to calculate squared length of + * @returns squared length of a + * @function + */ + public static sqrLen(a: quat): number; + + /** + * Normalize a quat + * + * @param out the receiving quaternion + * @param a quaternion to normalize + * @returns out + * @function + */ + public static normalize(out: quat, a: quat): quat; + + /** + * Calculates the dot product of two quat's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + * @function + */ + public static dot(a: quat, b: quat): number; + + /** + * Performs a linear interpolation between two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + * @function + */ + public static lerp(out: quat, a: quat, b: quat, t: number): quat; + + /** + * Performs a spherical linear interpolation between two quat + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ + public static slerp(out: quat, a: quat, b: quat, t: number): quat; + + /** + * Performs a spherical linear interpolation with two control points + * + * @param {quat} out the receiving quaternion + * @param {quat} a the first operand + * @param {quat} b the second operand + * @param {quat} c the third operand + * @param {quat} d the fourth operand + * @param {number} t interpolation amount + * @returns {quat} out + */ + public static sqlerp(out: quat, a: quat, b: quat, c: quat, d: quat, t: number): quat; + + /** + * Calculates the inverse of a quat + * + * @param out the receiving quaternion + * @param a quat to calculate inverse of + * @returns out + */ + public static invert(out: quat, a: quat): quat; + + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. + * + * @param out the receiving quaternion + * @param a quat to calculate conjugate of + * @returns out + */ + public static conjugate(out: quat, a: quat): quat; + + /** + * Returns a string representation of a quaternion + * + * @param a quat to represent as a string + * @returns string representation of the quat + */ + public static str(a: quat): string; + + /** + * Rotates a quaternion by the given angle about the X axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ + public static rotateX(out: quat, a: quat, rad: number): quat; + + /** + * Rotates a quaternion by the given angle about the Y axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ + public static rotateY(out: quat, a: quat, rad: number): quat; + + /** + * Rotates a quaternion by the given angle about the Z axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ + public static rotateZ(out: quat, a: quat, rad: number): quat; + + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to renormalize the quaternion yourself where necessary. + * + * @param out the receiving quaternion + * @param m rotation matrix + * @returns out + * @function + */ + public static fromMat3(out: quat, m: mat3): quat; + + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * + * @param out the receiving quat + * @param view the vector representing the viewing direction + * @param right the vector representing the local "right" direction + * @param up the vector representing the local "up" direction + * @returns out + */ + public static setAxes(out: quat, view: vec3 | number[], right: vec3 | number[], up: vec3 | number[]): quat; + + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * + * @param out the receiving quaternion. + * @param a the initial vector + * @param b the destination vector + * @returns out + */ + public static rotationTo(out: quat, a: vec3 | number[], b: vec3 | number[]): quat; + + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * + * @param out the receiving quaternion + * @param a quat to calculate W component of + * @returns out + */ + public static calculateW(out: quat, a: quat): quat; + + /** + * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===) + * + * @param {quat} a The first vector. + * @param {quat} b The second vector. + * @returns {boolean} True if the quaternions are equal, false otherwise. + */ + public static exactEquals (a: quat, b: quat): boolean; + + /** + * Returns whether or not the quaternions have approximately the same elements in the same position. + * + * @param {quat} a The first vector. + * @param {quat} b The second vector. + * @returns {boolean} True if the quaternions are equal, false otherwise. + */ + public static equals (a: quat, b: quat): boolean; + } } -// vec3 -export class vec3 extends Float32Array { - private typeVec3: number; - - /** - * Creates a new, empty vec3 - * - * @returns a new 3D vector - */ - public static create(): vec3; - - /** - * Creates a new vec3 initialized with values from an existing vector - * - * @param a vector to clone - * @returns a new 3D vector - */ - public static clone(a: vec3 | number[]): vec3; - - /** - * Creates a new vec3 initialized with the given values - * - * @param x X component - * @param y Y component - * @param z Z component - * @returns a new 3D vector - */ - public static fromValues(x: number, y: number, z: number): vec3; - - /** - * Copy the values from one vec3 to another - * - * @param out the receiving vector - * @param a the source vector - * @returns out - */ - public static copy(out: vec3, a: vec3 | number[]): vec3; - - /** - * Set the components of a vec3 to the given values - * - * @param out the receiving vector - * @param x X component - * @param y Y component - * @param z Z component - * @returns out - */ - public static set(out: vec3, x: number, y: number, z: number): vec3; - - /** - * Adds two vec3's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static add(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; - - /** - * Subtracts vector b from vector a - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static subtract(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; - - /** - * Subtracts vector b from vector a - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static sub(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3 - - /** - * Multiplies two vec3's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static multiply(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; - - /** - * Multiplies two vec3's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static mul(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; - - /** - * Divides two vec3's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static divide(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; - - /** - * Divides two vec3's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static div(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; - - /** - * Math.ceil the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to ceil - * @returns {vec3} out - */ - public static ceil (out: vec3, a: vec3 | number[]): vec3; - - /** - * Math.floor the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to floor - * @returns {vec3} out - */ - public static floor (out: vec3, a: vec3 | number[]): vec3; - - /** - * Returns the minimum of two vec3's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static min(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; - - /** - * Returns the maximum of two vec3's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static max(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; - - /** - * Math.round the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to round - * @returns {vec3} out - */ - public static round (out: vec3, a: vec3 | number[]): vec3 - - /** - * Scales a vec3 by a scalar number - * - * @param out the receiving vector - * @param a the vector to scale - * @param b amount to scale the vector by - * @returns out - */ - public static scale(out: vec3, a: vec3 | number[], b: number): vec3; - - /** - * Adds two vec3's after scaling the second operand by a scalar value - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @param scale the amount to scale b by before adding - * @returns out - */ - public static scaleAndAdd(out: vec3, a: vec3 | number[], b: vec3 | number[], scale: number): vec3; - - /** - * Calculates the euclidian distance between two vec3's - * - * @param a the first operand - * @param b the second operand - * @returns distance between a and b - */ - public static distance(a: vec3 | number[], b: vec3 | number[]): number; - - /** - * Calculates the euclidian distance between two vec3's - * - * @param a the first operand - * @param b the second operand - * @returns distance between a and b - */ - public static dist(a: vec3 | number[], b: vec3 | number[]): number; - - /** - * Calculates the squared euclidian distance between two vec3's - * - * @param a the first operand - * @param b the second operand - * @returns squared distance between a and b - */ - public static squaredDistance(a: vec3 | number[], b: vec3 | number[]): number; - - /** - * Calculates the squared euclidian distance between two vec3's - * - * @param a the first operand - * @param b the second operand - * @returns squared distance between a and b - */ - public static sqrDist(a: vec3 | number[], b: vec3 | number[]): number; - - /** - * Calculates the length of a vec3 - * - * @param a vector to calculate length of - * @returns length of a - */ - public static length(a: vec3 | number[]): number; - - /** - * Calculates the length of a vec3 - * - * @param a vector to calculate length of - * @returns length of a - */ - public static len(a: vec3 | number[]): number; - - /** - * Calculates the squared length of a vec3 - * - * @param a vector to calculate squared length of - * @returns squared length of a - */ - public static squaredLength(a: vec3 | number[]): number; - - /** - * Calculates the squared length of a vec3 - * - * @param a vector to calculate squared length of - * @returns squared length of a - */ - public static sqrLen(a: vec3 | number[]): number; - - /** - * Negates the components of a vec3 - * - * @param out the receiving vector - * @param a vector to negate - * @returns out - */ - public static negate(out: vec3, a: vec3 | number[]): vec3; - - /** - * Returns the inverse of the components of a vec3 - * - * @param out the receiving vector - * @param a vector to invert - * @returns out - */ - public static inverse(out: vec3, a: vec3 | number[]): vec3; - - /** - * Normalize a vec3 - * - * @param out the receiving vector - * @param a vector to normalize - * @returns out - */ - public static normalize(out: vec3, a: vec3 | number[]): vec3; - - /** - * Calculates the dot product of two vec3's - * - * @param a the first operand - * @param b the second operand - * @returns dot product of a and b - */ - public static dot(a: vec3 | number[], b: vec3 | number[]): number; - - /** - * Computes the cross product of two vec3's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static cross(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3; - - /** - * Performs a linear interpolation between two vec3's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @param t interpolation amount between the two inputs - * @returns out - */ - public static lerp(out: vec3, a: vec3 | number[], b: vec3 | number[], t: number): vec3; - - /** - * Performs a hermite interpolation with two control points - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @param {vec3} c the third operand - * @param {vec3} d the fourth operand - * @param {number} t interpolation amount between the two inputs - * @returns {vec3} out - */ - public static hermite (out: vec3, a: vec3 | number[], b: vec3 | number[], c: vec3 | number[], d: vec3 | number[], t: number): vec3; - - /** - * Performs a bezier interpolation with two control points - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @param {vec3} c the third operand - * @param {vec3} d the fourth operand - * @param {number} t interpolation amount between the two inputs - * @returns {vec3} out - */ - public static bezier (out: vec3, a: vec3 | number[], b: vec3 | number[], c: vec3 | number[], d: vec3 | number[], t: number): vec3; - - /** - * Generates a random unit vector - * - * @param out the receiving vector - * @returns out - */ - public static random(out: vec3): vec3; - - /** - * Generates a random vector with the given scale - * - * @param out the receiving vector - * @param [scale] Length of the resulting vector. If omitted, a unit vector will be returned - * @returns out - */ - public static random(out: vec3, scale: number): vec3; - - /** - * Transforms the vec3 with a mat3. - * - * @param out the receiving vector - * @param a the vector to transform - * @param m the 3x3 matrix to transform with - * @returns out - */ - public static transformMat3(out: vec3, a: vec3 | number[], m: mat3): vec3; - - /** - * Transforms the vec3 with a mat4. - * 4th vector component is implicitly '1' - * - * @param out the receiving vector - * @param a the vector to transform - * @param m matrix to transform with - * @returns out - */ - public static transformMat4(out: vec3, a: vec3 | number[], m: mat4): vec3; - - /** - * Transforms the vec3 with a quat - * - * @param out the receiving vector - * @param a the vector to transform - * @param q quaternion to transform with - * @returns out - */ - public static transformQuat(out: vec3, a: vec3 | number[], q: quat): vec3; - - - /** - * Rotate a 3D vector around the x-axis - * @param out The receiving vec3 - * @param a The vec3 point to rotate - * @param b The origin of the rotation - * @param c The angle of rotation - * @returns out - */ - public static rotateX(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3; - - /** - * Rotate a 3D vector around the y-axis - * @param out The receiving vec3 - * @param a The vec3 point to rotate - * @param b The origin of the rotation - * @param c The angle of rotation - * @returns out - */ - public static rotateY(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3; - - /** - * Rotate a 3D vector around the z-axis - * @param out The receiving vec3 - * @param a The vec3 point to rotate - * @param b The origin of the rotation - * @param c The angle of rotation - * @returns out - */ - public static rotateZ(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3; - - /** - * Perform some operation over an array of vec3s. - * - * @param a the array of vectors to iterate over - * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed - * @param offset Number of elements to skip at the beginning of the array - * @param count Number of vec3s to iterate over. If 0 iterates over entire array - * @param fn Function to call for each vector in the array - * @param arg additional argument to pass to fn - * @returns a - * @function - */ - public static forEach(a: Float32Array, stride: number, offset: number, count: number, - fn: (a: vec3 | number[], b: vec3 | number[], arg: any) => void, arg: any): Float32Array; - - /** - * Perform some operation over an array of vec3s. - * - * @param a the array of vectors to iterate over - * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed - * @param offset Number of elements to skip at the beginning of the array - * @param count Number of vec3s to iterate over. If 0 iterates over entire array - * @param fn Function to call for each vector in the array - * @returns a - * @function - */ - public static forEach(a: Float32Array, stride: number, offset: number, count: number, - fn: (a: vec3 | number[], b: vec3 | number[]) => void): Float32Array; - - /** - * Get the angle between two 3D vectors - * @param a The first operand - * @param b The second operand - * @returns The angle in radians - */ - public static angle(a: vec3 | number[], b: vec3 | number[]): number; - - /** - * Returns a string representation of a vector - * - * @param a vector to represent as a string - * @returns string representation of the vector - */ - public static str(a: vec3 | number[]): string; - - /** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {vec3} a The first vector. - * @param {vec3} b The second vector. - * @returns {boolean} True if the vectors are equal, false otherwise. - */ - public static exactEquals (a: vec3 | number[], b: vec3 | number[]): boolean - - /** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {vec3} a The first vector. - * @param {vec3} b The second vector. - * @returns {boolean} True if the vectors are equal, false otherwise. - */ - public static equals (a: vec3 | number[], b: vec3 | number[]): boolean +declare module 'gl-matrix/src/gl-matrix/vec2' { + import { vec2 } from 'gl-matrix'; + export = vec2; } -// vec4 -export class vec4 extends Float32Array { - private typeVec3: number; - - /** - * Creates a new, empty vec4 - * - * @returns a new 4D vector - */ - public static create(): vec4; - - /** - * Creates a new vec4 initialized with values from an existing vector - * - * @param a vector to clone - * @returns a new 4D vector - */ - public static clone(a: vec4 | number[]): vec4; - - /** - * Creates a new vec4 initialized with the given values - * - * @param x X component - * @param y Y component - * @param z Z component - * @param w W component - * @returns a new 4D vector - */ - public static fromValues(x: number, y: number, z: number, w: number): vec4; - - /** - * Copy the values from one vec4 to another - * - * @param out the receiving vector - * @param a the source vector - * @returns out - */ - public static copy(out: vec4, a: vec4 | number[]): vec4; - - /** - * Set the components of a vec4 to the given values - * - * @param out the receiving vector - * @param x X component - * @param y Y component - * @param z Z component - * @param w W component - * @returns out - */ - public static set(out: vec4, x: number, y: number, z: number, w: number): vec4; - - /** - * Adds two vec4's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static add(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; - - /** - * Subtracts vector b from vector a - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static subtract(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; - - /** - * Subtracts vector b from vector a - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static sub(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; - - /** - * Multiplies two vec4's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static multiply(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; - - /** - * Multiplies two vec4's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static mul(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; - - /** - * Divides two vec4's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static divide(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; - - /** - * Divides two vec4's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static div(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; - - /** - * Math.ceil the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {vec4} a vector to ceil - * @returns {vec4} out - */ - public static ceil (out: vec4, a: vec4 | number[]): vec4; - - /** - * Math.floor the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {vec4} a vector to floor - * @returns {vec4} out - */ - public static floor (out: vec4, a: vec4 | number[]): vec4; - - /** - * Returns the minimum of two vec4's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static min(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; - - /** - * Returns the maximum of two vec4's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static max(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4; - - /** - * Math.round the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {vec4} a vector to round - * @returns {vec4} out - */ - public static round (out: vec4, a: vec4 | number[]): vec4; - - /** - * Scales a vec4 by a scalar number - * - * @param out the receiving vector - * @param a the vector to scale - * @param b amount to scale the vector by - * @returns out - */ - public static scale(out: vec4, a: vec4 | number[], b: number): vec4; - - /** - * Adds two vec4's after scaling the second operand by a scalar value - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @param scale the amount to scale b by before adding - * @returns out - */ - public static scaleAndAdd(out: vec4, a: vec4 | number[], b: vec4 | number[], scale: number): vec4; - - /** - * Calculates the euclidian distance between two vec4's - * - * @param a the first operand - * @param b the second operand - * @returns distance between a and b - */ - public static distance(a: vec4 | number[], b: vec4 | number[]): number; - - /** - * Calculates the euclidian distance between two vec4's - * - * @param a the first operand - * @param b the second operand - * @returns distance between a and b - */ - public static dist(a: vec4 | number[], b: vec4 | number[]): number; - - /** - * Calculates the squared euclidian distance between two vec4's - * - * @param a the first operand - * @param b the second operand - * @returns squared distance between a and b - */ - public static squaredDistance(a: vec4 | number[], b: vec4 | number[]): number; - - /** - * Calculates the squared euclidian distance between two vec4's - * - * @param a the first operand - * @param b the second operand - * @returns squared distance between a and b - */ - public static sqrDist(a: vec4 | number[], b: vec4 | number[]): number; - - /** - * Calculates the length of a vec4 - * - * @param a vector to calculate length of - * @returns length of a - */ - public static length(a: vec4 | number[]): number; - - /** - * Calculates the length of a vec4 - * - * @param a vector to calculate length of - * @returns length of a - */ - public static len(a: vec4 | number[]): number; - - /** - * Calculates the squared length of a vec4 - * - * @param a vector to calculate squared length of - * @returns squared length of a - */ - public static squaredLength(a: vec4 | number[]): number; - - /** - * Calculates the squared length of a vec4 - * - * @param a vector to calculate squared length of - * @returns squared length of a - */ - public static sqrLen(a: vec4 | number[]): number; - - /** - * Negates the components of a vec4 - * - * @param out the receiving vector - * @param a vector to negate - * @returns out - */ - public static negate(out: vec4, a: vec4 | number[]): vec4; - - /** - * Returns the inverse of the components of a vec4 - * - * @param out the receiving vector - * @param a vector to invert - * @returns out - */ - public static inverse(out: vec4, a: vec4 | number[]): vec4; - - /** - * Normalize a vec4 - * - * @param out the receiving vector - * @param a vector to normalize - * @returns out - */ - public static normalize(out: vec4, a: vec4 | number[]): vec4; - - /** - * Calculates the dot product of two vec4's - * - * @param a the first operand - * @param b the second operand - * @returns dot product of a and b - */ - public static dot(a: vec4 | number[], b: vec4 | number[]): number; - - /** - * Performs a linear interpolation between two vec4's - * - * @param out the receiving vector - * @param a the first operand - * @param b the second operand - * @param t interpolation amount between the two inputs - * @returns out - */ - public static lerp(out: vec4, a: vec4 | number[], b: vec4 | number[], t: number): vec4; - - /** - * Generates a random unit vector - * - * @param out the receiving vector - * @returns out - */ - public static random(out: vec4): vec4; - - /** - * Generates a random vector with the given scale - * - * @param out the receiving vector - * @param scale length of the resulting vector. If ommitted, a unit vector will be returned - * @returns out - */ - public static random(out: vec4, scale: number): vec4; - - /** - * Transforms the vec4 with a mat4. - * - * @param out the receiving vector - * @param a the vector to transform - * @param m matrix to transform with - * @returns out - */ - public static transformMat4(out: vec4, a: vec4 | number[], m: mat4): vec4; - - /** - * Transforms the vec4 with a quat - * - * @param out the receiving vector - * @param a the vector to transform - * @param q quaternion to transform with - * @returns out - */ - - public static transformQuat(out: vec4, a: vec4 | number[], q: quat): vec4; - - /** - * Perform some operation over an array of vec4s. - * - * @param a the array of vectors to iterate over - * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed - * @param offset Number of elements to skip at the beginning of the array - * @param count Number of vec4s to iterate over. If 0 iterates over entire array - * @param fn Function to call for each vector in the array - * @param arg additional argument to pass to fn - * @returns a - * @function - */ - public static forEach(a: Float32Array, stride: number, offset: number, count: number, - fn: (a: vec4 | number[], b: vec4 | number[], arg: any) => void, arg: any): Float32Array; - - /** - * Perform some operation over an array of vec4s. - * - * @param a the array of vectors to iterate over - * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed - * @param offset Number of elements to skip at the beginning of the array - * @param count Number of vec4s to iterate over. If 0 iterates over entire array - * @param fn Function to call for each vector in the array - * @returns a - * @function - */ - public static forEach(a: Float32Array, stride: number, offset: number, count: number, - fn: (a: vec4 | number[], b: vec4 | number[]) => void): Float32Array; - - /** - * Returns a string representation of a vector - * - * @param a vector to represent as a string - * @returns string representation of the vector - */ - public static str(a: vec4 | number[]): string; - - /** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {vec4} a The first vector. - * @param {vec4} b The second vector. - * @returns {boolean} True if the vectors are equal, false otherwise. - */ - public static exactEquals (a: vec4 | number[], b: vec4 | number[]): boolean; - - /** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {vec4} a The first vector. - * @param {vec4} b The second vector. - * @returns {boolean} True if the vectors are equal, false otherwise. - */ - public static equals (a: vec4 | number[], b: vec4 | number[]): boolean; +declare module 'gl-matrix/src/gl-matrix/vec3' { + import { vec3 } from 'gl-matrix'; + export = vec3; } -// mat2 -export class mat2 extends Float32Array { - private typeMat2: number; - - /** - * Creates a new identity mat2 - * - * @returns a new 2x2 matrix - */ - public static create(): mat2; - - /** - * Creates a new mat2 initialized with values from an existing matrix - * - * @param a matrix to clone - * @returns a new 2x2 matrix - */ - public static clone(a: mat2): mat2; - - /** - * Copy the values from one mat2 to another - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static copy(out: mat2, a: mat2): mat2; - - /** - * Set a mat2 to the identity matrix - * - * @param out the receiving matrix - * @returns out - */ - public static identity(out: mat2): mat2; - - /** - * Create a new mat2 with the given values - * - * @param {number} m00 Component in column 0, row 0 position (index 0) - * @param {number} m01 Component in column 0, row 1 position (index 1) - * @param {number} m10 Component in column 1, row 0 position (index 2) - * @param {number} m11 Component in column 1, row 1 position (index 3) - * @returns {mat2} out A new 2x2 matrix - */ - public static fromValues(m00: number, m01: number, m10: number, m11: number): mat2; - - /** - * Set the components of a mat2 to the given values - * - * @param {mat2} out the receiving matrix - * @param {number} m00 Component in column 0, row 0 position (index 0) - * @param {number} m01 Component in column 0, row 1 position (index 1) - * @param {number} m10 Component in column 1, row 0 position (index 2) - * @param {number} m11 Component in column 1, row 1 position (index 3) - * @returns {mat2} out - */ - public static set(out: mat2, m00: number, m01: number, m10: number, m11: number): mat2; - - /** - * Transpose the values of a mat2 - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static transpose(out: mat2, a: mat2): mat2; - - /** - * Inverts a mat2 - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static invert(out: mat2, a: mat2): mat2; - - /** - * Calculates the adjugate of a mat2 - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static adjoint(out: mat2, a: mat2): mat2; - - /** - * Calculates the determinant of a mat2 - * - * @param a the source matrix - * @returns determinant of a - */ - public static determinant(a: mat2): number; - - /** - * Multiplies two mat2's - * - * @param out the receiving matrix - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static multiply(out: mat2, a: mat2, b: mat2): mat2; - - /** - * Multiplies two mat2's - * - * @param out the receiving matrix - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static mul(out: mat2, a: mat2, b: mat2): mat2; - - /** - * Rotates a mat2 by the given angle - * - * @param out the receiving matrix - * @param a the matrix to rotate - * @param rad the angle to rotate the matrix by - * @returns out - */ - public static rotate(out: mat2, a: mat2, rad: number): mat2; - - /** - * Scales the mat2 by the dimensions in the given vec2 - * - * @param out the receiving matrix - * @param a the matrix to rotate - * @param v the vec2 to scale the matrix by - * @returns out - **/ - public static scale(out: mat2, a: mat2, v: vec2 | number[]): mat2; - - /** - * Creates a matrix from a given angle - * This is equivalent to (but much faster than): - * - * mat2.identity(dest); - * mat2.rotate(dest, dest, rad); - * - * @param {mat2} out mat2 receiving operation result - * @param {number} rad the angle to rotate the matrix by - * @returns {mat2} out - */ - public static fromRotation(out: mat2, rad: number): mat2; - - /** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat2.identity(dest); - * mat2.scale(dest, dest, vec); - * - * @param {mat2} out mat2 receiving operation result - * @param {vec2} v Scaling vector - * @returns {mat2} out - */ - public static fromScaling(out: mat2, v: vec2 | number[]): mat2; - - /** - * Returns a string representation of a mat2 - * - * @param a matrix to represent as a string - * @returns string representation of the matrix - */ - public static str(a: mat2): string; - - /** - * Returns Frobenius norm of a mat2 - * - * @param a the matrix to calculate Frobenius norm of - * @returns Frobenius norm - */ - public static frob(a: mat2): number; - - /** - * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix - * @param L the lower triangular matrix - * @param D the diagonal matrix - * @param U the upper triangular matrix - * @param a the input matrix to factorize - */ - public static LDU(L: mat2, D: mat2, U: mat2, a: mat2): mat2; - - /** - * Adds two mat2's - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the first operand - * @param {mat2} b the second operand - * @returns {mat2} out - */ - public static add(out: mat2, a: mat2, b: mat2): mat2; - - /** - * Subtracts matrix b from matrix a - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the first operand - * @param {mat2} b the second operand - * @returns {mat2} out - */ - public static subtract (out: mat2, a: mat2, b: mat2): mat2; - - /** - * Subtracts matrix b from matrix a - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the first operand - * @param {mat2} b the second operand - * @returns {mat2} out - */ - public static sub (out: mat2, a: mat2, b: mat2): mat2; - - /** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {mat2} a The first matrix. - * @param {mat2} b The second matrix. - * @returns {boolean} True if the matrices are equal, false otherwise. - */ - public static exactEquals (a: mat2, b: mat2): boolean; - - /** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {mat2} a The first matrix. - * @param {mat2} b The second matrix. - * @returns {boolean} True if the matrices are equal, false otherwise. - */ - public static equals (a: mat2, b: mat2): boolean; - - /** - * Multiply each element of the matrix by a scalar. - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the matrix to scale - * @param {number} b amount to scale the matrix's elements by - * @returns {mat2} out - */ - public static multiplyScalar (out: mat2, a: mat2, b: number): mat2 - - /** - * Adds two mat2's after multiplying each element of the second operand by a scalar value. - * - * @param {mat2} out the receiving vector - * @param {mat2} a the first operand - * @param {mat2} b the second operand - * @param {number} scale the amount to scale b's elements by before adding - * @returns {mat2} out - */ - public static multiplyScalarAndAdd (out: mat2, a: mat2, b: mat2, scale: number): mat2 - - - +declare module 'gl-matrix/src/gl-matrix/vec4' { + import { vec4 } from 'gl-matrix'; + export = vec4; } -// mat2d -export class mat2d extends Float32Array { - private typeMat2d: number; - - /** - * Creates a new identity mat2d - * - * @returns a new 2x3 matrix - */ - public static create(): mat2d; - - /** - * Creates a new mat2d initialized with values from an existing matrix - * - * @param a matrix to clone - * @returns a new 2x3 matrix - */ - public static clone(a: mat2d): mat2d; - - /** - * Copy the values from one mat2d to another - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static copy(out: mat2d, a: mat2d): mat2d; - - /** - * Set a mat2d to the identity matrix - * - * @param out the receiving matrix - * @returns out - */ - public static identity(out: mat2d): mat2d; - - /** - * Create a new mat2d with the given values - * - * @param {number} a Component A (index 0) - * @param {number} b Component B (index 1) - * @param {number} c Component C (index 2) - * @param {number} d Component D (index 3) - * @param {number} tx Component TX (index 4) - * @param {number} ty Component TY (index 5) - * @returns {mat2d} A new mat2d - */ - public static fromValues (a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d - - - /** - * Set the components of a mat2d to the given values - * - * @param {mat2d} out the receiving matrix - * @param {number} a Component A (index 0) - * @param {number} b Component B (index 1) - * @param {number} c Component C (index 2) - * @param {number} d Component D (index 3) - * @param {number} tx Component TX (index 4) - * @param {number} ty Component TY (index 5) - * @returns {mat2d} out - */ - public static set (out: mat2d, a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d - - /** - * Inverts a mat2d - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static invert(out: mat2d, a: mat2d): mat2d; - - /** - * Calculates the determinant of a mat2d - * - * @param a the source matrix - * @returns determinant of a - */ - public static determinant(a: mat2d): number; - - /** - * Multiplies two mat2d's - * - * @param out the receiving matrix - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static multiply(out: mat2d, a: mat2d, b: mat2d): mat2d; - - /** - * Multiplies two mat2d's - * - * @param out the receiving matrix - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static mul(out: mat2d, a: mat2d, b: mat2d): mat2d; - - /** - * Rotates a mat2d by the given angle - * - * @param out the receiving matrix - * @param a the matrix to rotate - * @param rad the angle to rotate the matrix by - * @returns out - */ - public static rotate(out: mat2d, a: mat2d, rad: number): mat2d; - - /** - * Scales the mat2d by the dimensions in the given vec2 - * - * @param out the receiving matrix - * @param a the matrix to translate - * @param v the vec2 to scale the matrix by - * @returns out - **/ - public static scale(out: mat2d, a: mat2d, v: vec2 | number[]): mat2d; - - /** - * Translates the mat2d by the dimensions in the given vec2 - * - * @param out the receiving matrix - * @param a the matrix to translate - * @param v the vec2 to translate the matrix by - * @returns out - **/ - public static translate(out: mat2d, a: mat2d, v: vec2 | number[]): mat2d; - - /** - * Creates a matrix from a given angle - * This is equivalent to (but much faster than): - * - * mat2d.identity(dest); - * mat2d.rotate(dest, dest, rad); - * - * @param {mat2d} out mat2d receiving operation result - * @param {number} rad the angle to rotate the matrix by - * @returns {mat2d} out - */ - public static fromRotation (out: mat2d, rad: number): mat2d; - - /** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat2d.identity(dest); - * mat2d.scale(dest, dest, vec); - * - * @param {mat2d} out mat2d receiving operation result - * @param {vec2} v Scaling vector - * @returns {mat2d} out - */ - public static fromScaling (out: mat2d, v: vec2 | number[]): mat2d; - - /** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat2d.identity(dest); - * mat2d.translate(dest, dest, vec); - * - * @param {mat2d} out mat2d receiving operation result - * @param {vec2} v Translation vector - * @returns {mat2d} out - */ - public static fromTranslation (out: mat2d, v: vec2 | number[]): mat2d - - /** - * Returns a string representation of a mat2d - * - * @param a matrix to represent as a string - * @returns string representation of the matrix - */ - public static str(a: mat2d): string; - - /** - * Returns Frobenius norm of a mat2d - * - * @param a the matrix to calculate Frobenius norm of - * @returns Frobenius norm - */ - public static frob(a: mat2d): number; - - /** - * Adds two mat2d's - * - * @param {mat2d} out the receiving matrix - * @param {mat2d} a the first operand - * @param {mat2d} b the second operand - * @returns {mat2d} out - */ - public static add (out: mat2d, a: mat2d, b: mat2d): mat2d - - /** - * Subtracts matrix b from matrix a - * - * @param {mat2d} out the receiving matrix - * @param {mat2d} a the first operand - * @param {mat2d} b the second operand - * @returns {mat2d} out - */ - public static subtract(out: mat2d, a: mat2d, b: mat2d): mat2d - - /** - * Subtracts matrix b from matrix a - * - * @param {mat2d} out the receiving matrix - * @param {mat2d} a the first operand - * @param {mat2d} b the second operand - * @returns {mat2d} out - */ - public static sub(out: mat2d, a: mat2d, b: mat2d): mat2d - - /** - * Multiply each element of the matrix by a scalar. - * - * @param {mat2d} out the receiving matrix - * @param {mat2d} a the matrix to scale - * @param {number} b amount to scale the matrix's elements by - * @returns {mat2d} out - */ - public static multiplyScalar (out: mat2d, a: mat2d, b: number): mat2d; - - /** - * Adds two mat2d's after multiplying each element of the second operand by a scalar value. - * - * @param {mat2d} out the receiving vector - * @param {mat2d} a the first operand - * @param {mat2d} b the second operand - * @param {number} scale the amount to scale b's elements by before adding - * @returns {mat2d} out - */ - public static multiplyScalarAndAdd (out: mat2d, a: mat2d, b: mat2d, scale: number): mat2d - - /** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {mat2d} a The first matrix. - * @param {mat2d} b The second matrix. - * @returns {boolean} True if the matrices are equal, false otherwise. - */ - public static exactEquals (a: mat2d, b: mat2d): boolean; - - /** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {mat2d} a The first matrix. - * @param {mat2d} b The second matrix. - * @returns {boolean} True if the matrices are equal, false otherwise. - */ - public static equals (a: mat2d, b: mat2d): boolean +declare module 'gl-matrix/src/gl-matrix/mat2' { + import { mat2 } from 'gl-matrix'; + export = mat2; } -// mat3 -export class mat3 extends Float32Array { - private typeMat3: number; - - /** - * Creates a new identity mat3 - * - * @returns a new 3x3 matrix - */ - public static create(): mat3; - - /** - * Copies the upper-left 3x3 values into the given mat3. - * - * @param {mat3} out the receiving 3x3 matrix - * @param {mat4} a the source 4x4 matrix - * @returns {mat3} out - */ - public static fromMat4(out: mat3, a: mat4): mat3 - - /** - * Creates a new mat3 initialized with values from an existing matrix - * - * @param a matrix to clone - * @returns a new 3x3 matrix - */ - public static clone(a: mat3): mat3; - - /** - * Copy the values from one mat3 to another - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static copy(out: mat3, a: mat3): mat3; - - /** - * Create a new mat3 with the given values - * - * @param {number} m00 Component in column 0, row 0 position (index 0) - * @param {number} m01 Component in column 0, row 1 position (index 1) - * @param {number} m02 Component in column 0, row 2 position (index 2) - * @param {number} m10 Component in column 1, row 0 position (index 3) - * @param {number} m11 Component in column 1, row 1 position (index 4) - * @param {number} m12 Component in column 1, row 2 position (index 5) - * @param {number} m20 Component in column 2, row 0 position (index 6) - * @param {number} m21 Component in column 2, row 1 position (index 7) - * @param {number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} A new mat3 - */ - public static fromValues(m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3; - - - /** - * Set the components of a mat3 to the given values - * - * @param {mat3} out the receiving matrix - * @param {number} m00 Component in column 0, row 0 position (index 0) - * @param {number} m01 Component in column 0, row 1 position (index 1) - * @param {number} m02 Component in column 0, row 2 position (index 2) - * @param {number} m10 Component in column 1, row 0 position (index 3) - * @param {number} m11 Component in column 1, row 1 position (index 4) - * @param {number} m12 Component in column 1, row 2 position (index 5) - * @param {number} m20 Component in column 2, row 0 position (index 6) - * @param {number} m21 Component in column 2, row 1 position (index 7) - * @param {number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} out - */ - public static set(out: mat3, m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3 - - /** - * Set a mat3 to the identity matrix - * - * @param out the receiving matrix - * @returns out - */ - public static identity(out: mat3): mat3; - - /** - * Transpose the values of a mat3 - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static transpose(out: mat3, a: mat3): mat3; - - /** - * Inverts a mat3 - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static invert(out: mat3, a: mat3): mat3; - - /** - * Calculates the adjugate of a mat3 - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static adjoint(out: mat3, a: mat3): mat3; - - /** - * Calculates the determinant of a mat3 - * - * @param a the source matrix - * @returns determinant of a - */ - public static determinant(a: mat3): number; - - /** - * Multiplies two mat3's - * - * @param out the receiving matrix - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static multiply(out: mat3, a: mat3, b: mat3): mat3; - - /** - * Multiplies two mat3's - * - * @param out the receiving matrix - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static mul(out: mat3, a: mat3, b: mat3): mat3; - - - /** - * Translate a mat3 by the given vector - * - * @param out the receiving matrix - * @param a the matrix to translate - * @param v vector to translate by - * @returns out - */ - public static translate(out: mat3, a: mat3, v: vec3 | number[]): mat3; - - /** - * Rotates a mat3 by the given angle - * - * @param out the receiving matrix - * @param a the matrix to rotate - * @param rad the angle to rotate the matrix by - * @returns out - */ - public static rotate(out: mat3, a: mat3, rad: number): mat3; - - /** - * Scales the mat3 by the dimensions in the given vec2 - * - * @param out the receiving matrix - * @param a the matrix to rotate - * @param v the vec2 to scale the matrix by - * @returns out - **/ - public static scale(out: mat3, a: mat3, v: vec2 | number[]): mat3; - - /** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.translate(dest, dest, vec); - * - * @param {mat3} out mat3 receiving operation result - * @param {vec2} v Translation vector - * @returns {mat3} out - */ - public static fromTranslation(out: mat3, v: vec2 | number[]): mat3 - - /** - * Creates a matrix from a given angle - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.rotate(dest, dest, rad); - * - * @param {mat3} out mat3 receiving operation result - * @param {number} rad the angle to rotate the matrix by - * @returns {mat3} out - */ - public static fromRotation(out: mat3, rad: number): mat3 - - /** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.scale(dest, dest, vec); - * - * @param {mat3} out mat3 receiving operation result - * @param {vec2} v Scaling vector - * @returns {mat3} out - */ - public static fromScaling(out: mat3, v: vec2 | number[]): mat3 - - /** - * Copies the values from a mat2d into a mat3 - * - * @param out the receiving matrix - * @param {mat2d} a the matrix to copy - * @returns out - **/ - public static fromMat2d(out: mat3, a: mat2d): mat3; - - /** - * Calculates a 3x3 matrix from the given quaternion - * - * @param out mat3 receiving operation result - * @param q Quaternion to create matrix from - * - * @returns out - */ - public static fromQuat(out: mat3, q: quat): mat3; - - /** - * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix - * - * @param out mat3 receiving operation result - * @param a Mat4 to derive the normal matrix from - * - * @returns out - */ - public static normalFromMat4(out: mat3, a: mat4): mat3; - - /** - * Returns a string representation of a mat3 - * - * @param mat matrix to represent as a string - * @returns string representation of the matrix - */ - public static str(mat: mat3): string; - - /** - * Returns Frobenius norm of a mat3 - * - * @param a the matrix to calculate Frobenius norm of - * @returns Frobenius norm - */ - public static frob(a: mat3): number; - - /** - * Adds two mat3's - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the first operand - * @param {mat3} b the second operand - * @returns {mat3} out - */ - public static add(out: mat3, a: mat3, b: mat3): mat3 - - /** - * Subtracts matrix b from matrix a - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the first operand - * @param {mat3} b the second operand - * @returns {mat3} out - */ - public static subtract(out: mat3, a: mat3, b: mat3): mat3 - - /** - * Subtracts matrix b from matrix a - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the first operand - * @param {mat3} b the second operand - * @returns {mat3} out - */ - public static sub(out: mat3, a: mat3, b: mat3): mat3 - - /** - * Multiply each element of the matrix by a scalar. - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the matrix to scale - * @param {number} b amount to scale the matrix's elements by - * @returns {mat3} out - */ - public static multiplyScalar(out: mat3, a: mat3, b: number): mat3 - - /** - * Adds two mat3's after multiplying each element of the second operand by a scalar value. - * - * @param {mat3} out the receiving vector - * @param {mat3} a the first operand - * @param {mat3} b the second operand - * @param {number} scale the amount to scale b's elements by before adding - * @returns {mat3} out - */ - public static multiplyScalarAndAdd(out: mat3, a: mat3, b: mat3, scale: number): mat3 - - /** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {mat3} a The first matrix. - * @param {mat3} b The second matrix. - * @returns {boolean} True if the matrices are equal, false otherwise. - */ - public static exactEquals(a: mat3, b: mat3): boolean; - - /** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {mat3} a The first matrix. - * @param {mat3} b The second matrix. - * @returns {boolean} True if the matrices are equal, false otherwise. - */ - public static equals(a: mat3, b: mat3): boolean +declare module 'gl-matrix/src/gl-matrix/mat2d' { + import { mat2d } from 'gl-matrix'; + export = mat2d; } -// mat4 -export class mat4 extends Float32Array { - private typeMat4: number; - - /** - * Creates a new identity mat4 - * - * @returns a new 4x4 matrix - */ - public static create(): mat4; - - /** - * Creates a new mat4 initialized with values from an existing matrix - * - * @param a matrix to clone - * @returns a new 4x4 matrix - */ - public static clone(a: mat4): mat4; - - /** - * Copy the values from one mat4 to another - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static copy(out: mat4, a: mat4): mat4; - - - /** - * Create a new mat4 with the given values - * - * @param {number} m00 Component in column 0, row 0 position (index 0) - * @param {number} m01 Component in column 0, row 1 position (index 1) - * @param {number} m02 Component in column 0, row 2 position (index 2) - * @param {number} m03 Component in column 0, row 3 position (index 3) - * @param {number} m10 Component in column 1, row 0 position (index 4) - * @param {number} m11 Component in column 1, row 1 position (index 5) - * @param {number} m12 Component in column 1, row 2 position (index 6) - * @param {number} m13 Component in column 1, row 3 position (index 7) - * @param {number} m20 Component in column 2, row 0 position (index 8) - * @param {number} m21 Component in column 2, row 1 position (index 9) - * @param {number} m22 Component in column 2, row 2 position (index 10) - * @param {number} m23 Component in column 2, row 3 position (index 11) - * @param {number} m30 Component in column 3, row 0 position (index 12) - * @param {number} m31 Component in column 3, row 1 position (index 13) - * @param {number} m32 Component in column 3, row 2 position (index 14) - * @param {number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} A new mat4 - */ - public static fromValues(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): mat4; - - /** - * Set the components of a mat4 to the given values - * - * @param {mat4} out the receiving matrix - * @param {number} m00 Component in column 0, row 0 position (index 0) - * @param {number} m01 Component in column 0, row 1 position (index 1) - * @param {number} m02 Component in column 0, row 2 position (index 2) - * @param {number} m03 Component in column 0, row 3 position (index 3) - * @param {number} m10 Component in column 1, row 0 position (index 4) - * @param {number} m11 Component in column 1, row 1 position (index 5) - * @param {number} m12 Component in column 1, row 2 position (index 6) - * @param {number} m13 Component in column 1, row 3 position (index 7) - * @param {number} m20 Component in column 2, row 0 position (index 8) - * @param {number} m21 Component in column 2, row 1 position (index 9) - * @param {number} m22 Component in column 2, row 2 position (index 10) - * @param {number} m23 Component in column 2, row 3 position (index 11) - * @param {number} m30 Component in column 3, row 0 position (index 12) - * @param {number} m31 Component in column 3, row 1 position (index 13) - * @param {number} m32 Component in column 3, row 2 position (index 14) - * @param {number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} out - */ - public static set(out: mat4, m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): mat4; - - /** - * Set a mat4 to the identity matrix - * - * @param out the receiving matrix - * @returns out - */ - public static identity(out: mat4): mat4; - - /** - * Transpose the values of a mat4 - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static transpose(out: mat4, a: mat4): mat4; - - /** - * Inverts a mat4 - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static invert(out: mat4, a: mat4): mat4; - - /** - * Calculates the adjugate of a mat4 - * - * @param out the receiving matrix - * @param a the source matrix - * @returns out - */ - public static adjoint(out: mat4, a: mat4): mat4; - - /** - * Calculates the determinant of a mat4 - * - * @param a the source matrix - * @returns determinant of a - */ - public static determinant(a: mat4): number; - - /** - * Multiplies two mat4's - * - * @param out the receiving matrix - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static multiply(out: mat4, a: mat4, b: mat4): mat4; - - /** - * Multiplies two mat4's - * - * @param out the receiving matrix - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static mul(out: mat4, a: mat4, b: mat4): mat4; - - /** - * Translate a mat4 by the given vector - * - * @param out the receiving matrix - * @param a the matrix to translate - * @param v vector to translate by - * @returns out - */ - public static translate(out: mat4, a: mat4, v: vec3 | number[]): mat4; - - /** - * Scales the mat4 by the dimensions in the given vec3 - * - * @param out the receiving matrix - * @param a the matrix to scale - * @param v the vec3 to scale the matrix by - * @returns out - **/ - public static scale(out: mat4, a: mat4, v: vec3 | number[]): mat4; - - /** - * Rotates a mat4 by the given angle - * - * @param out the receiving matrix - * @param a the matrix to rotate - * @param rad the angle to rotate the matrix by - * @param axis the axis to rotate around - * @returns out - */ - public static rotate(out: mat4, a: mat4, rad: number, axis: vec3 | number[]): mat4; - - /** - * Rotates a matrix by the given angle around the X axis - * - * @param out the receiving matrix - * @param a the matrix to rotate - * @param rad the angle to rotate the matrix by - * @returns out - */ - public static rotateX(out: mat4, a: mat4, rad: number): mat4; - - /** - * Rotates a matrix by the given angle around the Y axis - * - * @param out the receiving matrix - * @param a the matrix to rotate - * @param rad the angle to rotate the matrix by - * @returns out - */ - public static rotateY(out: mat4, a: mat4, rad: number): mat4; - - /** - * Rotates a matrix by the given angle around the Z axis - * - * @param out the receiving matrix - * @param a the matrix to rotate - * @param rad the angle to rotate the matrix by - * @returns out - */ - public static rotateZ(out: mat4, a: mat4, rad: number): mat4; - - /** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {vec3} v Translation vector - * @returns {mat4} out - */ - public static fromTranslation(out: mat4, v: vec3 | number[]): mat4 - - /** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.scale(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {vec3} v Scaling vector - * @returns {mat4} out - */ - public static fromScaling(out: mat4, v: vec3 | number[]): mat4 - - /** - * Creates a matrix from a given angle around a given axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotate(dest, dest, rad, axis); - * - * @param {mat4} out mat4 receiving operation result - * @param {number} rad the angle to rotate the matrix by - * @param {vec3} axis the axis to rotate around - * @returns {mat4} out - */ - public static fromRotation(out: mat4, rad: number, axis: vec3 | number[]): mat4 - - /** - * Creates a matrix from the given angle around the X axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateX(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ - public static fromXRotation(out: mat4, rad: number): mat4 - - /** - * Creates a matrix from the given angle around the Y axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateY(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ - public static fromYRotation(out: mat4, rad: number): mat4 - - - /** - * Creates a matrix from the given angle around the Z axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateZ(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ - public static fromZRotation(out: mat4, rad: number): mat4 - - /** - * Creates a matrix from a quaternion rotation and vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * var quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * - * @param out mat4 receiving operation result - * @param q Rotation quaternion - * @param v Translation vector - * @returns out - */ - public static fromRotationTranslation(out: mat4, q: quat, v: vec3 | number[]): mat4; - - /** - * Returns the translation vector component of a transformation - * matrix. If a matrix is built with fromRotationTranslation, - * the returned vector will be the same as the translation vector - * originally supplied. - * @param {vec3} out Vector to receive translation component - * @param {mat4} mat Matrix to be decomposed (input) - * @return {vec3} out - */ - public static getTranslation(out: vec3, mat: mat4): vec3; - - /** - * Returns a quaternion representing the rotational component - * of a transformation matrix. If a matrix is built with - * fromRotationTranslation, the returned quaternion will be the - * same as the quaternion originally supplied. - * @param {quat} out Quaternion to receive the rotation component - * @param {mat4} mat Matrix to be decomposed (input) - * @return {quat} out - */ - public static getRotation(out: quat, mat: mat4): quat; - - /** - * Creates a matrix from a quaternion rotation, vector translation and vector scale - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * var quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * - * @param out mat4 receiving operation result - * @param q Rotation quaternion - * @param v Translation vector - * @param s Scaling vector - * @returns out - */ - public static fromRotationTranslationScale(out: mat4, q: quat, v: vec3 | number[], s: vec3 | number[]): mat4; - - /** - * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * mat4.translate(dest, origin); - * var quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * mat4.translate(dest, negativeOrigin); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat} q Rotation quaternion - * @param {vec3} v Translation vector - * @param {vec3} s Scaling vector - * @param {vec3} o The origin vector around which to scale and rotate - * @returns {mat4} out - */ - public static fromRotationTranslationScaleOrigin(out: mat4, q: quat, v: vec3 | number[], s: vec3 | number[], o: vec3 | number[]): mat4 - - /** - * Calculates a 4x4 matrix from the given quaternion - * - * @param {mat4} out mat4 receiving operation result - * @param {quat} q Quaternion to create matrix from - * - * @returns {mat4} out - */ - public static fromQuat(out: mat4, q: quat): mat4 - - /** - * Generates a frustum matrix with the given bounds - * - * @param out mat4 frustum matrix will be written into - * @param left Left bound of the frustum - * @param right Right bound of the frustum - * @param bottom Bottom bound of the frustum - * @param top Top bound of the frustum - * @param near Near bound of the frustum - * @param far Far bound of the frustum - * @returns out - */ - public static frustum(out: mat4, left: number, right: number, - bottom: number, top: number, near: number, far: number): mat4; - - /** - * Generates a perspective projection matrix with the given bounds - * - * @param out mat4 frustum matrix will be written into - * @param fovy Vertical field of view in radians - * @param aspect Aspect ratio. typically viewport width/height - * @param near Near bound of the frustum - * @param far Far bound of the frustum - * @returns out - */ - public static perspective(out: mat4, fovy: number, aspect: number, - near: number, far: number): mat4; - - /** - * Generates a perspective projection matrix with the given field of view. - * This is primarily useful for generating projection matrices to be used - * with the still experimental WebVR API. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ - public static perspectiveFromFieldOfView(out: mat4, - fov:{upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number}, - near: number, far: number): mat4 - - /** - * Generates a orthogonal projection matrix with the given bounds - * - * @param out mat4 frustum matrix will be written into - * @param left Left bound of the frustum - * @param right Right bound of the frustum - * @param bottom Bottom bound of the frustum - * @param top Top bound of the frustum - * @param near Near bound of the frustum - * @param far Far bound of the frustum - * @returns out - */ - public static ortho(out: mat4, left: number, right: number, - bottom: number, top: number, near: number, far: number): mat4; - - /** - * Generates a look-at matrix with the given eye position, focal point, and up axis - * - * @param out mat4 frustum matrix will be written into - * @param eye Position of the viewer - * @param center Point the viewer is looking at - * @param up vec3 pointing up - * @returns out - */ - public static lookAt(out: mat4, eye: vec3 | number[], center: vec3 | number[], up: vec3 | number[]): mat4; - - /** - * Returns a string representation of a mat4 - * - * @param mat matrix to represent as a string - * @returns string representation of the matrix - */ - public static str(mat: mat4): string; - - /** - * Returns Frobenius norm of a mat4 - * - * @param a the matrix to calculate Frobenius norm of - * @returns Frobenius norm - */ - public static frob(a: mat4): number; - - /** - * Adds two mat4's - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the first operand - * @param {mat4} b the second operand - * @returns {mat4} out - */ - public static add(out: mat4, a: mat4, b: mat4): mat4 - - /** - * Subtracts matrix b from matrix a - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the first operand - * @param {mat4} b the second operand - * @returns {mat4} out - */ - public static subtract(out: mat4, a: mat4, b: mat4): mat4 - - /** - * Subtracts matrix b from matrix a - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the first operand - * @param {mat4} b the second operand - * @returns {mat4} out - */ - public static sub(out: mat4, a: mat4, b: mat4): mat4 - - /** - * Multiply each element of the matrix by a scalar. - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to scale - * @param {number} b amount to scale the matrix's elements by - * @returns {mat4} out - */ - public static multiplyScalar(out: mat4, a: mat4, b: number): mat4 - - /** - * Adds two mat4's after multiplying each element of the second operand by a scalar value. - * - * @param {mat4} out the receiving vector - * @param {mat4} a the first operand - * @param {mat4} b the second operand - * @param {number} scale the amount to scale b's elements by before adding - * @returns {mat4} out - */ - public static multiplyScalarAndAdd (out: mat4, a: mat4, b: mat4, scale: number): mat4 - - /** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {mat4} a The first matrix. - * @param {mat4} b The second matrix. - * @returns {boolean} True if the matrices are equal, false otherwise. - */ - public static exactEquals (a: mat4, b: mat4): boolean - - /** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {mat4} a The first matrix. - * @param {mat4} b The second matrix. - * @returns {boolean} True if the matrices are equal, false otherwise. - */ - public static equals (a: mat4, b: mat4): boolean - +declare module 'gl-matrix/src/gl-matrix/mat3' { + import { mat3 } from 'gl-matrix'; + export = mat3; } -// quat -export class quat extends Float32Array { - private typeQuat: number; - - /** - * Creates a new identity quat - * - * @returns a new quaternion - */ - public static create(): quat; - - /** - * Creates a new quat initialized with values from an existing quaternion - * - * @param a quaternion to clone - * @returns a new quaternion - * @function - */ - public static clone(a: quat): quat; - - /** - * Creates a new quat initialized with the given values - * - * @param x X component - * @param y Y component - * @param z Z component - * @param w W component - * @returns a new quaternion - * @function - */ - public static fromValues(x: number, y: number, z: number, w: number): quat; - - /** - * Copy the values from one quat to another - * - * @param out the receiving quaternion - * @param a the source quaternion - * @returns out - * @function - */ - public static copy(out: quat, a: quat): quat; - - /** - * Set the components of a quat to the given values - * - * @param out the receiving quaternion - * @param x X component - * @param y Y component - * @param z Z component - * @param w W component - * @returns out - * @function - */ - public static set(out: quat, x: number, y: number, z: number, w: number): quat; - - /** - * Set a quat to the identity quaternion - * - * @param out the receiving quaternion - * @returns out - */ - public static identity(out: quat): quat; - - /** - * Sets a quaternion to represent the shortest rotation from one - * vector to another. - * - * Both vectors are assumed to be unit length. - * - * @param {quat} out the receiving quaternion. - * @param {vec3} a the initial vector - * @param {vec3} b the destination vector - * @returns {quat} out - */ - public static rotationTo (out: quat, a: vec3 | number[], b: vec3 | number[]): quat; - - /** - * Sets the specified quaternion with values corresponding to the given - * axes. Each axis is a vec3 and is expected to be unit length and - * perpendicular to all other specified axes. - * - * @param {vec3} view the vector representing the viewing direction - * @param {vec3} right the vector representing the local "right" direction - * @param {vec3} up the vector representing the local "up" direction - * @returns {quat} out - */ - public static setAxes (out: quat, view: vec3 | number[], right: vec3 | number[], up: vec3 | number[]): quat - - - - /** - * Sets a quat from the given angle and rotation axis, - * then returns it. - * - * @param out the receiving quaternion - * @param axis the axis around which to rotate - * @param rad the angle in radians - * @returns out - **/ - public static setAxisAngle(out: quat, axis: vec3 | number[], rad: number): quat; - - /** - * Gets the rotation axis and angle for a given - * quaternion. If a quaternion is created with - * setAxisAngle, this method will return the same - * values as providied in the original parameter list - * OR functionally equivalent values. - * Example: The quaternion formed by axis [0, 0, 1] and - * angle -90 is the same as the quaternion formed by - * [0, 0, 1] and 270. This method favors the latter. - * @param {vec3} out_axis Vector receiving the axis of rotation - * @param {quat} q Quaternion to be decomposed - * @return {number} Angle, in radians, of the rotation - */ - public static getAxisAngle (out_axis: vec3 | number[], q: quat): number - - /** - * Adds two quat's - * - * @param out the receiving quaternion - * @param a the first operand - * @param b the second operand - * @returns out - * @function - */ - public static add(out: quat, a: quat, b: quat): quat; - - /** - * Multiplies two quat's - * - * @param out the receiving quaternion - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static multiply(out: quat, a: quat, b: quat): quat; - - /** - * Multiplies two quat's - * - * @param out the receiving quaternion - * @param a the first operand - * @param b the second operand - * @returns out - */ - public static mul(out: quat, a: quat, b: quat): quat; - - /** - * Scales a quat by a scalar number - * - * @param out the receiving vector - * @param a the vector to scale - * @param b amount to scale the vector by - * @returns out - * @function - */ - public static scale(out: quat, a: quat, b: number): quat; - - /** - * Calculates the length of a quat - * - * @param a vector to calculate length of - * @returns length of a - * @function - */ - public static length(a: quat): number; - - /** - * Calculates the length of a quat - * - * @param a vector to calculate length of - * @returns length of a - * @function - */ - public static len(a: quat): number; - - /** - * Calculates the squared length of a quat - * - * @param a vector to calculate squared length of - * @returns squared length of a - * @function - */ - public static squaredLength(a: quat): number; - - /** - * Calculates the squared length of a quat - * - * @param a vector to calculate squared length of - * @returns squared length of a - * @function - */ - public static sqrLen(a: quat): number; - - /** - * Normalize a quat - * - * @param out the receiving quaternion - * @param a quaternion to normalize - * @returns out - * @function - */ - public static normalize(out: quat, a: quat): quat; - - /** - * Calculates the dot product of two quat's - * - * @param a the first operand - * @param b the second operand - * @returns dot product of a and b - * @function - */ - public static dot(a: quat, b: quat): number; - - /** - * Performs a linear interpolation between two quat's - * - * @param out the receiving quaternion - * @param a the first operand - * @param b the second operand - * @param t interpolation amount between the two inputs - * @returns out - * @function - */ - public static lerp(out: quat, a: quat, b: quat, t: number): quat; - - /** - * Performs a spherical linear interpolation between two quat - * - * @param out the receiving quaternion - * @param a the first operand - * @param b the second operand - * @param t interpolation amount between the two inputs - * @returns out - */ - public static slerp(out: quat, a: quat, b: quat, t: number): quat; - - /** - * Performs a spherical linear interpolation with two control points - * - * @param {quat} out the receiving quaternion - * @param {quat} a the first operand - * @param {quat} b the second operand - * @param {quat} c the third operand - * @param {quat} d the fourth operand - * @param {number} t interpolation amount - * @returns {quat} out - */ - public static sqlerp(out: quat, a: quat, b: quat, c: quat, d: quat, t: number): quat; - - /** - * Calculates the inverse of a quat - * - * @param out the receiving quaternion - * @param a quat to calculate inverse of - * @returns out - */ - public static invert(out: quat, a: quat): quat; - - /** - * Calculates the conjugate of a quat - * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. - * - * @param out the receiving quaternion - * @param a quat to calculate conjugate of - * @returns out - */ - public static conjugate(out: quat, a: quat): quat; - - /** - * Returns a string representation of a quaternion - * - * @param a quat to represent as a string - * @returns string representation of the quat - */ - public static str(a: quat): string; - - /** - * Rotates a quaternion by the given angle about the X axis - * - * @param out quat receiving operation result - * @param a quat to rotate - * @param rad angle (in radians) to rotate - * @returns out - */ - public static rotateX(out: quat, a: quat, rad: number): quat; - - /** - * Rotates a quaternion by the given angle about the Y axis - * - * @param out quat receiving operation result - * @param a quat to rotate - * @param rad angle (in radians) to rotate - * @returns out - */ - public static rotateY(out: quat, a: quat, rad: number): quat; - - /** - * Rotates a quaternion by the given angle about the Z axis - * - * @param out quat receiving operation result - * @param a quat to rotate - * @param rad angle (in radians) to rotate - * @returns out - */ - public static rotateZ(out: quat, a: quat, rad: number): quat; - - /** - * Creates a quaternion from the given 3x3 rotation matrix. - * - * NOTE: The resultant quaternion is not normalized, so you should be sure - * to renormalize the quaternion yourself where necessary. - * - * @param out the receiving quaternion - * @param m rotation matrix - * @returns out - * @function - */ - public static fromMat3(out: quat, m: mat3): quat; - - /** - * Sets the specified quaternion with values corresponding to the given - * axes. Each axis is a vec3 and is expected to be unit length and - * perpendicular to all other specified axes. - * - * @param out the receiving quat - * @param view the vector representing the viewing direction - * @param right the vector representing the local "right" direction - * @param up the vector representing the local "up" direction - * @returns out - */ - public static setAxes(out: quat, view: vec3 | number[], right: vec3 | number[], up: vec3 | number[]): quat; - - /** - * Sets a quaternion to represent the shortest rotation from one - * vector to another. - * - * Both vectors are assumed to be unit length. - * - * @param out the receiving quaternion. - * @param a the initial vector - * @param b the destination vector - * @returns out - */ - public static rotationTo(out: quat, a: vec3 | number[], b: vec3 | number[]): quat; - - /** - * Calculates the W component of a quat from the X, Y, and Z components. - * Assumes that quaternion is 1 unit in length. - * Any existing W component will be ignored. - * - * @param out the receiving quaternion - * @param a quat to calculate W component of - * @returns out - */ - public static calculateW(out: quat, a: quat): quat; - - /** - * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===) - * - * @param {quat} a The first vector. - * @param {quat} b The second vector. - * @returns {boolean} True if the quaternions are equal, false otherwise. - */ - public static exactEquals (a: quat, b: quat): boolean; - - /** - * Returns whether or not the quaternions have approximately the same elements in the same position. - * - * @param {quat} a The first vector. - * @param {quat} b The second vector. - * @returns {boolean} True if the quaternions are equal, false otherwise. - */ - public static equals (a: quat, b: quat): boolean; +declare module 'gl-matrix/src/gl-matrix/mat4' { + import { mat4 } from 'gl-matrix'; + export = mat4; +} + +declare module 'gl-matrix/src/gl-matrix/quat' { + import { quat } from 'gl-matrix'; + export = quat; } diff --git a/gl-matrix/tsconfig.json b/gl-matrix/tsconfig.json index 5350b55fb6..14294473ba 100644 --- a/gl-matrix/tsconfig.json +++ b/gl-matrix/tsconfig.json @@ -3,7 +3,8 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/gldatepicker/tsconfig.json b/gldatepicker/tsconfig.json index b1cc6c62a4..b7b8bddab7 100644 --- a/gldatepicker/tsconfig.json +++ b/gldatepicker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/glidejs/tsconfig.json b/glidejs/tsconfig.json index 847d2a2725..ac71b653aa 100644 --- a/glidejs/tsconfig.json +++ b/glidejs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/glob-expand/tsconfig.json b/glob-expand/tsconfig.json index 0f01a3ab8d..ed919c095c 100644 --- a/glob-expand/tsconfig.json +++ b/glob-expand/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/glob-stream/tsconfig.json b/glob-stream/tsconfig.json index 8a903bbba4..e134b568e5 100644 --- a/glob-stream/tsconfig.json +++ b/glob-stream/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/glob/tsconfig.json b/glob/tsconfig.json index d53ce03d64..e0764339c5 100644 --- a/glob/tsconfig.json +++ b/glob/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/globalize-compiler/tsconfig.json b/globalize-compiler/tsconfig.json index 87dae3c759..99ba9c2530 100644 --- a/globalize-compiler/tsconfig.json +++ b/globalize-compiler/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/globalize/index.d.ts b/globalize/index.d.ts index ece0790c10..4fdff6bac8 100644 --- a/globalize/index.d.ts +++ b/globalize/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Globalize +// Type definitions for Globalize // Project: https://github.com/jquery/globalize // Definitions by: Grégoire Castre , Aram Taieb // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/globalize/tsconfig.json b/globalize/tsconfig.json index 4c6f99a33a..5131824903 100644 --- a/globalize/tsconfig.json +++ b/globalize/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gm/index.d.ts b/gm/index.d.ts index 93174e9b24..288ce150ce 100644 --- a/gm/index.d.ts +++ b/gm/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for gm 1.17.0 +// Type definitions for gm 1.17.0 // Project: https://github.com/aheckmann/gm // Definitions by: Joel Spadin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/gm/tsconfig.json b/gm/tsconfig.json index 0bb26d4194..915b2fd085 100644 --- a/gm/tsconfig.json +++ b/gm/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/go/tsconfig.json b/go/tsconfig.json index 641a33abd6..ced78ef938 100644 --- a/go/tsconfig.json +++ b/go/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google-apps-script/tsconfig.json b/google-apps-script/tsconfig.json index 61af6d942a..d42e7d2acd 100644 --- a/google-apps-script/tsconfig.json +++ b/google-apps-script/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google-closure-compiler/tsconfig.json b/google-closure-compiler/tsconfig.json index 87e5ecf5d8..9feb5f9bf8 100644 --- a/google-closure-compiler/tsconfig.json +++ b/google-closure-compiler/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google-drive-realtime-api/index.d.ts b/google-drive-realtime-api/index.d.ts index 025ce08a86..6cfd9b1cc1 100644 --- a/google-drive-realtime-api/index.d.ts +++ b/google-drive-realtime-api/index.d.ts @@ -16,8 +16,9 @@ // gapi is a global var introduced by https://apis.google.com/js/api.js declare namespace gapi.drive.realtime { + export type CollaborativeObjectType = 'EditableString' | 'Map' | 'List' - type GoogEventHandler = ((evt:ObjectChangedEvent) => void) | ((e:Event) => void) | EventListener; + export type GoogEventHandler = ((evt:ObjectChangedEvent) => void) | ((e:Event) => void) | EventListener; // Complete // https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.Collaborator @@ -65,7 +66,7 @@ declare namespace gapi.drive.realtime { // see gapi.drive.realtime.CollaborrativeType for possible values; for custom collaborative objects, this value is // application-defined. // Addition: the possible values for standard objects are EditableString, List, and Map. - type:string; + type:CollaborativeObjectType; // Adds an event listener to the event target. The same handler can only be added once per the type. // Even if you add the same handler multiple times using the same type then it will only be called once @@ -107,9 +108,9 @@ declare namespace gapi.drive.realtime { // Complete // https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.CollaborativeMap export class CollaborativeMap extends CollaborativeObject { - size:string; + size:number; - static type:string; // equals "Map" + static type:'Map'; // Removes all entries. clear():void; @@ -154,7 +155,7 @@ declare namespace gapi.drive.realtime { // The text of this collaborative string. Reading from this property is equivalent to calling getText(). Writing to this property is equivalent to calling setText(). text:string; - static type:string; // equals "EditableString" + static type:'EditableString'; // Appends a string to the end of this one. append(text:string):void; @@ -186,7 +187,7 @@ declare namespace gapi.drive.realtime { // The length of a list cannot be extended in this way. length:number; - static type:string; // equals "List" + static type:"List"; // Returns a copy of the contents of this collaborative list as an array. // Changes to the returned object will not affect the original collaborative list. @@ -344,9 +345,68 @@ declare namespace gapi.drive.realtime { undo():void; } + export type EventType = 'object_changed' | 'values_set' | 'values_added' | 'values_removed' | 'value_changed' | + 'text_inserted' | 'text_deleted' | 'collaborator_joined' | 'collaborator_left' | 'reference_shifted' | + 'document_save_state_changed' | 'undo_redo_state_changed' | 'attribute_changed'; + export const EventType:{ + // A collaborative object has changed. This event wraps a specific event, and bubbles to ancestors. + // Defaults to object_changed. + OBJECT_CHANGED:'object_changed' + + // Values in a list are changed in place. + // Defaults to values_set. + VALUES_SET:'values_set', + + // New values have been added to the list. + // values_added + VALUES_ADDED:'values_added' + + // Values have been removed from the list. + // values_removed + VALUES_REMOVED:'values_removed' + + // A map or custom object value has changed. Note this could be a new value or deleted value. + // value_changed + VALUE_CHANGED:'value_changed' + + // Text has been inserted into a string. + // text_inserted + TEXT_INSERTED:'text_inserted' + + // Text has been removed from a string. + // text_deleted + TEXT_DELETED:'text_deleted' + + // A new collaborator joined the document. Listen on the gapi.drive.realtime.Document for these changes. + // collaborator_joined + COLLABORATOR_JOINED:'collaborator_joined' + + // A collaborator left the document. Listen on the gapi.drive.realtime.Document for these changes. + // collaborator_left + COLLABORATOR_LEFT:'collaborator_left' + + // An index reference changed. + // reference_shifted + REFERENCE_SHIFTED:'reference_shifted' + + // The document save state changed. Listen on the gapi.drive.realtime.Document for these changes. + // document_save_state_changed + DOCUMENT_SAVE_STATE_CHANGED:'document_save_state_changed' + + // The model canUndo/canRedo state changed. Listen on the gapi.drive.realtime.Model for these changes. + // undo_redo_state_changed + UNDO_REDO_STATE_CHANGED:'undo_redo_state_changed' + + // A metadata attribute of the document changed. This is fired on changes to: + // gapi.drive.realtime.Attribute.IS_READ_ONLY + // Listen on the gapi.drive.realtime.Document for these changes. + // attribute_changed + ATTRIBUTE_CHANGED:'attribute_changed' + } + // Complete // https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.BaseModelEvent - interface BaseModelEvent { + export interface BaseModelEvent { // Whether this event bubbles. bubbles : boolean; @@ -373,7 +433,7 @@ declare namespace gapi.drive.realtime { target : CollaborativeObject; // The type of the event. - type : string; + type : EventType; // The user id of the user that initiated this event. userId : string; @@ -399,6 +459,7 @@ declare namespace gapi.drive.realtime { Array of string The list of names from the hierarchy of compound operations that initiated the event. Value must not be null. + isLocal boolean True if the event originated in the local session. @@ -417,7 +478,7 @@ declare namespace gapi.drive.realtime { // Complete // https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.ObjectChangedEvent - interface ObjectChangedEvent extends BaseModelEvent { + export interface ObjectChangedEvent extends BaseModelEvent { // parameters as in BaseModelEvent above except for addition of: // events: // Array of gapi.drive.realtime.BaseModelEvent @@ -435,7 +496,7 @@ declare namespace gapi.drive.realtime { new (target:CollaborativeObject, sessionId:string, userId:string, compoundOperationNames:string[], isLocal:boolean, isUndo:boolean, isRedo:boolean, index:number, values:V[], movedFromList:CollaborativeList, movedFromIndex:number):ValuesAddedEvent; - + // The index of the first added value index:number; @@ -523,7 +584,7 @@ declare namespace gapi.drive.realtime { "missing_property" | "not_found" | "forbidden" | "server_error" | "client_error" | "token_refresh_required" | "invalid_element_type" | "no_write_permission" | "fatal_network_error" | "unexpected_element"; - export var ErrorType : { + export const ErrorType : { // Another user created the document's initial state after // gapi.drive.realtime.load was called but before the local // creation was saved. @@ -627,12 +688,12 @@ declare namespace gapi.drive.realtime { opt_initializerFn? : (m:Model) => void, opt_errorFn? : (e:gapi.drive.realtime.Error) => void ) : Document; - + /* Loads an existing file by id. https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime#.load - + @Param fileId {string} Id of the file to load. - + @Param onLoaded {function(non-null gapi.drive.realtime.Document)} A callback that will be called when the realtime document is ready. The created or opened realtime document object will be passed to this function. @@ -649,8 +710,22 @@ declare namespace gapi.drive.realtime { fileId:string, onLoaded? : (d:Document) => void, opt_initializerFn? : (m:Model) => void, - opt_errorFn? : (e:gapi.drive.realtime.Error) => void + opt_errorFn? : (e:Error) => void ):void; + + export function loadAppDataDocument( + onLoaded:(x:Document) => void, + opt_initializerFn?:(x:Model) => void, + opt_errorFn?:(e:Error) => void + ):void + + // Loads an in-memory document from a json string. + // This document does not talk to the server and will only exist in memory for as long as the browser session exists. + export function loadFromJson( + json:string, + opt_errorFn?:(e:Error) => void + ):Document + } @@ -674,29 +749,21 @@ declare namespace gapi.drive.realtime.databinding { } -declare namespace gapi.drive.realtime.EventType { - export var TEXT_INSERTED: string - export var TEXT_DELETED: string - export var OBJECT_CHANGED: string - // List - export var VALUES_ADDED:string; - export var VALUES_REMOVED:string; - export var VALUES_SET:string; -} - - // rtclient is a global var introduced by realtime-client-utils.js declare namespace rtclient { // INCOMPLETE export interface RealtimeLoader { start():void; load():void; + handleErrors(e:gapi.drive.realtime.Error):void; } interface RealtimeLoaderFactory { new (options:LoaderOptions) : RealtimeLoader; } // *********************************** + // NOTE THIS IS OUT OF DATE. realtime-client-utils.js has been rewritten, with the new version "Realtime Utils 1.0.0". + // Will add typings for the new version later. // The remainder of this file types some (not all) things in realtime-client-utils.js, found here: // https://developers.google.com/google-apps/realtime/realtime-quickstart // and diff --git a/google-drive-realtime-api/tsconfig.json b/google-drive-realtime-api/tsconfig.json index 4eebf9f009..aab9688031 100644 --- a/google-drive-realtime-api/tsconfig.json +++ b/google-drive-realtime-api/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google-earth/tsconfig.json b/google-earth/tsconfig.json index da2ea498a4..7f1420e7fe 100644 --- a/google-earth/tsconfig.json +++ b/google-earth/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google-libphonenumber/index.d.ts b/google-libphonenumber/index.d.ts index 937a0d9623..13659182a9 100644 --- a/google-libphonenumber/index.d.ts +++ b/google-libphonenumber/index.d.ts @@ -1,6 +1,5 @@ // Type definitions for libphonenumber v7.4.3 -// Project: https://github.com/googlei18n/libphonenumber -// Project: https://github.com/seegno/google-libphonenumber +// Project: https://github.com/googlei18n/libphonenumber, https://github.com/seegno/google-libphonenumber // Definitions by: Leon Yu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,18 +11,45 @@ declare namespace libphonenumber { RFC3966 } + export enum PhoneNumberType { + FIXED_LINE = 0, + MOBILE = 1, + FIXED_LINE_OR_MOBILE = 2, + TOLL_FREE = 3, + PREMIUM_RATE = 4, + SHARED_COST = 5, + VOIP = 6, + PERSONAL_NUMBER = 7, + PAGER = 8, + UAN = 9, + VOICEMAIL = 10, + UNKNOWN = -1 + } + interface PhoneNumber { } + export module PhoneNumberUtil { + export enum ValidationResult { + IS_POSSIBLE, + INVALID_COUNTRY_CODE, + TOO_SHORT, + TOO_LONG + } + } + export class PhoneNumberUtil { static getInstance(): PhoneNumberUtil parse(number: string, region: string): PhoneNumber; isValidNumber(phoneNumber: PhoneNumber): boolean; isPossibleNumber(phoneNumber: PhoneNumber): boolean; - isValidNumberForRegion(phoneNumber: PhoneNumber): boolean; + isPossibleNumberWithReason(phoneNumber: PhoneNumber): PhoneNumberUtil.ValidationResult; + isValidNumberForRegion(phoneNumber: PhoneNumber, region: string): boolean; + getNumberType(phoneNumber: PhoneNumber): PhoneNumberType; getRegionCodeForNumber(phoneNumber: PhoneNumber): string; isNANPACountry(regionCode: string): boolean; format(phoneNumber: PhoneNumber, format: PhoneNumberFormat): string; + parseAndKeepRawInput(number: string, regionCode: string): PhoneNumber; } export class AsYouTypeFormatter { diff --git a/google-libphonenumber/tsconfig.json b/google-libphonenumber/tsconfig.json index 7ece19fabf..e7af478d29 100644 --- a/google-libphonenumber/tsconfig.json +++ b/google-libphonenumber/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google-maps/google-maps-tests.ts b/google-maps/google-maps-tests.ts index c723a9ded3..a6af09776c 100644 --- a/google-maps/google-maps-tests.ts +++ b/google-maps/google-maps-tests.ts @@ -1,27 +1,41 @@ - - import GoogleMapsLoader = require('google-maps'); - -GoogleMapsLoader.load(function(google) { - var loadedMap = google.maps.Map; -}); +GoogleMapsLoader.URL = 'https://maps.googleapis.com/maps/api/js'; GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm'; - -GoogleMapsLoader.CLIENT = 'yourclientkey'; -GoogleMapsLoader.VERSION = '3.14'; - -GoogleMapsLoader.SENSOR = true; - GoogleMapsLoader.LIBRARIES = ['geometry', 'places']; - +GoogleMapsLoader.CLIENT = 'yourclientkey'; +GoogleMapsLoader.CHANNEL = 'myChannel'; GoogleMapsLoader.LANGUAGE = 'fr'; +GoogleMapsLoader.REGION = 'GB'; +GoogleMapsLoader.VERSION = '3.14'; +GoogleMapsLoader.WINDOW_CALLBACK_NAME = '__google_maps_api_provider_initializator__'; -GoogleMapsLoader.release(function() { - console.log('No google maps api around'); +var callback: GoogleMapsLoader.CallBack = function (google) { + var uluru = {lat: -25.363, lng: 131.044}; + + var map = new google.maps.Map(document.getElementById('map'), { + zoom: 4, + center: uluru + }); + + var marker = new google.maps.Marker({ + position: uluru, + map: map + }); +}; + + +GoogleMapsLoader.createLoader(); + +var isLoaded: boolean = GoogleMapsLoader.isLoaded(); + +GoogleMapsLoader.load(callback); +GoogleMapsLoader.release(callback); + +GoogleMapsLoader.onLoad(function () { + console.log("loaded!") }); -GoogleMapsLoader.onLoad(function(google) { - var loadedMap = google.maps.Map; - console.log('I just loaded google maps api'); -}); +var url: string = GoogleMapsLoader.createUrl(); + +GoogleMapsLoader.makeMock(); diff --git a/google-maps/index.d.ts b/google-maps/index.d.ts index f5c28f1581..86a9e137e7 100644 --- a/google-maps/index.d.ts +++ b/google-maps/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for google-maps 3.1.0 +// Type definitions for google-maps 3.2.1 // Project: https://www.npmjs.com/package/google-maps // Definitions by: Deividas Bakanas , Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,20 +6,29 @@ /// declare namespace GoogleMapsLoader { + type google = { maps: typeof google.maps }; interface CallBack { - (google: { maps: { Map: google.maps.Map } }): void; + (google: google): void; } + export var KEY: string; - export var CLIENT: string; - export var VERSION: string; - export var SENSOR: boolean; + export var URL: string; export var LIBRARIES: Array; + export var CLIENT: string; + export var CHANNEL: string; export var LANGUAGE: string; + export var REGION: string; + export var VERSION: string; + export var WINDOW_CALLBACK_NAME: string; + export function release(callBack: Function): void; export function onLoad(callBack?: CallBack): void; export function load(callBack?: CallBack): void; export function isLoaded(): boolean; - + export function createLoader(): void; + export function createUrl(): string; + export function makeMock(): void; } + export = GoogleMapsLoader; export as namespace GoogleMapsLoader; diff --git a/google-maps/tsconfig.json b/google-maps/tsconfig.json index 0d60e3639f..c523da6157 100644 --- a/google-maps/tsconfig.json +++ b/google-maps/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google.analytics/tsconfig.json b/google.analytics/tsconfig.json index 30735a7575..ddce77f25e 100644 --- a/google.analytics/tsconfig.json +++ b/google.analytics/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google.feeds/tsconfig.json b/google.feeds/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/google.feeds/tsconfig.json +++ b/google.feeds/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google.geolocation/tsconfig.json b/google.geolocation/tsconfig.json index fe1912fbb8..32019f7828 100644 --- a/google.geolocation/tsconfig.json +++ b/google.geolocation/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google.picker/tsconfig.json b/google.picker/tsconfig.json index 4265c00a83..71e3335369 100644 --- a/google.picker/tsconfig.json +++ b/google.picker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/google.visualization/google.visualization-tests.ts b/google.visualization/google.visualization-tests.ts index 2cbd8220f2..a51657a592 100644 --- a/google.visualization/google.visualization-tests.ts +++ b/google.visualization/google.visualization-tests.ts @@ -156,10 +156,17 @@ function test_areaChart() { ['2016', 1030, 540] ]); - var options = { + var options:google.visualization.AreaChartOptions = { title: 'Company Performance', hAxis: {title: 'Year', titleTextStyle: {color: '#333'}}, - vAxis: {minValue: 0} + vAxis: {minValue: 0}, + annotations: { + textStyle: { + bold: true, + italic: true, + color: "black" + } + } }; var chart = new google.visualization.AreaChart(document.getElementById('chart_div')); @@ -510,3 +517,107 @@ function test_ChartsLoad() { google.charts.setOnLoadCallback(drawChart); } + + +function test_ChartAnnotations() { + var annotations:google.visualization.ChartAnnotations = { + boxStyle: { + // Color of the box outline. + stroke: '#888', + // Thickness of the box outline. + strokeWidth: 1, + // x-radius of the corner curvature. + rx: 10, + // y-radius of the corner curvature. + ry: 10, + // Attributes for linear gradient fill. + gradient: { + // Start color for gradient. + color1: '#fbf6a7', + // Finish color for gradient. + color2: '#33b679', + // Where on the boundary to start and + // end the color1/color2 gradient, + // relative to the upper left corner + // of the boundary. + x1: '0%', y1: '0%', + x2: '100%', y2: '100%', + // If true, the boundary for x1, + // y1, x2, and y2 is the box. If + // false, it's the entire chart. + useObjectBoundingBoxUnits: true + } + }, + datum: { + stem: { + color: 'black', + length: 12 + }, + style: 'point' + }, + domain: { + stem: { + color: 'black', + length: 5 + }, + style: 'point' + }, + highContrast: true, + stem: { + color: 'black', + length: 5 + }, + style: 'line', + textStyle: { + fontName: 'Times-Roman', + fontSize: 18, + bold: true, + italic: true, + // The color of the text. + color: '#871b47', + // The color of the text outline. + auraColor: '#d799ae', + // The transparency of the text. + opacity: 0.8 + } + }; + + var barAnnotations:google.visualization.ChartBarColumnAnnotations = { + alwaysOutside: true, + textStyle: { + fontName: 'Times-Roman', + fontSize: 18, + bold: true + } + }; +} + + +function test_OrgChart() { + var data = new google.visualization.DataTable(); + data.addColumn('string', 'Name'); + data.addColumn('string', 'Manager'); + data.addColumn('string', 'ToolTip'); + + // For each orgchart box, provide the name, manager, and tooltip to show. + data.addRows([ + [{v:'Mike', f:'Mike
President
'}, '', 'The President'], + [{v:'Jim', f:'Jim
Vice President
'}, 'Mike', 'VP'], + ['Alice', 'Mike', ''], + ['Bob', 'Jim', 'Bob Sponge'], + ['Carol', 'Bob', ''] + ]); + + var chart = new google.visualization.OrgChart(document.getElementById('chart_div')); + chart.draw(data, { + allowCollapse: true, + allowHtml: true, + nodeClass: 'node', + selectedNodeClass: 'selected', + size: 'small' + }); + chart.collapse(1, true); + var children = chart.getChildrenIndexes(0); + var collapsed = chart.getCollapsedNodes(); + +} diff --git a/google.visualization/index.d.ts b/google.visualization/index.d.ts index a4dc1b7b1a..83b08296f8 100644 --- a/google.visualization/index.d.ts +++ b/google.visualization/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Google Visualisation Apis // Project: https://developers.google.com/chart/ -// Definitions by: Dan Ludwig , Gregory Moore +// Definitions by: Dan Ludwig , Gregory Moore , Dan Manastireanu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace google { @@ -331,6 +331,25 @@ declare namespace google { export interface ChartAnnotations { boxStyle?: ChartBoxStyle; textStyle?: ChartTextStyle; + datum?: ChartStemAndStyle; + domain?: ChartStemAndStyle; + highContrast?: boolean; + stem?: ChartStem; + style?: string; // 'line' or 'point' + } + + export interface ChartBarColumnAnnotations extends ChartAnnotations { + alwaysOutside?: boolean; + } + + export interface ChartStemAndStyle { + stem?: ChartStem; + style?: string; + } + + export interface ChartStem { + color?: string; + length?: number; } export interface ChartBoxStyle { @@ -565,7 +584,7 @@ declare namespace google { export interface ColumnChartOptions { aggregationTarget?: string; animation?: TransitionAnimation; - annotations?: ChartAnnotations; + annotations?: ChartBarColumnAnnotations; axisTitlesPosition?: string; // in, out, none backgroundColor?: any; bar?: GroupWidth; @@ -645,7 +664,7 @@ declare namespace google { export interface BarChartOptions { aggregationTarget?: string; animation?: TransitionAnimation; - annotations?: ChartAnnotations; + annotations?: ChartBarColumnAnnotations; axisTitlesPosition?: string; // in, out, none backgroundColor?: any; bar?: GroupWidth; @@ -739,6 +758,7 @@ declare namespace google { export interface AreaChartOptions { aggregationTarget?: string; animation?: TransitionAnimation; + annotations?: ChartAnnotations; areaOpacity?: number; axisTitlesPosition?: string; backgroundColor?: any; @@ -1357,6 +1377,34 @@ declare namespace google { format(dataTable: DataTable, srcColumnIndices: number[], opt_dstColumnIndex?: number): void; } + //#endregion + //#region OrgChart + + // https://google-developers.appspot.com/chart/interactive/docs/gallery/orgchart + export class OrgChart extends CoreChartBase { + draw(data: DataTable, options: OrgChartOptions): void; + draw(data: DataView, options: OrgChartOptions): void; + collapse(row: number, collapsed: boolean): void; + getChildrenIndexes(row: number): number[]; + getCollapsedNodes(): number[]; + } + + // https://google-developers.appspot.com/chart/interactive/docs/gallery/orgchart#Configuration_Options + export interface OrgChartOptions { + allowCollapse?: boolean; + allowHtml?: boolean; + color?: string; + nodeClass?: string; + selectedNodeClass?: string; + selectionColor?: string; + /** + * Chart size + * @type {('small'|'medium'|'large')} + * @default 'medium' + */ + size?: string; + } + //#endregion } } diff --git a/google.visualization/tsconfig.json b/google.visualization/tsconfig.json index ddb7dc8c15..6ee61bc43c 100644 --- a/google.visualization/tsconfig.json +++ b/google.visualization/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/googlemaps.infobubble/tsconfig.json b/googlemaps.infobubble/tsconfig.json index cfc01eb4b5..165f392587 100644 --- a/googlemaps.infobubble/tsconfig.json +++ b/googlemaps.infobubble/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/googlemaps/google.maps-tests.ts b/googlemaps/google.maps-tests.ts index e119cf25bc..9829a23a1a 100644 --- a/googlemaps/google.maps-tests.ts +++ b/googlemaps/google.maps-tests.ts @@ -4,10 +4,10 @@ var map = new google.maps.Map(document.querySelector("☺")); /***** Data *****/ - + new google.maps.Data(); new google.maps.Data({ map: map }); - + var latLng = new google.maps.LatLng(52.201203, -1.724370), feature = new google.maps.Data.Feature(), geometry = new google.maps.Data.Geometry(); @@ -61,7 +61,7 @@ data.loadGeoJson("http://magicGeoJsonSource.com"); data.loadGeoJson( "http://magicGeoJsonSource.com", { idPropertyName: "test" }); - + data.loadGeoJson( "http://magicGeoJsonSource.com", { idPropertyName: "test" }, @@ -99,7 +99,7 @@ var setPropertyEvent: google.maps.Data.SetPropertyEvent = { newValue: {}, oldValue: {} }; - + var removePropertyEvent: google.maps.Data.RemovePropertyEvent = { feature: feature, name: "test", @@ -140,3 +140,29 @@ var mapTypeStyle: google.maps.MapTypeStyle ={ elementType: 'labels', stylers: [], }; + +// https://developers.google.com/maps/documentation/javascript/adding-a-google-map +function initMap() { + var uluru = {lat: -25.363, lng: 131.044}; + var map = new google.maps.Map(document.getElementById('map'), { + zoom: 4, + center: uluru + }); + var marker = new google.maps.Marker({ + position: uluru, + map: map + }); +} + +/***** OverlayView *****/ +var div = document.createElement('div'); +var overlay = new google.maps.OverlayView(); +var panes = overlay.getPanes(); +panes.floatPane.appendChild(div); +panes.floatShadow.appendChild(div); +panes.mapPane.appendChild(div); +panes.markerLayer.appendChild(div); +panes.overlayImage.appendChild(div); +panes.overlayLayer.appendChild(div); +panes.overlayMouseTarget.appendChild(div); +panes.overlayShadow.appendChild(div); diff --git a/googlemaps/index.d.ts b/googlemaps/index.d.ts index c4168645a6..dff5c1cd90 100644 --- a/googlemaps/index.d.ts +++ b/googlemaps/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Google Maps JavaScript API 3.25 // Project: https://developers.google.com/maps/ -// Definitions by: Folia A/S , Chris Wrench +// Definitions by: Folia A/S , Chris Wrench , Kiarash Ghiaseddin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /* @@ -871,10 +871,13 @@ declare namespace google.maps { export interface MapPanes { floatPane: Element; + floatShadow: Element; mapPane: Element; markerLayer: Element; + overlayImage: Element; overlayLayer: Element; overlayMouseTarget: Element; + overlayShadow: Element; } export class MapCanvasProjection extends MVCObject { diff --git a/googlemaps/tsconfig.json b/googlemaps/tsconfig.json index deafdc4eec..dc12fbf795 100644 --- a/googlemaps/tsconfig.json +++ b/googlemaps/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/graceful-fs/tsconfig.json b/graceful-fs/tsconfig.json index 44eb974395..9c0a280533 100644 --- a/graceful-fs/tsconfig.json +++ b/graceful-fs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/graham_scan/tsconfig.json b/graham_scan/tsconfig.json index 867db5e611..c18044cd81 100644 --- a/graham_scan/tsconfig.json +++ b/graham_scan/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/graphene-pk11/tsconfig.json b/graphene-pk11/tsconfig.json index c1d4c8a1c8..df3b4ad0e0 100644 --- a/graphene-pk11/tsconfig.json +++ b/graphene-pk11/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/graphlib/tsconfig.json b/graphlib/tsconfig.json index eea9c47ddd..6bb2bd68e4 100644 --- a/graphlib/tsconfig.json +++ b/graphlib/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/graphql-relay/graphql-relay-tests.ts b/graphql-relay/graphql-relay-tests.ts new file mode 100644 index 0000000000..1ee0b5e111 --- /dev/null +++ b/graphql-relay/graphql-relay-tests.ts @@ -0,0 +1,230 @@ +import { + GraphQLString, + GraphQLObjectType, + GraphQLFieldResolver, + GraphQLFieldConfigMap, + GraphQLResolveInfo, + GraphQLTypeResolver, + GraphQLFieldConfig, + GraphQLInterfaceType, + GraphQLInputType, + GraphQLInputFieldConfigMap, + GraphQLNonNull, + GraphQLID, +} from "graphql"; +import { + // Connections + connectionArgs, + forwardConnectionArgs, + backwardConnectionArgs, + connectionDefinitions, + connectionFromArray, + connectionFromPromisedArray, + cursorForObjectInConnection, + // Object Identification + nodeDefinitions, + toGlobalId, + fromGlobalId, + globalIdField, + pluralIdentifyingRootField, + // Mutations + mutationWithClientMutationId, +} from "."; +// Connections +// connectionArgs returns the arguments that fields should provide when they return a connection type that supports bidirectional pagination. +connectionArgs.first = 10; +connectionArgs.after = "a"; +connectionArgs.before = "b"; +connectionArgs.last = 10; +// forwardConnectionArgs returns the arguments that fields should provide when they return a connection type that only supports forward pagination. +forwardConnectionArgs.after = "a"; +forwardConnectionArgs.first = 10; +// backwardConnectionArgs returns the arguments that fields should provide when they return a connection type that only supports backward pagination. +backwardConnectionArgs.before = "b"; +backwardConnectionArgs.last = 10; +// connectionDefinitions returns a connectionType and its associated edgeType, given a node type. +let resolve: GraphQLFieldResolver = (source, args, context, info) => { + info.fieldName = "f"; +}; +const fields: GraphQLFieldConfigMap = {}; +let t: GraphQLObjectType; +let e: GraphQLObjectType; +let def = connectionDefinitions({ + connectionFields: fields, + edgeFields: fields, + name: "N", + nodeType: new GraphQLObjectType({ + name: "N", + fields: {}, + }), + resolveCursor: resolve, + resolveNode: resolve, +}); +t = def.connectionType; +e = def.edgeType; +// connectionFromArray is a helper method that takes an array and the arguments from connectionArgs, does pagination and filtering, and returns an object in the shape expected by a connectionType's resolve function. +const conn = connectionFromArray([1, 2, 3], { + after: "a", + before: "b", + first: 1, + last: 5, +}); +conn.edges.map((e) => { e.cursor.toLowerCase(); e.node.toExponential(); }); +conn.pageInfo.endCursor = "e"; +conn.pageInfo.hasNextPage = true; +conn.pageInfo.hasPreviousPage = true; +conn.pageInfo.startCursor = "s"; +// connectionFromPromisedArray is similar to connectionFromArray, but it takes a promise that resolves to an array, and returns a promise that resolves to the expected shape by connectionType. +const conn2 = connectionFromPromisedArray(new Promise((resolve) => { + resolve(); +}), { + after: "a", + before: "b", + first: 1, + last: 5, + }); +conn2.then((res) => { + res = conn; +}); +// cursorForObjectInConnection is a helper method that takes an array and a member object, and returns a cursor for use in the mutation payload. +cursorForObjectInConnection(["a"], "b").toLowerCase(); +// An example usage of these methods from the test schema: +let shipType: GraphQLObjectType = new GraphQLObjectType({ + name: "ShipType", + fields: {}, +}); +const {connectionType: ShipConnection} = + connectionDefinitions({ nodeType: shipType }); +const factionType = new GraphQLObjectType({ + name: "Faction", + fields: () => ({ + ships: { + type: ShipConnection, + args: connectionArgs, + resolve: (faction, args) => connectionFromArray( + faction.ships.map((id: any) => id), + args + ), + } + }), +}); +// Object Identification +// nodeDefinitions returns the Node interface that objects can implement, and returns the node root field to include on the query type. To implement this, it takes a function to resolve an ID to an object, and to determine the type of a given object. +const resolver: GraphQLTypeResolver = () => { + return new GraphQLObjectType({ + name: "T", + fields: {}, + }); +}; +const idFetcher = (id: string, context: number, info: GraphQLResolveInfo) => { + info.fieldName = "f"; +}; +const nodeDef = nodeDefinitions(idFetcher, resolver); +const fieldConfig: GraphQLFieldConfig = nodeDef.nodeField; +const interfaceType: GraphQLInterfaceType = nodeDef.nodeInterface; +// toGlobalId takes a type name and an ID specific to that type name, and returns a "global ID" that is unique among all types. +toGlobalId("t", "i").toLowerCase(); +// fromGlobalId takes the "global ID" created by toGlobalID, and returns the type name and ID used to create it. +const fgi = fromGlobalId("gid"); +fgi.id.toLowerCase(); +fgi.type.toUpperCase(); +// globalIdField creates the configuration for an id field on a node. +const idFetcher2 = (object: any, context: any, info: GraphQLResolveInfo) => { + return ""; +}; +const gif: GraphQLFieldConfig = globalIdField("t", idFetcher2); +// pluralIdentifyingRootField creates a field that accepts a list of non-ID identifiers (like a username) and maps them to their corresponding objects. +const input: GraphQLInputType = GraphQLString; +const prf: GraphQLFieldConfig = pluralIdentifyingRootField({ + argName: "a", + inputType: input, + outputType: input, + resolveSingleInput: (input: any, context: any, info: GraphQLResolveInfo) => { + return ""; + }, + description: "d", +}); +// An example usage of these methods from the test schema: +const {nodeInterface, nodeField} = nodeDefinitions( + (globalId) => { + var {type, id} = fromGlobalId(globalId); + return "data[type][id]"; + }, + (obj) => { + return obj.ships ? factionType : shipType; + } +); + +const factionType2 = new GraphQLObjectType({ + name: 'Faction', + fields: () => ({ + id: globalIdField(), + }), + interfaces: [nodeInterface] +}); + +const queryType = new GraphQLObjectType({ + name: 'Query', + fields: () => ({ + node: nodeField + }) +}); +// Mutations +// mutationWithClientMutationId takes a name, input fields, output fields, and a mutation method to map from the input fields to the output fields, performing the mutation along the way. It then creates and returns a field configuration that can be used as a top-level field on the mutation type. +const gifcm: GraphQLInputFieldConfigMap = {}; +const gfcm: GraphQLFieldConfigMap = {}; +mutationWithClientMutationId({ + name: "M", + description: "D", + inputFields: gifcm, + mutateAndGetPayload: (object: any, + ctx: any, + info: GraphQLResolveInfo) => { + return new Promise((resolve) => { + resolve(info.fieldName); + }); + }, + outputFields: gfcm, +}); +// An example usage of these methods from the test schema: +const data: any = {}; +var shipMutation = mutationWithClientMutationId({ + name: 'IntroduceShip', + inputFields: { + shipName: { + type: new GraphQLNonNull(GraphQLString) + }, + factionId: { + type: new GraphQLNonNull(GraphQLID) + } + }, + outputFields: { + ship: { + type: shipType, + resolve: (payload) => data['Ship'][payload.shipId] + }, + faction: { + type: factionType, + resolve: (payload) => data['Faction'][payload.factionId] + } + }, + mutateAndGetPayload: ({shipName, factionId}) => { + var newShip = { + id: "11", + name: shipName + }; + // data.Ship[newShip.id] = newShip; + // data.Faction[factionId].ships.push(newShip.id); + return { + shipId: newShip.id, + factionId, + }; + } +}); + +var mutationType = new GraphQLObjectType({ + name: 'Mutation', + fields: () => ({ + introduceShip: shipMutation + }) +}); diff --git a/graphql-relay/index.d.ts b/graphql-relay/index.d.ts new file mode 100644 index 0000000000..3672a2d1c0 --- /dev/null +++ b/graphql-relay/index.d.ts @@ -0,0 +1,310 @@ +// Type definitions for graphql-relay 0.4 +// Project: https://github.com/graphql/graphql-relay-js +// Definitions by: Arvitaly , nitintutlani , Grelinfo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +import { + GraphQLBoolean, + GraphQLInt, + GraphQLNonNull, + GraphQLList, + GraphQLObjectType, + GraphQLString, + GraphQLFieldConfig, + GraphQLInputFieldConfigMap, + GraphQLFieldConfigMap, + GraphQLFieldConfigArgumentMap, + GraphQLResolveInfo, + GraphQLInterfaceType, + GraphQLInputType, + GraphQLOutputType, + GraphQLFieldResolver, + GraphQLTypeResolver, + Thunk +} from "graphql"; + +// connection/connection.js + +/** + * Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field + * whose return type is a connection type with forward pagination. + */ +interface ForwardConnectionArgs { + after: ConnectionCursor; + first: number; +} +export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap & { + after: ConnectionCursor; + first: number; +}; + +/** + * Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field + * whose return type is a connection type with backward pagination. + */ +interface BackwardConnectionArgs { + before: ConnectionCursor; + last: number; +} +export const backwardConnectionArgs: GraphQLFieldConfigArgumentMap & { + before: ConnectionCursor; + last: number; +}; + +/** + * Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field + * whose return type is a connection type with bidirectional pagination. + */ +export const connectionArgs: GraphQLFieldConfigArgumentMap & ForwardConnectionArgs & BackwardConnectionArgs; + +interface ConnectionConfig { + name?: string | null; + nodeType: GraphQLObjectType; + resolveNode?: GraphQLFieldResolver | null; + resolveCursor?: GraphQLFieldResolver | null; + edgeFields?: Thunk> | null; + connectionFields?: Thunk> | null; +} + +interface GraphQLConnectionDefinitions { + edgeType: GraphQLObjectType; + connectionType: GraphQLObjectType; +} + +/** + * Returns a GraphQLObjectType for a connection with the given name, + * and whose nodes are of the specified type. + */ +export function connectionDefinitions( + config: ConnectionConfig +): GraphQLConnectionDefinitions; + +// connection/connectiontypes.js + +/** + * An flow type alias for cursors in this implementation. + */ +export type ConnectionCursor = string; + +/** + * A flow type designed to be exposed as `PageInfo` over GraphQL. + */ +export interface PageInfo { + startCursor: ConnectionCursor; + endCursor: ConnectionCursor; + hasPreviousPage: boolean; + hasNextPage: boolean; +} + +/** + * A flow type designed to be exposed as a `Connection` over GraphQL. + */ +export interface Connection { + edges: Array>; + pageInfo: PageInfo; +} + +/** + * A flow type designed to be exposed as a `Edge` over GraphQL. + */ +interface Edge { + node: T; + cursor: ConnectionCursor; +} + +/** + * A flow type describing the arguments a connection field receives in GraphQL. + */ +interface ConnectionArguments { + before?: ConnectionCursor; + after?: ConnectionCursor; + first?: number; + last?: number; +} + + +// connection/arrayconnection.js + +interface ArraySliceMetaInfo { + sliceStart: number; + arrayLength: number; +} + +/** + * A simple function that accepts an array and connection arguments, and returns + * a connection object for use in GraphQL. It uses array offsets as pagination, + * so pagination will only work if the array is static. + */ +export function connectionFromArray( + data: T[], + args: ConnectionArguments +): Connection; + +/** + * A version of `connectionFromArray` that takes a promised array, and returns a + * promised connection. + */ +export function connectionFromPromisedArray( + dataPromise: Promise, + args: ConnectionArguments +): Promise>; + +/** + * Given a slice (subset) of an array, returns a connection object for use in + * GraphQL. + * +* This function is similar to `connectionFromArray`, but is intended for use +* cases where you know the cardinality of the connection, consider it too large +* to materialize the entire array, and instead wish pass in a slice of the +* total result large enough to cover the range specified in `args`. +*/ +export function connectionFromArraySlice( + arraySlice: T[], + args: ConnectionArguments, + meta: ArraySliceMetaInfo +): Connection; + +/** + * A version of `connectionFromArraySlice` that takes a promised array slice, + * and returns a promised connection. + */ +export function connectionFromPromisedArraySlice( + dataPromise: Promise, + args: ConnectionArguments, + arrayInfo: ArraySliceMetaInfo +): Promise>; + +/** + * Creates the cursor string from an offset. + */ +export function offsetToCursor(offset: number): ConnectionCursor; + +/** + * Rederives the offset from the cursor string. + */ +export function cursorToOffset(cursor: ConnectionCursor): number; + +/** + * Return the cursor associated with an object in an array. + */ +export function cursorForObjectInConnection( + data: T[], + object: T +): ConnectionCursor; + +/** + * Given an optional cursor and a default offset, returns the offset + * to use; if the cursor contains a valid offset, that will be used, + * otherwise it will be the default. + */ +export function getOffsetWithDefault( + cursor?: ConnectionCursor, + defaultOffset?: number +): number; + +// mutation/mutation.js + +type mutationFn = ( + object: any, + ctx: any, + info: GraphQLResolveInfo +) => Promise | any; + +/** + * A description of a mutation consumable by mutationWithClientMutationId + * to create a GraphQLFieldConfig for that mutation. + * + * The inputFields and outputFields should not include `clientMutationId`, + * as this will be provided automatically. + * + * An input object will be created containing the input fields, and an + * object will be created containing the output fields. + * + * mutateAndGetPayload will receieve an Object with a key for each + * input field, and it should return an Object with a key for each + * output field. It may return synchronously, or return a Promise. + */ +interface MutationConfig { + name: string; + description?: string; + inputFields: Thunk; + outputFields: Thunk>; + mutateAndGetPayload: mutationFn; +} + +/** + * Returns a GraphQLFieldConfig for the mutation described by the + * provided MutationConfig. + */ +export function mutationWithClientMutationId( + config: MutationConfig +): GraphQLFieldConfig; + +// node/node.js + +interface GraphQLNodeDefinitions { + nodeInterface: GraphQLInterfaceType; + nodeField: GraphQLFieldConfig; +} + +type typeResolverFn = ((any: any) => GraphQLObjectType) | + ((any: any) => Promise); + +/** + * Given a function to map from an ID to an underlying object, and a function + * to map from an underlying object to the concrete GraphQLObjectType it + * corresponds to, constructs a `Node` interface that objects can implement, + * and a field config for a `node` root field. + * + * If the typeResolver is omitted, object resolution on the interface will be + * handled with the `isTypeOf` method on object types, as with any GraphQL + * interface without a provided `resolveType` method. + */ +export function nodeDefinitions( + idFetcher: ((id: string, context: TContext, info: GraphQLResolveInfo) => any), + typeResolver?: GraphQLTypeResolver +): GraphQLNodeDefinitions; + +interface ResolvedGlobalId { + type: string; + id: string; +} + +/** + * Takes a type name and an ID specific to that type name, and returns a + * "global ID" that is unique among all types. + */ +export function toGlobalId(type: string, id: string): string; + +/** + * Takes the "global ID" created by toGlobalID, and returns the type name and ID + * used to create it. + */ +export function fromGlobalId(globalId: string): ResolvedGlobalId; + +/** + * Creates the configuration for an id field on a node, using `toGlobalId` to + * construct the ID from the provided typename. The type-specific ID is fetched + * by calling idFetcher on the object, or if not provided, by accessing the `id` + * property on the object. + */ +export function globalIdField( + typeName?: string, + idFetcher?: (object: any, context: any, info: GraphQLResolveInfo) => string +): GraphQLFieldConfig; + + +// node/plural.js + +interface PluralIdentifyingRootFieldConfig { + argName: string; + inputType: GraphQLInputType; + outputType: GraphQLOutputType; + resolveSingleInput: (input: any, context: any, info: GraphQLResolveInfo) => any; + description?: string; +} + +export function pluralIdentifyingRootField( + config: PluralIdentifyingRootFieldConfig +): GraphQLFieldConfig; \ No newline at end of file diff --git a/graphql-relay/tsconfig.json b/graphql-relay/tsconfig.json new file mode 100644 index 0000000000..4a26498184 --- /dev/null +++ b/graphql-relay/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "graphql-relay-tests.ts" + ] +} \ No newline at end of file diff --git a/graphql-relay/tslint.json b/graphql-relay/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/graphql-relay/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/graphql/index.d.ts b/graphql/index.d.ts index b441fbc204..14b29144eb 100644 --- a/graphql/index.d.ts +++ b/graphql/index.d.ts @@ -1,11 +1,11 @@ -// Type definitions for graphql v0.7.0 +// Type definitions for graphql v0.8.2 // Project: https://www.npmjs.com/package/graphql -// Definitions by: TonyYang +// Definitions by: TonyYang , Caleb Meredith , Dominic Watson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /************************************* - * * - * MODULES * + * * + * MODULES * * * *************************************/ /////////////////////////// @@ -19,103 +19,26 @@ declare module "graphql" { // Create and operate on GraphQL type definitions and schema. - export { - GraphQLSchema, - - // Definitions - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLList, - GraphQLNonNull, - GraphQLDirective, - - // "Enum" of Type Kinds - TypeKind, - - // "Enum" of Directive Locations - DirectiveLocation, - - // Scalars - GraphQLInt, - GraphQLFloat, - GraphQLString, - GraphQLBoolean, - GraphQLID, - - // Built-in Directives defined by the Spec - specifiedDirectives, - GraphQLIncludeDirective, - GraphQLSkipDirective, - GraphQLDeprecatedDirective, - - // Constant Deprecation Reason - DEFAULT_DEPRECATION_REASON, - - // Meta-field definitions. - SchemaMetaFieldDef, - TypeMetaFieldDef, - TypeNameMetaFieldDef, - - // GraphQL Types for introspection. - __Schema, - __Directive, - __DirectiveLocation, - __Type, - __Field, - __InputValue, - __EnumValue, - __TypeKind, - - // Predicates - isType, - isInputType, - isOutputType, - isLeafType, - isCompositeType, - isAbstractType, - - // Un-modifiers - getNullableType, - getNamedType, - } from 'graphql/type'; + export * from 'graphql/type'; // Parse and operate on GraphQL language source files. - export { - Source, - getLocation, - - // Parse - parse, - parseValue, - parseType, - - // Print - print, - - // Visit - visit, - visitInParallel, - visitWithTypeInfo, - Kind, - TokenKind, - BREAK, - } from 'graphql/language'; + export * from 'graphql/language'; // Execute GraphQL queries. export { execute, + defaultFieldResolver, + responsePathAsArray, + ExecutionResult, } from 'graphql/execution'; // Validate GraphQL queries. export { validate, + ValidationContext, specifiedRules, } from 'graphql/validation'; @@ -124,11 +47,12 @@ declare module "graphql" { export { GraphQLError, formatError, + GraphQLFormattedError, + GraphQLErrorLocation, } from 'graphql/error'; // Utilities for operating on GraphQL type schema and parsed sources. - /* export { // The GraphQL query recommended for a full schema introspection. introspectionQuery, @@ -152,6 +76,9 @@ declare module "graphql" { // Print a GraphQLSchema to GraphQL Schema language. printSchema, + // Print a GraphQLType to GraphQL Schema language. + printType, + // Create a GraphQLType from a GraphQL language AST. typeFromAST, @@ -184,13 +111,32 @@ declare module "graphql" { // Asserts a string is a valid GraphQL name. assertValidName, + + BreakingChange, + + IntrospectionDirective, + IntrospectionEnumType, + IntrospectionEnumValue, + IntrospectionField, + IntrospectionInputObjectType, + IntrospectionInputValue, + IntrospectionInterfaceType, + IntrospectionListTypeRef, + IntrospectionNamedTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionObjectType, + IntrospectionQuery, + IntrospectionScalarType, + IntrospectionSchema, + IntrospectionType, + IntrospectionTypeRef, + IntrospectionUnionType, } from 'graphql/utilities'; - */ } declare module "graphql/graphql" { - import { GraphQLError } from 'graphql/error/GraphQLError'; import { GraphQLSchema } from 'graphql/type/schema'; + import { ExecutionResult } from 'graphql/execution/execute'; /** * This is the primary entry point function for fulfilling GraphQL operations @@ -225,18 +171,7 @@ declare module "graphql/graphql" { [key: string]: any }, operationName?: string - ): Promise; - - /** - * The result of a GraphQL parse, validation and execution. - * - * `data` is the result of a successful execution of the query. - * `errors` is included when any errors occurred as a non-empty array. - */ - type GraphQLResult = { - data?: Object; - errors?: Array; - } + ): Promise; } /////////////////////////// @@ -256,11 +191,12 @@ declare module "graphql/language" { } declare module "graphql/language/index" { + export * from 'graphql/language/ast'; export { getLocation } from 'graphql/language/location'; import * as Kind from 'graphql/language/kinds'; export { Kind }; - export { createLexer, TokenKind } from 'graphql/language/lexer'; - export { parse, parseValue, parseType } from 'graphql/language/parser'; + export { createLexer, TokenKind, Lexer } from 'graphql/language/lexer'; + export { parse, parseValue, parseType, ParseOptions } from 'graphql/language/parser'; export { print } from 'graphql/language/printer'; export { Source } from 'graphql/language/source'; export { visit, visitInParallel, visitWithTypeInfo, BREAK } from 'graphql/language/visitor'; @@ -273,7 +209,7 @@ declare module "graphql/language/ast" { * Contains a range of UTF-8 character offsets and token references that * identify the region of the source from which the AST derived. */ - type Location = { + export type Location = { /** * The character offset at which this Node begins. @@ -305,7 +241,7 @@ declare module "graphql/language/ast" { * Represents a range of characters represented by a lexical token * within a Source. */ - type Token = { + export type Token = { /** * The kind of Token. @@ -368,46 +304,46 @@ declare module "graphql/language/ast" { /** * The list of all possible AST node types. */ - type Node = Name - | Document - | OperationDefinition - | VariableDefinition - | Variable - | SelectionSet - | Field - | Argument - | FragmentSpread - | InlineFragment - | FragmentDefinition - | IntValue - | FloatValue - | StringValue - | BooleanValue - | EnumValue - | ListValue - | ObjectValue - | ObjectField - | Directive - | NamedType - | ListType - | NonNullType - | SchemaDefinition - | OperationTypeDefinition - | ScalarTypeDefinition - | ObjectTypeDefinition - | FieldDefinition - | InputValueDefinition - | InterfaceTypeDefinition - | UnionTypeDefinition - | EnumTypeDefinition - | EnumValueDefinition - | InputObjectTypeDefinition - | TypeExtensionDefinition - | DirectiveDefinition + export type ASTNode = NameNode + | DocumentNode + | OperationDefinitionNode + | VariableDefinitionNode + | VariableNode + | SelectionSetNode + | FieldNode + | ArgumentNode + | FragmentSpreadNode + | InlineFragmentNode + | FragmentDefinitionNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode + | ObjectFieldNode + | DirectiveNode + | NamedTypeNode + | ListTypeNode + | NonNullTypeNode + | SchemaDefinitionNode + | OperationTypeDefinitionNode + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | FieldDefinitionNode + | InputValueDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | EnumValueDefinitionNode + | InputObjectTypeDefinitionNode + | TypeExtensionDefinitionNode + | DirectiveDefinitionNode; // Name - type Name = { + export type NameNode = { kind: 'Name'; loc?: Location; value: string; @@ -415,306 +351,306 @@ declare module "graphql/language/ast" { // Document - type Document = { + export type DocumentNode = { kind: 'Document'; loc?: Location; - definitions: Array; + definitions: Array; } - type Definition = OperationDefinition - | FragmentDefinition - | TypeSystemDefinition // experimental non-spec addition. + export type DefinitionNode = OperationDefinitionNode + | FragmentDefinitionNode + | TypeSystemDefinitionNode // experimental non-spec addition. - type OperationDefinition = { + export type OperationDefinitionNode = { kind: 'OperationDefinition'; loc?: Location; - operation: OperationType; - name?: Name; - variableDefinitions?: Array; - directives?: Array; - selectionSet: SelectionSet; + operation: OperationTypeNode; + name?: NameNode; + variableDefinitions?: Array; + directives?: Array; + selectionSet: SelectionSetNode; } // Note: subscription is an experimental non-spec addition. - type OperationType = 'query' | 'mutation' | 'subscription'; + export type OperationTypeNode = 'query' | 'mutation' | 'subscription'; - type VariableDefinition = { + export type VariableDefinitionNode = { kind: 'VariableDefinition'; loc?: Location; - variable: Variable; - type: Type; - defaultValue?: Value; + variable: VariableNode; + type: TypeNode; + defaultValue?: ValueNode; } - type Variable = { + export type VariableNode = { kind: 'Variable'; loc?: Location; - name: Name; + name: NameNode; } - type SelectionSet = { + export type SelectionSetNode = { kind: 'SelectionSet'; loc?: Location; - selections: Array; + selections: Array; } - type Selection = Field - | FragmentSpread - | InlineFragment + export type SelectionNode = FieldNode + | FragmentSpreadNode + | InlineFragmentNode - type Field = { + export type FieldNode = { kind: 'Field'; loc?: Location; - alias?: Name; - name: Name; - arguments?: Array; - directives?: Array; - selectionSet?: SelectionSet; + alias?: NameNode; + name: NameNode; + arguments?: Array; + directives?: Array; + selectionSet?: SelectionSetNode; } - type Argument = { + export type ArgumentNode = { kind: 'Argument'; loc?: Location; - name: Name; - value: Value; + name: NameNode; + value: ValueNode; } // Fragments - type FragmentSpread = { + export type FragmentSpreadNode = { kind: 'FragmentSpread'; loc?: Location; - name: Name; - directives?: Array; + name: NameNode; + directives?: Array; } - type InlineFragment = { + export type InlineFragmentNode = { kind: 'InlineFragment'; loc?: Location; - typeCondition?: NamedType; - directives?: Array; - selectionSet: SelectionSet; + typeCondition?: NamedTypeNode; + directives?: Array; + selectionSet: SelectionSetNode; } - type FragmentDefinition = { + export type FragmentDefinitionNode = { kind: 'FragmentDefinition'; loc?: Location; - name: Name; - typeCondition: NamedType; - directives?: Array; - selectionSet: SelectionSet; + name: NameNode; + typeCondition: NamedTypeNode; + directives?: Array; + selectionSet: SelectionSetNode; } // Values - type Value = Variable - | IntValue - | FloatValue - | StringValue - | BooleanValue - | EnumValue - | ListValue - | ObjectValue + export type ValueNode = VariableNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode - type IntValue = { + export type IntValueNode = { kind: 'IntValue'; loc?: Location; value: string; } - type FloatValue = { + export type FloatValueNode = { kind: 'FloatValue'; loc?: Location; value: string; } - type StringValue = { + export type StringValueNode = { kind: 'StringValue'; loc?: Location; value: string; } - type BooleanValue = { + export type BooleanValueNode = { kind: 'BooleanValue'; loc?: Location; value: boolean; } - type EnumValue = { + export type EnumValueNode = { kind: 'EnumValue'; loc?: Location; value: string; } - type ListValue = { + export type ListValueNode = { kind: 'ListValue'; loc?: Location; - values: Array; + values: Array; } - type ObjectValue = { + export type ObjectValueNode = { kind: 'ObjectValue'; loc?: Location; - fields: Array; + fields: Array; } - type ObjectField = { + export type ObjectFieldNode = { kind: 'ObjectField'; loc?: Location; - name: Name; - value: Value; + name: NameNode; + value: ValueNode; } // Directives - type Directive = { + export type DirectiveNode = { kind: 'Directive'; loc?: Location; - name: Name; - arguments?: Array; + name: NameNode; + arguments?: Array; } // Type Reference - type Type = NamedType - | ListType - | NonNullType + export type TypeNode = NamedTypeNode + | ListTypeNode + | NonNullTypeNode - type NamedType = { + export type NamedTypeNode = { kind: 'NamedType'; loc?: Location; - name: Name; + name: NameNode; }; - type ListType = { + export type ListTypeNode = { kind: 'ListType'; loc?: Location; - type: Type; + type: TypeNode; } - type NonNullType = { + export type NonNullTypeNode = { kind: 'NonNullType'; loc?: Location; - type: NamedType | ListType; + type: NamedTypeNode | ListTypeNode; } // Type System Definition - type TypeSystemDefinition = SchemaDefinition - | TypeDefinition - | TypeExtensionDefinition - | DirectiveDefinition + export type TypeSystemDefinitionNode = SchemaDefinitionNode + | TypeDefinitionNode + | TypeExtensionDefinitionNode + | DirectiveDefinitionNode - type SchemaDefinition = { + export type SchemaDefinitionNode = { kind: 'SchemaDefinition'; loc?: Location; - directives: Array; - operationTypes: Array; + directives: Array; + operationTypes: Array; } - type OperationTypeDefinition = { + export type OperationTypeDefinitionNode = { kind: 'OperationTypeDefinition'; loc?: Location; - operation: OperationType; - type: NamedType; + operation: OperationTypeNode; + type: NamedTypeNode; } - type TypeDefinition = ScalarTypeDefinition - | ObjectTypeDefinition - | InterfaceTypeDefinition - | UnionTypeDefinition - | EnumTypeDefinition - | InputObjectTypeDefinition + export type TypeDefinitionNode = ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | InputObjectTypeDefinitionNode - type ScalarTypeDefinition = { + export type ScalarTypeDefinitionNode = { kind: 'ScalarTypeDefinition'; loc?: Location; - name: Name; - directives?: Array; + name: NameNode; + directives?: Array; } - type ObjectTypeDefinition = { + export type ObjectTypeDefinitionNode = { kind: 'ObjectTypeDefinition'; loc?: Location; - name: Name; - interfaces?: Array; - directives?: Array; - fields: Array; + name: NameNode; + interfaces?: Array; + directives?: Array; + fields: Array; } - type FieldDefinition = { + export type FieldDefinitionNode = { kind: 'FieldDefinition'; loc?: Location; - name: Name; - arguments: Array; - type: Type; - directives?: Array; + name: NameNode; + arguments: Array; + type: TypeNode; + directives?: Array; } - type InputValueDefinition = { + export type InputValueDefinitionNode = { kind: 'InputValueDefinition'; loc?: Location; - name: Name; - type: Type; - defaultValue?: Value; - directives?: Array; + name: NameNode; + type: TypeNode; + defaultValue?: ValueNode; + directives?: Array; } - type InterfaceTypeDefinition = { + export type InterfaceTypeDefinitionNode = { kind: 'InterfaceTypeDefinition'; loc?: Location; - name: Name; - directives?: Array; - fields: Array; + name: NameNode; + directives?: Array; + fields: Array; } - type UnionTypeDefinition = { + export type UnionTypeDefinitionNode = { kind: 'UnionTypeDefinition'; loc?: Location; - name: Name; - directives?: Array; - types: Array; + name: NameNode; + directives?: Array; + types: Array; } - type EnumTypeDefinition = { + export type EnumTypeDefinitionNode = { kind: 'EnumTypeDefinition'; loc?: Location; - name: Name; - directives?: Array; - values: Array; + name: NameNode; + directives?: Array; + values: Array; } - type EnumValueDefinition = { + export type EnumValueDefinitionNode = { kind: 'EnumValueDefinition'; loc?: Location; - name: Name; - directives?: Array; + name: NameNode; + directives?: Array; } - type InputObjectTypeDefinition = { + export type InputObjectTypeDefinitionNode = { kind: 'InputObjectTypeDefinition'; loc?: Location; - name: Name; - directives?: Array; - fields: Array; + name: NameNode; + directives?: Array; + fields: Array; } - type TypeExtensionDefinition = { + export type TypeExtensionDefinitionNode = { kind: 'TypeExtensionDefinition'; loc?: Location; - definition: ObjectTypeDefinition; + definition: ObjectTypeDefinitionNode; } - type DirectiveDefinition = { + export type DirectiveDefinitionNode = { kind: 'DirectiveDefinition'; loc?: Location; - name: Name; - arguments?: Array; - locations: Array; + name: NameNode; + arguments?: Array; + locations: Array; } } @@ -746,6 +682,7 @@ declare module "graphql/language/kinds" { const FLOAT: 'FloatValue'; const STRING: 'StringValue'; const BOOLEAN: 'BooleanValue'; + const NULL: 'NullValue'; const ENUM: 'EnumValue'; const LIST: 'ListValue'; const OBJECT: 'ObjectValue'; @@ -883,7 +820,7 @@ declare module "graphql/language/location" { } declare module "graphql/language/parser" { - import { NamedType, Type, Value, Document } from "graphql/language/ast"; + import { NamedTypeNode, TypeNode, ValueNode, DocumentNode } from "graphql/language/ast"; import { Source } from "graphql/language/source"; import { Lexer } from "graphql/language/lexer"; @@ -906,7 +843,7 @@ declare module "graphql/language/parser" { function parse( source: string | Source, options?: ParseOptions - ): Document; + ): DocumentNode; /** * Given a string containing a GraphQL value, parse the AST for that value. @@ -918,9 +855,9 @@ declare module "graphql/language/parser" { function parseValue( source: Source | string, options?: ParseOptions - ): Value; + ): ValueNode; - function parseConstValue(lexer: Lexer): Value; + function parseConstValue(lexer: Lexer): ValueNode; /** * Type : @@ -928,12 +865,20 @@ declare module "graphql/language/parser" { * - ListType * - NonNullType */ - function parseType(lexer: Lexer): Type; + function parseType(lexer: Lexer): TypeNode; + + /** + * Type : + * - NamedType + * - ListType + * - NonNullType + */ + function parseTypeReference(lexer: Lexer): TypeNode; /** * NamedType : Name */ - function parseNamedType(lexer: Lexer): NamedType; + function parseNamedType(lexer: Lexer): NamedTypeNode; } declare module "graphql/language/printer" { @@ -971,6 +916,7 @@ declare module "graphql/language/visitor" { FloatValue: number[]; StringValue: string[]; BooleanValue: boolean[]; + NullValue: null[], EnumValue: any[]; ListValue: string[]; ObjectValue: string[]; @@ -1014,29 +960,7 @@ declare module "graphql/type/index" { // GraphQL Schema definition export { GraphQLSchema } from 'graphql/type/schema'; - export { - // Predicates - isType, - isInputType, - isOutputType, - isLeafType, - isCompositeType, - isAbstractType, - - // Un-modifiers - getNullableType, - getNamedType, - - // Definitions - GraphQLScalarType, - GraphQLObjectType, - GraphQLInterfaceType, - GraphQLUnionType, - GraphQLEnumType, - GraphQLInputObjectType, - GraphQLList, - GraphQLNonNull, - } from 'graphql/type/definition'; + export * from 'graphql/type/definition'; export { // "Enum" of Directive Locations @@ -1084,21 +1008,22 @@ declare module "graphql/type/index" { TypeNameMetaFieldDef, } from 'graphql/type/introspection'; + export { DirectiveLocationEnum } from 'graphql/type/directives'; } declare module "graphql/type/definition" { import { - OperationDefinition, - Field, - FragmentDefinition, - Value, + OperationDefinitionNode, + FieldNode, + FragmentDefinitionNode, + ValueNode, } from 'graphql/language/ast'; import { GraphQLSchema } from 'graphql/type/schema'; /** * These are all of the possible kinds of types. */ - type GraphQLType = + export type GraphQLType = GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | @@ -1108,12 +1033,14 @@ declare module "graphql/type/definition" { GraphQLList | GraphQLNonNull; - function isType(type: any): boolean; + export function isType(type: any): type is GraphQLType; + + export function assertType(type: any): GraphQLType; /** * These types may be used as input types for arguments and directives. */ - type GraphQLInputType = + export type GraphQLInputType = GraphQLScalarType | GraphQLEnumType | GraphQLInputObjectType | @@ -1125,12 +1052,14 @@ declare module "graphql/type/definition" { GraphQLList >; - function isInputType(type: GraphQLType): boolean; + export function isInputType(type: GraphQLType): type is GraphQLInputType; + + export function assertInputType(type: GraphQLType): GraphQLInputType; /** * These types may be used as output types as the result of fields. */ - type GraphQLOutputType = + export type GraphQLOutputType = GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | @@ -1146,40 +1075,48 @@ declare module "graphql/type/definition" { GraphQLList >; - function isOutputType(type: GraphQLType): boolean; + export function isOutputType(type: GraphQLType): type is GraphQLOutputType; + + export function assertOutputType(type: GraphQLType): GraphQLOutputType; /** * These types may describe types which may be leaf values. */ - type GraphQLLeafType = + export type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType; - function isLeafType(type: GraphQLType): boolean; + export function isLeafType(type: GraphQLType): type is GraphQLLeafType; + + export function assertLeafType(type: GraphQLType): GraphQLLeafType; /** * These types may describe the parent context of a selection set. */ - type GraphQLCompositeType = + export type GraphQLCompositeType = GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType; - function isCompositeType(type: GraphQLType): boolean; + export function isCompositeType(type: GraphQLType): type is GraphQLCompositeType; + + export function assertCompositeType(type: GraphQLType): GraphQLCompositeType; /** * These types may describe the parent context of a selection set. */ - type GraphQLAbstractType = + export type GraphQLAbstractType = GraphQLInterfaceType | GraphQLUnionType; - function isAbstractType(type: GraphQLType): boolean; + export function isAbstractType(type: GraphQLType): type is GraphQLAbstractType; + + export function assertAbstractType(type: GraphQLType): GraphQLAbstractType; /** * These types can all accept null as a value. */ - type GraphQLNullableType = + export type GraphQLNullableType = GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | @@ -1188,14 +1125,14 @@ declare module "graphql/type/definition" { GraphQLInputObjectType | GraphQLList; - function getNullableType( + export function getNullableType( type: T ): (T & GraphQLNullableType); /** * These named types do not include modifiers like List or NonNull. */ - type GraphQLNamedType = + export type GraphQLNamedType = GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | @@ -1203,7 +1140,7 @@ declare module "graphql/type/definition" { GraphQLEnumType | GraphQLInputObjectType; - function getNamedType(type: GraphQLType): GraphQLNamedType + export function getNamedType(type: GraphQLType): GraphQLNamedType /** * Used while defining GraphQL types to allow for circular references in @@ -1240,17 +1177,17 @@ declare module "graphql/type/definition" { parseValue(value: any): any; // Parses an externally provided literal value to use as an input. - parseLiteral(valueAST: Value): any; + parseLiteral(valueNode: ValueNode): any; toString(): string; } - interface GraphQLScalarTypeConfig { + export interface GraphQLScalarTypeConfig { name: string; description?: string; serialize: (value: any) => TInternal; parseValue?: (value: any) => TExternal; - parseLiteral?: (valueAST: Value) => TInternal; + parseLiteral?: (valueNode: ValueNode) => TInternal; } /** @@ -1293,97 +1230,99 @@ declare module "graphql/type/definition" { class GraphQLObjectType { name: string; description: string; - isTypeOf: GraphQLIsTypeOfFn; + isTypeOf: GraphQLIsTypeOfFn; - constructor(config: GraphQLObjectTypeConfig); - getFields(): GraphQLFieldDefinitionMap; + constructor(config: GraphQLObjectTypeConfig); + getFields(): GraphQLFieldMap; getInterfaces(): Array; toString(): string; } // - interface GraphQLObjectTypeConfig { + export interface GraphQLObjectTypeConfig { name: string; interfaces?: Thunk>; - fields: Thunk>; - isTypeOf?: GraphQLIsTypeOfFn; + fields: Thunk>; + isTypeOf?: GraphQLIsTypeOfFn; description?: string } - type GraphQLTypeResolveFn = ( - value: any, - context: any, + export type GraphQLTypeResolver = ( + value: TSource, + context: TContext, info: GraphQLResolveInfo ) => GraphQLObjectType; - type GraphQLIsTypeOfFn = ( - source: any, - context: any, + export type GraphQLIsTypeOfFn = ( + source: TSource, + context: TContext, info: GraphQLResolveInfo ) => boolean; - type GraphQLFieldResolveFn = ( + export type GraphQLFieldResolver = ( source: TSource, args: { [argName: string]: any }, - context: any, + context: TContext, info: GraphQLResolveInfo ) => any; - interface GraphQLResolveInfo { + export interface GraphQLResolveInfo { fieldName: string; - fieldASTs: Array; + fieldNodes: Array; returnType: GraphQLOutputType; parentType: GraphQLCompositeType; - path: Array; + path: ResponsePath; schema: GraphQLSchema; - fragments: { [fragmentName: string]: FragmentDefinition }; + fragments: { [fragmentName: string]: FragmentDefinitionNode }; rootValue: any; - operation: OperationDefinition; + operation: OperationDefinitionNode; variableValues: { [variableName: string]: any }; } - interface GraphQLFieldConfig { + export type ResponsePath = { prev: ResponsePath, key: string | number } | void; + + export interface GraphQLFieldConfig { type: GraphQLOutputType; args?: GraphQLFieldConfigArgumentMap; - resolve?: GraphQLFieldResolveFn; + resolve?: GraphQLFieldResolver; deprecationReason?: string; description?: string; } - interface GraphQLFieldConfigArgumentMap { + export interface GraphQLFieldConfigArgumentMap { [argName: string]: GraphQLArgumentConfig; } - interface GraphQLArgumentConfig { + export interface GraphQLArgumentConfig { type: GraphQLInputType; defaultValue?: any; description?: string; } - interface GraphQLFieldConfigMap { - [fieldName: string]: GraphQLFieldConfig; + export interface GraphQLFieldConfigMap { + [fieldName: string]: GraphQLFieldConfig; } - interface GraphQLFieldDefinition { + export interface GraphQLField { name: string; description: string; type: GraphQLOutputType; args: Array; - resolve: GraphQLFieldResolveFn; - isDeprecated: boolean; - deprecationReason: string; + resolve?: GraphQLFieldResolver; + isDeprecated?: boolean; + deprecationReason?: string; } - interface GraphQLArgument { + export interface GraphQLArgument { name: string; type: GraphQLInputType; defaultValue?: any; description?: string; } - interface GraphQLFieldDefinitionMap { - [fieldName: string]: GraphQLFieldDefinition; + export interface GraphQLFieldMap { + [fieldName: string]: GraphQLField; } /** @@ -1407,24 +1346,24 @@ declare module "graphql/type/definition" { class GraphQLInterfaceType { name: string; description: string; - resolveType: GraphQLTypeResolveFn; + resolveType: GraphQLTypeResolver; - constructor(config: GraphQLInterfaceTypeConfig); + constructor(config: GraphQLInterfaceTypeConfig); - getFields(): GraphQLFieldDefinitionMap; + getFields(): GraphQLFieldMap; toString(): string; } - interface GraphQLInterfaceTypeConfig { + export interface GraphQLInterfaceTypeConfig { name: string, - fields: Thunk>, + fields: Thunk>, /** * Optionally provide a custom type resolver function. If one is not provided, * the default implementation will call `isTypeOf` on each implementing * Object type. */ - resolveType?: GraphQLTypeResolveFn, + resolveType?: GraphQLTypeResolver, description?: string } @@ -1454,16 +1393,16 @@ declare module "graphql/type/definition" { class GraphQLUnionType { name: string; description: string; - resolveType: GraphQLTypeResolveFn; + resolveType: GraphQLTypeResolver; - constructor(config: GraphQLUnionTypeConfig); + constructor(config: GraphQLUnionTypeConfig); getTypes(): Array; toString(): string; } - interface GraphQLUnionTypeConfig { + export interface GraphQLUnionTypeConfig { name: string, types: Thunk>, /** @@ -1471,7 +1410,7 @@ declare module "graphql/type/definition" { * the default implementation will call `isTypeOf` on each implementing * Object type. */ - resolveType?: GraphQLTypeResolveFn; + resolveType?: GraphQLTypeResolver; description?: string; } @@ -1501,30 +1440,30 @@ declare module "graphql/type/definition" { description: string; constructor(config: GraphQLEnumTypeConfig); - getValues(): Array; + getValues(): Array; serialize(value: any): string; parseValue(value: any): any; - parseLiteral(valueAST: Value): any; + parseLiteral(valueNode: ValueNode): any; toString(): string; } - interface GraphQLEnumTypeConfig { + export interface GraphQLEnumTypeConfig { name: string; values: GraphQLEnumValueConfigMap; description?: string; } - interface GraphQLEnumValueConfigMap { + export interface GraphQLEnumValueConfigMap { [valueName: string]: GraphQLEnumValueConfig; } - interface GraphQLEnumValueConfig { + export interface GraphQLEnumValueConfig { value?: any; deprecationReason?: string; description?: string; } - interface GraphQLEnumValueDefinition { + export interface GraphQLEnumValue { name: string; description: string; deprecationReason: string; @@ -1554,36 +1493,36 @@ declare module "graphql/type/definition" { class GraphQLInputObjectType { name: string; description: string; - constructor(config: InputObjectConfig); - getFields(): InputObjectFieldMap; + constructor(config: GraphQLInputObjectTypeConfig); + getFields(): GraphQLInputFieldMap; toString(): string; } - interface InputObjectConfig { + export interface GraphQLInputObjectTypeConfig { name: string; - fields: Thunk; + fields: Thunk; description?: string; } - interface InputObjectFieldConfig { + export interface GraphQLInputFieldConfig { type: GraphQLInputType; defaultValue?: any; description?: string; } - interface InputObjectConfigFieldMap { - [fieldName: string]: InputObjectFieldConfig; + export interface GraphQLInputFieldConfigMap { + [fieldName: string]: GraphQLInputFieldConfig; } - interface InputObjectField { + export interface GraphQLInputField { name: string; type: GraphQLInputType; defaultValue?: any; description?: string; } - interface InputObjectFieldMap { - [fieldName: string]: InputObjectField; + export interface GraphQLInputFieldMap { + [fieldName: string]: GraphQLInputField; } /** @@ -1727,7 +1666,7 @@ declare module "graphql/type/introspection" { GraphQLList, GraphQLNonNull, } from 'graphql/type/definition'; - import { GraphQLFieldDefinition } from 'graphql/type/definition'; + import { GraphQLField } from 'graphql/type/definition'; const __Schema: GraphQLObjectType; const __Directive: GraphQLObjectType; @@ -1751,12 +1690,12 @@ declare module "graphql/type/introspection" { const __TypeKind: GraphQLEnumType; /** - * Note that these are GraphQLFieldDefinition and not GraphQLFieldConfig, + * Note that these are GraphQLField and not GraphQLFieldConfig, * so the format for args is different. */ - const SchemaMetaFieldDef: GraphQLFieldDefinition; - const TypeMetaFieldDef: GraphQLFieldDefinition; - const TypeNameMetaFieldDef: GraphQLFieldDefinition; + const SchemaMetaFieldDef: GraphQLField; + const TypeMetaFieldDef: GraphQLField; + const TypeNameMetaFieldDef: GraphQLField; } declare module "graphql/type/scalars" { @@ -1852,7 +1791,7 @@ declare module "graphql/validation" { } declare module "graphql/validation/index" { - export { validate } from 'graphql/validation/validate'; + export { validate, ValidationContext } from 'graphql/validation/validate'; export { specifiedRules } from 'graphql/validation/specifiedRules'; } @@ -1869,19 +1808,19 @@ declare module "graphql/validation/specifiedRules" { declare module "graphql/validation/validate" { import { GraphQLError } from 'graphql/error'; import { - Document, - OperationDefinition, - Variable, - SelectionSet, - FragmentSpread, - FragmentDefinition, + DocumentNode, + OperationDefinitionNode, + VariableNode, + SelectionSetNode, + FragmentSpreadNode, + FragmentDefinitionNode, } from 'graphql/language/ast'; import { GraphQLSchema } from 'graphql/type/schema'; import { GraphQLInputType, GraphQLOutputType, GraphQLCompositeType, - GraphQLFieldDefinition, + GraphQLField, GraphQLArgument } from 'graphql/type/definition'; import { GraphQLDirective } from 'graphql/type/directives'; @@ -1905,7 +1844,7 @@ declare module "graphql/validation/validate" { */ function validate( schema: GraphQLSchema, - ast: Document, + ast: DocumentNode, rules?: Array ): Array; @@ -1918,13 +1857,13 @@ declare module "graphql/validation/validate" { function visitUsingRules( schema: GraphQLSchema, typeInfo: TypeInfo, - documentAST: Document, + documentAST: DocumentNode, rules: Array ): Array; - type HasSelectionSet = OperationDefinition | FragmentDefinition; + type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; interface VariableUsage { - node: Variable, + node: VariableNode, type: GraphQLInputType } @@ -1934,27 +1873,27 @@ declare module "graphql/validation/validate" { * validation rule. */ export class ValidationContext { - constructor(schema: GraphQLSchema, ast: Document, typeInfo: TypeInfo); + constructor(schema: GraphQLSchema, ast: DocumentNode, typeInfo: TypeInfo); reportError(error: GraphQLError): void; getErrors(): Array; getSchema(): GraphQLSchema; - getDocument(): Document; + getDocument(): DocumentNode; - getFragment(name: string): FragmentDefinition; + getFragment(name: string): FragmentDefinitionNode; - getFragmentSpreads(node: SelectionSet): Array; + getFragmentSpreads(node: SelectionSetNode): Array; getRecursivelyReferencedFragments( - operation: OperationDefinition - ): Array; + operation: OperationDefinitionNode + ): Array; - getVariableUsages(node: HasSelectionSet): Array; + getVariableUsages(node: NodeWithSelectionSet): Array; getRecursiveVariableUsages( - operation: OperationDefinition + operation: OperationDefinitionNode ): Array; getType(): GraphQLOutputType; @@ -1963,7 +1902,7 @@ declare module "graphql/validation/validate" { getInputType(): GraphQLInputType; - getFieldDef(): GraphQLFieldDefinition; + getFieldDef(): GraphQLField; getDirective(): GraphQLDirective; @@ -1981,20 +1920,21 @@ declare module "graphql/execution" { } declare module "graphql/execution/index" { - export { execute } from 'graphql/execution/execute'; + export { execute, defaultFieldResolver, responsePathAsArray, ExecutionResult } from 'graphql/execution/execute'; } declare module "graphql/execution/execute" { import { GraphQLError, locatedError } from 'graphql/error'; import { GraphQLSchema } from 'graphql/type/schema'; + import { GraphQLField, GraphQLFieldResolver, ResponsePath } from 'graphql/type/definition'; import { - Directive, - Document, - OperationDefinition, - SelectionSet, - Field, - InlineFragment, - FragmentDefinition + DirectiveNode, + DocumentNode, + OperationDefinitionNode, + SelectionSetNode, + FieldNode, + InlineFragmentNode, + FragmentDefinitionNode, } from 'graphql/language/ast'; /** * Data that must be available at all points during query execution. @@ -2004,9 +1944,9 @@ declare module "graphql/execution/execute" { */ interface ExecutionContext { schema: GraphQLSchema; - fragments: { [key: string]: FragmentDefinition }; + fragments: { [key: string]: FragmentDefinitionNode }; rootValue: any; - operation: OperationDefinition; + operation: OperationDefinitionNode; variableValues: { [key: string]: any }; errors: Array; } @@ -2016,8 +1956,8 @@ declare module "graphql/execution/execute" { * query, `errors` is null if no errors occurred, and is a * non-empty array if an error occurred. */ - interface ExecutionResult { - data: Object; + export interface ExecutionResult { + data?: {[key: string]: any}; errors?: Array; } @@ -2031,20 +1971,39 @@ declare module "graphql/execution/execute" { */ function execute( schema: GraphQLSchema, - documentAST: Document, + document: DocumentNode, rootValue?: any, contextValue?: any, variableValues?: { [key: string]: any }, operationName?: string - ): Promise + ): Promise; + + /** + * Given a ResponsePath (found in the `path` entry in the information provided + * as the last argument to a field resolver), return an Array of the path keys. + */ + export function responsePathAsArray( + path: ResponsePath + ): Array; + + function addPath(prev: ResponsePath, key: string | number): any; + + /** + * If a resolve function is not given, then a default resolve behavior is used + * which takes the property of the source object of the same name as the field + * and returns it as the result, or if it's a function, returns the result + * of calling that function while passing along args and context. + */ + export const defaultFieldResolver: GraphQLFieldResolver; } declare module "graphql/execution/values" { - import { GraphQLInputType, GraphQLArgument } from 'graphql/type/definition'; + import { GraphQLInputType, GraphQLField, GraphQLArgument } from 'graphql/type/definition'; + import { GraphQLDirective } from 'graphql/type/directives'; import { GraphQLSchema } from 'graphql/type/schema'; - import { Argument, VariableDefinition } from 'graphql/language/ast'; + import { FieldNode, DirectiveNode, VariableDefinitionNode } from 'graphql/language/ast'; /** * Prepares an object map of variableValues of the correct type based on the * provided variable definitions and arbitrary input. If the input cannot be @@ -2052,7 +2011,7 @@ declare module "graphql/execution/values" { */ function getVariableValues( schema: GraphQLSchema, - definitionASTs: Array, + varDefNodes: Array, inputs: { [key: string]: any } ): { [key: string]: any } @@ -2061,8 +2020,8 @@ declare module "graphql/execution/values" { * definitions and list of argument AST nodes. */ function getArgumentValues( - argDefs: Array, - argASTs: Array, + def: GraphQLField | GraphQLDirective, + node: FieldNode | DirectiveNode, variableValues?: { [key: string]: any } ): { [key: string]: any }; } @@ -2078,7 +2037,7 @@ declare module "graphql/error/index" { export { GraphQLError } from 'graphql/error/GraphQLError'; export { syntaxError } from 'graphql/error/syntaxError'; export { locatedError } from 'graphql/error/locatedError'; - export { formatError } from 'graphql/error/formatError'; + export { formatError, GraphQLFormattedError, GraphQLErrorLocation } from 'graphql/error/formatError'; } declare module "graphql/error/formatError" { @@ -2092,7 +2051,8 @@ declare module "graphql/error/formatError" { type GraphQLFormattedError = { message: string, - locations: Array + locations: Array, + path: Array }; type GraphQLErrorLocation = { @@ -2103,7 +2063,7 @@ declare module "graphql/error/formatError" { declare module "graphql/error/GraphQLError" { import { getLocation } from 'graphql/language'; - import { Node } from 'graphql/language/ast'; + import { ASTNode } from 'graphql/language/ast'; import { Source } from 'graphql/language/source'; /** @@ -2131,7 +2091,7 @@ declare module "graphql/error/GraphQLError" { * * Enumerable, and appears in the result of JSON.stringify(). */ - locations: Array<{ line: number, column: number }> | void; + locations?: Array<{ line: number, column: number }> | void; /** * An array describing the JSON-path into the execution response which @@ -2139,28 +2099,37 @@ declare module "graphql/error/GraphQLError" { * * Enumerable, and appears in the result of JSON.stringify(). */ - path: Array | void; + path?: Array | void; /** * An array of GraphQL AST Nodes corresponding to this error. */ - nodes: Array | void; + nodes?: Array | void; /** * The source GraphQL document corresponding to this error. */ - source: Source | void; + source?: Source | void; /** * An array of character offsets within the source GraphQL document * which correspond to this error. */ - positions: Array | void; + positions?: Array | void; /** * The original error thrown from a field resolver during execution. */ - originalError: Error; + originalError?: Error; + + constructor( + message: string, + nodes?: Array, + source?: Source, + positions?: Array, + path?: Array, + originalError?: Error, + ); } } @@ -2197,194 +2166,702 @@ declare module "graphql/error/syntaxError" { /////////////////////////// // graphql/utilities // /////////////////////////// -// declare module "graphql/utilities/index" { -// // The GraphQL query recommended for a full schema introspection. -// export { introspectionQuery } from 'graphql/utilities/introspectionQuery'; - -// // Gets the target Operation from a Document -// export { getOperationAST } from 'graphql/utilities/getOperationAST'; - -// // Build a GraphQLSchema from an introspection result. -// export { buildClientSchema } from 'graphql/utilities/buildClientSchema'; - -// // Build a GraphQLSchema from GraphQL Schema language. -// export { buildASTSchema, buildSchema } from 'graphql/utilities/buildASTSchema'; - -// // Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. -// export { extendSchema } from 'graphql/utilities/extendSchema'; - -// // Print a GraphQLSchema to GraphQL Schema language. -// export { printSchema, printIntrospectionSchema } from 'graphql/utilities/schemaPrinter'; - -// // Create a GraphQLType from a GraphQL language AST. -// export { typeFromAST } from 'graphql/utilities/typeFromAST'; - -// // Create a JavaScript value from a GraphQL language AST. -// export { valueFromAST } from 'graphql/utilities/valueFromAST'; - -// // Create a GraphQL language AST from a JavaScript value. -// export { astFromValue } from 'graphql/utilities/astFromValue'; - -// // A helper to use within recursive-descent visitors which need to be aware of -// // the GraphQL type system. -// export { TypeInfo } from 'graphql/utilities/TypeInfo'; - -// // Determine if JavaScript values adhere to a GraphQL type. -// export { isValidJSValue } from 'graphql/utilities/isValidJSValue'; - -// // Determine if AST values adhere to a GraphQL type. -// export { isValidLiteralValue } from 'graphql/utilities/isValidLiteralValue'; - -// // Concatenates multiple AST together. -// export { concatAST } from 'graphql/utilities/concatAST'; - -// // Separates an AST into an AST per Operation. -// export { separateOperations } from 'graphql/utilities/separateOperations'; - -// // Comparators for types -// export { -// isEqualType, -// isTypeSubTypeOf, -// doTypesOverlap -// } from 'graphql/utilities/typeComparators'; - -// // Asserts that a string is a valid GraphQL name -// export { assertValidName } from 'graphql/utilities/assertValidName'; -// } - -// declare module "graphql/utilities/assertValidName" { -// // Helper to assert that provided names are valid. -// function assertValidName(name: string): void; -// } - -// declare module "graphql/utilities/astFromValue" { -// import { -// Value, -// //IntValue, -// //FloatValue, -// //StringValue, -// //BooleanValue, -// //EnumValue, -// //ListValue, -// //ObjectValue, -// } from 'graphql/language/ast'; -// import { GraphQLInputType } from 'graphql/type/definition'; - -// /** -// * Produces a GraphQL Value AST given a JavaScript value. -// * -// * A GraphQL type must be provided, which will be used to interpret different -// * JavaScript values. -// * -// * | JSON Value | GraphQL Value | -// * | ------------- | -------------------- | -// * | Object | Input Object | -// * | Array | List | -// * | Boolean | Boolean | -// * | String | String / Enum Value | -// * | Number | Int / Float | -// * | Mixed | Enum Value | -// * -// */ -// // TODO: this should set overloads according to above the table -// export function astFromValue( -// value: any, -// type: GraphQLInputType -// ): Value // Warning: there is a code in bottom: throw new TypeError - -// } - -// declare module "graphql/utilities/buildASTSchema" { -// import { Document } from 'graphql/language/ast'; -// import { Source } from 'graphql/language/source'; -// import { GraphQLSchema } from 'graphql/type/schema'; - -// /** -// * This takes the ast of a schema document produced by the parse function in -// * src/language/parser.js. -// * -// * If no schema definition is provided, then it will look for types named Query -// * and Mutation. -// * -// * Given that AST it constructs a GraphQLSchema. The resulting schema -// * has no resolve methods, so execution will use default resolvers. -// */ -// function buildASTSchema(ast: Document): GraphQLSchema; - -// /** -// * Given an ast node, returns its string description based on a contiguous -// * block full-line of comments preceding it. -// */ -// function getDescription(node: { loc?: Location }): string; - -// /** -// * A helper function to build a GraphQLSchema directly from a source -// * document. -// */ -// function buildSchema(source: string | Source): GraphQLSchema; -// } - -// declare module "graphql/utilities/buildClientSchema" { -// import { IntrospectionQuery } from 'graphql/utilities/introspectionQuery'; -// import { GraphQLSchema } from 'graphql/type/schema'; -// /** -// * Build a GraphQLSchema for use by client tools. -// * -// * Given the result of a client running the introspection query, creates and -// * returns a GraphQLSchema instance which can be then used with all graphql-js -// * tools, but cannot be used to execute a query, as introspection does not -// * represent the "resolver", "parse" or "serialize" functions or any other -// * server-internal mechanisms. -// */ -// export function buildClientSchema( -// introspection: IntrospectionQuery -// ): GraphQLSchema; -// } - -// declare module "graphql/utilities/concatAST" { - -// } - -// declare module "graphql/utilities/extendSchema" { - -// } - -// declare module "graphql/utilities/getOperationAST" { - -// } - -// declare module "graphql/utilities/introspectionQuery" { - -// } - -// declare module "graphql/utilities/isValidJSValue" { - -// } - -// declare module "graphql/utilities/isValidLiteralValue" { - -// } - -// declare module "graphql/utilities/schemaPrinter" { - -// } - -// declare module "graphql/utilities/separateOperations" { - -// } - -// declare module "graphql/utilities/typeComparators" { - -// } - -// declare module "graphql/utilities/typeFromAST" { - -// } - -declare module "graphql/utilities/TypeInfo" { - class TypeInfo { } +declare module "graphql/utilities" { + export * from "graphql/utilities/index"; } -// declare module "graphql/utilities/valueFromAST" { +declare module "graphql/utilities/index" { + // The GraphQL query recommended for a full schema introspection. + export { introspectionQuery } from 'graphql/utilities/introspectionQuery'; + export { + IntrospectionQuery, + IntrospectionSchema, + IntrospectionType, + IntrospectionScalarType, + IntrospectionObjectType, + IntrospectionInterfaceType, + IntrospectionUnionType, + IntrospectionEnumType, + IntrospectionInputObjectType, + IntrospectionTypeRef, + IntrospectionNamedTypeRef, + IntrospectionListTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionField, + IntrospectionInputValue, + IntrospectionEnumValue, + IntrospectionDirective, + } from 'graphql/utilities/introspectionQuery'; -// } + // Gets the target Operation from a Document + export { getOperationAST } from 'graphql/utilities/getOperationAST'; + + // Build a GraphQLSchema from an introspection result. + export { buildClientSchema } from 'graphql/utilities/buildClientSchema'; + + // Build a GraphQLSchema from GraphQL Schema language. + export { buildASTSchema, buildSchema } from 'graphql/utilities/buildASTSchema'; + + // Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. + export { extendSchema } from 'graphql/utilities/extendSchema'; + + // Print a GraphQLSchema to GraphQL Schema language. + export { printSchema, printType, printIntrospectionSchema } from 'graphql/utilities/schemaPrinter'; + + // Create a GraphQLType from a GraphQL language AST. + export { typeFromAST } from 'graphql/utilities/typeFromAST'; + + // Create a JavaScript value from a GraphQL language AST. + export { valueFromAST } from 'graphql/utilities/valueFromAST'; + + // Create a GraphQL language AST from a JavaScript value. + export { astFromValue } from 'graphql/utilities/astFromValue'; + + // A helper to use within recursive-descent visitors which need to be aware of + // the GraphQL type system. + export { TypeInfo } from 'graphql/utilities/TypeInfo'; + + // Determine if JavaScript values adhere to a GraphQL type. + export { isValidJSValue } from 'graphql/utilities/isValidJSValue'; + + // Determine if AST values adhere to a GraphQL type. + export { isValidLiteralValue } from 'graphql/utilities/isValidLiteralValue'; + + // Concatenates multiple AST together. + export { concatAST } from 'graphql/utilities/concatAST'; + + // Separates an AST into an AST per Operation. + export { separateOperations } from 'graphql/utilities/separateOperations'; + + // Comparators for types + export { + isEqualType, + isTypeSubTypeOf, + doTypesOverlap + } from 'graphql/utilities/typeComparators'; + + // Asserts that a string is a valid GraphQL name + export { assertValidName } from 'graphql/utilities/assertValidName'; + + // Compares two GraphQLSchemas and detects breaking changes. + export { findBreakingChanges } from 'graphql/utilities/findBreakingChanges'; + export { BreakingChange } from 'graphql/utilities/findBreakingChanges'; +} + +declare module "graphql/utilities/assertValidName" { + // Helper to assert that provided names are valid. + function assertValidName(name: string): void; +} + +declare module "graphql/utilities/astFromValue" { + import { + ValueNode, + //IntValueNode, + //FloatValueNode, + //StringValueNode, + //BooleanValueNode, + //EnumValueNode, + //ListValueNode, + //ObjectValueNode, + } from 'graphql/language/ast'; + import { GraphQLInputType } from 'graphql/type/definition'; + + /** + * Produces a GraphQL Value AST given a JavaScript value. + * + * A GraphQL type must be provided, which will be used to interpret different + * JavaScript values. + * + * | JSON Value | GraphQL Value | + * | ------------- | -------------------- | + * | Object | Input Object | + * | Array | List | + * | Boolean | Boolean | + * | String | String / Enum Value | + * | Number | Int / Float | + * | Mixed | Enum Value | + * + */ + // TODO: this should set overloads according to above the table + export function astFromValue( + value: any, + type: GraphQLInputType + ): ValueNode // Warning: there is a code in bottom: throw new TypeError +} + +declare module "graphql/utilities/buildASTSchema" { + import { DocumentNode, Location } from 'graphql/language/ast'; + import { Source } from 'graphql/language/source'; + import { GraphQLSchema } from 'graphql/type/schema'; + + /** + * This takes the ast of a schema document produced by the parse function in + * src/language/parser.js. + * + * If no schema definition is provided, then it will look for types named Query + * and Mutation. + * + * Given that AST it constructs a GraphQLSchema. The resulting schema + * has no resolve methods, so execution will use default resolvers. + */ + function buildASTSchema(ast: DocumentNode): GraphQLSchema; + + /** + * Given an ast node, returns its string description based on a contiguous + * block full-line of comments preceding it. + */ + function getDescription(node: { loc?: Location }): string; + + /** + * A helper function to build a GraphQLSchema directly from a source + * document. + */ + function buildSchema(source: string | Source): GraphQLSchema; + + /** + * Given an ast node, returns its string description based on a contiguous + * block full-line of comments preceding it. + */ + function getDescription(node: { loc?: Location }): string; + + /** + * A helper function to build a GraphQLSchema directly from a source + * document. + */ + function buildSchema(source: string | Source): GraphQLSchema; +} + +declare module "graphql/utilities/buildClientSchema" { + import { IntrospectionQuery } from 'graphql/utilities/introspectionQuery'; + import { GraphQLSchema } from 'graphql/type/schema'; + /** + * Build a GraphQLSchema for use by client tools. + * + * Given the result of a client running the introspection query, creates and + * returns a GraphQLSchema instance which can be then used with all graphql-js + * tools, but cannot be used to execute a query, as introspection does not + * represent the "resolver", "parse" or "serialize" functions or any other + * server-internal mechanisms. + */ + function buildClientSchema( + introspection: IntrospectionQuery + ): GraphQLSchema; +} + +declare module "graphql/utilities/concatAST" { + import { DocumentNode } from 'graphql/language/ast'; + /** + * Provided a collection of ASTs, presumably each from different files, + * concatenate the ASTs together into batched AST, useful for validating many + * GraphQL source files which together represent one conceptual application. + */ + function concatAST(asts: Array): DocumentNode; +} + +declare module "graphql/utilities/extendSchema" { + import { DocumentNode } from 'graphql/language/ast'; + import { GraphQLSchema } from 'graphql/type/schema'; + + /** + * Produces a new schema given an existing schema and a document which may + * contain GraphQL type extensions and definitions. The original schema will + * remain unaltered. + * + * Because a schema represents a graph of references, a schema cannot be + * extended without effectively making an entire copy. We do not know until it's + * too late if subgraphs remain unchanged. + * + * This algorithm copies the provided schema, applying extensions while + * producing the copy. The original schema remains unaltered. + */ + function extendSchema( + schema: GraphQLSchema, + documentAST: DocumentNode + ): GraphQLSchema; +} + +declare module "graphql/utilities/findBreakingChanges" { + import { + getNamedType, + GraphQLScalarType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLObjectType, + GraphQLUnionType, + GraphQLNamedType, + } from 'graphql/type/definition'; + import { GraphQLSchema } from 'graphql/type/schema'; + + export const BreakingChangeType: { + FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND', + FIELD_REMOVED: 'FIELD_REMOVED', + TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND', + TYPE_REMOVED: 'TYPE_REMOVED', + TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION', + VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM', + }; + + type BreakingChangeKey = 'FIELD_CHANGED_KIND' + | 'FIELD_REMOVED' + | 'TYPE_CHANGED_KIND' + | 'TYPE_REMOVED' + | 'TYPE_REMOVED_FROM_UNION' + | 'VALUE_REMOVED_FROM_ENUM'; + + export type BreakingChange = { + type: BreakingChangeKey; + description: string; + }; + + /** + * Given two schemas, returns an Array containing descriptions of all the types + * of breaking changes covered by the other functions down below. + */ + export function findBreakingChanges( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema + ): Array + + /** + * Given two schemas, returns an Array containing descriptions of any breaking + * changes in the newSchema related to removing an entire type. + */ + export function findRemovedTypes( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema + ): Array + + /** + * Given two schemas, returns an Array containing descriptions of any breaking + * changes in the newSchema related to changing the type of a type. + */ + export function findTypesThatChangedKind( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema + ): Array + + /** + * Given two schemas, returns an Array containing descriptions of any breaking + * changes in the newSchema related to the fields on a type. This includes if + * a field has been removed from a type or if a field has changed type. + */ + export function findFieldsThatChangedType( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema + ): Array; + + /** + * Given two schemas, returns an Array containing descriptions of any breaking + * changes in the newSchema related to removing types from a union type. + */ + export function findTypesRemovedFromUnions( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema + ): Array; + + /** + * Given two schemas, returns an Array containing descriptions of any breaking + * changes in the newSchema related to removing values from an enum type. + */ + export function findValuesRemovedFromEnums( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema + ): Array; +} + +declare module "graphql/utilities/getOperationAST" { + import { DocumentNode, OperationDefinitionNode } from 'graphql/language/ast'; + + /** + * Returns an operation AST given a document AST and optionally an operation + * name. If a name is not provided, an operation is only returned if only one is + * provided in the document. + */ + export function getOperationAST( + documentAST: DocumentNode, + operationName: string + ): OperationDefinitionNode; +} + +declare module "graphql/utilities/introspectionQuery" { + import { DirectiveLocationEnum } from 'graphql/type/directives'; + + /* + query IntrospectionQuery { + __schema { + queryType { name } + mutationType { name } + subscriptionType { name } + types { + ...FullType + } + directives { + name + description + locations + args { + ...InputValue + } + } + } + } + + fragment FullType on __Type { + kind + name + description + fields(includeDeprecated: true) { + name + description + args { + ...InputValue + } + type { + ...TypeRef + } + isDeprecated + deprecationReason + } + inputFields { + ...InputValue + } + interfaces { + ...TypeRef + } + enumValues(includeDeprecated: true) { + name + description + isDeprecated + deprecationReason + } + possibleTypes { + ...TypeRef + } + } + + fragment InputValue on __InputValue { + name + description + type { ...TypeRef } + defaultValue + } + + fragment TypeRef on __Type { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + } + } + } + } + } + } + } + } + */ + const introspectionQuery: string; + + + interface IntrospectionQuery { + __schema: IntrospectionSchema + } + + interface IntrospectionSchema { + queryType: IntrospectionNamedTypeRef; + mutationType?: IntrospectionNamedTypeRef; + subscriptionType?: IntrospectionNamedTypeRef; + types: Array; + directives: Array; + } + + type IntrospectionType = + IntrospectionScalarType | + IntrospectionObjectType | + IntrospectionInterfaceType | + IntrospectionUnionType | + IntrospectionEnumType | + IntrospectionInputObjectType; + + interface IntrospectionScalarType { + kind: 'SCALAR'; + name: string; + description?: string; + } + + interface IntrospectionObjectType { + kind: 'OBJECT'; + name: string; + description?: string; + fields: Array; + interfaces: Array; + } + + interface IntrospectionInterfaceType { + kind: 'INTERFACE'; + name: string; + description?: string; + fields: Array; + possibleTypes: Array; + } + + interface IntrospectionUnionType { + kind: 'UNION'; + name: string; + description?: string; + possibleTypes: Array; + } + + interface IntrospectionEnumType { + kind: 'ENUM'; + name: string; + description?: string; + enumValues: Array; + } + + interface IntrospectionInputObjectType { + kind: 'INPUT_OBJECT'; + name: string; + description?: string; + inputFields: Array; + } + + type IntrospectionTypeRef = + IntrospectionNamedTypeRef | + IntrospectionListTypeRef | + IntrospectionNonNullTypeRef + + interface IntrospectionNamedTypeRef { + kind: string; + name: string; + } + + interface IntrospectionListTypeRef { + kind: 'LIST'; + ofType?: IntrospectionTypeRef; + } + + interface IntrospectionNonNullTypeRef { + kind: 'NON_NULL'; + ofType?: IntrospectionTypeRef; + } + + interface IntrospectionField { + name: string; + description?: string; + args: Array; + type: IntrospectionTypeRef; + isDeprecated: boolean; + deprecationReason?: string; + } + + interface IntrospectionInputValue { + name: string; + description?: string; + type: IntrospectionTypeRef; + defaultValue?: string; + } + + interface IntrospectionEnumValue { + name: string; + description?: string; + isDeprecated: boolean; + deprecationReason?: string; + } + + interface IntrospectionDirective { + name: string; + description?: string; + locations: Array; + args: Array; + } +} + +declare module "graphql/utilities/isValidJSValue" { + import { GraphQLInputType } from 'graphql/type/definition'; + + /** + * Given a JavaScript value and a GraphQL type, determine if the value will be + * accepted for that type. This is primarily useful for validating the + * runtime values of query variables. + */ + function isValidJSValue( + value: any, + type: GraphQLInputType + ): Array +} + +declare module "graphql/utilities/isValidLiteralValue" { + import { ValueNode } from 'graphql/language/ast'; + import { GraphQLInputType } from 'graphql/type/definition'; + + /** + * Utility for validators which determines if a value literal AST is valid given + * an input type. + * + * Note that this only validates literal values, variables are assumed to + * provide values of the correct type. + */ + function isValidLiteralValue( + type: GraphQLInputType, + valueNode: ValueNode + ): Array +} + +declare module "graphql/utilities/schemaPrinter" { + import { GraphQLSchema } from 'graphql/type/schema'; + import { GraphQLType } from 'graphql/type/definition'; + + function printSchema(schema: GraphQLSchema): string; + + function printIntrospectionSchema(schema: GraphQLSchema): string; + + function printType(type: GraphQLType): string +} + +declare module "graphql/utilities/separateOperations" { + import { + DocumentNode, + OperationDefinitionNode, + } from 'graphql/language/ast'; + + function separateOperations( + documentAST: DocumentNode + ): { [operationName: string]: DocumentNode } +} + +declare module "graphql/utilities/typeComparators" { + import { + GraphQLType, + GraphQLCompositeType, + GraphQLAbstractType + } from 'graphql/type/definition'; + import { + GraphQLSchema + } from 'graphql/type/schema'; + + /** + * Provided two types, return true if the types are equal (invariant). + */ + function isEqualType(typeA: GraphQLType, typeB: GraphQLType): boolean; + + /** + * Provided a type and a super type, return true if the first type is either + * equal or a subset of the second super type (covariant). + */ + function isTypeSubTypeOf( + schema: GraphQLSchema, + maybeSubType: GraphQLType, + superType: GraphQLType + ): boolean; + + /** + * Provided two composite types, determine if they "overlap". Two composite + * types overlap when the Sets of possible concrete types for each intersect. + * + * This is often used to determine if a fragment of a given type could possibly + * be visited in a context of another type. + * + * This function is commutative. + */ + function doTypesOverlap( + schema: GraphQLSchema, + typeA: GraphQLCompositeType, + typeB: GraphQLCompositeType + ): boolean; +} + +declare module "graphql/utilities/typeFromAST" { + import { TypeNode } from 'graphql/language/ast'; + import { GraphQLType, GraphQLNullableType } from 'graphql/type/definition'; + import { GraphQLSchema } from 'graphql/type/schema'; + + function typeFromAST( + schema: GraphQLSchema, + typeNode: TypeNode + ): GraphQLType +} + +declare module "graphql/utilities/TypeInfo" { + import { GraphQLSchema } from 'graphql/type/schema'; + import { + GraphQLOutputType, + GraphQLCompositeType, + GraphQLInputType, + GraphQLField, + GraphQLArgument, + GraphQLType, + } from 'graphql/type/definition'; + import { GraphQLDirective } from 'graphql/type/directives'; + import { ASTNode, FieldNode } from 'graphql/language/ast'; + + /** + * TypeInfo is a utility class which, given a GraphQL schema, can keep track + * of the current field and type definitions at any point in a GraphQL document + * AST during a recursive descent by calling `enter(node)` and `leave(node)`. + */ + class TypeInfo { + constructor( + schema: GraphQLSchema, + // NOTE: this experimental optional second parameter is only needed in order + // to support non-spec-compliant codebases. You should never need to use it. + // It may disappear in the future. + getFieldDefFn: getFieldDef + ); + + getType(): GraphQLOutputType; + getParentType(): GraphQLCompositeType; + getInputType(): GraphQLInputType; + getFieldDef(): GraphQLField; + getDirective(): GraphQLDirective; + getArgument(): GraphQLArgument; + enter(node: ASTNode): any; + leave(node: ASTNode): any; + } + + export interface getFieldDef { + ( + schema: GraphQLSchema, + parentType: GraphQLType, + fieldNode: FieldNode + ): GraphQLField + } +} + +declare module "graphql/utilities/valueFromAST" { + import { GraphQLInputType } from 'graphql/type/definition'; + import { + ValueNode, + VariableNode, + ListValueNode, + ObjectValueNode + } from 'graphql/language/ast'; + + function valueFromAST( + valueNode: ValueNode, + type: GraphQLInputType, + variables?: { + [key: string]: any + } + ): any; +} diff --git a/graphql/tsconfig.json b/graphql/tsconfig.json index 667f0430fb..074faa4e94 100644 --- a/graphql/tsconfig.json +++ b/graphql/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/graphviz/tsconfig.json b/graphviz/tsconfig.json index 2cea24a109..bf378d1302 100644 --- a/graphviz/tsconfig.json +++ b/graphviz/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gravatar/tsconfig.json b/gravatar/tsconfig.json index 156eb0500c..68ca420384 100644 --- a/gravatar/tsconfig.json +++ b/gravatar/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/greasemonkey/tsconfig.json b/greasemonkey/tsconfig.json index 267da618da..a03172bb20 100644 --- a/greasemonkey/tsconfig.json +++ b/greasemonkey/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/grecaptcha/tsconfig.json b/grecaptcha/tsconfig.json index 0dd4b139f3..e33355d32f 100644 --- a/grecaptcha/tsconfig.json +++ b/grecaptcha/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/greensock/index.d.ts b/greensock/index.d.ts index 95c2ad6a4c..65f7ee52e7 100644 --- a/greensock/index.d.ts +++ b/greensock/index.d.ts @@ -44,7 +44,7 @@ declare type TweenConfig = { autoCSS?: boolean; callbackScope?: Object; } - + //com.greensock.core declare class Animation { static ticker: IDispatcher; @@ -161,7 +161,7 @@ declare class TimelineLite extends SimpleTimeline { static exportRoot(vars?: Object, omitDelayedCalls?: boolean): TimelineLite; from(target: Object, duration: number, vars: Object, position?: any): TimelineLite; fromTo(target: Object, duration: number, fromVars: Object, toVars: Object, position?: any): TimelineLite; - getChildren(nested?: boolean, tweens?: boolean, timelines?: boolean, ignoreBeforeTime?: number): Tween | Timeline[]; + getChildren(nested?: boolean, tweens?: boolean, timelines?: boolean, ignoreBeforeTime?: number): (Tween | Timeline)[]; getLabelTime(label: string): number; getTweensOf(target: Object, nested?: boolean): Tween[]; recent(): Animation; @@ -185,8 +185,9 @@ declare class TimelineMax extends TimelineLite { getActive(nested?: boolean, tweens?: boolean, timelines?: boolean): Tween | Timeline[]; getLabelAfter(time: number): string; getLabelBefore(time: number): string; - getLabelsArray(): any[]; + getLabelsArray(): {name: string; time: number;}[]; removeCallback(callback: Function, timeOrLabel?: any): TimelineMax; + removePause(position: any): TimelineMax; repeat(): number; repeat(value: number): TimelineMax; repeatDelay(): number; diff --git a/greensock/tsconfig.json b/greensock/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/greensock/tsconfig.json +++ b/greensock/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gregorian-calendar/tsconfig.json b/gregorian-calendar/tsconfig.json index 8d63d8f904..6ab367237a 100644 --- a/gregorian-calendar/tsconfig.json +++ b/gregorian-calendar/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gridfs-stream/tsconfig.json b/gridfs-stream/tsconfig.json index 6c210bc6e0..4a8882064d 100644 --- a/gridfs-stream/tsconfig.json +++ b/gridfs-stream/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gridstack/index.d.ts b/gridstack/index.d.ts index 399f25e04b..7bf2fa3780 100644 --- a/gridstack/index.d.ts +++ b/gridstack/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Gridstack +// Type definitions for Gridstack // Project: http://troolee.github.io/gridstack.js/ // Definitions by: Pascal Senn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/gridstack/tsconfig.json b/gridstack/tsconfig.json index cec147d460..544a5ee000 100644 --- a/gridstack/tsconfig.json +++ b/gridstack/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/grunt/tsconfig.json b/grunt/tsconfig.json index 0eed2e922a..f4b2b816d9 100644 --- a/grunt/tsconfig.json +++ b/grunt/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gsap/Core.d.ts b/gsap/Core.d.ts index 776ec5f88e..30b07a3e19 100644 --- a/gsap/Core.d.ts +++ b/gsap/Core.d.ts @@ -1,4 +1,4 @@ -declare class Animation { +declare class Animation { /** Base class for all TweenLite, TweenMax, TimelineLite, and TimelineMax classes, providing core methods/properties/functionality, but there is no reason to create an instance of this class directly. */ constructor(duration?: number, vars?: any); diff --git a/gsap/Ease.d.ts b/gsap/Ease.d.ts index e52520aaf0..932222ff56 100644 --- a/gsap/Ease.d.ts +++ b/gsap/Ease.d.ts @@ -1,4 +1,4 @@ -declare class Ease { +declare class Ease { constructor(func?: Function, extraParams?: any[], type?: number, power?: number); /** Translates the tween's progress ratio into the corresponding ease ratio. */ diff --git a/gsap/TweenLite.d.ts b/gsap/TweenLite.d.ts index b1aad2b0e8..21150acf22 100644 --- a/gsap/TweenLite.d.ts +++ b/gsap/TweenLite.d.ts @@ -1,4 +1,4 @@ -declare class TweenLite { +declare class TweenLite { constructor(target: any, duration: number, vars: any); /** Provides An easy way to change the default easing equation. */ diff --git a/gsap/tsconfig.json b/gsap/tsconfig.json index 9502ab3d1f..795f528b6c 100644 --- a/gsap/tsconfig.json +++ b/gsap/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-angular-templatecache/gulp-angular-templatecache.d.ts b/gulp-angular-templatecache/index.d.ts similarity index 100% rename from gulp-angular-templatecache/gulp-angular-templatecache.d.ts rename to gulp-angular-templatecache/index.d.ts diff --git a/gulp-angular-templatecache/tsconfig.json b/gulp-angular-templatecache/tsconfig.json index 6b3a7a2fa2..3bd2dc70e3 100644 --- a/gulp-angular-templatecache/tsconfig.json +++ b/gulp-angular-templatecache/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "gulp-angular-templatecache.d.ts", + "index.d.ts", "gulp-angular-templatecache-tests.ts" ] } \ No newline at end of file diff --git a/gulp-autoprefixer/tsconfig.json b/gulp-autoprefixer/tsconfig.json index 53de420b6a..19328f4d2b 100644 --- a/gulp-autoprefixer/tsconfig.json +++ b/gulp-autoprefixer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-babel/tsconfig.json b/gulp-babel/tsconfig.json index d4396af5ff..88b9b5a7de 100644 --- a/gulp-babel/tsconfig.json +++ b/gulp-babel/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-cache/gulp-cache-tests.ts b/gulp-cache/gulp-cache-tests.ts index 2efa3975fc..31df7b0259 100644 --- a/gulp-cache/gulp-cache-tests.ts +++ b/gulp-cache/gulp-cache-tests.ts @@ -1,6 +1,3 @@ -/// -/// - import * as fs from "fs"; import * as gulp from "gulp"; import * as cache from "gulp-cache"; @@ -29,7 +26,7 @@ var jsHintVersion = '2.4.1', jshintOptions = fs.readFileSync('.jshintrc'); function makeHashKey(file: File) { - return [file.contents.toString('utf8'), jsHintVersion, jshintOptions].join(''); + return [(file.contents as Buffer).toString('utf8'), jsHintVersion, jshintOptions].join(''); } gulp.task('clear', function (done: any) { diff --git a/gulp-cache/gulp-cache.d.ts b/gulp-cache/gulp-cache.d.ts deleted file mode 100644 index cfb1cb2514..0000000000 --- a/gulp-cache/gulp-cache.d.ts +++ /dev/null @@ -1,94 +0,0 @@ -// Type definitions for gulp-cache v0.4.5 -// Project: https://github.com/jgable/gulp-cache -// Definitions by: Arun Aravind -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// -/// - -declare module "gulp-cache" { - import File = require("vinyl"); - import { Transform } from "stream"; - import { PluginError } from "gulp-util"; - - namespace gc { - type Predicate = (arg: T) => boolean; - - interface IGulpCacheOptions { - /** - * The cache instance to use for caching. - */ - fileCache?: IGulpCache; - - /** - * The name of the bucket which stores the cached objects. - * Default value = 'default' - */ - name?: string, - - /** - * The hash generator to use. - */ - key?: (file: File, callback?: (err: any, result: string) => void) => string | Promise; - - /** - * Value representing the success of a task. - */ - success?: boolean | Predicate; - - /** - * Content that is to be cached. - */ - value?: (result: any) => Object | Promise | string; - } - - interface ICacheOptions { - /** - * Specifies the name of the directory where the cache - * is to be stored. - */ - cacheDirName: string; - } - - interface IGulpCacheStatic { - /** - * Caches the result of a task. - * @param task The task whose result is to be cached. - */ - (task: NodeJS.ReadWriteStream): Transform; - - /** - * Caches the result of a task. - * @param task Task whose result is to be cached. - * @param options Override values for available settings. - */ - (task: NodeJS.ReadWriteStream, options: IGulpCacheOptions): Transform; - - clear(options: IGulpCacheOptions): Transform; - - /** - * Represents a cache store. - */ - Cache: IGulpCache; - - /** - * Purges the cache. - * @param err PluginError instance in case of a plugin error. - * If callback is not specified an exception of type - * 'PluginError' is thrown. - */ - clearAll(callback?: (err: PluginError) => void): void; - } - - /** - * Represents a cach store. - */ - interface IGulpCache { - new (options: ICacheOptions): any; - } - } - - const _: gc.IGulpCacheStatic; - export = _; -} diff --git a/gulp-cache/index.d.ts b/gulp-cache/index.d.ts new file mode 100644 index 0000000000..d576427f3d --- /dev/null +++ b/gulp-cache/index.d.ts @@ -0,0 +1,90 @@ +// Type definitions for gulp-cache v0.4.5 +// Project: https://github.com/jgable/gulp-cache +// Definitions by: Arun Aravind +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import File = require("vinyl"); +import { Transform } from "stream"; +import { PluginError } from "gulp-util"; + +declare namespace gc { + type Predicate = (arg: T) => boolean; + + interface IGulpCacheOptions { + /** + * The cache instance to use for caching. + */ + fileCache?: IGulpCache; + + /** + * The name of the bucket which stores the cached objects. + * Default value = 'default' + */ + name?: string, + + /** + * The hash generator to use. + */ + key?: (file: File, callback?: (err: any, result: string) => void) => string | Promise; + + /** + * Value representing the success of a task. + */ + success?: boolean | Predicate; + + /** + * Content that is to be cached. + */ + value?: (result: any) => Object | Promise | string; + } + + interface ICacheOptions { + /** + * Specifies the name of the directory where the cache + * is to be stored. + */ + cacheDirName: string; + } + + interface IGulpCacheStatic { + /** + * Caches the result of a task. + * @param task The task whose result is to be cached. + */ + (task: NodeJS.ReadWriteStream): Transform; + + /** + * Caches the result of a task. + * @param task Task whose result is to be cached. + * @param options Override values for available settings. + */ + (task: NodeJS.ReadWriteStream, options: IGulpCacheOptions): Transform; + + clear(options: IGulpCacheOptions): Transform; + + /** + * Represents a cache store. + */ + Cache: IGulpCache; + + /** + * Purges the cache. + * @param err PluginError instance in case of a plugin error. + * If callback is not specified an exception of type + * 'PluginError' is thrown. + */ + clearAll(callback?: (err: PluginError) => void): void; + } + + /** + * Represents a cach store. + */ + interface IGulpCache { + new (options: ICacheOptions): any; + } +} + +declare const _: gc.IGulpCacheStatic; +export = _; diff --git a/gulp-cache/tsconfig.json b/gulp-cache/tsconfig.json new file mode 100644 index 0000000000..656815d5f2 --- /dev/null +++ b/gulp-cache/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "gulp-cache-tests.ts" + ] +} \ No newline at end of file diff --git a/gulp-cached/tsconfig.json b/gulp-cached/tsconfig.json index 043fc2d2f3..ec498013ca 100644 --- a/gulp-cached/tsconfig.json +++ b/gulp-cached/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-changed/tsconfig.json b/gulp-changed/tsconfig.json index 20234a8147..4db34c9923 100644 --- a/gulp-changed/tsconfig.json +++ b/gulp-changed/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-cheerio/tsconfig.json b/gulp-cheerio/tsconfig.json index 7591c39b5c..f923b98c6e 100644 --- a/gulp-cheerio/tsconfig.json +++ b/gulp-cheerio/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-coffeeify/tsconfig.json b/gulp-coffeeify/tsconfig.json index aff348fdec..422ff78a08 100644 --- a/gulp-coffeeify/tsconfig.json +++ b/gulp-coffeeify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-coffeelint/tsconfig.json b/gulp-coffeelint/tsconfig.json index 9dd9c63f37..58ed9c6480 100644 --- a/gulp-coffeelint/tsconfig.json +++ b/gulp-coffeelint/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-concat/tsconfig.json b/gulp-concat/tsconfig.json index b1522db4ff..807f41c7a5 100644 --- a/gulp-concat/tsconfig.json +++ b/gulp-concat/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-copy/gulp-copy-tests.ts b/gulp-copy/gulp-copy-tests.ts index acb225bbe5..f4bc3ac023 100644 --- a/gulp-copy/gulp-copy-tests.ts +++ b/gulp-copy/gulp-copy-tests.ts @@ -1,6 +1,3 @@ -/// -/// - import * as gulp from "gulp"; import * as gulpCopy from "gulp-copy"; diff --git a/gulp-copy/gulp-copy.d.ts b/gulp-copy/gulp-copy.d.ts deleted file mode 100644 index 68f652ed9a..0000000000 --- a/gulp-copy/gulp-copy.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Type definitions for gulp-copy v0.0.2 -// Project: https://github.com/klaascuvelier/gulp-copy -// Definitions by: Arun Aravind -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare module "gulp-copy" { - import through = require("through"); - - /** - * Copy files to destination and expose those files as source streams for the gulp pipeline. - * - * @param outDirectory The name of the destination directory. If this directory - * does not exist, it will be created atomatically. - */ - function gulpCopy(outDirectory: string): through.ThroughStream; - - /** - * Copy files to destination and expose those files as source streams for the gulp pipeline. - * - * @param outDirectory The name of the destination directory. If this directory - * does not exist, it will be created atomatically. - * @param options Override values for available settings. - */ - function gulpCopy(outDirectory: string, options: gulpCopy.GulpCopyOptions): through.ThroughStream; - - namespace gulpCopy { - - export interface GulpCopyOptions { - /** - * Specifies the number of parts of the path to be ignored as path prefixes. - */ - prefix: number; - } - } - - export = gulpCopy; -} diff --git a/gulp-copy/index.d.ts b/gulp-copy/index.d.ts new file mode 100644 index 0000000000..18a85d1292 --- /dev/null +++ b/gulp-copy/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for gulp-copy v0.0.2 +// Project: https://github.com/klaascuvelier/gulp-copy +// Definitions by: Arun Aravind +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import through = require("through"); + +/** + * Copy files to destination and expose those files as source streams for the gulp pipeline. + * + * @param outDirectory The name of the destination directory. If this directory + * does not exist, it will be created atomatically. + */ +declare function gulpCopy(outDirectory: string): through.ThroughStream; + +/** + * Copy files to destination and expose those files as source streams for the gulp pipeline. + * + * @param outDirectory The name of the destination directory. If this directory + * does not exist, it will be created atomatically. + * @param options Override values for available settings. + */ +declare function gulpCopy(outDirectory: string, options: gulpCopy.GulpCopyOptions): through.ThroughStream; + +declare namespace gulpCopy { + export interface GulpCopyOptions { + /** + * Specifies the number of parts of the path to be ignored as path prefixes. + */ + prefix: number; + } +} + +export = gulpCopy; diff --git a/gulp-copy/tsconfig.json b/gulp-copy/tsconfig.json new file mode 100644 index 0000000000..83cebe7c02 --- /dev/null +++ b/gulp-copy/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "gulp-copy-tests.ts" + ] +} \ No newline at end of file diff --git a/gulp-csso/tsconfig.json b/gulp-csso/tsconfig.json index 17fc023f71..6575a1460c 100644 --- a/gulp-csso/tsconfig.json +++ b/gulp-csso/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-debug/tsconfig.json b/gulp-debug/tsconfig.json index 04f89dcf0f..bd3e8691d1 100644 --- a/gulp-debug/tsconfig.json +++ b/gulp-debug/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-dtsm/tsconfig.json b/gulp-dtsm/tsconfig.json index 3507b77bdb..b3438db319 100644 --- a/gulp-dtsm/tsconfig.json +++ b/gulp-dtsm/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-espower/tsconfig.json b/gulp-espower/tsconfig.json index 37735f2227..94a1fe9f27 100644 --- a/gulp-espower/tsconfig.json +++ b/gulp-espower/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-file-include/tsconfig.json b/gulp-file-include/tsconfig.json index 82b98c8f9f..844431741f 100644 --- a/gulp-file-include/tsconfig.json +++ b/gulp-file-include/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-filter/tsconfig.json b/gulp-filter/tsconfig.json index 3abefabdb5..2de729f2c4 100644 --- a/gulp-filter/tsconfig.json +++ b/gulp-filter/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-flatten/tsconfig.json b/gulp-flatten/tsconfig.json index 15381b116a..9f40ce7a75 100644 --- a/gulp-flatten/tsconfig.json +++ b/gulp-flatten/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-gh-pages/tsconfig.json b/gulp-gh-pages/tsconfig.json index bfbc694416..4156fc1099 100644 --- a/gulp-gh-pages/tsconfig.json +++ b/gulp-gh-pages/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-gzip/tsconfig.json b/gulp-gzip/tsconfig.json index 0fa71c9235..2070cbdec3 100644 --- a/gulp-gzip/tsconfig.json +++ b/gulp-gzip/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-help-doc/gulp-help-doc.d.ts b/gulp-help-doc/index.d.ts similarity index 100% rename from gulp-help-doc/gulp-help-doc.d.ts rename to gulp-help-doc/index.d.ts diff --git a/gulp-help-doc/tsconfig.json b/gulp-help-doc/tsconfig.json index f7206b7785..54c262774d 100644 --- a/gulp-help-doc/tsconfig.json +++ b/gulp-help-doc/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "gulp-help-doc.d.ts", + "index.d.ts", "gulp-help-doc-tests.ts" ] } \ No newline at end of file diff --git a/gulp-help/tsconfig.json b/gulp-help/tsconfig.json index c15330918b..55e26fb16a 100644 --- a/gulp-help/tsconfig.json +++ b/gulp-help/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-html-replace/tsconfig.json b/gulp-html-replace/tsconfig.json index fbc45f7a5a..581b46d07e 100644 --- a/gulp-html-replace/tsconfig.json +++ b/gulp-html-replace/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-htmlmin/tsconfig.json b/gulp-htmlmin/tsconfig.json index bc9384bca9..b3f888d796 100644 --- a/gulp-htmlmin/tsconfig.json +++ b/gulp-htmlmin/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-if/tsconfig.json b/gulp-if/tsconfig.json index 4a336dd5f6..2f14114d8a 100644 --- a/gulp-if/tsconfig.json +++ b/gulp-if/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-inject/tsconfig.json b/gulp-inject/tsconfig.json index eaf856e6ce..0d86a4f0a5 100644 --- a/gulp-inject/tsconfig.json +++ b/gulp-inject/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-insert/gulp-insert.d.ts b/gulp-insert/index.d.ts similarity index 100% rename from gulp-insert/gulp-insert.d.ts rename to gulp-insert/index.d.ts diff --git a/gulp-insert/tsconfig.json b/gulp-insert/tsconfig.json index 109f4aaa90..1da5bd793c 100644 --- a/gulp-insert/tsconfig.json +++ b/gulp-insert/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "gulp-insert.d.ts", + "index.d.ts", "gulp-insert-tests.ts" ] } \ No newline at end of file diff --git a/gulp-install/tsconfig.json b/gulp-install/tsconfig.json index 49a8fd91b8..3db84a16bf 100644 --- a/gulp-install/tsconfig.json +++ b/gulp-install/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-istanbul/tsconfig.json b/gulp-istanbul/tsconfig.json index 89d6cab5bf..30fd3e534f 100644 --- a/gulp-istanbul/tsconfig.json +++ b/gulp-istanbul/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-jade/tsconfig.json b/gulp-jade/tsconfig.json index 1446e20bc5..d5a0b1365f 100644 --- a/gulp-jade/tsconfig.json +++ b/gulp-jade/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-jasmine-browser/tsconfig.json b/gulp-jasmine-browser/tsconfig.json index 33f4dcd49b..e22613b810 100644 --- a/gulp-jasmine-browser/tsconfig.json +++ b/gulp-jasmine-browser/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-json-editor/tsconfig.json b/gulp-json-editor/tsconfig.json index 5c0fa0048d..7a7f0404e7 100644 --- a/gulp-json-editor/tsconfig.json +++ b/gulp-json-editor/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-jspm/tsconfig.json b/gulp-jspm/tsconfig.json index 31f3b73587..18c7835f71 100644 --- a/gulp-jspm/tsconfig.json +++ b/gulp-jspm/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-less/tsconfig.json b/gulp-less/tsconfig.json index a4c9d230c2..deea3371a2 100644 --- a/gulp-less/tsconfig.json +++ b/gulp-less/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-load-plugins/tsconfig.json b/gulp-load-plugins/tsconfig.json index 265e7e5ec6..5b8c64c574 100644 --- a/gulp-load-plugins/tsconfig.json +++ b/gulp-load-plugins/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-minify-css/tsconfig.json b/gulp-minify-css/tsconfig.json index e648f13655..2c831a76d7 100644 --- a/gulp-minify-css/tsconfig.json +++ b/gulp-minify-css/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-minify-html/tsconfig.json b/gulp-minify-html/tsconfig.json index aa59c127bc..6ea7ebe878 100644 --- a/gulp-minify-html/tsconfig.json +++ b/gulp-minify-html/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-mocha/tsconfig.json b/gulp-mocha/tsconfig.json index a810657b32..1414992d0c 100644 --- a/gulp-mocha/tsconfig.json +++ b/gulp-mocha/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-newer/tsconfig.json b/gulp-newer/tsconfig.json index 0e0499f244..03c3f2ad10 100644 --- a/gulp-newer/tsconfig.json +++ b/gulp-newer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-ng-annotate/tsconfig.json b/gulp-ng-annotate/tsconfig.json index 8ce1f5ad51..b41c36618e 100644 --- a/gulp-ng-annotate/tsconfig.json +++ b/gulp-ng-annotate/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-nodemon/tsconfig.json b/gulp-nodemon/tsconfig.json index a662bdd35c..46fa7d1365 100644 --- a/gulp-nodemon/tsconfig.json +++ b/gulp-nodemon/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-plumber/tsconfig.json b/gulp-plumber/tsconfig.json index 5eb352c980..3250508b93 100644 --- a/gulp-plumber/tsconfig.json +++ b/gulp-plumber/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-protractor/tsconfig.json b/gulp-protractor/tsconfig.json index b62ae13916..49bbdf6eaa 100644 --- a/gulp-protractor/tsconfig.json +++ b/gulp-protractor/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-remember/tsconfig.json b/gulp-remember/tsconfig.json index 09d7d1292f..a9fe348e31 100644 --- a/gulp-remember/tsconfig.json +++ b/gulp-remember/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-rename/tsconfig.json b/gulp-rename/tsconfig.json index 6f22283034..5e9f0b1824 100644 --- a/gulp-rename/tsconfig.json +++ b/gulp-rename/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-replace/tsconfig.json b/gulp-replace/tsconfig.json index a93504c448..f7b7003ca6 100644 --- a/gulp-replace/tsconfig.json +++ b/gulp-replace/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-rev-replace/tsconfig.json b/gulp-rev-replace/tsconfig.json index df0172e99a..a67ef46a67 100644 --- a/gulp-rev-replace/tsconfig.json +++ b/gulp-rev-replace/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-rev/tsconfig.json b/gulp-rev/tsconfig.json index beb6f33a52..0d23af4b22 100644 --- a/gulp-rev/tsconfig.json +++ b/gulp-rev/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-ruby-sass/tsconfig.json b/gulp-ruby-sass/tsconfig.json index be3c6876f9..e9ba142444 100644 --- a/gulp-ruby-sass/tsconfig.json +++ b/gulp-ruby-sass/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-sass/tsconfig.json b/gulp-sass/tsconfig.json index ef97123b2b..aa8b901e99 100644 --- a/gulp-sass/tsconfig.json +++ b/gulp-sass/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-shell/tsconfig.json b/gulp-shell/tsconfig.json index ee4d501a1a..9a4fb07a2a 100644 --- a/gulp-shell/tsconfig.json +++ b/gulp-shell/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-size/tsconfig.json b/gulp-size/tsconfig.json index d555d62c32..f4406a0a19 100644 --- a/gulp-size/tsconfig.json +++ b/gulp-size/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-sort/tsconfig.json b/gulp-sort/tsconfig.json index 7f0a4525a2..8c76049155 100644 --- a/gulp-sort/tsconfig.json +++ b/gulp-sort/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-sourcemaps/tsconfig.json b/gulp-sourcemaps/tsconfig.json index d76db38589..305f32083b 100644 --- a/gulp-sourcemaps/tsconfig.json +++ b/gulp-sourcemaps/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-strip-debug/tsconfig.json b/gulp-strip-debug/tsconfig.json index 031b2f6c36..c378a11723 100644 --- a/gulp-strip-debug/tsconfig.json +++ b/gulp-strip-debug/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-svg-sprite/tsconfig.json b/gulp-svg-sprite/tsconfig.json index 6b746b93dc..c3459a8e82 100644 --- a/gulp-svg-sprite/tsconfig.json +++ b/gulp-svg-sprite/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-task-listing/tsconfig.json b/gulp-task-listing/tsconfig.json index 65f886f630..298275b50b 100644 --- a/gulp-task-listing/tsconfig.json +++ b/gulp-task-listing/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-tsd/tsconfig.json b/gulp-tsd/tsconfig.json index f9de72e7b6..34560794d8 100644 --- a/gulp-tsd/tsconfig.json +++ b/gulp-tsd/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-tslint/tsconfig.json b/gulp-tslint/tsconfig.json index dd93c4d173..8d1f4b5b34 100644 --- a/gulp-tslint/tsconfig.json +++ b/gulp-tslint/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-typedoc/tsconfig.json b/gulp-typedoc/tsconfig.json index b9ffdab0c8..5b58681283 100644 --- a/gulp-typedoc/tsconfig.json +++ b/gulp-typedoc/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-typescript/tsconfig.json b/gulp-typescript/tsconfig.json index 89dc634ee2..e3d1ed6b4c 100644 --- a/gulp-typescript/tsconfig.json +++ b/gulp-typescript/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-uglify/tsconfig.json b/gulp-uglify/tsconfig.json index a13a214978..9930a55243 100644 --- a/gulp-uglify/tsconfig.json +++ b/gulp-uglify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-useref/tsconfig.json b/gulp-useref/tsconfig.json index 6928e48ffc..35d29c5da5 100644 --- a/gulp-useref/tsconfig.json +++ b/gulp-useref/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-util/index.d.ts b/gulp-util/index.d.ts index feea14ec8e..ee059ca986 100644 --- a/gulp-util/index.d.ts +++ b/gulp-util/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for gulp-util v3.0.x +// Type definitions for gulp-util v3.0.x // Project: https://github.com/gulpjs/gulp-util // Definitions by: jedmao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,7 +11,7 @@ import vinyl = require('vinyl'); import chalk = require('chalk'); import through2 = require('through2'); -export class File extends vinyl { } +export { vinyl as File }; /** * Replaces a file extension in a path. Returns the new path. diff --git a/gulp-util/tsconfig.json b/gulp-util/tsconfig.json index 6581d34926..26962b537c 100644 --- a/gulp-util/tsconfig.json +++ b/gulp-util/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp-watch/tsconfig.json b/gulp-watch/tsconfig.json index 4301104958..50be0269a7 100644 --- a/gulp-watch/tsconfig.json +++ b/gulp-watch/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/gulp/tsconfig.json b/gulp/tsconfig.json index d86d7977f1..ef4f0576a4 100644 --- a/gulp/tsconfig.json +++ b/gulp/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/halfred/tsconfig.json b/halfred/tsconfig.json index 3474d1e45b..f522ec22c5 100644 --- a/halfred/tsconfig.json +++ b/halfred/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/halogen/halogen-clip-loader-tests.tsx b/halogen/halogen-clip-loader-tests.tsx new file mode 100644 index 0000000000..884e1caec6 --- /dev/null +++ b/halogen/halogen-clip-loader-tests.tsx @@ -0,0 +1,18 @@ +import * as React from "react"; +import * as Halogen from "halogen"; + +class HalogenTests_ClipLoader_withNoProps extends React.Component, {}>{ + render() { + return ( + + ) + } +} + +class HalogenTests_ClipLoader_withAllProps extends React.Component, {}>{ + render() { + return ( + + ) + } +} diff --git a/halogen/halogen-fade-loader-tests.tsx b/halogen/halogen-fade-loader-tests.tsx new file mode 100644 index 0000000000..63781098eb --- /dev/null +++ b/halogen/halogen-fade-loader-tests.tsx @@ -0,0 +1,19 @@ +import * as React from "react"; +import * as Halogen from "halogen"; + +class HalogenTests_FadeLoader_withNoProps extends React.Component, {}>{ + render() { + return ( + + ) + } +} + +class HalogenTests_FadeLoader_withAllProps extends React.Component, {}>{ + render() { + return ( + + ) + } +} diff --git a/halogen/halogen-pacman-loader-tests.tsx b/halogen/halogen-pacman-loader-tests.tsx new file mode 100644 index 0000000000..7ccd294918 --- /dev/null +++ b/halogen/halogen-pacman-loader-tests.tsx @@ -0,0 +1,18 @@ +import * as React from "react"; +import * as Halogen from "halogen"; + +class HalogenTests_PacmanLoader_withNoProps extends React.Component, {}>{ + render() { + return ( + + ) + } +} + +class HalogenTests_PacmanLoader_withAllProps extends React.Component, {}>{ + render() { + return ( + + ) + } +} diff --git a/halogen/halogen-rotate-loader-tests.tsx b/halogen/halogen-rotate-loader-tests.tsx new file mode 100644 index 0000000000..82b4b2b380 --- /dev/null +++ b/halogen/halogen-rotate-loader-tests.tsx @@ -0,0 +1,18 @@ +import * as React from "react"; +import * as Halogen from "halogen"; + +class HalogenTests_RotateLoader_withNoProps extends React.Component, {}>{ + render() { + return ( + + ) + } +} + +class HalogenTests_RotateLoader_withAllProps extends React.Component, {}>{ + render() { + return ( + + ) + } +} diff --git a/halogen/index.d.ts b/halogen/index.d.ts new file mode 100644 index 0000000000..5a6448899c --- /dev/null +++ b/halogen/index.d.ts @@ -0,0 +1,88 @@ +// Type definitions for halogen 0.2 +// Project: https://github.com/yuanyan/halogen +// Definitions by: Vincent Rouffiat +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as react from "react"; + +export = Halogen; + +declare namespace Halogen { + + type VerticalAlign = "baseline" | "length" | "sub" | "super" | "top" | "text-top" | "middle" | "bottom" | "text-bottom" | "initial" | "inherit"; + + interface HalogenCommonProps { + loading?: boolean; + color?: string; + id?: string; + className?: string; + verticalAlign?: VerticalAlign; + } + + interface SizeLoaderProps extends HalogenCommonProps { + size?: string; + } + + interface MarginLoaderProps extends HalogenCommonProps { + margin?: T; + size?: T; + } + + interface RadiusLoaderProps extends MarginLoaderProps { + height?: string; + width?: string; + radius?: string; + } + + /** + * React components + */ + type PulseLoader = react.Component, {}>; + export const PulseLoader: react.ComponentClass>; + + type RotateLoader = react.Component, {}>; + export const RotateLoader: react.ComponentClass>; + + type BeatLoader = react.Component, {}>; + export const BeatLoader: react.ComponentClass>; + + type RiseLoader = react.Component, {}>; + export const RiseLoader: react.ComponentClass>; + + type SyncLoader = react.Component, {}>; + export const SyncLoader: react.ComponentClass>; + + type GridLoader = react.Component, {}>; + export const GridLoader: react.ComponentClass>; + + type ClipLoader = react.Component; + export const ClipLoader: react.ComponentClass; + + type SquareLoader = react.Component; + export const SquareLoader: react.ComponentClass; + + type DotLoader = react.Component; + export const DotLoader: react.ComponentClass; + + type PacmanLoader = react.Component, {}>; + export const PacmanLoader: react.ComponentClass>; + + type MoonLoader = react.Component; + export const MoonLoader: react.ComponentClass; + + type RingLoader = react.Component; + export const RingLoader: react.ComponentClass; + + type BounceLoader = react.Component; + export const BounceLoader: react.ComponentClass; + + type SkewLoader = react.Component; + export const SkewLoader: react.ComponentClass; + + type FadeLoader = react.Component; + export const FadeLoader: react.ComponentClass; + + type ScaleLoader = react.Component; + export const ScaleLoader: react.ComponentClass; + +} diff --git a/halogen/tsconfig.json b/halogen/tsconfig.json new file mode 100644 index 0000000000..1b880dc4e8 --- /dev/null +++ b/halogen/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts" + ], + "include": [ + "halogen-*-loader-tests.tsx" + ] +} \ No newline at end of file diff --git a/halogen/tslint.json b/halogen/tslint.json new file mode 100644 index 0000000000..fdc7cdc370 --- /dev/null +++ b/halogen/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} \ No newline at end of file diff --git a/hammerjs/tsconfig.json b/hammerjs/tsconfig.json index 8c67b1a1ad..cfe6673028 100644 --- a/hammerjs/tsconfig.json +++ b/hammerjs/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/handlebars/tsconfig.json b/handlebars/tsconfig.json index cee9eda56d..c76c499f6e 100644 --- a/handlebars/tsconfig.json +++ b/handlebars/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/handsontable/handsontable-tests.ts b/handsontable/handsontable-tests.ts index d062f9c629..eb48441244 100644 --- a/handsontable/handsontable-tests.ts +++ b/handsontable/handsontable-tests.ts @@ -250,7 +250,7 @@ function test_HandsontableMethods() { hot.getRowHeight(123); hot.getSchema(); hot.getSelected(); - hot.getSelectedRange(); + const range: ht.Range = hot.getSelectedRange(); hot.getSettings(); hot.getSourceData(123, 123, 123, 123); hot.getSourceDataAtCell(123, 123); @@ -267,6 +267,7 @@ function test_HandsontableMethods() { hot.loadData([]); hot.populateFromArray(123, 123, [], 123, 123, 'foo', 'foo', 'foo', []); hot.propToCol('foo'); + hot.propToCol(123); hot.removeCellMeta(123, 123, 'foo'); hot.removeHook('foo', function() {}); hot.render(); @@ -283,4 +284,8 @@ function test_HandsontableMethods() { hot.unlisten(); hot.updateSettings({}, true); hot.validateCells(function() {}); + + Handsontable.renderers.NumericRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {}); + Handsontable.renderers.TextRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {}); + Handsontable.Dom.addEvent(new HTMLElement(), "eventName", () => {}); } diff --git a/handsontable/index.d.ts b/handsontable/index.d.ts index 7a82509baa..eeef57394e 100644 --- a/handsontable/index.d.ts +++ b/handsontable/index.d.ts @@ -250,7 +250,7 @@ declare namespace ht { getRowHeight(row: number): number; getSchema(): Object; getSelected(): any[]; - getSelectedRange(): any; + getSelectedRange(): Range; getSettings(): Object; getSourceData(r?: number, c?: number, r2?: number, c2?: number): any[]; getSourceDataAtCell(row: number, column: number): any; @@ -266,7 +266,7 @@ declare namespace ht { listen(): void; loadData(data: any[]): void; populateFromArray(row: number, col: number, input: any[], endRow?: number, endCol?: number, source?: string, method?: string, direction?: string, deltas?: any[]): any; - propToCol(prop: string): number; + propToCol(prop: string | number): number; removeCellMeta(row: number, col: number, key: string): void; removeHook(key: string, callback: Function): void; render(): void; @@ -284,9 +284,79 @@ declare namespace ht { updateSettings(settings: Object, init: boolean): void; validateCells(callback: Function): void; } + + interface Selection { + start: CellPosition; + end: CellPosition; + } + + interface Range { + from: CellPosition; + to: CellPosition; + } + + interface HandsontableRegisterer { + getInstance(id: string): Methods; + registerInstance(id: string, instance: Methods): void; + removeInstance(id: string): void; + } + + interface ColumnProperties extends CellProperties { + data?: string; + editor?: string; + selectOptions?: any[]; + } + + interface CellProperties { + renderer?: ( + instance: Methods, + td: HTMLTableDataCellElement, + row: number, + col: number, + prop: string, + value: any, + tdCellProperties: Object) => void; + type?: string; + readOnly?: boolean; + language?: string; + format?: string; + validator?: (value: string, callback: (condition: boolean) => void) => void; + } + + interface CellPosition { + row: number; + col: number; + } } declare var Handsontable: { new (element: Element, options: ht.Options): ht.Methods; + renderers: { + TextRenderer( + instance: any, + td: HTMLTableCellElement, + row: number, + col: number, + prop: string, + value: any, + cellProperties: any): void; + NumericRenderer( + instance: any, + td: HTMLTableCellElement, + row: number, + col: number, + prop: string, + value: any, + cellProperties: any): void; + } + Dom: { + addEvent(element: HTMLElement, eventName: string, callback: Function): void; + } }; + +declare module "handsontable" { + export var Handsontable: { + new (element: Element, options: ht.Options): ht.Methods; + }; +} diff --git a/handsontable/tsconfig.json b/handsontable/tsconfig.json index 19de5cb771..578ca40774 100644 --- a/handsontable/tsconfig.json +++ b/handsontable/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hapi-decorators/hapi-decorators-tests.ts b/hapi-decorators/hapi-decorators-tests.ts index 57d0c1a232..2a05f67e4d 100644 --- a/hapi-decorators/hapi-decorators-tests.ts +++ b/hapi-decorators/hapi-decorators-tests.ts @@ -1,6 +1,3 @@ -/// -/// - import * as hapi from 'hapi'; import { controller, get, post, put, cache, config, route, validate, Controller } from 'hapi-decorators'; diff --git a/hapi-decorators/tsconfig.json b/hapi-decorators/tsconfig.json index a763c6c6cd..72f5fdb496 100644 --- a/hapi-decorators/tsconfig.json +++ b/hapi-decorators/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "experimentalDecorators": true, "baseUrl": "../", diff --git a/hapi/hapi-8.2.0.d.ts b/hapi/hapi-8.2.0.d.ts index d3f51873d9..9a9355412d 100644 --- a/hapi/hapi-8.2.0.d.ts +++ b/hapi/hapi-8.2.0.d.ts @@ -304,9 +304,9 @@ export interface ISessionHandler { export interface IStrictSessionHandler { (request: Request, reply: IStrictReply): void; -} + } -export interface IRequestHandler { + export interface IRequestHandler { (request: Request): T; } diff --git a/hapi/hapi-tests.ts b/hapi/hapi-tests.ts index 2ee355e9d1..97c4a77b44 100644 --- a/hapi/hapi-tests.ts +++ b/hapi/hapi-tests.ts @@ -116,8 +116,8 @@ server.route([{ server.route({ method: 'GET', path: '/hello6', - handler: function (request, reply) { - request.log('info', { route: '/hello' }, Date.now()); + handler: function (request: Hapi.Request, reply: Hapi.IReply) { + request.log('info', { route: '/hello' }, Date.now()); reply('hello world'); } }); diff --git a/hapi/tsconfig.json b/hapi/tsconfig.json index eda77f1630..e70c705d7b 100644 --- a/hapi/tsconfig.json +++ b/hapi/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/harmony-proxy/tsconfig.json b/harmony-proxy/tsconfig.json index bbad87b671..3d3405c46d 100644 --- a/harmony-proxy/tsconfig.json +++ b/harmony-proxy/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hasher/tsconfig.json b/hasher/tsconfig.json index a82d69cff9..2f3a508608 100644 --- a/hasher/tsconfig.json +++ b/hasher/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hashids/tsconfig.json b/hashids/tsconfig.json index f94626a7eb..3d21df8610 100644 --- a/hashids/tsconfig.json +++ b/hashids/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hashmap/tsconfig.json b/hashmap/tsconfig.json index aae8efe897..7ecd39e67a 100644 --- a/hashmap/tsconfig.json +++ b/hashmap/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hashset/tsconfig.json b/hashset/tsconfig.json index f3182aa7df..35120dbce4 100644 --- a/hashset/tsconfig.json +++ b/hashset/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hashtable/tsconfig.json b/hashtable/tsconfig.json index 1ed164e172..fbc68818fc 100644 --- a/hashtable/tsconfig.json +++ b/hashtable/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/he/tsconfig.json b/he/tsconfig.json index 8ca79f913b..e04e52f581 100644 --- a/he/tsconfig.json +++ b/he/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/headroom/tsconfig.json b/headroom/tsconfig.json index 6b6f41a4b8..40f24b3df6 100644 --- a/headroom/tsconfig.json +++ b/headroom/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ }, "files": [ "index.d.ts", - "Headroom-tests.ts" + "headroom-tests.ts" ] } \ No newline at end of file diff --git a/heap/tsconfig.json b/heap/tsconfig.json index 3fb0cb6302..19f2156148 100644 --- a/heap/tsconfig.json +++ b/heap/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/heatmap.js/tsconfig.json b/heatmap.js/tsconfig.json index d1b8fbae24..b90279cd8c 100644 --- a/heatmap.js/tsconfig.json +++ b/heatmap.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "types": [], diff --git a/hellojs/tsconfig.json b/hellojs/tsconfig.json index 2274eb4fed..204f61ce53 100644 --- a/hellojs/tsconfig.json +++ b/hellojs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hellosign-embedded/index.d.ts b/hellosign-embedded/index.d.ts index 45b70774ff..ec77a92b92 100644 --- a/hellosign-embedded/index.d.ts +++ b/hellosign-embedded/index.d.ts @@ -1,12 +1,68 @@ -// Type definitions for hellosign-embedded v1.2.0 +// Type definitions for hellosign-embedded v1.2.0 // Project: https://github.com/HelloFax/hellosign-embedded // Definitions by: Brian Surowiec // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module HelloSign { - interface MessageEvent { - event: string; + interface SignedMessageEvent { + event: 'signature_request_signed'; + signature_id: string; } + interface DeclinedMessageEvent { + event: 'signature_request_declined'; + signature_id: string; + } + + interface CanceledMessageEvent { + event: 'signature_request_canceled'; + } + + interface SentMessageEvent { + event: 'signature_request_sent'; + signature_request_id: string; + signature_request_info: { + title: string; + message: string; + signatures: Array<{ + signature_id: string; + signer_email_address: string; + signer_name: string; + order: number; + status_code: string; + signed_at: number; + last_viewed_at: number; + last_reminded_at: number; + has_pin: boolean; + }>; + cc_email_addresses: Array; + }; + } + + interface TemplateCreatedMessageEvent { + event: 'template_created'; + template_id: string; + template_info: { + title: string; + message: string; + signer_roles: Array<{ + name: string; + order: number; + }>; + cc_roles: Array<{ + name: string; + }>; + }; + } + + interface ErrorMessageEvent { + event: 'error'; + description: string; + } + + type MessageEvent = SignedMessageEvent | DeclinedMessageEvent | + CanceledMessageEvent | SentMessageEvent | TemplateCreatedMessageEvent | + ErrorMessageEvent; + interface ClientCultures { /** * English (United States) @@ -169,6 +225,20 @@ declare module HelloSign { */ EVENT_CANCELED: string; + /** + * The user sent a signature request + * + * @default signature_request_sent + */ + EVENT_SENT: string; + + /** + * The template was created or edited + * + * @default template_created + */ + EVENT_TEMPLATE_CREATED: string; + /** * An error occurred in the iFrame * diff --git a/hellosign-embedded/tsconfig.json b/hellosign-embedded/tsconfig.json index 4b57500456..d2d18780ae 100644 --- a/hellosign-embedded/tsconfig.json +++ b/hellosign-embedded/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/helmet/tsconfig.json b/helmet/tsconfig.json index 9bdf041525..0099f29659 100644 --- a/helmet/tsconfig.json +++ b/helmet/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/heremaps/tsconfig.json b/heremaps/tsconfig.json index d3679723ea..b7e553319c 100644 --- a/heremaps/tsconfig.json +++ b/heremaps/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/highcharts-ng/index.d.ts b/highcharts-ng/index.d.ts index eed6dde0db..123799e76c 100644 --- a/highcharts-ng/index.d.ts +++ b/highcharts-ng/index.d.ts @@ -3,41 +3,43 @@ // Definitions by: Scott Hatcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import { ChartObject, IndividualSeriesOptions, Options } from "highcharts"; -interface HighChartsNGConfig { - options: __Highcharts.Options; - //The below properties are watched separately for changes. +declare global { + interface HighChartsNGConfig { + options: Options; + //The below properties are watched separately for changes. - //Series object (optional) - a list of series using normal highcharts series options. - series?: __Highcharts.IndividualSeriesOptions[]; - //Title configuration (optional) - title?: { - text?: string; - }; - //Boolean to control showng loading status on chart (optional) - //Could be a string if you want to show specific loading text. - loading?: boolean | string; - //Configuration for the xAxis (optional). Currently only one x axis can be dynamically controlled. - //properties currentMin and currentMax provied 2-way binding to the chart's maximimum and minimum - xAxis?: { - currentMin?: number; - currentMax?: number; - title?: { text?: string } - }; - //Whether to use HighStocks instead of HighCharts (optional). Defaults to false. - useHighStocks?: boolean; - //size (optional) if left out the chart will default to size of the div or something sensible. - size?: { - width?: number; - height?: number; - }; - //function (optional) - setup some logic for the chart - func?: (chart: __Highcharts.ChartObject) => void; -} + //Series object (optional) - a list of series using normal highcharts series options. + series?: IndividualSeriesOptions[]; + //Title configuration (optional) + title?: { + text?: string; + }; + //Boolean to control showng loading status on chart (optional) + //Could be a string if you want to show specific loading text. + loading?: boolean | string; + //Configuration for the xAxis (optional). Currently only one x axis can be dynamically controlled. + //properties currentMin and currentMax provied 2-way binding to the chart's maximimum and minimum + xAxis?: { + currentMin?: number; + currentMax?: number; + title?: { text?: string } + }; + //Whether to use HighStocks instead of HighCharts (optional). Defaults to false. + useHighStocks?: boolean; + //size (optional) if left out the chart will default to size of the div or something sensible. + size?: { + width?: number; + height?: number; + }; + //function (optional) - setup some logic for the chart + func?: (chart: ChartObject) => void; + } -//Instantiated Chart -interface HighChartsNGChart extends HighChartsNGConfig { - //This is a simple way to access all the Highcharts API that is not currently managed by this directive. - getHighcharts(): __Highcharts.ChartObject; + //Instantiated Chart + interface HighChartsNGChart extends HighChartsNGConfig { + //This is a simple way to access all the Highcharts API that is not currently managed by this directive. + getHighcharts(): ChartObject; + } } diff --git a/highcharts-ng/tsconfig.json b/highcharts-ng/tsconfig.json index c0a83321c0..a738083bf0 100644 --- a/highcharts-ng/tsconfig.json +++ b/highcharts-ng/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/highcharts/highcharts-more-tests.ts b/highcharts/highcharts-more-tests.ts new file mode 100644 index 0000000000..e6e5e9af5c --- /dev/null +++ b/highcharts/highcharts-more-tests.ts @@ -0,0 +1 @@ +HighchartsMore(Highcharts); diff --git a/highcharts/highcharts-more.d.ts b/highcharts/highcharts-more.d.ts index b80ce30f4a..14f4940784 100644 --- a/highcharts/highcharts-more.d.ts +++ b/highcharts/highcharts-more.d.ts @@ -3,10 +3,8 @@ // Definitions by: Maciej Suchecki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as Highcharts from "highcharts"; -declare var HighchartsMore: (H: __Highcharts.Static) => __Highcharts.Static; - -declare module "highcharts/highcharts-more" { - export = HighchartsMore; -} +declare var HighchartsMore: (H: Highcharts.Static) => Highcharts.Static; +export = HighchartsMore; +export as namespace HighchartsMore; diff --git a/highcharts/highcharts-tests.ts b/highcharts/highcharts-tests.ts index 31db25f482..316e2f42a6 100644 --- a/highcharts/highcharts-tests.ts +++ b/highcharts/highcharts-tests.ts @@ -1,5 +1,5 @@ - /// +import * as Highcharts from "highcharts"; // May also use /// function originalTests() { Highcharts.setOptions({ @@ -16,13 +16,13 @@ function originalTests() { }); - var animate: __Highcharts.Animation = { + var animate: Highcharts.Animation = { duration: 200, easing: "linear" }; - var gradient: __Highcharts.Gradient = { + var gradient: Highcharts.Gradient = { linearGradient: { x1: 0, y1: 0, @@ -42,19 +42,19 @@ function originalTests() { renderTo: "container" }, xAxis: {}, - series: [<__Highcharts.LineChartSeriesOptions>{ + series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], type: "line", allowPointSelect: true }] }); - chart1.addSeries<__Highcharts.BarChartSeriesOptions>({ + chart1.addSeries({ enableMouseTracking: true, data: [1, 2, 3, 4, 5] }); - console.log((<__Highcharts.LineChartSeriesOptions>chart1.series[0].options).dashStyle); + console.log((chart1.series[0].options).dashStyle); var chart2 = new Highcharts.Chart({ chart: { @@ -85,7 +85,7 @@ function originalTests() { legend: { enabled: false }, - series: [<__Highcharts.ScatterChartSeriesOptions>{ + series: [{ data: [ [550, 870], [738, 362], [719, 711], [547, 665], [595, 197], [332, 144], [581, 555], [196, 862], [6, 837], [400, 924], [888, 148], [785, 730], @@ -113,14 +113,14 @@ function originalTests() { var r = new Highcharts.Renderer(div, 20, 30); var box = r.text("Hello", 10, 10).getBBox(); - var highChartSettings: __Highcharts.Options = { + var highChartSettings: Highcharts.Options = { chart: { width: 400, height: 400 }, xAxis: [{ }], - series: [<__Highcharts.PieChartSeriesOptions>{ + series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }; @@ -129,16 +129,16 @@ function originalTests() { chart.series[0].setVisible(true, true); }); - var singleYAxisOptions: __Highcharts.Options = { + var singleYAxisOptions: Highcharts.Options = { yAxis: {} }; - var multipleYAxisOptions: __Highcharts.Options = { + var multipleYAxisOptions: Highcharts.Options = { yAxis: [{}, {}] }; var renderToIdChart = new Highcharts.Chart("container", { xAxis: {}, - series: [<__Highcharts.LineChartSeriesOptions>{ + series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], type: "line", allowPointSelect: true @@ -147,7 +147,7 @@ function originalTests() { var renderToElementChart = new Highcharts.Chart(div, { xAxis: {}, - series: [<__Highcharts.LineChartSeriesOptions>{ + series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], type: "line", allowPointSelect: true @@ -156,7 +156,7 @@ function originalTests() { var createWithFunction = Highcharts.chart({ xAxis: {}, - series: [<__Highcharts.LineChartSeriesOptions>{ + series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], type: "line", allowPointSelect: true @@ -165,7 +165,7 @@ function originalTests() { var createWithFunctionRenderToId = Highcharts.chart("container", { xAxis: {}, - series: [<__Highcharts.LineChartSeriesOptions>{ + series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], type: "line", allowPointSelect: true @@ -174,7 +174,7 @@ function originalTests() { var createWithFunctionRenderToElement = Highcharts.chart(div, { xAxis: {}, - series: [<__Highcharts.LineChartSeriesOptions>{ + series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], type: "line", allowPointSelect: true @@ -183,7 +183,7 @@ function originalTests() { } function test_alldefaults() { - var options: __Highcharts.Options = { + var options: Highcharts.Options = { chart: {}, credits: {}, data: {}, @@ -207,19 +207,19 @@ function test_alldefaults() { } function test_ChartOptions() { - var emptyChartOptions: __Highcharts.ChartOptions = { + var emptyChartOptions: Highcharts.ChartOptions = { events: {}, options3d: {}, resetZoomButton: {} }; - var allValuesSet: __Highcharts.ChartOptions = { + var allValuesSet: Highcharts.ChartOptions = { alignTicks: false, animation: { duration: 500, easing: "linear" }, - backgroundColor: <__Highcharts.Gradient> { + backgroundColor: { linearGradient: { x1: 0, y1: 0, @@ -233,7 +233,7 @@ function test_ChartOptions() { borderWidth: 5, className: "class", defaultSeriesType: "deprecated", - events: <__Highcharts.ChartEvents> { + events: { addSeries: () => {}, afterPrint: () => {}, beforePrint: () => {}, @@ -252,21 +252,21 @@ function test_ChartOptions() { marginLeft: 10, marginRight: 10, marginTop: 10, - options3d: <__Highcharts.ChartOptions3d> { + options3d: { alpha: 20, beta: 20, depth: 50, enabled: true, frame: { - back: <__Highcharts.ChartOptions3dFrame> { + back: { color: "black", size: 2 }, - bottom: <__Highcharts.ChartOptions3dFrame> { + bottom: { color: "black", size: 2 }, - side: <__Highcharts.ChartOptions3dFrame> { + side: { color: "black", size: 2 } @@ -280,7 +280,7 @@ function test_ChartOptions() { plotBackgroundImage: "http://image.url/image.jpg", plotBorderColor: "grey", plotBorderWidth: 5, - plotShadow: <__Highcharts.Shadow> { + plotShadow: { color: "magenta", offsetX: 10, offsetY: 10, @@ -290,15 +290,15 @@ function test_ChartOptions() { polar: true, reflow: false, renderTo: "elementId", - resetZoomButton: <__Highcharts.ChartResetZoomButton> { - position: <__Highcharts.Position> { + resetZoomButton: { + position: { align: "left", verticalAlign: "top", x: 5, y: 5 }, relativeTo: "chart", - theme: <__Highcharts.ButtonTheme> { + theme: { display: "hidden", fill: "black", stroke: "white", @@ -364,7 +364,7 @@ function test_ChartOptions() { }); // animation example - $('#container').highcharts(<__Highcharts.Options> { + $('#container').highcharts( { chart: { animation: { duration: 1500, @@ -449,7 +449,7 @@ function test_ChartOptions() { chart: { events: { addSeries: function () { - var label = (<__Highcharts.ChartObject>this).renderer.label('A series was added, about to redraw chart', 100, 120) + var label = (this).renderer.label('A series was added, about to redraw chart', 100, 120) .attr({ fill: Highcharts.getOptions().colors[0], padding: 10, @@ -578,7 +578,7 @@ function test_ChartOptions() { } function test_CreditsOptions() { - var allDefaults: __Highcharts.CreditsOptions = {}; + var allDefaults: Highcharts.CreditsOptions = {}; // custom url and text example $('#container').highcharts({ @@ -597,7 +597,7 @@ function test_CreditsOptions() { function test_Data() { // all defaults - var data: __Highcharts.DataOptions = {}; + var data: Highcharts.DataOptions = {}; // data from table example $('#container').highcharts({ @@ -631,10 +631,10 @@ function test_Data() { } }, series: [ - <__Highcharts.LineChartSeriesOptions> { + { lineWidth: 1 }, - <__Highcharts.AreaSplineChartSeriesOptions> { + { type: 'areaspline', color: '#c4392d', negativeColor: '#5679c4', @@ -645,7 +645,7 @@ function test_Data() { // limited data example $('#container').highcharts({ - data: <__Highcharts.DataOptions> { + data: { csv: document.getElementById('csv').innerHTML, startRow: 114, endRow: 134, @@ -655,7 +655,7 @@ function test_Data() { xAxis: { allowDecimals: false }, - series: [<__Highcharts.LineChartSeriesOptions> { + series: [ { name: 'Annual mean' }] }); @@ -675,7 +675,7 @@ function test_Data() { } function test_Drilldown() { - var allDefaults: __Highcharts.DrilldownOptions = {}; + var allDefaults: Highcharts.DrilldownOptions = {}; // multiseries drilldown example $('#container').highcharts({ @@ -686,14 +686,14 @@ function test_Drilldown() { type: 'category' }, plotOptions: { - series: <__Highcharts.ColumnChart> { + series: { borderWidth: 0, dataLabels: { enabled: true } } }, - series: [<__Highcharts.ColumnChartSeriesOptions>{ + series: [{ name: '2010', data: [{ name: 'Republican', @@ -708,7 +708,7 @@ function test_Drilldown() { y: 4, drilldown: 'other-2010' }] - }, <__Highcharts.ColumnChartSeriesOptions>{ + }, { name: '2014', data: [{ name: 'Republican', @@ -725,7 +725,7 @@ function test_Drilldown() { }] }], drilldown: { - series: [<__Highcharts.ColumnChartSeriesOptions>{ + series: [{ id: 'republican-2010', data: [ ['East', 4], @@ -733,7 +733,7 @@ function test_Drilldown() { ['North', 1], ['South', 4] ] - }, <__Highcharts.ColumnChartSeriesOptions>{ + }, { id: 'democrats-2010', data: [ ['East', 6], @@ -741,7 +741,7 @@ function test_Drilldown() { ['North', 2], ['South', 4] ] - }, <__Highcharts.ColumnChartSeriesOptions>{ + }, { id: 'other-2010', data: [ ['East', 2], @@ -749,7 +749,7 @@ function test_Drilldown() { ['North', 3], ['South', 2] ] - }, <__Highcharts.ColumnChartSeriesOptions>{ + }, { id: 'republican-2014', data: [ ['East', 2], @@ -757,7 +757,7 @@ function test_Drilldown() { ['North', 1], ['South', 7] ] - }, <__Highcharts.ColumnChartSeriesOptions>{ + }, { id: 'democrats-2014', data: [ ['East', 4], @@ -765,7 +765,7 @@ function test_Drilldown() { ['North', 5], ['South', 3] ] - }, <__Highcharts.ColumnChartSeriesOptions>{ + }, { id: 'other-2014', data: [ ['East', 7], @@ -783,14 +783,14 @@ function test_Drilldown() { type: 'column' }, plotOptions: { - series: <__Highcharts.ColumnChart> { + series: { borderWidth: 0, dataLabels: { enabled: true } } }, - series: [<__Highcharts.ColumnChartSeriesOptions>{ + series: [{ name: 'Things', colorByPoint: true, data: [{ @@ -858,7 +858,7 @@ function test_Drilldown() { } function test_Exporting() { - var allDefaults: __Highcharts.ExportingOptions = {}; + var allDefaults: Highcharts.ExportingOptions = {}; // source size example $('#container').highcharts({ @@ -890,13 +890,13 @@ function test_Exporting() { } function test_Loading() { - var allDefaults: __Highcharts.LoadingOptions = {}; + var allDefaults: Highcharts.LoadingOptions = {}; // examples // the button handler var isLoading = false, $button = $('#button'), - chart: __Highcharts.ChartObject; + chart: Highcharts.ChartObject; $button.click(function () { if (!isLoading) { @@ -932,7 +932,7 @@ function test_Loading() { } function test_Navigation() { - var allDefaults: __Highcharts.NavigationOptions = {}; + var allDefaults: Highcharts.NavigationOptions = {}; // examples $('#container').highcharts({ @@ -974,7 +974,7 @@ function test_Navigation() { } function test_NoData() { - var allDefaults: __Highcharts.NoDataOptions = {}; + var allDefaults: Highcharts.NoDataOptions = {}; // example $('#container').highcharts({ @@ -1000,7 +1000,7 @@ function test_NoData() { } function test_AreaOptions() { - var allDefaults: __Highcharts.AreaChartSeriesOptions = {}; + var allDefaults: Highcharts.AreaChartSeriesOptions = {}; // examples $('#container').highcharts({ @@ -1011,12 +1011,12 @@ function test_AreaOptions() { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, plotOptions: { - series: <__Highcharts.AreaChartSeriesOptions> { + series: { fillColor: { linearGradient: [0, 0, 0, 300], stops: [ [0, Highcharts.getOptions().colors[0]], - [1, (<__Highcharts.Gradient>Highcharts.Color(Highcharts.getOptions().colors[0])).setOpacity(0).get('rgba')] + [1, (Highcharts.Color(Highcharts.getOptions().colors[0])).setOpacity(0).get('rgba')] ] }, fillOpacity: 0.1, @@ -1036,7 +1036,7 @@ function test_AreaOptions() { } function test_AreaRange() { - var allDefaults: __Highcharts.AreaRangeChartSeriesOptions = {}; + var allDefaults: Highcharts.AreaRangeChartSeriesOptions = {}; // example $('#container').highcharts({ @@ -1044,7 +1044,7 @@ function test_AreaRange() { type: "arearange", zoomType: 'x' }, - series: [<__Highcharts.AreaRangeChartSeriesOptions>{ + series: [{ data: (function (arr: number[], len: number) { var i: number; for (i = 0; i < len; i = i + 1) { @@ -1090,7 +1090,7 @@ function test_AreaRange() { legend: { enabled: false }, - series: [<__Highcharts.AreaRangeChartSeriesOptions> { + series: [ { name: 'Temperatures', data: data, dataLabels: { @@ -1105,7 +1105,7 @@ function test_AreaRange() { } function test_Bar() { - var allDefaults: __Highcharts.BarChartSeriesOptions = {}; + var allDefaults: Highcharts.BarChartSeriesOptions = {}; $('#container').highcharts({ chart: { @@ -1115,7 +1115,7 @@ function test_Bar() { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, plotOptions: { - series: <__Highcharts.BarChartSeriesOptions> { + series: { borderColor: '#303030', borderRadius: 5, borderWidth: 2, @@ -1174,7 +1174,7 @@ function test_Bar() { // grouping example Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function (color: string) { - return (<__Highcharts.Gradient>Highcharts.Color(color)) + return (Highcharts.Color(color)) .setOpacity(0.5) .get('rgba'); }); @@ -1209,19 +1209,19 @@ function test_Bar() { shadow: false } }, - series: [<__Highcharts.BarChartSeriesOptions> { + series: [ { name: 'Tokyo', data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], pointPadding: 0 - }, <__Highcharts.BarChartSeriesOptions> { + }, { name: 'New York', data: [83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2, 83.5, 106.6, 92.3], pointPadding: 0.1 - }, <__Highcharts.BarChartSeriesOptions> { + }, { name: 'London', data: [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2], pointPadding: 0.2 - }, <__Highcharts.BarChartSeriesOptions> { + }, { name: 'Berlin', data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1], pointPadding: 0.3 @@ -1230,7 +1230,7 @@ function test_Bar() { } function test_BoxPlot() { - var allDefaults: __Highcharts.BoxPlotChartSeriesOptions = {}; + var allDefaults: Highcharts.BoxPlotChartSeriesOptions = {}; // boxplot example $('#container').highcharts({ @@ -1282,7 +1282,7 @@ function test_BoxPlot() { } function test_Bubble() { - var allDefaults: __Highcharts.BubbleChartSeriesOptions = {}; + var allDefaults: Highcharts.BubbleChartSeriesOptions = {}; // bubble example $('#container').highcharts({ @@ -1307,7 +1307,7 @@ function test_Bubble() { maxSize: 50 } }, - series: [<__Highcharts.BubbleChartSeriesOptions> { + series: [ { data: [ [9, 81, 13], [98, 5, 39], @@ -1344,7 +1344,7 @@ function test_Bubble() { subtitle: { text: 'Size is computed by absolute value on negative bubbles' }, - series: [<__Highcharts.BubbleChartSeriesOptions>{ + series: [{ data: [ [-5, 0, -5], [-4, 0, -4], @@ -1365,19 +1365,19 @@ function test_Bubble() { } function test_Column() { - var allDefaults: __Highcharts.ColumnChartSeriesOptions = {}; + var allDefaults: Highcharts.ColumnChartSeriesOptions = {}; // same options as bar chart } function test_ColumnRange() { - var allDefaults: __Highcharts.ColumnRangeChartSeriesOptions = {}; + var allDefaults: Highcharts.ColumnRangeChartSeriesOptions = {}; // same options as bar chart and datalabels from arearange } function test_ErrorBar() { - var allDefaults: __Highcharts.ErrorBarChartSeriesOptions = {}; + var allDefaults: Highcharts.ErrorBarChartSeriesOptions = {}; // error bar styling example $('#container').highcharts({ @@ -1401,7 +1401,7 @@ function test_ErrorBar() { tooltip: { shared: true }, - series: [<__Highcharts.SplineChartSeriesOptions>{ + series: [{ name: 'Temperature', type: 'spline', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6], @@ -1411,7 +1411,7 @@ function test_ErrorBar() { tooltip: { pointFormat: '{series.name}: {point.y:.1f}°C
' } - }, <__Highcharts.ErrorBarChartSeriesOptions> { + }, { color: '#FF0000', name: 'Temperature error', type: 'errorbar', @@ -1428,7 +1428,7 @@ function test_ErrorBar() { } function test_Funnel() { - var allDefaults: __Highcharts.FunnelChartSeriesOptions = {}; + var allDefaults: Highcharts.FunnelChartSeriesOptions = {}; // funnel demo $('#container').highcharts({ @@ -1441,7 +1441,7 @@ function test_Funnel() { x: -50 }, plotOptions: { - series: <__Highcharts.FunnelChartSeriesOptions> { + series: { dataLabels: { enabled: true, format: '{point.name} ({point.y:,.0f})', @@ -1472,7 +1472,7 @@ function test_Funnel() { } function test_Gauge() { - var allDefaults: __Highcharts.GaugeChartSeriesOptions = {}; + var allDefaults: Highcharts.GaugeChartSeriesOptions = {}; // example $('#container').highcharts({ @@ -1518,7 +1518,7 @@ function test_Gauge() { } } }, - series: [<__Highcharts.GaugeChartSeriesOptions> { + series: [ { data: [80], overshoot: 5 }] @@ -1526,7 +1526,7 @@ function test_Gauge() { } function test_HeatMap() { - var allDefaults: __Highcharts.HeatMapSeriesOptions = {}; + var allDefaults: Highcharts.HeatMapSeriesOptions = {}; // heatmap demo $('#container').highcharts({ @@ -1574,7 +1574,7 @@ function test_HeatMap() { ], min: -5 }, - series: [<__Highcharts.HeatMapSeriesOptions> { + series: [ { borderWidth: 0, colsize: 24 * 36e5, // one day tooltip: { @@ -1586,7 +1586,7 @@ function test_HeatMap() { } function test_Line() { - var allDefaults: __Highcharts.LineChartSeriesOptions = {}; + var allDefaults: Highcharts.LineChartSeriesOptions = {}; // step example $('#container').highcharts({ @@ -1596,17 +1596,17 @@ function test_Line() { xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, - series: [<__Highcharts.LineChartSeriesOptions>{ + series: [{ data: [1, 2, 3, 4, null, 6, 7, null, 9], step: 'right', name: 'Right', linecap: 'round' - }, <__Highcharts.LineChartSeriesOptions>{ + }, { data: [5, 6, 7, 8, null, 10, 11, null, 13], step: 'center', name: 'Center', linecap: 'round' - }, <__Highcharts.LineChartSeriesOptions>{ + }, { data: [9, 10, 11, 12, null, 14, 15, null, 17], step: 'left', name: 'Left', @@ -1616,7 +1616,7 @@ function test_Line() { } function test_Pie() { - var allDefaults: __Highcharts.PieChartSeriesOptions = {}; + var allDefaults: Highcharts.PieChartSeriesOptions = {}; // pie demo $('#container').highcharts({ @@ -1646,7 +1646,7 @@ function test_Pie() { } } }, - series: [<__Highcharts.PieChartSeriesOptions>{ + series: [{ name: "Brands", colorByPoint: true, data: [{ @@ -1705,7 +1705,7 @@ function test_Pie() { center: ['50%', '75%'] } }, - series: [<__Highcharts.PieChartSeriesOptions>{ + series: [{ type: 'pie', name: 'Browser share', innerSize: '50%', @@ -1757,7 +1757,7 @@ function test_Pie() { } function test_Polygon() { - var allDefaults: __Highcharts.PolygonChartSeriesOptions = {}; + var allDefaults: Highcharts.PolygonChartSeriesOptions = {}; $('#container').highcharts({ chart: { @@ -1786,7 +1786,7 @@ function test_Polygon() { } function test_Pyramid() { - var allDefaults: __Highcharts.PyramidChartSeriesOptions = {}; + var allDefaults: Highcharts.PyramidChartSeriesOptions = {}; // pyramid demo $('#container').highcharts({ @@ -1825,10 +1825,10 @@ function test_Pyramid() { } function test_SolidGauge() { - var allDefaults: __Highcharts.SolidGaugeChartSeriesOptions = {}; + var allDefaults: Highcharts.SolidGaugeChartSeriesOptions = {}; // partial solid gauge demo - var gaugeOptions: __Highcharts.Options = { + var gaugeOptions: Highcharts.Options = { chart: { type: 'solidgauge' }, @@ -1880,10 +1880,10 @@ function test_SolidGauge() { } function test_TreeMap() { - var allDefaults: __Highcharts.TreeMapChartSeriesOptions = {}; + var allDefaults: Highcharts.TreeMapChartSeriesOptions = {}; // allowDrillToNode - var treeMap: __Highcharts.TreeMapChartSeriesOptions = { + var treeMap: Highcharts.TreeMapChartSeriesOptions = { type: "treemap", layoutAlgorithm: 'squarified', allowDrillToNode: true, @@ -1932,10 +1932,10 @@ function test_TreeMap() { } function test_Waterfall() { - var allDefaults: __Highcharts.WaterFallChartSeriesOptions = {}; + var allDefaults: Highcharts.WaterFallChartSeriesOptions = {}; // partial waterfall demo - var series: __Highcharts.WaterFallChartSeriesOptions = { + var series: Highcharts.WaterFallChartSeriesOptions = { upColor: Highcharts.getOptions().colors[2], color: Highcharts.getOptions().colors[3], data: [{ @@ -1978,9 +1978,9 @@ function test_Waterfall() { } function test_AxisOptions() { - var allDefaults: __Highcharts.AxisOptions = {}; + var allDefaults: Highcharts.AxisOptions = {}; - var axis: __Highcharts.AxisOptions = { + var axis: Highcharts.AxisOptions = { allowDecimals: false, alternateGridColor: '#000000', breaks: [{ @@ -2168,31 +2168,31 @@ function test_AxisObject() { axis.toPixels(10, true); axis.toValue(10); axis.toValue(10, true); - axis.update(<__Highcharts.AxisOptions>{}); - axis.update(<__Highcharts.AxisOptions>{}, true); + axis.update({}); + axis.update({}, true); } function test_ChartObject() { var chart = $("#container").highcharts(); - chart.addAxis(<__Highcharts.AxisOptions>{}); - chart.addAxis(<__Highcharts.AxisOptions>{}, true); - chart.addAxis(<__Highcharts.AxisOptions>{}, true, false); - chart.addAxis(<__Highcharts.AxisOptions>{}, true, true, false); - chart.addAxis(<__Highcharts.AxisOptions>{}, true, true, {duration: 50}); - chart.addSeries(<__Highcharts.IndividualSeriesOptions>{}); - chart.addSeries(<__Highcharts.IndividualSeriesOptions>{}, false); - chart.addSeries(<__Highcharts.IndividualSeriesOptions>{}, false, false); - chart.addSeries(<__Highcharts.IndividualSeriesOptions>{}, false, {duration: 50}); - chart.addSeriesAsDrilldown(<__Highcharts.PointObject>{}, <__Highcharts.IndividualSeriesOptions>{}); + chart.addAxis({}); + chart.addAxis({}, true); + chart.addAxis({}, true, false); + chart.addAxis({}, true, true, false); + chart.addAxis({}, true, true, {duration: 50}); + chart.addSeries({}); + chart.addSeries({}, false); + chart.addSeries({}, false, false); + chart.addSeries({}, false, {duration: 50}); + chart.addSeriesAsDrilldown({}, {}); var container = chart.container; console.log(container.id); chart.destroy(); chart.drillUp(); - chart.exportChart(<__Highcharts.ExportingOptions>{}, <__Highcharts.Options>{}); - chart.exportChartLocal(<__Highcharts.ExportingOptions>{}, <__Highcharts.Options>{}); + chart.exportChart({}, {}); + chart.exportChartLocal({}, {}); var object = chart.get('axisIdOrSeriesIdOrPointId'); var svg1 = chart.getSVG(); - var svg2 = chart.getSVG(<__Highcharts.Options>{}); + var svg2 = chart.getSVG({}); var selectedPoints = chart.getSelectedPoints(); var selectedSeries = chart.getSelectedSeries(); chart.hideLoading(); @@ -2212,6 +2212,7 @@ function test_ChartObject() { chart.showLoading("Loading label"); var firstXAxis = chart.xAxis[0]; var firstYAxis = chart.yAxis[0]; + var legend = chart.legend; } function test_ElementObject() { @@ -2257,7 +2258,7 @@ function test_ElementObject() { } function test_PointObject() { - var point = <__Highcharts.PointObject>$('#container').highcharts().get('point1'); + var point = $('#container').highcharts().get('point1'); var category = point.category; var percentage = point.percentage; point.index; @@ -2298,7 +2299,7 @@ function test_RendererObject() { } function test_SeriesObject() { - var series = <__Highcharts.SeriesObject>$('#container').highcharts().get('series1'); + var series = $('#container').highcharts().get('series1'); series.addPoint(0); series.addPoint([0, 0]); series.addPoint({}); @@ -2338,3 +2339,8 @@ function test_SeriesObject() { var xAxis = series.xAxis; var yAxis = series.yAxis; } +function test_LegendObject() { + var legend = $('#container').highcharts().legend; + legend.update({}); + legend.update({}, false); +} diff --git a/highcharts/highstock-tests.ts b/highcharts/highstock-tests.ts index fda21c1616..ac7cb883f2 100644 --- a/highcharts/highstock-tests.ts +++ b/highcharts/highstock-tests.ts @@ -1,5 +1,5 @@ - /// +import * as Highcharts from "highcharts"; var someData = [1, 2, 3, 4, 5, 6, 7, 8, 9]; @@ -55,7 +55,7 @@ $(function () { } }, - series: [<__Highcharts.AreaRangeChartSeriesOptions>{ + series: [{ name: 'USD to EUR', data: someData, lineColor: "blue" diff --git a/highcharts/highstock.d.ts b/highcharts/highstock.d.ts index bf57b32429..6784e83eb1 100644 --- a/highcharts/highstock.d.ts +++ b/highcharts/highstock.d.ts @@ -3,8 +3,10 @@ // Definitions by: David Deutsch // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import * as Highcharts from "highcharts"; + declare namespace __Highstock { - interface ChartObject extends __Highcharts.ChartObject { + interface ChartObject extends Highcharts.ChartObject { options: Options; } @@ -22,16 +24,16 @@ declare namespace __Highstock { maskInside?: boolean; outlineColor?: string; outlineWidth?: number; - series?: __Highcharts.IndividualSeriesOptions; - xAxis?: __Highcharts.AxisOptions; - yAxis?: __Highcharts.AxisOptions; + series?: Highcharts.IndividualSeriesOptions; + xAxis?: Highcharts.AxisOptions; + yAxis?: Highcharts.AxisOptions; } interface RangeSelectorButton { - type: string; //Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'. - count?: number; - text: string; - dataGrouping?: any; //not sure how this works + type: string; //Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'. + count?: number; + text: string; + dataGrouping?: any; //not sure how this works } interface RangeSelectorOptions { @@ -53,33 +55,33 @@ declare namespace __Highstock { x?: number; y?: number; }; - inputStyle?: __Highcharts.CSSObject; - labelStyle?: __Highcharts.CSSObject; + inputStyle?: Highcharts.CSSObject; + labelStyle?: Highcharts.CSSObject; selected?: number; } interface ScrollbarOptions { - barBackgroundColor?: string; - barBorderColor?: string; - barBorderRadius?: number; - barBorderWidth?: number; - buttonArrowColor?: string; - buttonBackgroundColor?: string; - buttonBorderColor?: string; - buttonBorderRadius?: number; - buttonBorderWidth?: number; - enabled?: boolean; - height?: number; - liveRedraw?: boolean; - minWidth?: number; - rifleColor?: string; - trackBackgroundColor?: string; - trackBorderColor?: string; - trackBorderRadius?: number; - trackBorderWidth?: number; + barBackgroundColor?: string; + barBorderColor?: string; + barBorderRadius?: number; + barBorderWidth?: number; + buttonArrowColor?: string; + buttonBackgroundColor?: string; + buttonBorderColor?: string; + buttonBorderRadius?: number; + buttonBorderWidth?: number; + enabled?: boolean; + height?: number; + liveRedraw?: boolean; + minWidth?: number; + rifleColor?: string; + trackBackgroundColor?: string; + trackBorderColor?: string; + trackBorderRadius?: number; + trackBorderWidth?: number; } - interface Options extends __Highcharts.Options { + interface Options extends Highcharts.Options { navigator?: NavigatorOptions; rangeSelector?: RangeSelectorOptions; scrollbar?: ScrollbarOptions; @@ -90,32 +92,35 @@ declare namespace __Highstock { new (options: Options, callback: (chart: ChartObject) => void): ChartObject; } - interface Static extends __Highcharts.Static { + interface Static extends Highcharts.Static { StockChart: Chart; } } -interface JQuery { - highcharts(type: "StockChart"): __Highstock.ChartObject; - /** - * Creates a new Highcharts.Chart for the current JQuery selector; usually - * a div selected by $('#container') - * @param {__Highcharts.Options} options Options for this chart - * @return current {JQuery} selector the current JQuery selector - **/ - highcharts(type: "StockChart", options: __Highstock.Options): JQuery; - /** - * Creates a new Highcharts.Chart for the current JQuery selector; usually - * a div selected by $('#container') - * @param {__Highcharts.Options} options Options for this chart - * @param callback Callback function used to manipulate the constructed chart instance - * @return current {JQuery} selector the current JQuery selector - **/ - highcharts(type: "StockChart", options: __Highstock.Options, callback: (chart: __Highstock.ChartObject) => void): JQuery; +declare global { + interface JQuery { + highcharts(type: "StockChart"): __Highstock.ChartObject; + /** + * Creates a new Highcharts.Chart for the current JQuery selector; usually + * a div selected by $('#container') + * @param {Highcharts.Options} options Options for this chart + * @return current {JQuery} selector the current JQuery selector + **/ + highcharts(type: "StockChart", options: __Highstock.Options): JQuery; + /** + * Creates a new Highcharts.Chart for the current JQuery selector; usually + * a div selected by $('#container') + * @param {Highcharts.Options} options Options for this chart + * @param callback Callback function used to manipulate the constructed chart instance + * @return current {JQuery} selector the current JQuery selector + **/ + highcharts(type: "StockChart", options: __Highstock.Options, callback: (chart: __Highstock.ChartObject) => void): JQuery; - highcharts(type: string): __Highcharts.ChartObject; - highcharts(type: string, options: __Highcharts.Options): JQuery; - highcharts(type: string, options: __Highcharts.Options, callback: (chart: __Highcharts.ChartObject) => void): JQuery; + highcharts(type: string): Highcharts.ChartObject; + highcharts(type: string, options: Highcharts.Options): JQuery; + highcharts(type: string, options: Highcharts.Options, callback: (chart: Highcharts.ChartObject) => void): JQuery; + } } + diff --git a/highcharts/index.d.ts b/highcharts/index.d.ts index 7f2d28e99b..e425c0458b 100644 --- a/highcharts/index.d.ts +++ b/highcharts/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Damiano Gambarotto , Dan Lewi Harkestad // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace __Highcharts { +declare namespace Highcharts { interface Position { align?: string; verticalAlign?: string; @@ -2244,7 +2244,7 @@ declare namespace __Highcharts { formAttributes?: any; /** * Path where Highcharts will look for export module dependencies to load on demand if they don't already exist on - * window. Should currently point to location of CanVG library (https://github.com/canvg/canvg) and RGBColor.js, + * window. Should currently point to location of CanVG library (https://github.com/canvg/canvg) and RGBColor.js, * required for client side export in certain browsers. * @default 'http://code.highcharts.com/{version}/lib' * @since 5.0.0 @@ -2989,7 +2989,7 @@ declare namespace __Highcharts { */ padding?: number; /** - * Whether to reserve space for the labels. This can be turned off when for example the labels are rendered inside + * Whether to reserve space for the labels. This can be turned off when for example the labels are rendered inside * the plot area instead of outside. * @default true * @since 4.1.10 @@ -4952,8 +4952,8 @@ declare namespace __Highcharts { } /* You will rarely, if ever, want to use this interface directly. Instead it is much more useful to use one of the derived - * interfaces (AreaChartSeriesOptions, LineChartSeriesOptions, etc.) - */ + * interfaces (AreaChartSeriesOptions, LineChartSeriesOptions, etc.) + */ interface IndividualSeriesOptions { type?: string; /** @@ -5946,6 +5946,19 @@ declare namespace __Highcharts { * @since 2.0.5 */ showLoading(str?: string): void; + /** + * A generic function to update any element of the chart. Elements can be enabled and disabled, moved, re-styled, + * re-formatted etc. + * A special case is configuration objects that take arrays, for example xAxis, yAxis or series. For these collections, + * an id option is used to map the new option set to an existing object. If an existing object of the same id is not + * found, the first item is updated. So for example, running chart.update with a series item without an id, will cause + * the existing chart's first series to be updated. + * See also the responsive option set. Switching between responsive.rules basically runs chart.update under the hood. + * @param {ChartOptions} option A configuration object for the new chart options as defined in the options section of the API. + * @param [boolean] redraw Whether to redraw the chart. Defaults to true. + * @since 5.0.0 + */ + update(options: ChartOptions, redraw?: boolean): void; /** * This method is deprecated as of 2.0.1. Updating the chart position after a move operation is no longer necessary. * @since 1.2.5 @@ -5964,6 +5977,8 @@ declare namespace __Highcharts { yAxis: AxisObject[]; renderer: RendererObject; + + legend: LegendObject; } interface Chart { @@ -6443,35 +6458,39 @@ declare namespace __Highcharts { */ yAxis: AxisObject; } + + interface LegendObject { + /** + * Update the legend with new options. + * @param {LegendOptions} options New options that will be merged into the legend's existing options. + * @param [boolean] redraw - Whether to redraw the chart. Defaults to true. + * @since 5.0.0 + */ + update(options: LegendOptions, redraw?: boolean): void; + } } -interface JQuery { - highcharts(): __Highcharts.ChartObject; - /** - * Creates a new Highcharts.Chart for the current JQuery selector; usually - * a div selected by $('#container') - * @param {Options} options Options for this chart - * @return current {JQuery} selector the current JQuery selector - **/ - highcharts(options: __Highcharts.Options): JQuery; - /** - * Creates a new Highcharts.Chart for the current JQuery selector; usually - * a div selected by $('#container') - * @param {Options} options Options for this chart - * @param callback Callback function used to manipulate the constructed chart instance - * @return current {JQuery} selector the current JQuery selector - **/ - highcharts(options: __Highcharts.Options, callback: (chart: __Highcharts.ChartObject) => void): JQuery; +declare global { + interface JQuery { + highcharts(): Highcharts.ChartObject; + /** + * Creates a new Highcharts.Chart for the current JQuery selector; usually + * a div selected by $('#container') + * @param {Options} options Options for this chart + * @return current {JQuery} selector the current JQuery selector + **/ + highcharts(options: Highcharts.Options): JQuery; + /** + * Creates a new Highcharts.Chart for the current JQuery selector; usually + * a div selected by $('#container') + * @param {Options} options Options for this chart + * @param callback Callback function used to manipulate the constructed chart instance + * @return current {JQuery} selector the current JQuery selector + **/ + highcharts(options: Highcharts.Options, callback: (chart: Highcharts.ChartObject) => void): JQuery; + } } -/** - * Enabling the usage of ES6 module loading. - */ -declare var Highcharts: __Highcharts.Static; - -/** - * Declaration for ES6 module loading. - */ -declare module "highcharts" { - export = __Highcharts; -} +declare var Highcharts: Highcharts.Static; +export = Highcharts; +export as namespace Highcharts; diff --git a/highcharts/modules/boost-tests.ts b/highcharts/modules/boost-tests.ts new file mode 100644 index 0000000000..98202a2129 --- /dev/null +++ b/highcharts/modules/boost-tests.ts @@ -0,0 +1 @@ +HighchartsBoost(Highcharts); diff --git a/highcharts/highcharts-modules-boost.d.ts b/highcharts/modules/boost.d.ts similarity index 53% rename from highcharts/highcharts-modules-boost.d.ts rename to highcharts/modules/boost.d.ts index 0991884558..9b62dab1c7 100644 --- a/highcharts/highcharts-modules-boost.d.ts +++ b/highcharts/modules/boost.d.ts @@ -3,10 +3,8 @@ // Definitions by: Daniel Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import { Static } from "highcharts"; -declare var HighchartsBoost: (H: __Highcharts.Static) => __Highcharts.Static; - -declare module "highcharts/modules/boost" { - export = HighchartsBoost; -} +declare var HighchartsBoost: (H: Static) => Static; +export = HighchartsBoost; +export as namespace HighchartsBoost; diff --git a/highcharts/modules/exporting-tests.ts b/highcharts/modules/exporting-tests.ts new file mode 100644 index 0000000000..22bced1b24 --- /dev/null +++ b/highcharts/modules/exporting-tests.ts @@ -0,0 +1 @@ +HighchartsExporting(Highcharts); diff --git a/highcharts/highcharts-modules-exporting.d.ts b/highcharts/modules/exporting.d.ts similarity index 53% rename from highcharts/highcharts-modules-exporting.d.ts rename to highcharts/modules/exporting.d.ts index b6a0e49f30..877ef3d0c1 100644 --- a/highcharts/highcharts-modules-exporting.d.ts +++ b/highcharts/modules/exporting.d.ts @@ -3,10 +3,8 @@ // Definitions by: Maciej Suchecki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import { Static } from "highcharts"; -declare var HighchartsExporting: (H: __Highcharts.Static) => __Highcharts.Static; - -declare module "highcharts/modules/exporting" { - export = HighchartsExporting; -} +declare var HighchartsExporting: (H: Static) => Static; +export = HighchartsExporting; +export as namespace HighchartsExporting; diff --git a/highcharts/highcharts-modules-no-data-to-display-tests.ts b/highcharts/modules/no-data-to-display-tests.ts similarity index 57% rename from highcharts/highcharts-modules-no-data-to-display-tests.ts rename to highcharts/modules/no-data-to-display-tests.ts index 6c7b12e105..84392c3bf4 100644 --- a/highcharts/highcharts-modules-no-data-to-display-tests.ts +++ b/highcharts/modules/no-data-to-display-tests.ts @@ -1,7 +1,3 @@ -/// -/// -/// - function test_NoDataToDisplay() { var chart = $("#container").highcharts(); var chartHasData = chart.hasData(); diff --git a/highcharts/highcharts-modules-no-data-to-display.d.ts b/highcharts/modules/no-data-to-display.d.ts similarity index 91% rename from highcharts/highcharts-modules-no-data-to-display.d.ts rename to highcharts/modules/no-data-to-display.d.ts index db799236b4..0da068c413 100644 --- a/highcharts/highcharts-modules-no-data-to-display.d.ts +++ b/highcharts/modules/no-data-to-display.d.ts @@ -2,8 +2,10 @@ // Project: http://www.highcharts.com/ // Definitions by: Andrey Zolotin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// -declare namespace __Highcharts { + +import * as Hc from "highcharts"; + +declare module "highcharts" { interface ChartObject { /** * Returns true if there are data points within the plot area now diff --git a/highcharts/modules/offline-exporting-tests.ts b/highcharts/modules/offline-exporting-tests.ts new file mode 100644 index 0000000000..22bced1b24 --- /dev/null +++ b/highcharts/modules/offline-exporting-tests.ts @@ -0,0 +1 @@ +HighchartsExporting(Highcharts); diff --git a/highcharts/highcharts-modules-offline-exporting.d.ts b/highcharts/modules/offline-exporting.d.ts similarity index 50% rename from highcharts/highcharts-modules-offline-exporting.d.ts rename to highcharts/modules/offline-exporting.d.ts index d0721c2d46..94ecf53485 100644 --- a/highcharts/highcharts-modules-offline-exporting.d.ts +++ b/highcharts/modules/offline-exporting.d.ts @@ -3,10 +3,8 @@ // Definitions by: Daniel Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import { Static } from "highcharts"; -declare var HighchartsOfflineExporting: (H: __Highcharts.Static) => __Highcharts.Static; - -declare module "highcharts/modules/offline-exporting" { - export = HighchartsOfflineExporting; -} +declare var HighchartsOfflineExporting: (H: Static) => Static; +export = HighchartsOfflineExporting; +export as namespace HighchartsOfflineExporting; diff --git a/highcharts/tsconfig.json b/highcharts/tsconfig.json index 735490820e..4744c83cb0 100644 --- a/highcharts/tsconfig.json +++ b/highcharts/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,8 +15,18 @@ }, "files": [ "index.d.ts", - "highstock.d.ts", "highcharts-tests.ts", + "modules/boost.d.ts", + "modules/boost-tests.ts", + "modules/exporting.d.ts", + "modules/exporting-tests.ts", + "modules/no-data-to-display.d.ts", + "modules/no-data-to-display-tests.ts", + "modules/offline-exporting.d.ts", + "modules/offline-exporting-tests.ts", + "highcharts-more.d.ts", + "highcharts-more-tests.ts", + "highstock.d.ts", "highstock-tests.ts" ] } \ No newline at end of file diff --git a/highland/tsconfig.json b/highland/tsconfig.json index 67e25f81e8..75f9a8053a 100644 --- a/highland/tsconfig.json +++ b/highland/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/highlight.js/tsconfig.json b/highlight.js/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/highlight.js/tsconfig.json +++ b/highlight.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/history.js/tsconfig.json b/history.js/tsconfig.json index 3e41931775..3ef4710368 100644 --- a/history.js/tsconfig.json +++ b/history.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/history/index.d.ts b/history/index.d.ts index b099b9beaa..6b61fa1b77 100644 --- a/history/index.d.ts +++ b/history/index.d.ts @@ -1,10 +1,8 @@ // Type definitions for history v2.0.0 -// Project: https://github.com/rackt/history +// Project: https://github.com/mjackson/history // Definitions by: Sergey Buturlakin , Nathan Brown // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// types based on https://github.com/rackt/history/blob/master/docs/Terms.md - export as namespace History; export type Action = string; diff --git a/history/tsconfig.json b/history/tsconfig.json index 91e7f3f3d6..87a547edfd 100644 --- a/history/tsconfig.json +++ b/history/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hoek/hoek-tests.ts b/hoek/hoek-tests.ts new file mode 100644 index 0000000000..09f82a7e2a --- /dev/null +++ b/hoek/hoek-tests.ts @@ -0,0 +1,290 @@ +import * as Hoek from "hoek"; + +/** + * Import the entire module as above or use named imports: + * import { clone, merge, assert } from "hoek"; + * "Tests" taken straight from hoek API reference and adapted to TypeScript. + */ + +// clone(obj) + +let nestedObj = { + w: /^something$/ig, + x: { + a: [1, 2, 3], + b: 123456, + c: new Date() + }, + y: 'y', + z: new Date() +}; + +let copy = Hoek.clone(nestedObj); + +copy.x.b = 100; + +console.log(copy.y); // results in 'y' +console.log(nestedObj.x.b); // results in 123456 +console.log(copy.x.b); // results in 100 + +// cloneWithShallow(obj, keys) + +nestedObj = { + w: /^something$/ig, + x: { + a: [1, 2, 3], + b: 123456, + c: new Date() + }, + y: 'y', + z: new Date() +}; + +copy = Hoek.cloneWithShallow(nestedObj, ['x']); + +copy.x.b = 100; + +console.log(copy.y); // results in 'y' +console.log(nestedObj.x.b); // results in 100 +console.log(copy.x.b); // results in 100 + +// merge(target, source, isNullOverride, isMergeArrays) + +let target = { a: 1, b: 2 }; +let source = { a: 0, c: 5 }; +let source2 = { a: null, c: 5 }; + +Hoek.merge(target, source); // results in {a: 0, b: 2, c: 5} +Hoek.merge(target, source2); // results in {a: null, b: 2, c: 5} +Hoek.merge(target, source2, false); // results in {a: 1, b: 2, c: 5} + +let targetArray = [1, 2, 3]; +let sourceArray = [4, 5]; + +Hoek.merge(targetArray, sourceArray); // results in [1, 2, 3, 4, 5] +Hoek.merge(targetArray, sourceArray, true, false); // results in [4, 5] + +// applyToDefaults(defaults, options, isNullOverride) + +let defaults = { host: "localhost", port: 8000 }; +let options = { port: 8080 }; + +let config = Hoek.applyToDefaults(defaults, options); // results in { host: "localhost", port: 8080 } + +defaults = { host: "localhost", port: 8000 }; +let options1 = { host: null, port: 8080 }; + +config = Hoek.applyToDefaults(defaults, options1, true); // results in { host: null, port: 8080 } + +// applyToDefaultsWithShallow(defaults, options, keys) + +let defaults1 = { + server: { + host: "localhost", + port: 8000 + }, + name: 'example' +}; + +let options2 = { server: { port: 8080 } }; + +let config1 = Hoek.applyToDefaultsWithShallow(defaults1, options2, ['server']); // results in { server: { port: 8080 }, name: 'example' } + +// deepEqual(b, a, [options]) + +Hoek.deepEqual({ a: [1, 2], b: 'string', c: { d: true } }, { a: [1, 2], b: 'string', c: { d: true } }); //results in true +Hoek.deepEqual(Object.create(null), {}, { prototype: false }); //results in true +Hoek.deepEqual(Object.create(null), {}); //results in false + +// unique(array, key) + +let array = [1, 2, 2, 3, 3, 4, 5, 6]; + +let newArray = Hoek.unique(array); // results in [1,2,3,4,5,6] + +let array1 = [{ id: 1 }, { id: 1 }, { id: 2 }]; + +let newArray1 = Hoek.unique(array1, "id"); // results in [{id: 1}, {id: 2}] + +// mapToObject(array, key) + +array = [1, 2, 3]; +let newObject = Hoek.mapToObject(array); // results in {"1": true, "2": true, "3": true} + +array1 = [{ id: 1 }, { id: 2 }]; +newObject = Hoek.mapToObject(array1, "id"); // results in {"1": true, "2": true} + +// intersect(array1, array2) + +array = [1, 2, 3]; +let array2 = [1, 4, 5]; + +let newArray2 = Hoek.intersect(array, array2); // results in [1] + +// contain(ref, values, [options]) + +Hoek.contain('aaa', 'a', { only: true }); // true +Hoek.contain([{ a: 1 }], [{ a: 1 }], { deep: true }); // true +Hoek.contain([1, 2, 2], [1, 2], { once: true }); // false +Hoek.contain({ a: 1, b: 2, c: 3 }, { a: 1, d: 4 }, { part: true }); // true + +// flatten(array, [target]) + +let array3 = [1, [2, 3]]; + +let flattenedArray = Hoek.flatten(array); // results in [1, 2, 3] + +array3 = [1, [2, 3]]; +let target1 = [4, [5]]; + +flattenedArray = Hoek.flatten(array3, target1); // results in [4, [5], 1, 2, 3] + +// reach(obj, chain, [options]) + +let chain = 'a.b.c'; +let obj = { a: { b: { c: 1 } } }; + +Hoek.reach(obj, chain); // returns 1 + +chain = 'a.b.-1'; +let obj1 = { a: { b: [2, 3, 6] } }; + +Hoek.reach(obj1, chain); // returns 6 + +// reachTemplate(obj, template, [options]) + +chain = 'a.b.c'; +obj = { a: { b: { c: 1 } } }; + +Hoek.reachTemplate(obj, '1+{a.b.c}=2'); // returns '1+1=2' + +// transform(obj, transform, [options]) + +let source1 = { + address: { + one: '123 main street', + two: 'PO Box 1234' + }, + title: 'Warehouse', + state: 'CA' +}; + +let result = Hoek.transform(source1, { + 'person.address.lineOne': 'address.one', + 'person.address.lineTwo': 'address.two', + 'title': 'title', + 'person.address.region': 'state' +}); +// Results in +// { +// person: { +// address: { +// lineOne: '123 main street', +// lineTwo: 'PO Box 1234', +// region: 'CA' +// } +// }, +// title: 'Warehouse' +// } + +// shallow(obj) + +let shallow = Hoek.shallow({ a: { b: 1 } }); + +// stringify(obj) + +let a: any = {}; +a.b = a; +Hoek.stringify(a); // Returns '[Cannot display object: Converting circular structure to JSON]' + +// Timer + +let timerObj = new Hoek.Timer(); +console.log("Time is now: " + timerObj.ts); +console.log("Elapsed time from initialization: " + timerObj.elapsed() + 'milliseconds'); + +// Bench + +let benchObj = new Hoek.Bench(); +console.log("Elapsed time from initialization: " + benchObj.elapsed() + 'milliseconds'); + +// base64urlEncode(value) + +Hoek.base64urlEncode("hoek"); + +// base64urlDecode(value) + +Hoek.base64urlDecode("aG9law=="); + +// escapeHtml(string) + +let string = ' hey '; +let escapedString = Hoek.escapeHtml(string); // returns <html> hey </html> + +// escapeHeaderAttribute(attribute) + +a = Hoek.escapeHeaderAttribute('I said "go w\\o me"'); //returns I said \"go w\\o me\" + +// escapeRegex(string) + +a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\/`"(>)[<]d{}s,'); // returns 4\^f\$s\.4\*5\+\-_\?%\=#\!\:@\|~\\\/`"\(>\)\[<\]d\{\}s\, + +// assert(condition, message) + +let x = 1, y = 2; + +Hoek.assert(x === y, 'x should equal y'); // Throws 'x should equal y' + +Hoek.assert(x === y, new Error('x should equal y')); // Throws the given error object + +// abort(message) + +Hoek.abort("Error message"); + +// displayStack(slice) + +let stack = Hoek.displayStack(); +console.log(stack); + +// callStack(slice) + +let stack2 = Hoek.callStack(); +console.log(stack2); + +// nextTick(fn) + +let myFn = function () { + console.log('Do this later'); +}; + +let nextFn = Hoek.nextTick(myFn); + +nextFn(); +console.log('Do this first'); + +// Results in: +// +// Do this first +// Do this later + +// once(fn) + +myFn = function () { + console.log('Ran myFn'); +}; + +let onceFn = Hoek.once(myFn); +onceFn(); // results in "Ran myFn" +onceFn(); // results in undefined + +// ignore + +Hoek.ignore(); + +// uniqueFilename(path, extension) + +let result1 = Hoek.uniqueFilename('./test/modules', 'txt'); // results in "full/path/test/modules/{random}.txt" + +// isInteger(value) + +result = Hoek.isInteger('23'); diff --git a/hoek/index.d.ts b/hoek/index.d.ts new file mode 100644 index 0000000000..98e2188fec --- /dev/null +++ b/hoek/index.d.ts @@ -0,0 +1,211 @@ +// Type definitions for hoek 4.1 +// Project: https://github.com/hapijs/hoek +// Definitions by: Prashant Tiwari +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface ContainOptions { + /** Perform a deep comparison of the values? */ + deep?: boolean; + /** Allow only one occurrence of each value? */ + once?: boolean; + /** Don't allow values not explicitly listed? */ + only?: boolean; + /** Allow partial match of the values? */ + part?: boolean; +} + +interface ReachOptions { + /** String to split chain path on. Defaults to ".". */ + separator?: string; + /** Value to return if the path or value is not present. Default is undefined. */ + default?: any; + /** Throw an error on missing member? Default is false. */ + strict?: boolean; + /** Allow traversing functions for properties? */ + functions?: boolean; +} + +// Object + +/** + * Clone an object or an array. + */ +export function clone(obj: T): T; + +/** + * Clone an object or array. + * */ +export function cloneWithShallow(obj: any, keys: string[]): any; + +/** + * Merge all the properties of source into target. */ +export function merge(target: T1, source: T2, isNullOverride?: boolean, isMergeArrays?: boolean): T1 & T2; + +/** + * Apply options to a copy of the defaults. + * */ +export function applyToDefaults(defaults: T1, options: T2, isNullOverride?: boolean): T1 & T2; + +/** + * Apply options to a copy of the defaults. + */ +export function applyToDefaultsWithShallow(defaults: T1, options: T2, keys?: string[]): T1 & T2; + +/** + * Perform a deep comparison of the two values. + */ +export function deepEqual(b: T, a: T, options?: any): T; + +/** + * Remove duplicate items from Array. + */ +export function unique(array: T[], key?: string): T[]; + +/** + * Convert an Array into an Object. + */ +export function mapToObject(array: any[], key?: string): any; + +/** + * Find the common unique items in two arrays. + */ +export function intersect(array1: any[], array2: any[]): any; + +/** + * Test if the reference value contains the provided values. + */ +export function contain(ref: any, values: any, options?: ContainOptions): boolean; + +/** + * Flatten an array. + */ +export function flatten(array: any[], target?: any[]): any[]; + +/** + * Convert an object key chain string to reference. + */ +export function reach(obj: any, chain: any, options?: ReachOptions): any; + +/** + * Replace string parameters ({name}) with their corresponding object key values. + */ +export function reachTemplate(obj: any, template: string, options?: ReachOptions): any; + +/** + * Transform an existing object into a new one based on the supplied obj and transform map. + */ +export function transform(obj: any, transform: any, options?: ReachOptions): any; + +/** + * Perform a shallow copy by copying the references of all the top level children. + */ +export function shallow(obj: any): any; + +/** + * Convert an object to string. Any errors are caught and reported back in the form of the returned string. + */ +export function stringify(obj: any): string; + +// Timer + +/** + * A Timer object. + */ +export class Timer { + /** The number of milliseconds elapsed since the epoch. */ + ts: number; + /** The time (ms) elapsed since the timer was created. */ + elapsed(): number; +} + +// Bench + +/** + * Same as Timer, except ts stores the internal node clock. + */ +export class Bench { + /** The number of milliseconds on the node clock elapsed since the epoch. */ + ts: number; + /** The time (ms) elapsed since the timer was created. */ + elapsed(): number; +} + +// Binary Encoding/Decoding + +/** + * Encode value of string or buffer type in Base64 or URL encoding. + */ +export function base64urlEncode(value: string): string; + +/** + * Decode string into Base64 or URL encoding. + */ +export function base64urlDecode(value: string): string; + +// Escaping Characters + +/** + * Escape html characters. + */ +export function escapeHtml(htmlString: string): string; + +/** + * Escape attribute value for use in HTTP header. + */ +export function escapeHeaderAttribute(attribute: string): string; + +/** + * Escape string for Regex construction. + */ +export function escapeRegex(regexString: string): string; + +// Errors + +/** + * Print message or throw error if condition fails. + */ +export function assert(condition: boolean, message: string | Error): void | Error; + +/** + * Throw if process.env.NODE_ENV === 'test'. Else display most recent stack and exit process. + */ +export function abort(message: string | Error): void; + +/** + * Display the trace stack. + */ +export function displayStack(slice?: any): string[]; + +/** + * Return a trace stack array. + */ +export function callStack(slice?: any): any[]; + +// Function + +/** + * Wrap fn in process.nextTick. + */ +export function nextTick(fn: () => void): () => void; + +/** + * Make sure fn is only run once. + */ +export function once(fn: () => void): () => void; + +/** + * A simple no-op function. + */ +export function ignore(): void; + +// Miscellaneous + +/** + * path to prepend to a randomly generated file name. + */ +export function uniqueFilename(path: string, extension?: string): string; + +/** + * Check value to see if it is an integer. + */ +export function isInteger(value: any): boolean; diff --git a/hoek/tsconfig.json b/hoek/tsconfig.json new file mode 100644 index 0000000000..f5600ad032 --- /dev/null +++ b/hoek/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "hoek-tests.ts" + ] +} \ No newline at end of file diff --git a/hoek/tslint.json b/hoek/tslint.json new file mode 100644 index 0000000000..192203ab54 --- /dev/null +++ b/hoek/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} \ No newline at end of file diff --git a/hooker/tsconfig.json b/hooker/tsconfig.json index e79b17a305..b43ede4e1c 100644 --- a/hooker/tsconfig.json +++ b/hooker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hopscotch/tsconfig.json b/hopscotch/tsconfig.json index b6ef58f29d..b75b071bad 100644 --- a/hopscotch/tsconfig.json +++ b/hopscotch/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/howler/howler-tests.ts b/howler/howler-tests.ts index bdd3a575bd..7b47b73abb 100644 --- a/howler/howler-tests.ts +++ b/howler/howler-tests.ts @@ -1,19 +1,13 @@ -/** - * howler-tests.ts - * Created by xperiments on 02/09/14. - */ - import * as howler from "howler"; -Howler.codecs('ogg'); -Howler.iOSAutoEnable = true; var sound = new Howl({ - urls: ['sound.mp3'] -}).play(); + src: ['sound.mp3'] +}); +sound.play(); var sound = new Howl({ - urls: ['sound.mp3', 'sound.ogg', 'sound.wav'], + src: ['sound.webm', 'sound.mp3', 'sound.wav'], autoplay: true, loop: true, volume: 0.5, @@ -23,7 +17,7 @@ var sound = new Howl({ }); var sound = new Howl({ - urls: ['sounds.mp3', 'sounds.ogg'], + src: ['sounds.webm', 'sounds.mp3'], sprite: { blast: [0, 1000], laser: [2000, 3000], @@ -31,5 +25,32 @@ var sound = new Howl({ } }); -// shoot the laser! +// Shoot the laser! sound.play('laser'); + +var sound = new Howl({ + src: ['sound.webm', 'sound.mp3'] +}); + +// Clear listener after first call. +sound.once('load', function(){ + sound.play(); +}); + +// Fires when the sound finishes playing. +sound.on('end', function(){ + console.log('Finished!'); +}); + +var sound = new Howl({ + src: ['sound.webm', 'sound.mp3'] +}); + +// Play returns a uniqe Sound ID that can be passed +// into any method on Howl to control that specific sound. +var id1 = sound.play(); +var id2 = sound.play(); + +// Fade out the first sound and speed up the second. +sound.fade(1, 0, 1000, id1); +sound.rate(1.5, id2); diff --git a/howler/index.d.ts b/howler/index.d.ts index cdb95ce44f..1b6604b1aa 100644 --- a/howler/index.d.ts +++ b/howler/index.d.ts @@ -1,73 +1,107 @@ -// Type definitions for howler.js v1.1.29 +// Type definitions for howler.js v2.0.0 // Project: https://github.com/goldfire/howler.js -// Definitions by: Pedro Casaubon +// Definitions by: Pedro Casaubon , Todd Dukart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare class HowlerGlobal { - mute(muted: boolean): HowlerGlobal; +interface HowlerGlobal { + mute(muted: boolean): void; volume(): number; - volume(volume: number): HowlerGlobal; - codecs(extension: string): boolean; - iOSAutoEnable: boolean; + volume(volume: number): this; + codecs(ext: string): boolean; + unload(): void; + usingWebAudio: boolean; + noAudio: boolean; + mobileAudioEnable: boolean; + autoSuspend: boolean; + ctx: AudioContext; + masterGain: GainNode; } -declare var Howler: HowlerGlobal; +declare let Howler: HowlerGlobal; interface IHowlSoundSpriteDefinition { - [name: string]: number[]; + [name: string]: [number, number]|[number, number, boolean] } -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; + src: string|string[]; volume?: number; - urls?: string[]; + html5?: boolean; + loop?: boolean; + preload?: boolean; + autoplay?: boolean; + mute?: boolean; + sprite?: IHowlSoundSpriteDefinition; rate?: number; - model?: 'equalpower'|'HRTF'; - onend?: Function; - onload?: Function; - onloaderror?: Function; - onpause?: Function; - onplay?: Function; + pool?: number; + format?: string[] | string; + onload?: () => void; + onloaderror?: (soundId: number, error: any) => void; + onplay?: (soundId: number) => void; + onend?: (soundId: number) => void; + onpause?: (soundId: number) => void; + onstop?: (soundId: number) => void; + onmute?: (soundId: number) => void; + onvolume?: (soundId: number) => void; + onrate?: (soundId: number) => void; + onseek?: (soundId: number) => void; + onfade?: (soundId: number) => void; } interface Howl { - autoplay: Boolean; - buffer: Boolean; - format: string; - rate: number; - model: string; - onend: Function; - onload: Function; - onloaderror: Function; - onpause: Function; - onplay: Function; - load(): Howl; - play(sprite?: string, callback?: (soundId: string) => void): Howl; - play(callback?: (soundId: string) => void): Howl; - pause(soundId?: string): Howl; - stop(soundId?: string): Howl; - mute(muted?: boolean, soundId?: string): Howl; - fade(from: number, to: number, duration: number, callback?: Function, soundId?: string): Howl; - loop(): boolean; - loop(loop: boolean): Howl; - pos(position?: number, soundId?: string): number; - pos3d(x: number, y: number, z: number, soundId?: string): any; - sprite(definition?: IHowlSoundSpriteDefinition): IHowlSoundSpriteDefinition; + play(spriteOrId?: string|number): number; // .play() is not chainable; the other methods are + pause(id?: number): this; + stop(id?: number): this; + + mute(): boolean; + mute(muted: boolean, id?: number): this; + volume(): number; - volume(volume?: number, soundId?: string): Howl; - urls(): string[]; - urls(urls: string[]): Howl; - on(event: string, listener?: Function): Howl; - off(event: string, listener?: Function): Howl; + volume(idOrSetVolume: number): this | number; + volume(volume: number, id: number): this; + + fade(from: number, to: number, duration: number, id?: number): this; + + rate(): number; + rate(idOrSetRate: number): this | number; + rate(rate: number, id: number): this; + + seek(seek?: number, id?: number): this; + loop(loop?: boolean, id?: number): this; + playing(id?: number): boolean; + duration(id?: number): number; + + + on(event: 'load', callback: () => void, id?: number): this; + on(event: 'loaderror', callback: (soundId: number, error: any) => void, id?: number): this; + on(event: 'play', callback: (soundId: number) => void, id?: number): this; + on(event: 'end', callback: (soundId: number) => void, id?: number): this; + on(event: 'pause', callback: (soundId: number) => void, id?: number): this; + on(event: 'stop', callback: (soundId: number) => void, id?: number): this; + on(event: 'mute', callback: (soundId: number) => void, id?: number): this; + on(event: 'volume', callback: (soundId: number) => void, id?: number): this; + on(event: 'rate', callback: (soundId: number) => void, id?: number): this; + on(event: 'seek', callback: (soundId: number) => void, id?: number): this; + on(event: 'fade', callback: (soundId: number) => void, id?: number): this; + on(event: string, callback: Function, id?: number): this; + + once(event: 'load', callback: () => void, id?: number): this; + once(event: 'loaderror', callback: (soundId: number, error: any) => void, id?: number): this; + once(event: 'play', callback: (soundId: number) => void, id?: number): this; + once(event: 'end', callback: (soundId: number) => void, id?: number): this; + once(event: 'pause', callback: (soundId: number) => void, id?: number): this; + once(event: 'stop', callback: (soundId: number) => void, id?: number): this; + once(event: 'mute', callback: (soundId: number) => void, id?: number): this; + once(event: 'volume', callback: (soundId: number) => void, id?: number): this; + once(event: 'rate', callback: (soundId: number) => void, id?: number): this; + once(event: 'seek', callback: (soundId: number) => void, id?: number): this; + once(event: 'fade', callback: (soundId: number) => void, id?: number): this; + once(event: string, callback: Function, id?: number): this; + + off(event: string, callback?: Function, id?: number): this; + + state(): 'unloaded' | 'loading' | 'loaded'; + load(): void; unload(): void; } diff --git a/howler/tsconfig.json b/howler/tsconfig.json index 0a6fbf7922..8f996926d6 100644 --- a/howler/tsconfig.json +++ b/howler/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/html-entities/tsconfig.json b/html-entities/tsconfig.json index cdbfdfef70..a07bf0dcea 100644 --- a/html-entities/tsconfig.json +++ b/html-entities/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/html-minifier/tsconfig.json b/html-minifier/tsconfig.json index 3d13d78e06..199844668b 100644 --- a/html-minifier/tsconfig.json +++ b/html-minifier/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/html-pdf/html-pdf.d.ts b/html-pdf/index.d.ts similarity index 100% rename from html-pdf/html-pdf.d.ts rename to html-pdf/index.d.ts diff --git a/html-pdf/tsconfig.json b/html-pdf/tsconfig.json index b3b3941f12..77e614684d 100644 --- a/html-pdf/tsconfig.json +++ b/html-pdf/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "html-pdf.d.ts", + "index.d.ts", "html-pdf-tests.ts" ] } \ No newline at end of file diff --git a/html-to-text/tsconfig.json b/html-to-text/tsconfig.json index d9f4bbaef7..fb4f7284d8 100644 --- a/html-to-text/tsconfig.json +++ b/html-to-text/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/html-webpack-plugin/html-webpack-plugin-tests.ts b/html-webpack-plugin/html-webpack-plugin-tests.ts index 9aac8c9b98..9d4ec35e11 100644 --- a/html-webpack-plugin/html-webpack-plugin-tests.ts +++ b/html-webpack-plugin/html-webpack-plugin-tests.ts @@ -1,5 +1,3 @@ -/// - import {Configuration} from "webpack"; import HtmlWebpackPlugin = require("html-webpack-plugin"); diff --git a/html-webpack-plugin/html-webpack-plugin.d.ts b/html-webpack-plugin/index.d.ts similarity index 100% rename from html-webpack-plugin/html-webpack-plugin.d.ts rename to html-webpack-plugin/index.d.ts diff --git a/html-webpack-plugin/tsconfig.json b/html-webpack-plugin/tsconfig.json index ea542ae271..61a4420bb2 100644 --- a/html-webpack-plugin/tsconfig.json +++ b/html-webpack-plugin/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "html-webpack-plugin.d.ts", + "index.d.ts", "html-webpack-plugin-tests.ts" ] } \ No newline at end of file diff --git a/html2canvas/index.d.ts b/html2canvas/index.d.ts index 8c3d9e7b8d..3e661b34fa 100644 --- a/html2canvas/index.d.ts +++ b/html2canvas/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for html2canvas.js v0.5.0-bata.4 +// Type definitions for html2canvas.js v0.5.0-bata.4 // Project: https://github.com/niklasvh/html2canvas // Definitions by: Richard Hepburn , Pei-Tang Huang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/html2canvas/tsconfig.json b/html2canvas/tsconfig.json index fada6e0974..3309d5c3b0 100644 --- a/html2canvas/tsconfig.json +++ b/html2canvas/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/htmlparser2/tsconfig.json b/htmlparser2/tsconfig.json index e2cfd7742a..978249142a 100644 --- a/htmlparser2/tsconfig.json +++ b/htmlparser2/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/htmltojsx/tsconfig.json b/htmltojsx/tsconfig.json index 553da90cb9..aa259071b6 100644 --- a/htmltojsx/tsconfig.json +++ b/htmltojsx/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/http-errors/index.d.ts b/http-errors/index.d.ts index 7766aa3508..883fbf0ac1 100644 --- a/http-errors/index.d.ts +++ b/http-errors/index.d.ts @@ -3,89 +3,90 @@ // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare module 'http-errors' { + namespace createHttpError { -declare namespace createHttpError { + // See https://github.com/jshttp/http-errors/blob/1.3.1/index.js#L42 + interface HttpError extends Error { + status: number; + statusCode: number; + expose: boolean; + } - // See https://github.com/jshttp/http-errors/blob/1.3.1/index.js#L42 - interface HttpError extends Error { - status: number; - statusCode: number; - expose: boolean; + type HttpErrorConstructor = new(msg?: string) => HttpError; + + interface CreateHttpError { + // See https://github.com/Microsoft/TypeScript/issues/227#issuecomment-50092674 + [code: string]: new () => HttpError; + + (...args: Array): HttpError; + + Continue: HttpErrorConstructor; + SwitchingProtocols: HttpErrorConstructor; + Processing: HttpErrorConstructor; + OK: HttpErrorConstructor; + Created: HttpErrorConstructor; + Accepted: HttpErrorConstructor; + NonAuthoritativeInformation: HttpErrorConstructor; + NoContent: HttpErrorConstructor; + ResetContent: HttpErrorConstructor; + PartialContent: HttpErrorConstructor; + MultiStatus: HttpErrorConstructor; + AlreadyReported: HttpErrorConstructor; + IMUsed: HttpErrorConstructor; + MultipleChoices: HttpErrorConstructor; + MovedPermanently: HttpErrorConstructor; + Found: HttpErrorConstructor; + SeeOther: HttpErrorConstructor; + NotModified: HttpErrorConstructor; + UseProxy: HttpErrorConstructor; + Unused: HttpErrorConstructor; + TemporaryRedirect: HttpErrorConstructor; + PermanentRedirect: HttpErrorConstructor; + BadRequest: HttpErrorConstructor; + Unauthorized: HttpErrorConstructor; + PaymentRequired: HttpErrorConstructor; + Forbidden: HttpErrorConstructor; + NotFound: HttpErrorConstructor; + MethodNotAllowed: HttpErrorConstructor; + NotAcceptable: HttpErrorConstructor; + ProxyAuthenticationRequired: HttpErrorConstructor; + RequestTimeout: HttpErrorConstructor; + Conflict: HttpErrorConstructor; + Gone: HttpErrorConstructor; + LengthRequired: HttpErrorConstructor; + PreconditionFailed: HttpErrorConstructor; + PayloadTooLarge: HttpErrorConstructor; + URITooLong: HttpErrorConstructor; + UnsupportedMediaType: HttpErrorConstructor; + RangeNotSatisfiable: HttpErrorConstructor; + ExpectationFailed: HttpErrorConstructor; + ImATeapot: HttpErrorConstructor; + MisdirectedRequest: HttpErrorConstructor; + UnprocessableEntity: HttpErrorConstructor; + Locked: HttpErrorConstructor; + FailedDependency: HttpErrorConstructor; + UnorderedCollection: HttpErrorConstructor; + UpgradeRequired: HttpErrorConstructor; + PreconditionRequired: HttpErrorConstructor; + TooManyRequests: HttpErrorConstructor; + RequestHeaderFieldsTooLarge: HttpErrorConstructor; + UnavailableForLegalReasons: HttpErrorConstructor; + InternalServerError: HttpErrorConstructor; + NotImplemented: HttpErrorConstructor; + BadGateway: HttpErrorConstructor; + ServiceUnavailable: HttpErrorConstructor; + GatewayTimeout: HttpErrorConstructor; + HTTPVersionNotSupported: HttpErrorConstructor; + VariantAlsoNegotiates: HttpErrorConstructor; + InsufficientStorage: HttpErrorConstructor; + LoopDetected: HttpErrorConstructor; + BandwidthLimitExceeded: HttpErrorConstructor; + NotExtended: HttpErrorConstructor; + NetworkAuthenticationRequired: HttpErrorConstructor; + } } - - type HttpErrorConstructor = new(msg?: string) => HttpError; - interface CreateHttpError { - // See https://github.com/Microsoft/TypeScript/issues/227#issuecomment-50092674 - [code: string]: new () => HttpError; - - (...args: Array): HttpError; - - Continue: HttpErrorConstructor; - SwitchingProtocols: HttpErrorConstructor; - Processing: HttpErrorConstructor; - OK: HttpErrorConstructor; - Created: HttpErrorConstructor; - Accepted: HttpErrorConstructor; - NonAuthoritativeInformation: HttpErrorConstructor; - NoContent: HttpErrorConstructor; - ResetContent: HttpErrorConstructor; - PartialContent: HttpErrorConstructor; - MultiStatus: HttpErrorConstructor; - AlreadyReported: HttpErrorConstructor; - IMUsed: HttpErrorConstructor; - MultipleChoices: HttpErrorConstructor; - MovedPermanently: HttpErrorConstructor; - Found: HttpErrorConstructor; - SeeOther: HttpErrorConstructor; - NotModified: HttpErrorConstructor; - UseProxy: HttpErrorConstructor; - Unused: HttpErrorConstructor; - TemporaryRedirect: HttpErrorConstructor; - PermanentRedirect: HttpErrorConstructor; - BadRequest: HttpErrorConstructor; - Unauthorized: HttpErrorConstructor; - PaymentRequired: HttpErrorConstructor; - Forbidden: HttpErrorConstructor; - NotFound: HttpErrorConstructor; - MethodNotAllowed: HttpErrorConstructor; - NotAcceptable: HttpErrorConstructor; - ProxyAuthenticationRequired: HttpErrorConstructor; - RequestTimeout: HttpErrorConstructor; - Conflict: HttpErrorConstructor; - Gone: HttpErrorConstructor; - LengthRequired: HttpErrorConstructor; - PreconditionFailed: HttpErrorConstructor; - PayloadTooLarge: HttpErrorConstructor; - URITooLong: HttpErrorConstructor; - UnsupportedMediaType: HttpErrorConstructor; - RangeNotSatisfiable: HttpErrorConstructor; - ExpectationFailed: HttpErrorConstructor; - ImATeapot: HttpErrorConstructor; - MisdirectedRequest: HttpErrorConstructor; - UnprocessableEntity: HttpErrorConstructor; - Locked: HttpErrorConstructor; - FailedDependency: HttpErrorConstructor; - UnorderedCollection: HttpErrorConstructor; - UpgradeRequired: HttpErrorConstructor; - PreconditionRequired: HttpErrorConstructor; - TooManyRequests: HttpErrorConstructor; - RequestHeaderFieldsTooLarge: HttpErrorConstructor; - UnavailableForLegalReasons: HttpErrorConstructor; - InternalServerError: HttpErrorConstructor; - NotImplemented: HttpErrorConstructor; - BadGateway: HttpErrorConstructor; - ServiceUnavailable: HttpErrorConstructor; - GatewayTimeout: HttpErrorConstructor; - HTTPVersionNotSupported: HttpErrorConstructor; - VariantAlsoNegotiates: HttpErrorConstructor; - InsufficientStorage: HttpErrorConstructor; - LoopDetected: HttpErrorConstructor; - BandwidthLimitExceeded: HttpErrorConstructor; - NotExtended: HttpErrorConstructor; - NetworkAuthenticationRequired: HttpErrorConstructor; - } + var createHttpError: createHttpError.CreateHttpError; + export = createHttpError; } - -declare var createHttpError: createHttpError.CreateHttpError; -export = createHttpError; diff --git a/http-errors/tsconfig.json b/http-errors/tsconfig.json index 232aa71388..2d86ab7052 100644 --- a/http-errors/tsconfig.json +++ b/http-errors/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/http-status-codes/tsconfig.json b/http-status-codes/tsconfig.json index fc3297eea7..319dd80136 100644 --- a/http-status-codes/tsconfig.json +++ b/http-status-codes/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/http-status/tsconfig.json b/http-status/tsconfig.json index d830e514af..0bec21c81c 100644 --- a/http-status/tsconfig.json +++ b/http-status/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/http-string-parser/index.d.ts b/http-string-parser/index.d.ts index cf844edbd2..93310b0384 100644 --- a/http-string-parser/index.d.ts +++ b/http-string-parser/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for http-string-parser +// Type definitions for http-string-parser // Project: https://github.com/apiaryio/http-string-parser // Definitions by: MIZUNE Pine // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/http-string-parser/tsconfig.json b/http-string-parser/tsconfig.json index 2fe6f4746f..da499b66b8 100644 --- a/http-string-parser/tsconfig.json +++ b/http-string-parser/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/httperr/index.d.ts b/httperr/index.d.ts index aa7e237db1..dbb00673e9 100644 --- a/httperr/index.d.ts +++ b/httperr/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for httperr v1.0.0 +// Type definitions for httperr v1.0.0 // Project: https://github.com/pluma/httperr // Definitions by: Troy Gerwien // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/httperr/tsconfig.json b/httperr/tsconfig.json index 0eaa73a9ce..82c34818d0 100644 --- a/httperr/tsconfig.json +++ b/httperr/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hubspot-pace/tsconfig.json b/hubspot-pace/tsconfig.json index c39a116bcc..67b152117c 100644 --- a/hubspot-pace/tsconfig.json +++ b/hubspot-pace/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/humane/tsconfig.json b/humane/tsconfig.json index a5b236773a..511f9212b7 100644 --- a/humane/tsconfig.json +++ b/humane/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/humanparser/humanparser-tests.ts b/humanparser/humanparser-tests.ts new file mode 100644 index 0000000000..0abe741554 --- /dev/null +++ b/humanparser/humanparser-tests.ts @@ -0,0 +1,19 @@ +import human = require('humanparser'); + +let parsedName = human.parseName("Mr. William R. Hearst, III"); +parsedName.firstName; +parsedName.lastName; +parsedName.fullName; +parsedName.suffix; +parsedName.middleName; +parsedName.salutation; + +let parsedAddress = human.parseAddress("123 Happy Street, Honolulu, HI 65780"); +parsedAddress.address; +parsedAddress.state; +parsedAddress.fullAddress; +parsedAddress.zip; +parsedAddress.city; + +let parsedFullName = human.getFullestName("John & Peggy Sue"); +parsedFullName.fullName; diff --git a/humanparser/index.d.ts b/humanparser/index.d.ts new file mode 100644 index 0000000000..37209a60f3 --- /dev/null +++ b/humanparser/index.d.ts @@ -0,0 +1,37 @@ +// Type definitions for humanparser 1.1.1 +// Project: https://github.com/chovy/humanparser +// Definitions by: Michał Podeszwa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace humanparser { + interface NameOutput { + firstName: string; + lastName: string; + fullName: string; + suffix?: string; + middleName?: string; + salutation?: string; + } + + interface FullerNameOutput { + fullName: string; + } + + interface AddressOutput { + address: string; + state: string; + fullAddress: string; + zip: string; + city: string; + } + + interface HumanparserStatic { + parseName (name: string): NameOutput; + getFullestName (name: string): FullerNameOutput; + parseAddress (address: string): AddressOutput; + } + +} + +declare const humanparser: humanparser.HumanparserStatic; +export = humanparser; diff --git a/humanparser/tsconfig.json b/humanparser/tsconfig.json new file mode 100644 index 0000000000..f918e433af --- /dev/null +++ b/humanparser/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "humanparser-tests.ts" + ] +} \ No newline at end of file diff --git a/humps/tsconfig.json b/humps/tsconfig.json index 2aa841836c..4deb7c907a 100644 --- a/humps/tsconfig.json +++ b/humps/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hyperscript/tsconfig.json b/hyperscript/tsconfig.json index 029f10f754..dfbdc84518 100644 --- a/hyperscript/tsconfig.json +++ b/hyperscript/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hypertext-application-language/tsconfig.json b/hypertext-application-language/tsconfig.json index 67ff40e86d..2cab4b84f5 100644 --- a/hypertext-application-language/tsconfig.json +++ b/hypertext-application-language/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/hystrixjs/tsconfig.json b/hystrixjs/tsconfig.json index d92c44bd26..7148196ac2 100644 --- a/hystrixjs/tsconfig.json +++ b/hystrixjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/i18n/index.d.ts b/i18n/index.d.ts index ac7829eb07..7c7697cc22 100644 --- a/i18n/index.d.ts +++ b/i18n/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for i18n-node 0.5.0 +// Type definitions for i18n-node 0.5.0 // Project: https://github.com/mashpie/i18n-node // Definitions by: Maxime LUCE // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/i18n/tsconfig.json b/i18n/tsconfig.json index 2d8a96c315..57a6b8ffb0 100644 --- a/i18n/tsconfig.json +++ b/i18n/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/i18next-browser-languagedetector/tsconfig.json b/i18next-browser-languagedetector/tsconfig.json index 4dd293bd4f..5e5217cc4e 100644 --- a/i18next-browser-languagedetector/tsconfig.json +++ b/i18next-browser-languagedetector/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/i18next-express-middleware/tsconfig.json b/i18next-express-middleware/tsconfig.json index 28c74af200..9a6bb79121 100644 --- a/i18next-express-middleware/tsconfig.json +++ b/i18next-express-middleware/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/i18next-node-fs-backend/tsconfig.json b/i18next-node-fs-backend/tsconfig.json index e3aec17f03..c7558b6c94 100644 --- a/i18next-node-fs-backend/tsconfig.json +++ b/i18next-node-fs-backend/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/i18next-sprintf-postprocessor/tsconfig.json b/i18next-sprintf-postprocessor/tsconfig.json index f7495711f8..cf5474ff0d 100644 --- a/i18next-sprintf-postprocessor/tsconfig.json +++ b/i18next-sprintf-postprocessor/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/i18next-xhr-backend/tsconfig.json b/i18next-xhr-backend/tsconfig.json index 1aedac3285..3846f699cf 100644 --- a/i18next-xhr-backend/tsconfig.json +++ b/i18next-xhr-backend/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/i18next/i18next-tests.ts b/i18next/i18next-tests.ts index f781fe7be9..23c67cc742 100644 --- a/i18next/i18next-tests.ts +++ b/i18next/i18next-tests.ts @@ -60,5 +60,7 @@ i18n.t('helloWorld', { defaultValue: 'default', count: 10 }); + +const options:i18n.Options = i18n.options; const currentLanguage:string = i18n.language; const userLanguageCodes:string[] = i18n.languages; diff --git a/i18next/index.d.ts b/i18next/index.d.ts index 39e0f2a1a2..b0cb04b267 100644 --- a/i18next/index.d.ts +++ b/i18next/index.d.ts @@ -130,9 +130,11 @@ declare namespace i18n { on(languageChanged: 'languageChanged', listener: (lng: string) => void): void; off(event: string, listener: () => void): void; + + options: Options; } } -declare var i18n:i18n.I18n; +declare var i18n: i18n.I18n; export = i18n; diff --git a/i18next/tsconfig.json b/i18next/tsconfig.json index 402a80f614..2784392036 100644 --- a/i18next/tsconfig.json +++ b/i18next/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/i2c-bus/tsconfig.json b/i2c-bus/tsconfig.json index 174a0be030..3a4d8c2502 100644 --- a/i2c-bus/tsconfig.json +++ b/i2c-bus/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ @@ -17,4 +18,4 @@ "index.d.ts", "i2c-bus-tests.ts" ] -} +} \ No newline at end of file diff --git a/iban/tsconfig.json b/iban/tsconfig.json index c30857751e..72f929945e 100644 --- a/iban/tsconfig.json +++ b/iban/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ibm-mobilefirst/tsconfig.json b/ibm-mobilefirst/tsconfig.json index 1b28764788..d8fd8fdfa1 100644 --- a/ibm-mobilefirst/tsconfig.json +++ b/ibm-mobilefirst/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/icepick/icepick-tests.ts b/icepick/icepick-tests.ts index 8c7b654492..5458509d42 100644 --- a/icepick/icepick-tests.ts +++ b/icepick/icepick-tests.ts @@ -27,7 +27,7 @@ class Foo {} // assoc(collection, key, value) { let coll = { a: 1, b: 2 }; - let newColl = i.assoc(coll, "b", 3); // {a: 1, b: 3} + let newColl = i.assoc(coll, "b", 3); // {a: 1, b: 3} let arr = ["a", "b", "c"]; let newArr = i.assoc(arr, 2, "d"); // ["a", "b", "d"] @@ -36,7 +36,7 @@ class Foo {} // alias: set(collection, key, value) { let coll = { a: 1, b: 2 }; - let newColl = i.set(coll, "b", 3); // {a: 1, b: 3} + let newColl = i.set(coll, "b", 3); // {a: 1, b: 3} let arr = ["a", "b", "c"]; let newArr = i.set(arr, 2, "d"); // ["a", "b", "d"] @@ -70,7 +70,7 @@ class Foo {} } }; - let newColl = i.assocIn(coll, ["c", "d"], "baz"); + let newColl = i.assocIn(coll, ["c", "d"], "baz"); let coll2 = {}; let newColl2 = i.assocIn(coll2, ["a", "b", "c"], 1); @@ -86,7 +86,7 @@ class Foo {} } }; - let newColl = i.setIn(coll, ["c", "d"], "baz"); + let newColl = i.setIn(coll, ["c", "d"], "baz"); let coll2 = {}; let newColl2 = i.setIn(coll2, ["a", "b", "c"], 1); @@ -99,7 +99,7 @@ class Foo {} { b: 2 } ]); - let result = i.getIn(coll, [1, "b"]); // 2 + let result = i.getIn(coll, [1, "b"]) as number; // 2 } // updateIn(collection, path, callback) @@ -166,9 +166,13 @@ class Foo {} }; let result = i.chain(o) - .assocIn(["a", 2], 4) + .assocIn(["a", 2], 4) + .setIn(["a", 1], 5) + .updateIn(["d"], function(d) { return d * 2 }) .merge({ b: { c: 2, c2: 3 } }) - .assoc("e", 2) + .assoc("e", 2) + .set("f", 3) .dissoc("d") - .value(); + .getIn(['a', 0]) + .value() as number; } diff --git a/icepick/index.d.ts b/icepick/index.d.ts index 184f0e12b1..bffe424d1b 100644 --- a/icepick/index.d.ts +++ b/icepick/index.d.ts @@ -1,15 +1,15 @@ -// Type definitions for icepick v1.1.0 +// Type definitions for icepick v1.3.0 // Project: https://github.com/aearly/icepick -// Definitions by: Nathan Brown +// Definitions by: Nathan Brown , Tobias Cohen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export declare function freeze(collection: T): T; export declare function thaw(collection: T): T; -export declare function assoc(collection: T, key: number | string, value: any): T; +export declare function assoc(collection: T, key: number | string, value: V): T; export declare function dissoc(collection: T, key: number | string): T; -export declare function assocIn(collection: T, path: Array, value: any): T; -export declare function getIn(collection: any, path: Array): Result; +export declare function assocIn(collection: T, path: Array, value: V): T; +export declare function getIn(collection: T, path: Array): any; export declare function updateIn(collection: T, path: Array, callback: (value: V) => V): T; export {assoc as set}; @@ -44,17 +44,17 @@ interface IcepickWrapper { freeze(): IcepickWrapper; thaw(): IcepickWrapper; - assoc(key: number | string, value: any): IcepickWrapper; - set(key: number | string, value: any): IcepickWrapper; + assoc(key: number | string, value: V): IcepickWrapper; + set(key: number | string, value: V): IcepickWrapper; dissoc(key: number | string): IcepickWrapper; unset(key: number | string): IcepickWrapper; - assocIn(path: Array, value: any): IcepickWrapper; - setIn(path: Array, value: any): IcepickWrapper; + assocIn(path: Array, value: V): IcepickWrapper; + setIn(path: Array, value: V): IcepickWrapper; - getIn(collection: any, path: Array): IcepickWrapper; - updateIn(collection: T, path: Array, callback: (value: V) => V): IcepickWrapper; + getIn(path: Array): IcepickWrapper; + updateIn(path: Array, callback: (value: V) => V): IcepickWrapper; assign(source1: S1): IcepickWrapper; assign(s1: S1, s2: S2): IcepickWrapper; diff --git a/icepick/tsconfig.json b/icepick/tsconfig.json index 7693f53526..deb295d7da 100644 --- a/icepick/tsconfig.json +++ b/icepick/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/icheck/tsconfig.json b/icheck/tsconfig.json index 1b21bd37f9..f094cd0321 100644 --- a/icheck/tsconfig.json +++ b/icheck/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/iconv-lite/tsconfig.json b/iconv-lite/tsconfig.json index a9833e3458..9c7f9b6e95 100644 --- a/iconv-lite/tsconfig.json +++ b/iconv-lite/tsconfig.json @@ -3,14 +3,13 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ "../" ], - "types": [ - "node" - ], + "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -18,4 +17,4 @@ "index.d.ts", "iconv-lite-tests.ts" ] -} +} \ No newline at end of file diff --git a/iconv/tsconfig.json b/iconv/tsconfig.json index 11151134ed..c3143c8575 100644 --- a/iconv/tsconfig.json +++ b/iconv/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ids/tsconfig.json b/ids/tsconfig.json index 822ef6cd32..6af13979ec 100644 --- a/ids/tsconfig.json +++ b/ids/tsconfig.json @@ -1,8 +1,9 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/image-size/tsconfig.json b/image-size/tsconfig.json index d07f3fff5b..61c2696d45 100644 --- a/image-size/tsconfig.json +++ b/image-size/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/imagemagick-native/tsconfig.json b/imagemagick-native/tsconfig.json index 5f0d725db6..506a10b58c 100644 --- a/imagemagick-native/tsconfig.json +++ b/imagemagick-native/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/imagemagick/tsconfig.json b/imagemagick/tsconfig.json index 85a2b32a8f..06aed95001 100644 --- a/imagemagick/tsconfig.json +++ b/imagemagick/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/imagemapster/imagemapster.d.ts b/imagemapster/index.d.ts similarity index 100% rename from imagemapster/imagemapster.d.ts rename to imagemapster/index.d.ts diff --git a/imagemapster/tsconfig.json b/imagemapster/tsconfig.json index 02230dff2f..d0aad3fe33 100644 --- a/imagemapster/tsconfig.json +++ b/imagemapster/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "imagemapster.d.ts", + "index.d.ts", "imagemapster-tests.ts" ] } \ No newline at end of file diff --git a/imagesloaded/tsconfig.json b/imagesloaded/tsconfig.json index fe5fb5afc6..6c9e4a682c 100644 --- a/imagesloaded/tsconfig.json +++ b/imagesloaded/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/imap-simple/tsconfig.json b/imap-simple/tsconfig.json index c7dd5ee90b..ce50347343 100644 --- a/imap-simple/tsconfig.json +++ b/imap-simple/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/imap/tsconfig.json b/imap/tsconfig.json index 4bd0dee115..46c0268b3f 100644 --- a/imap/tsconfig.json +++ b/imap/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/imgur-rest-api/tsconfig.json b/imgur-rest-api/tsconfig.json index 6f5fa142fd..8edfea9b9d 100644 --- a/imgur-rest-api/tsconfig.json +++ b/imgur-rest-api/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/immutability-helper/tsconfig.json b/immutability-helper/tsconfig.json index a0e54d632f..3901b1e0cc 100644 --- a/immutability-helper/tsconfig.json +++ b/immutability-helper/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/immutable/immutable-tests.ts b/immutable/immutable-tests.ts index 50520cde2f..e3e0d357eb 100644 --- a/immutable/immutable-tests.ts +++ b/immutable/immutable-tests.ts @@ -46,7 +46,10 @@ list = list.asImmutable(); let indexedSeq: immutable.Seq.Indexed = list.toSeq(); // Iterable tests -let value: number = list.get(0); +let optionalValue: number | undefined; +let value: number; + +optionalValue = list.get(0); value = list.get(0, 1); list = list.interpose(0); list = list.interleave(list, list1); @@ -77,8 +80,8 @@ value = list.hashCode(); bool = list.has(1); bool = list.includes(1); bool = list.contains(1); -value = list.first(); -value = list.last(); +optionalValue = list.first(); +optionalValue = list.last(); let toArr: number[] = list.toArray(); let toMap: immutable.Map = list.toMap(); let toOrderedMap: immutable.OrderedMap = list.toOrderedMap(); @@ -177,23 +180,23 @@ tuple = list.findLastEntry( null, 0 ); -value = list.findKey( +optionalValue = list.findKey( (value: number, key: number, iter: immutable.List) => true, null ); -value = list.findLastKey( +optionalValue = list.findLastKey( (value: number, key: number, iter: immutable.List) => true, null ); -value = list.keyOf(0); -value = list.lastKeyOf(0); -value = list.max((valA: number, valB: number) => 0); -value = list.maxBy( +optionalValue = list.keyOf(0); +optionalValue = list.lastKeyOf(0); +optionalValue = list.max((valA: number, valB: number) => 0); +optionalValue = list.maxBy( (value: number, key: number, iter: immutable.List) => "foo", (valueA: string, valueB: string) => 0 ); -value = list.min((valA: number, valB: number) => 0); -value = list.minBy( +optionalValue = list.min((valA: number, valB: number) => 0); +optionalValue = list.minBy( (value: number, key: number, iter: immutable.List) => "foo", (valueA: string, valueB: string) => 0 ); @@ -279,7 +282,7 @@ let stack: immutable.Stack = immutable.Stack(); bool = immutable.Stack.isStack(stack); stack = immutable.Stack.of(0, 1, 2, 3, 4, 5); stack = immutable.Stack(list); -value = stack.peek(); +optionalValue = stack.peek(); stack = stack.clear(); stack = stack.unshift(0, 1, 2); stack = stack.unshiftAll(list); diff --git a/immutable/index.d.ts b/immutable/index.d.ts index cbc27ab300..c8f0a24cc9 100644 --- a/immutable/index.d.ts +++ b/immutable/index.d.ts @@ -260,11 +260,11 @@ declare namespace Immutable { * @see `Map#mergeWith` */ mergeWith( - merger: (previous?: T, next?: T, key?: number) => T, + merger: (previous: T, next: T, key: number) => T, ...iterables: Iterable.Indexed[] ): List; mergeWith( - merger: (previous?: T, next?: T, key?: number) => T, + merger: (previous: T, next: T, key: number) => T, ...iterables: Array[] ): List; @@ -278,11 +278,11 @@ declare namespace Immutable { * @see `Map#mergeDeepWith` */ mergeDeepWith( - merger: (previous?: T, next?: T, key?: number) => T, + merger: (previous: T, next: T, key: number) => T, ...iterables: Iterable.Indexed[] ): List; mergeDeepWith( - merger: (previous?: T, next?: T, key?: number) => T, + merger: (previous: T, next: T, key: number) => T, ...iterables: Array[] ): List; @@ -541,11 +541,11 @@ declare namespace Immutable { * */ mergeWith( - merger: (previous?: V, next?: V, key?: K) => V, + merger: (previous: V, next: V, key: K) => V, ...iterables: Iterable[] ): Map; mergeWith( - merger: (previous?: V, next?: V, key?: K) => V, + merger: (previous: V, next: V, key: K) => V, ...iterables: {[key: string]: V}[] ): Map; @@ -572,11 +572,11 @@ declare namespace Immutable { * */ mergeDeepWith( - merger: (previous?: V, next?: V, key?: K) => V, + merger: (previous: V, next: V, key: K) => V, ...iterables: Iterable[] ): Map; mergeDeepWith( - merger: (previous?: V, next?: V, key?: K) => V, + merger: (previous: V, next: V, key: K) => V, ...iterables: {[key: string]: V}[] ): Map; @@ -988,7 +988,7 @@ declare namespace Immutable { /** * Alias for `Stack.first()`. */ - peek(): T; + peek(): T | undefined; // Persistent changes @@ -1459,7 +1459,7 @@ declare namespace Immutable { * */ mapKeys( - mapper: (key?: K, value?: V, iter?: this) => M, + mapper: (key: K, value: V, iter: this) => M, context?: any ): /*this*/Iterable.Keyed; @@ -1474,9 +1474,9 @@ declare namespace Immutable { */ mapEntries( mapper: ( - entry?: [K, V], - index?: number, - iter?: this + entry: [K, V], + index: number, + iter: this ) => [KM, VM], context?: any ): /*this*/Iterable.Keyed; @@ -1521,8 +1521,8 @@ declare namespace Immutable { * `index` may be a negative number, which indexes back from the end of the * Iterable. `s.get(-1)` gets the last item in the Iterable. */ - get(index: number, notSetValue?: T): T; - + get(index: number, notSetValue: T): T; + get(index: number): T | undefined; // Conversion to Seq @@ -1641,7 +1641,7 @@ declare namespace Immutable { * provided predicate function. Otherwise -1 is returned. */ findIndex( - predicate: (value?: T, index?: number, iter?: this) => boolean, + predicate: (value: T, index: number, iter: this) => boolean, context?: any ): number; @@ -1650,7 +1650,7 @@ declare namespace Immutable { * provided predicate function. Otherwise -1 is returned. */ findLastIndex( - predicate: (value?: T, index?: number, iter?: this) => boolean, + predicate: (value: T, index: number, iter: this) => boolean, context?: any ): number; } @@ -1758,7 +1758,8 @@ declare namespace Immutable { * so if `notSetValue` is not provided and this method returns `undefined`, * that does not guarantee the key was not found. */ - get(key: K, notSetValue?: V): V; + get(key: K, notSetValue: V): V; + get(key: K): V | undefined; /** * True if a key exists within this `Iterable`, using `Immutable.is` to determine equality @@ -1775,12 +1776,12 @@ declare namespace Immutable { /** * The first value in the Iterable. */ - first(): V; + first(): V | undefined; /** * The last value in the Iterable. */ - last(): V; + last(): V | undefined; // Reading deep values @@ -1971,7 +1972,7 @@ declare namespace Immutable { * */ map( - mapper: (value?: V, key?: K, iter?: this) => M, + mapper: (value: V, key: K, iter: this) => M, context?: any ): /*this*/Iterable; @@ -1984,7 +1985,7 @@ declare namespace Immutable { * */ filter( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -1997,7 +1998,7 @@ declare namespace Immutable { * */ filterNot( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -2033,7 +2034,7 @@ declare namespace Immutable { * */ sortBy( - comparatorValueMapper: (value?: V, key?: K, iter?: this) => C, + comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number ): this; @@ -2044,7 +2045,7 @@ declare namespace Immutable { * Note: This is always an eager operation. */ groupBy( - grouper: (value?: V, key?: K, iter?: this) => G, + grouper: (value: V, key: K, iter: this) => G, context?: any ): Seq.Keyed; @@ -2059,7 +2060,7 @@ declare namespace Immutable { * (including the last iteration which returned false). */ forEach( - sideEffect: (value?: V, key?: K, iter?: this) => any, + sideEffect: (value: V, key: K, iter: this) => any, context?: any ): number; @@ -2118,7 +2119,7 @@ declare namespace Immutable { * */ skipWhile( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -2132,7 +2133,7 @@ declare namespace Immutable { * */ skipUntil( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -2158,7 +2159,7 @@ declare namespace Immutable { * */ takeWhile( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -2171,7 +2172,7 @@ declare namespace Immutable { * */ takeUntil( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): this; @@ -2209,11 +2210,11 @@ declare namespace Immutable { * Similar to `iter.map(...).flatten(true)`. */ flatMap( - mapper: (value?: V, key?: K, iter?: this) => Iterable, + mapper: (value: V, key: K, iter: this) => Iterable, context?: any ): /*this*/Iterable; flatMap( - mapper: (value?: V, key?: K, iter?: this) => /*iterable-like*/any, + mapper: (value: V, key: K, iter: this) => /*iterable-like*/any, context?: any ): /*this*/Iterable; @@ -2230,10 +2231,13 @@ declare namespace Immutable { * @see `Array#reduce`. */ reduce( - reducer: (reduction?: R, value?: V, key?: K, iter?: this) => R, - initialReduction?: R, + reducer: (reduction: R, value: V, key: K, iter: this) => R, + initialReduction: R, context?: any ): R; + reduce( + reducer: (reduction: R, value: V, key: K, iter: this) => R + ): R | undefined; /** * Reduces the Iterable in reverse (from the right side). @@ -2242,16 +2246,19 @@ declare namespace Immutable { * with `Array#reduceRight`. */ reduceRight( - reducer: (reduction?: R, value?: V, key?: K, iter?: this) => R, - initialReduction?: R, + reducer: (reduction: R, value: V, key: K, iter: this) => R, + initialReduction: R, context?: any ): R; + reduceRight( + reducer: (reduction: R, value: V, key: K, iter: this) => R + ): R | undefined; /** * True if `predicate` returns true for all entries in the Iterable. */ every( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): boolean; @@ -2259,7 +2266,7 @@ declare namespace Immutable { * True if `predicate` returns true for any entry in the Iterable. */ some( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): boolean; @@ -2289,7 +2296,7 @@ declare namespace Immutable { */ count(): number; count( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any ): number; @@ -2300,7 +2307,7 @@ declare namespace Immutable { * Note: This is not a lazy operation. */ countBy( - grouper: (value?: V, key?: K, iter?: this) => G, + grouper: (value: V, key: K, iter: this) => G, context?: any ): Seq.Keyed; @@ -2311,10 +2318,14 @@ declare namespace Immutable { * Returns the first value for which the `predicate` returns true. */ find( - predicate: (value?: V, key?: K, iter?: this) => boolean, - context?: any, - notSetValue?: V + predicate: (value: V, key: K, iter: this) => boolean, + context: any, + notSetValue: V ): V; + find( + predicate: (value: V, key: K, iter: this) => boolean, + context?: any + ): V | undefined; /** * Returns the last value for which the `predicate` returns true. @@ -2322,19 +2333,27 @@ declare namespace Immutable { * Note: `predicate` will be called for each entry in reverse. */ findLast( - predicate: (value?: V, key?: K, iter?: this) => boolean, - context?: any, - notSetValue?: V + predicate: (value: V, key: K, iter: this) => boolean, + context: any, + notSetValue: V ): V; + findLast( + predicate: (value: V, key: K, iter: this) => boolean, + context?: any + ): V | undefined; /** * Returns the first [key, value] entry for which the `predicate` returns true. */ findEntry( - predicate: (value?: V, key?: K, iter?: this) => boolean, - context?: any, - notSetValue?: V + predicate: (value: V, key: K, iter: this) => boolean, + context: any, + notSetValue: V ): [K, V]; + findEntry( + predicate: (value: V, key: K, iter: this) => boolean, + context?: any + ): [K, V] | undefined; /** * Returns the last [key, value] entry for which the `predicate` @@ -2343,18 +2362,22 @@ declare namespace Immutable { * Note: `predicate` will be called for each entry in reverse. */ findLastEntry( - predicate: (value?: V, key?: K, iter?: this) => boolean, - context?: any, - notSetValue?: V + predicate: (value: V, key: K, iter: this) => boolean, + context: any, + notSetValue: V ): [K, V]; + findLastEntry( + predicate: (value: V, key: K, iter: this) => boolean, + context?: any + ): [K, V] | undefined; /** * Returns the key for which the `predicate` returns true. */ findKey( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any - ): K; + ): K | undefined; /** * Returns the last key for which the `predicate` returns true. @@ -2362,19 +2385,19 @@ declare namespace Immutable { * Note: `predicate` will be called for each entry in reverse. */ findLastKey( - predicate: (value?: V, key?: K, iter?: this) => boolean, + predicate: (value: V, key: K, iter: this) => boolean, context?: any - ): K; + ): K | undefined; /** * Returns the key associated with the search value, or undefined. */ - keyOf(searchValue: V): K; + keyOf(searchValue: V): K | undefined; /** * Returns the last key associated with the search value, or undefined. */ - lastKeyOf(searchValue: V): K; + lastKeyOf(searchValue: V): K | undefined; /** * Returns the maximum value in this collection. If any values are @@ -2391,7 +2414,7 @@ declare namespace Immutable { * If `comparator` returns 0 and either value is NaN, undefined, or null, * that value will be returned. */ - max(comparator?: (valueA: V, valueB: V) => number): V; + max(comparator?: (valueA: V, valueB: V) => number): V | undefined; /** * Like `max`, but also accepts a `comparatorValueMapper` which allows for @@ -2401,9 +2424,9 @@ declare namespace Immutable { * */ maxBy( - comparatorValueMapper: (value?: V, key?: K, iter?: this) => C, + comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number - ): V; + ): V | undefined; /** * Returns the minimum value in this collection. If any values are @@ -2420,7 +2443,7 @@ declare namespace Immutable { * If `comparator` returns 0 and either value is NaN, undefined, or null, * that value will be returned. */ - min(comparator?: (valueA: V, valueB: V) => number): V; + min(comparator?: (valueA: V, valueB: V) => number): V | undefined; /** * Like `min`, but also accepts a `comparatorValueMapper` which allows for @@ -2430,9 +2453,9 @@ declare namespace Immutable { * */ minBy( - comparatorValueMapper: (value?: V, key?: K, iter?: this) => C, + comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number - ): V; + ): V | undefined; // Comparison @@ -2540,5 +2563,4 @@ declare namespace Immutable { export interface Iterator { next(): { value: T; done: boolean; } } - } diff --git a/immutable/tsconfig.json b/immutable/tsconfig.json index dcf2c26e73..54fe69567b 100644 --- a/immutable/tsconfig.json +++ b/immutable/tsconfig.json @@ -3,7 +3,8 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/impress/tsconfig.json b/impress/tsconfig.json index e3383e52f0..6d1a71de6d 100644 --- a/impress/tsconfig.json +++ b/impress/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/in-range/in-range-tests.ts b/in-range/in-range-tests.ts new file mode 100644 index 0000000000..a10113bd0f --- /dev/null +++ b/in-range/in-range-tests.ts @@ -0,0 +1,9 @@ +import inRange = require("in-range"); + +inRange(30, 100); + +inRange(30, 10, 100); + +inRange(30, 100, 10); + +inRange(30, 10); \ No newline at end of file diff --git a/in-range/index.d.ts b/in-range/index.d.ts new file mode 100644 index 0000000000..6d81a61e4d --- /dev/null +++ b/in-range/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for in-range 1.0 +// Project: https://github.com/sindresorhus/in-range +// Definitions by: Daniel Rosenwasser +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function in_range(x: number, start: number, end?: number): boolean; + +export = in_range; diff --git a/in-range/tsconfig.json b/in-range/tsconfig.json new file mode 100644 index 0000000000..959b41a5bd --- /dev/null +++ b/in-range/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "in-range-tests.ts" + ] +} \ No newline at end of file diff --git a/in-range/tslint.json b/in-range/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/in-range/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/incremental-dom/all-tests.ts b/incremental-dom/all-tests.ts deleted file mode 100644 index aa04d08c57..0000000000 --- a/incremental-dom/all-tests.ts +++ /dev/null @@ -1,8 +0,0 @@ - -declare var describe:any -,it:any -,expect:any -,beforeEach:any -,afterEach:any; - -/// diff --git a/incremental-dom/tests/functional/attributes-tests.ts b/incremental-dom/incremental-dom-tests.ts similarity index 98% rename from incremental-dom/tests/functional/attributes-tests.ts rename to incremental-dom/incremental-dom-tests.ts index b1100b4ac0..2e30297e57 100644 --- a/incremental-dom/tests/functional/attributes-tests.ts +++ b/incremental-dom/incremental-dom-tests.ts @@ -1,4 +1,5 @@ -/// +/// +declare var expect: any; import id = require('incremental-dom'); var patch = id.patch; diff --git a/incremental-dom/index.d.ts b/incremental-dom/index.d.ts index f4091748b2..a2a2e80aeb 100644 --- a/incremental-dom/index.d.ts +++ b/incremental-dom/index.d.ts @@ -1,48 +1,122 @@ -// Type definitions for Incremetal DOM +// Type definitions for Incremetal DOM 0.5 // Project: https://github.com/google/incremental-dom -// Definitions by: Basarat Ali Syed , Markus Lanthaler +// Definitions by: Basarat Ali Syed , Markus Lanthaler , vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +type NameOrCtorDef = string | { new (...args: any[]): Element; }; /** - * Patches the document starting at el with the provided function. This function - * may be called during an existing patch operation. - * @param {!Element} el the element to patch - * @param {!function(T)} fn A function containing elementOpen/elementClose/etc. - * calls that describe the DOM. - * @param {?T} data An argument passed to fn to represent DOM state. + * Patches the document starting at node with the provided function. This + * function may be called during an existing patch operation. + * @param {!Element|!DocumentFragment} node The Element or Documen to patch. + * @param {!function(T)} fn A function containing open/close/etc. calls that + * describe the DOM. + * @param {T=} data An argument passed to fn to represent DOM state. + * @return {!Node} The patched node. + * @template T */ -export declare var patch: (el: Node, fn: (data: T) => void, data?: T) => void; +export declare var patchInner: (node: Element | DocumentFragment, fn: (data: T) => void, data?: T) => Node; /** - * Declares a virtual Element at the current location in the document. This - * corresponds to an opening tag and a elementClose tag is required. - * @param {string} tag The element's tag. - * @param {?string} key The key used to identify this element. This can be an + * Patches the document starting at node with the provided function. This + * function may be called during an existing patch operation. + * @param {!Element|!DocumentFragment} node The Element or Documen to patch. + * @param {!function(T)} fn A function containing open/close/etc. calls that + * describe the DOM. + * @param {T=} data An argument passed to fn to represent DOM state. + * @return {!Node} The patched node. + * @template T + */ +export declare var patch: typeof patchInner; + +/** + * Patches an Element with the the provided function. Exactly one top level + * element call should be made corresponding to `node`. + * @param {!Element} node The Element where the patch should start. + * @param {!function(T)} fn A function containing open/close/etc. calls that + * describe the DOM. This should have at most one top level element call. + * @param {T=} data An argument passed to fn to represent DOM state. + * @return {?Node} The node if it was updated, its replacedment or null if it + * was removed. + * @template T + */ +export declare var patchOuter: (node: Element, fn: (data: T) => void, data?: T) => Node | null; + +/** + * Makes sure that the current node is an Element with a matching nameOrCtor and + * key. + * + * @param {NameOrCtorDef} nameOrCtor The tag or constructor for the Element. + * @param {?string=} key The key used to identify this element. This can be an * empty string, but performance may be better if a unique value is used * when iterating over an array of items. - * @param {?Array<*>} statics An array of attribute name/value pairs of the + * @param {*=} typeId An type identifier that avoids reuse between elements that + * would otherwise match. + * @return {!Element} The corresponding Element. + */ +export declare var open: (nameOrCtor: NameOrCtorDef, key?: string, typeId?: any) => Element; + +/** + * Closes the currently open Element, removing any unvisited children if + * necessary. + * + * @return {!Element} The corresponding Element. + */ +export declare var close: () => Element; + +/** + * Gets the current Element being patched. + * @return {!Element} + */ +export declare var currentElement: () => Element; + +/** + * @return {Node} The Node that will be evaluated for the next instruction. + */ +export declare var currentPointer: () => Node; + +/** + * Skips the children in a subtree, allowing an Element to be closed without + * clearing out the children. + */ +export declare var skip: () => void; + +/** + * Skips the next Node to be patched, moving the pointer forward to the next + * sibling of the current pointer. + */ +export declare var skipNode: () => void; + +/** + * @param {NameOrCtorDef} nameOrCtor The Element's tag or constructor. + * @param {?string=} key The key used to identify this element. This can be an + * empty string, but performance may be better if a unique value is used + * when iterating over an array of items. + * @param {?Array<*>=} statics An array of attribute name/value pairs of the * static attributes for the Element. These will only be set once when the * Element is created. - * @param {...*} var_args Attribute name/value pairs of the dynamic attributes + * @param {...*} var_args, Attribute name/value pairs of the dynamic attributes * for the Element. + * @return {!Element} The corresponding Element. */ -export declare var elementOpen: (tag: string, key?: string, statics?: any[], ...var_args: any[]) => HTMLElement; +export declare var elementOpen: (nameOrCtor: NameOrCtorDef, key?: string, statics?: any[], ...var_args: any[]) => Element; + /** * Declares a virtual Element at the current location in the document. This * corresponds to an opening tag and a elementClose tag is required. This is * like elementOpen, but the attributes are defined using the attr function * rather than being passed as arguments. Must be folllowed by 0 or more calls * to attr, then a call to elementOpenEnd. - * @param {string} tag The element's tag. - * @param {?string} key The key used to identify this element. This can be an + * @param {NameOrCtorDef} nameOrCtor The Element's tag or constructor. + * @param {?string=} key The key used to identify this element. This can be an * empty string, but performance may be better if a unique value is used * when iterating over an array of items. - * @param {?Array<*>} statics An array of attribute name/value pairs of the + * @param {?Array<*>=} statics An array of attribute name/value pairs of the * static attributes for the Element. These will only be set once when the * Element is created. */ -export declare var elementOpenStart: (tag: string, key?: any, ...statics: any[]) => void; +export declare var elementOpenStart: (nameOrCtor: NameOrCtorDef, key?: string, statics?: any[]) => void; + /*** * Defines a virtual attribute at this point of the DOM. This is only valid * when called between elementOpenStart and elementOpenEnd. @@ -51,31 +125,78 @@ export declare var elementOpenStart: (tag: string, key?: any, ...statics: any[]) * @param {*} value */ export declare var attr: (name: string, value: any) => void; + /** * Closes an open tag started with elementOpenStart. + * @return {!Element} The corresponding Element. */ -export declare var elementOpenEnd: () => HTMLElement; +export declare var elementOpenEnd: () => Element; + /** * Closes an open virtual Element. + * + * @param {NameOrCtorDef} nameOrCtor The Element's tag or constructor. + * @return {!Element} The corresponding Element. */ -export declare var elementClose: (tag: string) => HTMLElement; +export declare var elementClose: (nameOrCtor: NameOrCtorDef) => Element; + /** * Declares a virtual Element at the current location in the document that has * no children. - * @param {string} tag The element's tag. - * @param {?string} key The key used to identify this element. This can be an + * @param {NameOrCtorDef} nameOrCtor The Element's tag or constructor. + * @param {?string=} key The key used to identify this element. This can be an * empty string, but performance may be better if a unique value is used * when iterating over an array of items. - * @param {?Array<*>} statics An array of attribute name/value pairs of the + * @param {?Array<*>=} statics An array of attribute name/value pairs of the * static attributes for the Element. These will only be set once when the * Element is created. * @param {...*} var_args Attribute name/value pairs of the dynamic attributes * for the Element. + * @return {!Element} The corresponding Element. */ -export declare var elementVoid: (tag: string, key?: string, statics?: any, ...var_args: any[]) => HTMLElement; +export declare var elementVoid: (nameOrCtor: NameOrCtorDef, key?: string, statics?: any[], ...var_args: any[]) => Element; + /** * Declares a virtual Text at this point in the document. * - * @param {string} value The text of the Text. + * @param {string|number|boolean} value The value of the Text. + * @param {...(function((string|number|boolean)):string)} var_args + * Functions to format the value which are called only when the value has + * changed. + * @return {!Text} The corresponding text node. */ -export declare var text: (value: string) => Text; +export declare var text: (value: string | number | boolean) => Text; + +/** @const */ +export declare var symbols: any; + +/** + * A publicly mutable object to provide custom mutators for attributes. + * @const {!Object} + */ +export declare var attributes: any; + +/** + * Applies an attribute or property to a given Element. If the value is null + * or undefined, it is removed from the Element. Otherwise, the value is set + * as an attribute. + * @param {!Element} el + * @param {string} name The attribute's name. + * @param {?(boolean|number|string)=} value The attribute's value. + */ +export declare var applyAttr: (el: Element, name: string, value?: boolean | number | string) => void; + +/** + * Applies a property to a given Element. + * @param {!Element} el + * @param {string} name The property's name. + * @param {*} value The property's value. + */ +export declare var applyProp: (el: Element, name: string, value?: any) => void; + +/** + * Imports node and its subtree, initializing caches. + * + * @param {?Node} node The Node to import. + */ +export declare var importNode: (node?: Node) => void; diff --git a/incremental-dom/tsconfig.json b/incremental-dom/tsconfig.json index 0bca72a982..dc0ebb2f84 100644 --- a/incremental-dom/tsconfig.json +++ b/incremental-dom/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -14,6 +15,6 @@ }, "files": [ "index.d.ts", - "all-tests.ts" + "incremental-dom-tests.ts" ] } \ No newline at end of file diff --git a/inert/index.d.ts b/inert/index.d.ts new file mode 100644 index 0000000000..fdd3d91bcd --- /dev/null +++ b/inert/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for inert 4.0 +// Project: https://github.com/hapijs/inert/ +// Definitions by: Steve Ognibene +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Note: this definition contains only enough to make TypeScript happy (hapi?) when +// importing inert. The functionality that importing inert adds to the reply +// object and its other features are implemented in the hapi definition on +// DefinitelyTyped. The inert object is never actually used in practice except to +// be passed as an extension to the server.register() method which already takes +// an `any` argument, so just using `any` here is fine. + +/// + +export var inert: any; \ No newline at end of file diff --git a/inert/inert-tests-es6.ts b/inert/inert-tests-es6.ts new file mode 100644 index 0000000000..ac50196d00 --- /dev/null +++ b/inert/inert-tests-es6.ts @@ -0,0 +1,7 @@ + +import * as HapiES6 from 'hapi'; +import * as InertES6 from 'inert'; + + +const server = new HapiES6.Server({}); +server.register(InertES6, () => {}); \ No newline at end of file diff --git a/inert/inert-tests.ts b/inert/inert-tests.ts new file mode 100644 index 0000000000..cd12de7780 --- /dev/null +++ b/inert/inert-tests.ts @@ -0,0 +1,9 @@ + +const Inert = require('inert'); +const Hapi = require('hapi'); + + +const server = new Hapi.Server({}); +server.register(Inert, () => {}); + +export var makeThisAModule: any; \ No newline at end of file diff --git a/inert/tsconfig.json b/inert/tsconfig.json new file mode 100644 index 0000000000..f19b878114 --- /dev/null +++ b/inert/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "inert-tests.ts", + "inert-tests-es6.ts" + ] +} \ No newline at end of file diff --git a/inert/tslint.json b/inert/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/inert/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file diff --git a/inflected/tsconfig.json b/inflected/tsconfig.json index 3e21f9612a..3f7ec070da 100644 --- a/inflected/tsconfig.json +++ b/inflected/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/inflection/tsconfig.json b/inflection/tsconfig.json index c19b06338f..39b0f370e9 100644 --- a/inflection/tsconfig.json +++ b/inflection/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/inherits/tsconfig.json b/inherits/tsconfig.json index 1bd649cb63..484b443dd2 100644 --- a/inherits/tsconfig.json +++ b/inherits/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ini/tsconfig.json b/ini/tsconfig.json index 7c3c1a9086..53644b4d94 100644 --- a/ini/tsconfig.json +++ b/ini/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/iniparser/tsconfig.json b/iniparser/tsconfig.json index d114e1c19d..dc0c79cbb9 100644 --- a/iniparser/tsconfig.json +++ b/iniparser/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/inline-css/tsconfig.json b/inline-css/tsconfig.json index dbfa91d3ae..fa2a455dcf 100644 --- a/inline-css/tsconfig.json +++ b/inline-css/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/inquirer/index.d.ts b/inquirer/index.d.ts index 244b1ee003..618da5593d 100644 --- a/inquirer/index.d.ts +++ b/inquirer/index.d.ts @@ -30,7 +30,8 @@ declare namespace inquirer { * @param cb Callback being passed the user answers * @return */ - prompt(questions: Questions, cb?: (answers: Answers) => any): ui.Prompt; + prompt(questions: Questions, cb: (answers: Answers) => any): ui.Prompt; + prompt(questions: Questions): Promise; prompts: Prompts; Separator: objects.SeparatorStatic; ui: { @@ -110,7 +111,7 @@ declare namespace inquirer { * A key/value hash containing the client answers in each prompt. */ interface Answers { - [key: string]: any; + [key: string]: any; } namespace ui { diff --git a/inquirer/tsconfig.json b/inquirer/tsconfig.json index cf4e93d175..a06f09ccd2 100644 --- a/inquirer/tsconfig.json +++ b/inquirer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/insight/tsconfig.json b/insight/tsconfig.json index 15d366d7dd..d9cc368185 100644 --- a/insight/tsconfig.json +++ b/insight/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/interact.js/index.d.ts b/interact.js/index.d.ts index 7d17b5ac5d..c9d15a2a5f 100644 --- a/interact.js/index.d.ts +++ b/interact.js/index.d.ts @@ -200,7 +200,7 @@ declare namespace Interact { (element: HTMLElement): Interactable; (element: SVGElement): Interactable; (element: string): Interactable; - (element: string, { context: Element } : { context: Element }): Interactable; + (element: string, options: {context: Element}): Interactable; // returns boolean or {[key: string]: any} autoScroll(): any; autoScroll(options: boolean): InteractStatic; diff --git a/interact.js/tsconfig.json b/interact.js/tsconfig.json index c1bb6409a4..9426c9e0cc 100644 --- a/interact.js/tsconfig.json +++ b/interact.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/intercomjs/tsconfig.json b/intercomjs/tsconfig.json index f876aef25b..6dfa66b6a1 100644 --- a/intercomjs/tsconfig.json +++ b/intercomjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/intl-tel-input/intl-tel-input.d.ts b/intl-tel-input/index.d.ts similarity index 100% rename from intl-tel-input/intl-tel-input.d.ts rename to intl-tel-input/index.d.ts diff --git a/intl-tel-input/tsconfig.json b/intl-tel-input/tsconfig.json index 2290a860c8..f56e16cbb0 100644 --- a/intl-tel-input/tsconfig.json +++ b/intl-tel-input/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "intl-tel-input.d.ts", + "index.d.ts", "intl-tel-input-tests.ts" ] } \ No newline at end of file diff --git a/intro.js/tsconfig.json b/intro.js/tsconfig.json index 5abd4b08ef..d9130ae39e 100644 --- a/intro.js/tsconfig.json +++ b/intro.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/invariant/tsconfig.json b/invariant/tsconfig.json index a9664e2819..3eeb5b5ade 100644 --- a/invariant/tsconfig.json +++ b/invariant/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/inversify-binding-decorators/tsconfig.json b/inversify-binding-decorators/tsconfig.json index 0cfbf3bb2f..8689b4b17d 100644 --- a/inversify-binding-decorators/tsconfig.json +++ b/inversify-binding-decorators/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "experimentalDecorators": true, diff --git a/inversify-devtools/tsconfig.json b/inversify-devtools/tsconfig.json index 9620cb1f86..ab530b69c7 100644 --- a/inversify-devtools/tsconfig.json +++ b/inversify-devtools/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "experimentalDecorators": true, diff --git a/inversify-express-utils/inversify-express-utils.d.ts b/inversify-express-utils/index.d.ts similarity index 100% rename from inversify-express-utils/inversify-express-utils.d.ts rename to inversify-express-utils/index.d.ts diff --git a/inversify-express-utils/tsconfig.json b/inversify-express-utils/tsconfig.json index c7e399100e..855d4c64aa 100644 --- a/inversify-express-utils/tsconfig.json +++ b/inversify-express-utils/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "experimentalDecorators": true, @@ -14,7 +15,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "inversify-express-utils.d.ts", + "index.d.ts", "inversify-express-utils-tests.ts" ] } \ No newline at end of file diff --git a/inversify-inject-decorators/tsconfig.json b/inversify-inject-decorators/tsconfig.json index 7b922e01fa..ab63ae0579 100644 --- a/inversify-inject-decorators/tsconfig.json +++ b/inversify-inject-decorators/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "experimentalDecorators": true, diff --git a/inversify-logger-middleware/tsconfig.json b/inversify-logger-middleware/tsconfig.json index 363943998d..1b0d1ec8ff 100644 --- a/inversify-logger-middleware/tsconfig.json +++ b/inversify-logger-middleware/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "experimentalDecorators": true, diff --git a/inversify-restify-utils/tsconfig.json b/inversify-restify-utils/tsconfig.json index c610f4fb27..7a2fcda912 100644 --- a/inversify-restify-utils/tsconfig.json +++ b/inversify-restify-utils/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "experimentalDecorators": true, diff --git a/inversify/tsconfig.json b/inversify/tsconfig.json index c1aa2f34b1..e655f522d8 100644 --- a/inversify/tsconfig.json +++ b/inversify/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "experimentalDecorators": true, diff --git a/ion.rangeslider/tsconfig.json b/ion.rangeslider/tsconfig.json index 9c848a6627..5912868fde 100644 --- a/ion.rangeslider/tsconfig.json +++ b/ion.rangeslider/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ionic/tsconfig.json b/ionic/tsconfig.json index 9ad8ed08d6..a575d24b88 100644 --- a/ionic/tsconfig.json +++ b/ionic/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ioredis/tsconfig.json b/ioredis/tsconfig.json index 02799a7152..b4e17b1761 100644 --- a/ioredis/tsconfig.json +++ b/ioredis/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ip/index.d.ts b/ip/index.d.ts index 1c00f1320e..0e3bb7bd14 100644 --- a/ip/index.d.ts +++ b/ip/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for node-ip +// Type definitions for node-ip // Project: https://github.com/indutny/node-ip // Definitions by: Peter Harris // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/ip/tsconfig.json b/ip/tsconfig.json index c2fb8b1cd9..4abc998147 100644 --- a/ip/tsconfig.json +++ b/ip/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/irc/tsconfig.json b/irc/tsconfig.json index 4db8cf6484..b9b4673383 100644 --- a/irc/tsconfig.json +++ b/irc/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/is-binary-path/index.d.ts b/is-binary-path/index.d.ts new file mode 100644 index 0000000000..9d825e6ae3 --- /dev/null +++ b/is-binary-path/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for is-binary-path 2.0 +// Project: https://github.com/sindresorhus/is-binary-path +// Definitions by: Daniel Rosenwasser +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = is_binary_path; +declare function is_binary_path(filepath: string): boolean; diff --git a/is-binary-path/is-binary-path-tests.ts b/is-binary-path/is-binary-path-tests.ts new file mode 100644 index 0000000000..967346a35a --- /dev/null +++ b/is-binary-path/is-binary-path-tests.ts @@ -0,0 +1,5 @@ +import isBinaryPath = require("is-binary-path"); + +let a: boolean = isBinaryPath("src/unicorn.png"); + +let b: boolean = isBinaryPath("src/unicorn.txt"); \ No newline at end of file diff --git a/is-binary-path/tsconfig.json b/is-binary-path/tsconfig.json new file mode 100644 index 0000000000..417e158ce0 --- /dev/null +++ b/is-binary-path/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "is-binary-path-tests.ts" + ] +} \ No newline at end of file diff --git a/is-binary-path/tslint.json b/is-binary-path/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/is-binary-path/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/is-lower-case/index.d.ts b/is-lower-case/index.d.ts deleted file mode 100644 index 1a489738f3..0000000000 --- a/is-lower-case/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for is-lower-case -// Project: https://github.com/blakeembrey/is-lower-case -// Definitions by: Sam Saint-Pettersen -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare function isLowerCase(string: string): boolean; -export = isLowerCase; diff --git a/is-lower-case/is-lower-case-tests.ts b/is-lower-case/is-lower-case-tests.ts deleted file mode 100644 index 2ff5a8488e..0000000000 --- a/is-lower-case/is-lower-case-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ - -import isLowerCase = require('is-lower-case') - -console.log(isLowerCase('string')); // => true -console.log(isLowerCase('String')); // => false -console.log(isLowerCase('STRING')); // => false diff --git a/is-lower-case/tsconfig.json b/is-lower-case/tsconfig.json deleted file mode 100644 index dcb1906005..0000000000 --- a/is-lower-case/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "is-lower-case-tests.ts" - ] -} \ No newline at end of file diff --git a/is-my-json-valid/tsconfig.json b/is-my-json-valid/tsconfig.json index 5459424bb3..c0eb5466c8 100644 --- a/is-my-json-valid/tsconfig.json +++ b/is-my-json-valid/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/is-path-cwd/index.d.ts b/is-path-cwd/index.d.ts new file mode 100644 index 0000000000..c00b20dae8 --- /dev/null +++ b/is-path-cwd/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for is-path-cwd 1.0 +// Project: https://github.com/sindresorhus/is-path-cwd +// Definitions by: Daniel Rosenwasser +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function isPathCwd(path: string): boolean; +export = isPathCwd; \ No newline at end of file diff --git a/is-path-cwd/is-path-cwd-tests.ts b/is-path-cwd/is-path-cwd-tests.ts new file mode 100644 index 0000000000..80398a23cd --- /dev/null +++ b/is-path-cwd/is-path-cwd-tests.ts @@ -0,0 +1,3 @@ +import isPathCwd = require("is-path-cwd"); + +isPathCwd("unicorn"); \ No newline at end of file diff --git a/is-path-cwd/tsconfig.json b/is-path-cwd/tsconfig.json new file mode 100644 index 0000000000..527ece0753 --- /dev/null +++ b/is-path-cwd/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "is-path-cwd-tests.ts" + ] +} \ No newline at end of file diff --git a/is-path-cwd/tslint.json b/is-path-cwd/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/is-path-cwd/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/is-plain-object/tsconfig.json b/is-plain-object/tsconfig.json index 5263b5a06a..bc2867db1c 100644 --- a/is-plain-object/tsconfig.json +++ b/is-plain-object/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/is-promise/tsconfig.json b/is-promise/tsconfig.json index ba2cdc609f..f93430fecb 100644 --- a/is-promise/tsconfig.json +++ b/is-promise/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ diff --git a/is-upper-case/index.d.ts b/is-upper-case/index.d.ts deleted file mode 100644 index 3bec58c214..0000000000 --- a/is-upper-case/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for is-upper-case -// Project: https://github.com/blakeembrey/is-upper-case -// Definitions by: Sam Saint-Pettersen -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare function isUpperCase(string: string, locale?: string): boolean; -export = isUpperCase; diff --git a/is-upper-case/is-upper-case-tests.ts b/is-upper-case/is-upper-case-tests.ts deleted file mode 100644 index 41fa04dc34..0000000000 --- a/is-upper-case/is-upper-case-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ - -import isUpperCase = require('is-upper-case') - -console.log(isUpperCase('STRING')); // => true -console.log(isUpperCase('String')); // => false -console.log(isUpperCase('string')); // => false diff --git a/is-upper-case/tsconfig.json b/is-upper-case/tsconfig.json deleted file mode 100644 index 71c23af917..0000000000 --- a/is-upper-case/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "is-upper-case-tests.ts" - ] -} \ No newline at end of file diff --git a/is-url/tsconfig.json b/is-url/tsconfig.json index 4391ab3040..10bb2a6397 100644 --- a/is-url/tsconfig.json +++ b/is-url/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/is/index.d.ts b/is/index.d.ts index a07a6054e6..3c0e279eea 100644 --- a/is/index.d.ts +++ b/is/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for is.js +// Type definitions for is.js // Project: http://arasatasaygin.github.io/is.js/ // Definitions by: Rodrigo Cabral // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/is/tsconfig.json b/is/tsconfig.json index 2704d828cb..2e97760d50 100644 --- a/is/tsconfig.json +++ b/is/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/iscroll/iscroll-5.d.ts b/iscroll/iscroll-5.d.ts index 31e9acaf6c..b4a8d62763 100644 --- a/iscroll/iscroll-5.d.ts +++ b/iscroll/iscroll-5.d.ts @@ -65,6 +65,9 @@ interface IScrollOptions { click?: boolean; invertWheelDirection?: boolean; eventPassthrough?: string | boolean; + + // iScroll probe edition + probeType?: number; } declare class IScroll { diff --git a/iscroll/tsconfig.json b/iscroll/tsconfig.json index f477f5bfc0..ac5b1f94c2 100644 --- a/iscroll/tsconfig.json +++ b/iscroll/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/iso8601-localizer/tsconfig.json b/iso8601-localizer/tsconfig.json index 9bc8e15e07..1a3d3b6135 100644 --- a/iso8601-localizer/tsconfig.json +++ b/iso8601-localizer/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/isomorphic-fetch/tsconfig.json b/isomorphic-fetch/tsconfig.json index 4844b8a800..a521c357c1 100644 --- a/isomorphic-fetch/tsconfig.json +++ b/isomorphic-fetch/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/istanbul-middleware/istanbul-middleware.d.ts b/istanbul-middleware/index.d.ts similarity index 100% rename from istanbul-middleware/istanbul-middleware.d.ts rename to istanbul-middleware/index.d.ts diff --git a/istanbul-middleware/tsconfig.json b/istanbul-middleware/tsconfig.json index e755a0b80e..6e55ba542b 100644 --- a/istanbul-middleware/tsconfig.json +++ b/istanbul-middleware/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "istanbul-middleware.d.ts", + "index.d.ts", "istanbul-middleware-tests.ts" ] } \ No newline at end of file diff --git a/istanbul/tsconfig.json b/istanbul/tsconfig.json index 05443238a5..47b30b151f 100644 --- a/istanbul/tsconfig.json +++ b/istanbul/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/ix.js/tsconfig.json b/ix.js/tsconfig.json index 92c67b5112..f0ce358bee 100644 --- a/ix.js/tsconfig.json +++ b/ix.js/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jade/tsconfig.json b/jade/tsconfig.json index 6950c4c8b1..9ae1ca0b1c 100644 --- a/jade/tsconfig.json +++ b/jade/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jake/tsconfig.json b/jake/tsconfig.json index c2ade89f63..1f87791515 100644 --- a/jake/tsconfig.json +++ b/jake/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jasmine-ajax/tsconfig.json b/jasmine-ajax/tsconfig.json index 3a320cc492..ee74778622 100644 --- a/jasmine-ajax/tsconfig.json +++ b/jasmine-ajax/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jasmine-data_driven_tests/index.d.ts b/jasmine-data_driven_tests/index.d.ts index 9f0be21477..9874f61cb8 100644 --- a/jasmine-data_driven_tests/index.d.ts +++ b/jasmine-data_driven_tests/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jasmine Data Driven Tests +// Type definitions for Jasmine Data Driven Tests // Project: https://github.com/gburghardt/jasmine-data_driven_tests // Definitions by: Anthony MacKinnon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/jasmine-data_driven_tests/tsconfig.json b/jasmine-data_driven_tests/tsconfig.json index 1cb0cd4c87..eedc107d0b 100644 --- a/jasmine-data_driven_tests/tsconfig.json +++ b/jasmine-data_driven_tests/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts index 148725ca29..9d76049de8 100644 --- a/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts +++ b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts @@ -4,15 +4,15 @@ describe('specs', () => { beforeEach(() => { JasminePromiseMatchers.install }); - + afterEach(() => { JasminePromiseMatchers.uninstall }); - + it('should have correct syntax', (done) => { var foo = {}; var bar = {}; - + expect(foo).toBeResolvedWith(bar, done); expect(foo).toBeRejectedWith(bar, done); expect(foo).toBeResolved(done); diff --git a/jasmine-es6-promise-matchers/tsconfig.json b/jasmine-es6-promise-matchers/tsconfig.json index d4576433aa..3c9178fbbf 100644 --- a/jasmine-es6-promise-matchers/tsconfig.json +++ b/jasmine-es6-promise-matchers/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jasmine-expect/tsconfig.json b/jasmine-expect/tsconfig.json index d554ee8043..9421a7d16b 100644 --- a/jasmine-expect/tsconfig.json +++ b/jasmine-expect/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jasmine-fixture/tsconfig.json b/jasmine-fixture/tsconfig.json index 7f10282f27..d0e127846f 100644 --- a/jasmine-fixture/tsconfig.json +++ b/jasmine-fixture/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jasmine-jquery/index.d.ts b/jasmine-jquery/index.d.ts index cfca2cc265..cbd713fd37 100644 --- a/jasmine-jquery/index.d.ts +++ b/jasmine-jquery/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jasmine-JQuery 1.5.8 +// Type definitions for Jasmine-JQuery 1.5.8 // Project: https://github.com/velesin/jasmine-jquery // Definitions by: Gregor Stamac // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/jasmine-jquery/tsconfig.json b/jasmine-jquery/tsconfig.json index d6e089af3f..6722afd469 100644 --- a/jasmine-jquery/tsconfig.json +++ b/jasmine-jquery/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jasmine-matchers/tsconfig.json b/jasmine-matchers/tsconfig.json index 1dc515d7f0..cbd3cffe1a 100644 --- a/jasmine-matchers/tsconfig.json +++ b/jasmine-matchers/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jasmine-node/tsconfig.json b/jasmine-node/tsconfig.json index 9ab267afdc..ab8f2a17c5 100644 --- a/jasmine-node/tsconfig.json +++ b/jasmine-node/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jasmine-promise-matchers/tsconfig.json b/jasmine-promise-matchers/tsconfig.json index 8c1b14f0fd..b4c51c1553 100644 --- a/jasmine-promise-matchers/tsconfig.json +++ b/jasmine-promise-matchers/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jasmine/index.d.ts b/jasmine/index.d.ts index c4151995a7..abf8ed4f82 100644 --- a/jasmine/index.d.ts +++ b/jasmine/index.d.ts @@ -10,24 +10,17 @@ declare function describe(description: string, specDefinitions: () => void): voi declare function fdescribe(description: string, specDefinitions: () => void): void; declare function xdescribe(description: string, specDefinitions: () => void): void; -declare function it(expectation: string, assertion?: () => void, timeout?: number): void; declare function it(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; -declare function fit(expectation: string, assertion?: () => void, timeout?: number): void; declare function fit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; -declare function xit(expectation: string, assertion?: () => void, timeout?: number): void; declare function xit(expectation: string, assertion?: (done: DoneFn) => void, timeout?: number): void; /** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */ declare function pending(reason?: string): void; -declare function beforeEach(action: () => void, timeout?: number): void; declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void; -declare function afterEach(action: () => void, timeout?: number): void; declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void; -declare function beforeAll(action: () => void, timeout?: number): void; declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void; -declare function afterAll(action: () => void, timeout?: number): void; declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void; declare function expect(spy: Function): jasmine.Matchers; @@ -162,6 +155,7 @@ declare namespace jasmine { versionString(): string; nextSpecId(): number; addReporter(reporter: Reporter): void; + addReporter(reporter: CustomReporter): void; execute(): void; describe(description: string, specDefinitions: () => void): Suite; // ddescribe(description: string, specDefinitions: () => void): Suite; Not a part of jasmine. Angular team adds these @@ -354,6 +348,45 @@ declare namespace jasmine { addReporter(reporter: Reporter): void; } + interface SuiteInfo { + totalSpecsDefined: number; + } + + interface CustomReportExpectation { + matcherName: string; + message: string; + passed: boolean; + stack: string; + } + + interface FailedExpectation extends CustomReportExpectation { + actual: string; + expected: string; + } + + interface PassedExpectation extends CustomReportExpectation { + + } + + interface CustomReporterResult { + description: string, + failedExpectations?: FailedExpectation[], + fullName: string, + id: string; + passedExpectations?: PassedExpectation[], + pendingReason?: string; + status?: string; + } + + interface CustomReporter { + jasmineStarted?(suiteInfo: SuiteInfo): void; + suiteStarted?(result: CustomReporterResult): void; + specStarted?(result: CustomReporterResult): void; + specDone?(result: CustomReporterResult): void; + suiteDone?(result: CustomReporterResult): void; + jasmineDone?(): any; + } + interface Runner { new (env: Env): any; diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index ca2b2808cc..87497e90c2 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -902,6 +902,62 @@ describe("Custom matcher: 'toBeGoofy'", function () { }); }); +// test based on http://jasmine.github.io/2.5/custom_reporter.html +var myReporter: jasmine.CustomReporter = { + jasmineStarted: function (suiteInfo: jasmine.SuiteInfo ) { + console.log("Running suite with " + suiteInfo.totalSpecsDefined); + }, + + suiteStarted: function (result: jasmine.CustomReporterResult) { + console.log("Suite started: " + result.description + " whose full description is: " + result.fullName); + }, + + specStarted: function (result: jasmine.CustomReporterResult) { + console.log("Spec started: " + result.description + " whose full description is: " + result.fullName); + }, + + specDone: function (result: jasmine.CustomReporterResult) { + console.log("Spec: " + result.description + " was " + result.status); + for (var i = 0; i < result.failedExpectations.length; i++) { + console.log("Failure: " + result.failedExpectations[i].message); + console.log("Actual: " + result.failedExpectations[i].actual); + console.log("Expected: " + result.failedExpectations[i].expected); + console.log(result.failedExpectations[i].stack); + } + console.log(result.passedExpectations.length); + }, + + suiteDone: function (result: jasmine.CustomReporterResult) { + console.log('Suite: ' + result.description + ' was ' + result.status); + for (var i = 0; i < result.failedExpectations.length; i++) { + console.log('AfterAll ' + result.failedExpectations[i].message); + console.log(result.failedExpectations[i].stack); + } + }, + + jasmineDone: function() { + console.log('Finished suite'); + } +}; + +jasmine.getEnv().addReporter(myReporter); + +// test for custom reporter which return ES6 Promise in jasmineDone(): +var myShortReporter: jasmine.CustomReporter = { + jasmineDone: function() { + return new Promise(function(resolve, reject) { + setTimeout(() => resolve(), 10000); + }); + } +} + +var jasmineDoneResolved: Promise = myShortReporter.jasmineDone(); +jasmineDoneResolved.then(() => { + console.log("[ShortReporter] : jasmineDone Resolved"); +}); + +jasmine.getEnv().addReporter(myShortReporter); + describe("Randomize Tests", function() { it("should allow randomization of the order of tests", function() { expect(function() { diff --git a/jasmine/tsconfig.json b/jasmine/tsconfig.json index e312108530..e7f9394641 100644 --- a/jasmine/tsconfig.json +++ b/jasmine/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/java-applet/tsconfig.json b/java-applet/tsconfig.json index 95ecfe5704..ca587c4589 100644 --- a/java-applet/tsconfig.json +++ b/java-applet/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/java/tsconfig.json b/java/tsconfig.json index e86aa7715f..8950d2bf27 100644 --- a/java/tsconfig.json +++ b/java/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/javascript-astar/tsconfig.json b/javascript-astar/tsconfig.json index 6d738fe121..adc00dc0cf 100644 --- a/javascript-astar/tsconfig.json +++ b/javascript-astar/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/javascript-bignum/tsconfig.json b/javascript-bignum/tsconfig.json index ad0d48a866..ce37762e26 100644 --- a/javascript-bignum/tsconfig.json +++ b/javascript-bignum/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/javascript-obfuscator/tsconfig.json b/javascript-obfuscator/tsconfig.json index 40b101b1f6..331ae49482 100644 --- a/javascript-obfuscator/tsconfig.json +++ b/javascript-obfuscator/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jbinary/tsconfig.json b/jbinary/tsconfig.json index b4f8625871..d73ffa8413 100644 --- a/jbinary/tsconfig.json +++ b/jbinary/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jcanvas/index.d.ts b/jcanvas/index.d.ts index 8d10dfdcb7..a5c1b7204f 100644 --- a/jcanvas/index.d.ts +++ b/jcanvas/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jCanvas 15.2 +// Type definitions for jCanvas 15.2 // Project: https://github.com/caleb531/jcanvas // Definitions by: Rogier Schouten // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/jcanvas/tsconfig.json b/jcanvas/tsconfig.json index 6f92aa9018..2ed60b2a58 100644 --- a/jcanvas/tsconfig.json +++ b/jcanvas/tsconfig.json @@ -3,14 +3,13 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ "../" ], - "types": [ - "node" - ], + "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -18,4 +17,4 @@ "index.d.ts", "jcanvas-tests.ts" ] -} +} \ No newline at end of file diff --git a/jdataview/index.d.ts b/jdataview/index.d.ts index 6ed80f870a..b91a6813ec 100644 --- a/jdataview/index.d.ts +++ b/jdataview/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jDataView +// Type definitions for jDataView // Project: https://github.com/jDataView/jDataView // Definitions by: Ingvar Stepanyan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/jdataview/tsconfig.json b/jdataview/tsconfig.json index bee1d727bd..2143c3949f 100644 --- a/jdataview/tsconfig.json +++ b/jdataview/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jdenticon/index.d.ts b/jdenticon/index.d.ts new file mode 100644 index 0000000000..87d8609551 --- /dev/null +++ b/jdenticon/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for Jdenticon 1.3.2 +// Project: http://jdenticon.com/ +// Definitions by: Martin Thorsen Ranang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface JdenticonConfig { + lightness?: { + color?: number[]; + grayscale?: number[]; + }; + saturation?: number; +} + +export var jdenticon_config: JdenticonConfig; + +export namespace jdenticon { + export function drawIcon(ctx: CanvasRenderingContext2D, hash: string, size: number): void; + + export function toSvg(hash: string, size: number, padding?: number): string; + + export function update(el: Element|string, hash?: string, padding?: number): void; + + export let config: JdenticonConfig; + + export const version: string; +} diff --git a/jdenticon/jdenticon-tests.ts b/jdenticon/jdenticon-tests.ts new file mode 100644 index 0000000000..b26a01696b --- /dev/null +++ b/jdenticon/jdenticon-tests.ts @@ -0,0 +1,11 @@ +import {jdenticon} from "jdenticon"; + +function testJdenticon() { + if (typeof jdenticon.version !== 'string') { + throw '.version should be of string type.'; + } + + jdenticon.update('#jdenticon', 'd6d7705392bc7af633328bea8c4c6904', 8); +} + +testJdenticon(); diff --git a/jdenticon/tsconfig.json b/jdenticon/tsconfig.json new file mode 100644 index 0000000000..4078d1a078 --- /dev/null +++ b/jdenticon/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jdenticon-tests.ts" + ] +} \ No newline at end of file diff --git a/jee-jsf/tsconfig.json b/jee-jsf/tsconfig.json index 7442610520..0774f560ab 100644 --- a/jee-jsf/tsconfig.json +++ b/jee-jsf/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jest/index.d.ts b/jest/index.d.ts index d0660193f6..cf50596d55 100644 --- a/jest/index.d.ts +++ b/jest/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jest 15.1.1 +// Type definitions for Jest 16.0.0 // Project: http://facebook.github.io/jest/ // Definitions by: Asana , Ivo Stratev , jwbay // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -26,23 +26,25 @@ interface NodeRequire { } declare namespace jest { - function addMatchers(matchers: jasmine.CustomMatcherFactories): void; + function addMatchers(matchers: jasmine.CustomMatcherFactories): typeof jest; /** Disables automatic mocking in the module loader. */ - function autoMockOff(): void; + function autoMockOff(): typeof jest; /** Enables automatic mocking in the module loader. */ - function autoMockOn(): void; + function autoMockOn(): typeof jest; + /** Clears the mock.calls and mock.instances properties of all mocks. Equivalent to calling .mockClear() on every mocked function. */ + function clearAllMocks(): typeof jest; /** Removes any pending timers from the timer system. If any timers have been scheduled, they will be cleared and will never have the opportunity to execute in the future. */ - function clearAllTimers(): void; + function clearAllTimers(): typeof jest; /** Indicates that the module system should never return a mocked version of the specified module, including all of the specificied module's dependencies. */ - function deepUnmock(moduleName: string): void; + function deepUnmock(moduleName: string): typeof jest; /** Disables automatic mocking in the module loader. */ - function disableAutomock(): void; + function disableAutomock(): typeof jest; /** Mocks a module with an auto-mocked version when it is being required. */ - function doMock(moduleName: string): void; + function doMock(moduleName: string): typeof jest; /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */ - function dontMock(moduleName: string): void; + function dontMock(moduleName: string): typeof jest; /** Enables automatic mocking in the module loader. */ - function enableAutomock(): void; + function enableAutomock(): typeof jest; /** Creates a mock function. Optionally takes a mock implementation. */ function fn(implementation?: Function): Mock; /** Use the automatic mocking system to generate a mocked version of the given module. */ @@ -50,28 +52,30 @@ declare namespace jest { /** Returns whether the given function is a mock function. */ function isMockFunction(fn: any): fn is Mock; /** Mocks a module with an auto-mocked version when it is being required. */ - function mock(moduleName: string, factory?: any, options?: MockOptions): void; + function mock(moduleName: string, factory?: any, options?: MockOptions): typeof jest; /** Resets the module registry - the cache of all required modules. This is useful to isolate modules where local state might conflict between tests. */ - function resetModuleRegistry(): void; + function resetModuleRegistry(): typeof jest; /** Resets the module registry - the cache of all required modules. This is useful to isolate modules where local state might conflict between tests. */ - function resetModules(): void; + function resetModules(): typeof jest; /** Exhausts tasks queued by setImmediate(). */ - function runAllImmediates(): void; + function runAllImmediates(): typeof jest; /** Exhausts the micro-task queue (usually interfaced in node via process.nextTick). */ - function runAllTicks(): void; + function runAllTicks(): typeof jest; /** Exhausts the macro-task queue (i.e., all tasks queued by setTimeout() and setInterval()). */ - function runAllTimers(): void; + function runAllTimers(): typeof jest; /** Executes only the macro-tasks that are currently pending (i.e., only the tasks that have been queued by setTimeout() or setInterval() up to this point). * If any of the currently pending macro-tasks schedule new macro-tasks, those new tasks will not be executed by this call. */ - function runOnlyPendingTimers(): void; + function runOnlyPendingTimers(): typeof jest; + /** Executes only the macro task queue (i.e. all tasks queued by setTimeout() or setInterval() and setImmediate()). */ + function runTimersToTime(msToRun: number): typeof jest; /** Explicitly supplies the mock object that the module system should return for the specified module. */ - function setMock(moduleName: string, moduleExports: T): void; + function setMock(moduleName: string, moduleExports: T): typeof jest; /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */ - function unmock(moduleName: string): void; + function unmock(moduleName: string): typeof jest; /** Instructs Jest to use fake versions of the standard timer functions. */ - function useFakeTimers(): void; + function useFakeTimers(): typeof jest; /** Instructs Jest to use the real versions of the standard timer functions. */ - function useRealTimers(): void; + function useRealTimers(): typeof jest; interface MockOptions { virtual?: boolean; @@ -87,7 +91,7 @@ declare namespace jest { } interface ProvidesCallback { - (cb?: DoneCallback): any; + (cb: DoneCallback): any; } interface Lifecycle { @@ -95,9 +99,10 @@ declare namespace jest { } interface It { - (name: string, fn: ProvidesCallback): void; + (name: string, fn?: ProvidesCallback): void; only: It; skip: It; + concurrent: It; } interface Describe { @@ -124,6 +129,7 @@ declare namespace jest { toBeTruthy(): void; toBeUndefined(): void; toContain(expected: any): void; + toContainEqual(expected: any): void; toEqual(expected: any): void; toHaveBeenCalled(): boolean; toHaveBeenCalledTimes(expected: number): boolean; @@ -132,6 +138,7 @@ declare namespace jest { toMatchSnapshot(): void; toThrow(): void; toThrowError(error?: string | Constructable | RegExp): void; + toThrowErrorMatchingSnapshot(): void; } interface Constructable { diff --git a/jest/jest-tests.ts b/jest/jest-tests.ts index e774ad1fb5..913a671fa1 100644 --- a/jest/jest-tests.ts +++ b/jest/jest-tests.ts @@ -208,6 +208,8 @@ describe('missing tests', function () { expect(getFruits()).toContain('Orange'); mock.mockReturnValueOnce(['Apple', 'Plum']); expect(mock()).not.toContain('Orange'); + const myBeverage: any = {delicious: true, sour: false}; + expect(myBeverage).toContainEqual({delicious: true, sour: false}); mock.mockReturnValue([]); //Deprecated: Use jest.fn(() => value) instead. mock.mockClear(); let thisMock: jest.Mock = jest.fn().mockReturnThis(); @@ -215,8 +217,7 @@ describe('missing tests', function () { }); it('creates snapshoter', function () { - jest.disableAutomock(); - jest.mock('./render', () => jest.fn((): string => "{Link to: \"facebook\"}"), { virtual: true }); + jest.disableAutomock().mock('./render', () => jest.fn((): string => "{Link to: \"facebook\"}"), { virtual: true }); const render: () => string = require('./render'); expect(render()).toMatch(/Link/); jest.enableAutomock(); @@ -225,7 +226,7 @@ describe('missing tests', function () { it('runs only pending timers', function () { jest.useRealTimers(); setTimeout(() => expect(1).not.toEqual(0), 3000); - jest.runOnlyPendingTimers(); + jest.runOnlyPendingTimers().runTimersToTime(300); }); it('runs all timers', function () { @@ -249,6 +250,12 @@ describe('toMatchSnapshot', function () { }); }); +describe('toThrowErrorMatchingSnapshot', function () { + it('compares snapshots', function () { + expect(() => { throw new Error('descriptiton') }).toThrowErrorMatchingSnapshot(); + }); +}); + function testInstances() { var mockFn = jest.fn(); var a = new mockFn(); @@ -351,3 +358,12 @@ describe('genMockFromModule', function () { }); }); }); + +/** + * Pass strictNullChecks + */ +describe('strictNullChecks', function () { + it('does not complain when using done callback', (done) => { + done(); + }) +}); diff --git a/jest/tsconfig.json b/jest/tsconfig.json index 0ad43c6b19..0987fd539f 100644 --- a/jest/tsconfig.json +++ b/jest/tsconfig.json @@ -3,7 +3,8 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "noImplicitThis": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/jfp/tsconfig.json b/jfp/tsconfig.json index e541ed8585..84f74ceffb 100644 --- a/jfp/tsconfig.json +++ b/jfp/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jjv/tsconfig.json b/jjv/tsconfig.json index 17b1440993..1247e95975 100644 --- a/jjv/tsconfig.json +++ b/jjv/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jjve/tsconfig.json b/jjve/tsconfig.json index 0c0648fa43..3310ea1d01 100644 --- a/jjve/tsconfig.json +++ b/jjve/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jodata/tsconfig.json b/jodata/tsconfig.json index ffcb8a4e8c..3638d1b6f6 100644 --- a/jodata/tsconfig.json +++ b/jodata/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/johnny-five/index.d.ts b/johnny-five/index.d.ts index 8f480c5e3e..c5e058c335 100644 --- a/johnny-five/index.d.ts +++ b/johnny-five/index.d.ts @@ -32,9 +32,9 @@ export interface AccelerometerMMA7361Option extends AccelerometerGeneralOption { export declare class Accelerometer { constructor(option: AccelerometerGeneralOption | AccelerometerAnalogOption | AccelerometerMPU6050Option | AccelerometerMMA7361Option); - on(event: string, cb: () => void): void; - on(event: "change", cb: () => void): void; - on(event: "data", cb: (freq: any) => void): void; + on(event: string, cb: () => void): this; + on(event: "change", cb: () => void): this; + on(event: "data", cb: (freq: any) => void): this; hasAxis(name: string): void; enable(): void; disable(): void; @@ -71,12 +71,12 @@ export interface ButtonOptions { export declare class Button { constructor(pin: number | string | ButtonOptions); - on(event: string, cb: () => void): void; - on(event: "hold", cb: (holdTime: number) => void): void; - on(event: "down", cb: () => void): void; - on(event: "press", cb: () => void): void; - on(event: "up", cb: () => void): void; - on(event: "release", cb: () => void): void; + on(event: string, cb: () => void): this; + on(event: "hold", cb: (holdTime: number) => void): this; + on(event: "down", cb: () => void): this; + on(event: "press", cb: () => void): this; + on(event: "up", cb: () => void): this; + on(event: "release", cb: () => void): this; } export interface BoardOptions { @@ -91,9 +91,9 @@ export interface Repl { export declare class Board { constructor(option?: BoardOptions); - on(event: string, cb: () => void): void; - on(event: "ready", cb: () => void): void; - on(event: "connect", cb: () => void): void; + on(event: string, cb: () => void): this; + on(event: "ready", cb: () => void): this; + on(event: "connect", cb: () => void): this; pinMode(pin: number, mode: number): void; analogWrite(pin: number, value: number): void; analogRead(pin: number, cb: (item: number) => void): void; @@ -170,9 +170,9 @@ export interface IMUMPU6050Option extends IMUGeneralOption { export declare class IMU { constructor(option: IMUGeneralOption | IMUMPU6050Option); - on(event: string, cb: () => void): void; - on(event: "change", cb: () => void): void; - on(event: "data", cb: (data: any) => void): void; + on(event: string, cb: () => void): this; + on(event: "change", cb: () => void): this; + on(event: "data", cb: (data: any) => void): this; } export declare module IR { @@ -182,11 +182,11 @@ export declare module IR { export class Motion { constructor(option: number | MotionOption); - on(event: string, cb: () => void): void; - on(event: "data", cb: (data: any) => void): void; - on(event: "motionstart", cb: () => void): void; - on(event: "motionend", cb: () => void): void; - on(event: "calibrated", cb: () => void): void; + on(event: string, cb: () => void): this; + on(event: "data", cb: (data: any) => void): this; + on(event: "motionstart", cb: () => void): this; + on(event: "motionend", cb: () => void): this; + on(event: "calibrated", cb: () => void): this; } export interface PloximityOption { @@ -196,9 +196,9 @@ export declare module IR { export class Proximity { constructor(option: number | PloximityOption); - on(event: string, cb: () => void): void; - on(event: "data", cb: (data: any) => void): void; - on(event: "change", cb: () => void): void; + on(event: string, cb: () => void): this; + on(event: "data", cb: (data: any) => void): this; + on(event: "change", cb: () => void): this; } export interface ArrayOption { @@ -220,10 +220,10 @@ export declare module IR { calibrate(): void; calibrateUntil(predicate: () => void): void; loadCalibration(option: LoadCalibrationOption): void; - on(event: string, cb: () => void): void; - on(event: "data", cb: (data: any) => void): void; - on(event: "calibratedData", cb: (data: any) => void): void; - on(event: "line", cb: (data: any) => void): void; + on(event: string, cb: () => void): this; + on(event: "data", cb: (data: any) => void): this; + on(event: "calibratedData", cb: (data: any) => void): this; + on(event: "line", cb: (data: any) => void): this; } } } @@ -234,10 +234,10 @@ export interface JoystickOption { export declare class Joystick { constructor(option: JoystickOption); - on(event: string, cb: () => void): void; - on(event: "data", cb: (data: any) => void): void; - on(event: "change", cb: () => void): void; - on(event: "axismove", cb: (error: Error, date: Date) => void): void; + on(event: string, cb: () => void): this; + on(event: "data", cb: (data: any) => void): this; + on(event: "change", cb: () => void): this; + on(event: "axismove", cb: (error: Error, date: Date) => void): this; axis: Array; raw: Array; @@ -468,9 +468,9 @@ export declare class Sensor { scale(): Sensor; booleanAt(barrier: number): boolean; within(range: Array, cb: () => void): void; - on(event: string, cb: () => void): void; - on(event: "data", cb: (data: any) => void): void; - on(event: "change", cb: () => void): void; + on(event: string, cb: () => void): this; + on(event: "data", cb: (data: any) => void): this; + on(event: "change", cb: () => void): this; } export interface ServoGeneralOption { @@ -505,8 +505,8 @@ export declare class Servo { stop(): void; cw(speed: number): void; ccw(speed: number): void; - on(event: string, cb: () => void): void; - on(event: "move:complete", cb: () => void): void; + on(event: string, cb: () => void): this; + on(event: "move:complete", cb: () => void): this; } export interface ShiftRegisterOption { @@ -529,9 +529,9 @@ export declare class Sonar { constructor(option: number | string | SonarOption); within(range: Array, cb: () => void): void; within(range: Array, unit: string, cb: () => void): void; - on(event: string, cb: () => void): void; - on(event: "data", cb: (data: any) => void): void; - on(event: "change", cb: () => void): void; + on(event: string, cb: () => void): this; + on(event: "data", cb: (data: any) => void): this; + on(event: "change", cb: () => void): this; } export interface StepperOption { @@ -568,9 +568,9 @@ export declare class Stepper { within(range: Array, cb: () => void): void; within(range: Array, unit: string, cb: () => void): void; - on(event: string, cb: () => void): void; - on(event: "data", cb: (data: any) => void): void; - on(event: "change", cb: () => void): void; + on(event: string, cb: () => void): this; + on(event: "data", cb: (data: any) => void): this; + on(event: "change", cb: () => void): this; } export interface TemperatureOption { @@ -582,7 +582,7 @@ export interface TemperatureOption { export declare class Temperature { constructor(option: TemperatureOption); - on(event: string, cb: () => void): void; - on(event: "data", cb: (data: any) => void): void; - on(event: "change", cb: () => void): void; + on(event: string, cb: () => void): this; + on(event: "data", cb: (data: any) => void): this; + on(event: "change", cb: () => void): this; } diff --git a/johnny-five/johnny-five-tests.ts b/johnny-five/johnny-five-tests.ts index 919f1fd7d5..da5cff19f6 100644 --- a/johnny-five/johnny-five-tests.ts +++ b/johnny-five/johnny-five-tests.ts @@ -250,4 +250,6 @@ board.on('ready', function(){ return (raw / 100) + 10; } }); +}).on("ready", function(){ + console.log("Everything is ready!!!"); }); diff --git a/johnny-five/tsconfig.json b/johnny-five/tsconfig.json index 93aaad00c9..f027f26c48 100644 --- a/johnny-five/tsconfig.json +++ b/johnny-five/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/joi/index.d.ts b/joi/index.d.ts index ece6bb6d62..55e6b9c75f 100644 --- a/joi/index.d.ts +++ b/joi/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for joi v9.0.0 +// Type definitions for joi v10.0.0 // Project: https://github.com/hapijs/joi // Definitions by: Bart van der Schoor , Laurence Dougal Myers , Christopher Glantschnig , David Broder-Rodgers , Gael Magnan de Bornier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -40,6 +40,10 @@ export interface ValidationOptions { * provides an external data set to be used in references */ context?: Object; + /** + * when true, do not apply default values. Defaults to false. + */ + noDefaults?: boolean; } export interface RenameOptions { @@ -121,10 +125,10 @@ export interface IPOptions { } export interface ValidationError extends Error { - message: string; + isJoi: boolean; details: ValidationErrorItem[]; - simple(): string; - annotated(): string; + annotate(): string; + _object: any; } export interface ValidationErrorItem { @@ -132,6 +136,7 @@ export interface ValidationErrorItem { type: string; path: string; options?: ValidationOptions; + context?: any; } export interface ValidationResult { @@ -287,6 +292,17 @@ export interface AnySchema> { * @param schema - any object or joi schema to match. An undefined schema unsets that rule. */ empty(schema?: any): T; + + /** + * Overrides the default joi error with a custom error if the rule fails where: + * @param err - the override error. + * + * Note that the provided error will be returned as-is, unmodified and undecorated + * with any of the normal joi error properties. If validation fails and another + * error is found before the error override, that error will be returned and the + * override will be ignored (unless the abortEarly option has been set to false). + */ + error?(err: Error): T; } export interface BooleanSchema extends AnySchema { @@ -749,7 +765,7 @@ export interface Rules { params?: ObjectSchema | { [key: string]: Schema }; setup?: Function; validate?: Function; - description: string | Function; + description?: string | Function; } export interface Extension { @@ -827,10 +843,18 @@ export declare function lazy(cb: () => Schema): Schema; /** * Validates a value using the given schema and options. */ -export declare function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void; -export declare function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void; -export declare function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): ValidationResult; +export function validate(value: T): ValidationResult; +export function validate(value: T, callback: (err: ValidationError, value: T) => R): R; +export function validate(value: T, schema: Schema): ValidationResult; +export function validate(value: T, schema: Object): ValidationResult; +export function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => R): R; +export function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => R): R; + +export function validate(value: T, schema: Schema, options: ValidationOptions): ValidationResult; +export function validate(value: T, schema: Object, options: ValidationOptions): ValidationResult; +export function validate(value: T, schema: Schema, options: ValidationOptions, callback: (err: ValidationError, value: T) => R): R; +export function validate(value: T, schema: Object, options: ValidationOptions, callback: (err: ValidationError, value: T) => R): R; /** * Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object). */ @@ -878,3 +902,118 @@ export function reach(schema: Schema, path: string): Schema; * Creates a new Joi instance customized with the extension(s) you provide included. */ export function extend(extention: Extension): any; + +/** + * Whitelists a value + */ +export function allow(value: any, ...values: any[]): Schema; +export function allow(values: any[]): Schema; + +/** + * Adds the provided values into the allowed whitelist and marks them as the only valid values allowed. + */ +export function valid(value: any, ...values: any[]): Schema; +export function valid(values: any[]): Schema; +export function only(value: any, ...values : any[]): Schema; +export function only(values: any[]): Schema; +export function equal(value: any, ...values : any[]): Schema; +export function equal(values: any[]): Schema; + +/** + * Blacklists a value + */ +export function invalid(value: any, ...values: any[]): Schema; +export function invalid(values: any[]): Schema; +export function disallow(value: any, ...values : any[]): Schema; +export function disallow(values: any[]): Schema; +export function not(value: any, ...values : any[]): Schema; +export function not(values: any[]): Schema; + +/** + * Marks a key as required which will not allow undefined as value. All keys are optional by default. + */ +export function required(): Schema; + +/** + * Marks a key as optional which will allow undefined as values. Used to annotate the schema for readability as all keys are optional by default. + */ +export function optional(): Schema; + +/** + * Marks a key as forbidden which will not allow any value except undefined. Used to explicitly forbid keys. + */ +export function forbidden(): Schema; + +/** + * Marks a key to be removed from a resulting object or array after validation. Used to sanitize output. + */ +export function strip(): Schema; + +/** + * Annotates the key + */ +export function description(desc: string): Schema; + +/** + * Annotates the key + */ +export function notes(notes: string): Schema; +export function notes(notes: string[]): Schema; + +/** + * Annotates the key + */ +export function tags(notes: string): Schema; +export function tags(notes: string[]): Schema; + +/** + * Attaches metadata to the key. + */ +export function meta(meta: Object): Schema; + +/** + * Annotates the key with an example value, must be valid. + */ +export function example(value: any): Schema; + +/** + * Annotates the key with an unit name. + */ +export function unit(name: string): Schema; + +/** + * Overrides the global validate() options for the current key and any sub-key. + */ +export function options(options: ValidationOptions): Schema; + +/** + * Sets the options.convert options to false which prevent type casting for the current key and any child keys. + */ +export function strict(isStrict?: boolean): Schema; + +/** + * Returns a new type that is the result of adding the rules of one type to another. + */ +export function concat(schema: T): T; + +/** + * Converts the type into an alternatives type where the conditions are merged into the type definition where: + */ +export function when(ref: string, options: WhenOptions): AlternativesSchema; +export function when(ref: Reference, options: WhenOptions): AlternativesSchema; + +/** + * Overrides the key name in error messages. + */ +export function label(name: string): Schema; + +/** + * Outputs the original untouched value instead of the casted value. + */ +export function raw(isRaw?: boolean): Schema; + +/** + * Considers anything that matches the schema to be empty (undefined). + * @param schema - any object or joi schema to match. An undefined schema unsets that rule. + */ +export function empty(schema?: any) : Schema; diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index eb0f147f78..59eb446b2f 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -58,6 +58,7 @@ validOpts = {stripUnknown: bool}; validOpts = {language: bool}; validOpts = {presence: str}; validOpts = {context: obj}; +validOpts = {noDefaults: bool}; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -125,7 +126,8 @@ validErrItem = { message: str, type: str, path: str, - options: validOpts + options: validOpts, + context: obj }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -221,6 +223,8 @@ namespace common { anySchema = anySchema.empty(); anySchema = anySchema.empty(str); anySchema = anySchema.empty(anySchema); + + anySchema = anySchema.error(err); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -756,30 +760,57 @@ schema = Joi.lazy(() => schema) // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -Joi.validate(value, obj); -Joi.validate(value, schema); -Joi.validate(value, schema, validOpts); -Joi.validate(value, schema, validOpts, (err, value) => { +namespace validate_tests { + { + Joi.validate(value, obj); + Joi.validate(value, schema); + Joi.validate(value, schema, validOpts); + Joi.validate(value, schema, validOpts, (err, value) => { x = value; str = err.message; str = err.details[0].path; str = err.details[0].message; str = err.details[0].type; -}); -Joi.validate(value, schema, (err, value) => { + }); + Joi.validate(value, schema, (err, value) => { x = value; str = err.message; str = err.details[0].path; str = err.details[0].message; str = err.details[0].type; -}); -// variant -Joi.validate(num, schema, validOpts, (err, value) => { + }); + // variant + Joi.validate(num, schema, validOpts, (err, value) => { num = value; -}); + }); + + // plain opts + Joi.validate(value, {}); + } + + { + let value = { username: 'example', password: 'example' }; + let schema = Joi.object().keys({ + username: Joi.string().max(255).required(), + password: Joi.string().regex(/^[a-zA-Z0-9]{3,255}$/).required(), + }); + let returnValue: Joi.ValidationResult; + + returnValue = Joi.validate(value); + value = Joi.validate(value, (err, value) => value); + + returnValue = Joi.validate(value, schema); + returnValue = Joi.validate(value, obj); + value = Joi.validate(value, obj, (err, value) => value); + value = Joi.validate(value, schema, (err, value) => value); + + returnValue = Joi.validate(value, schema, validOpts); + returnValue = Joi.validate(value, obj, validOpts); + value = Joi.validate(value, obj, validOpts, (err, value) => value); + value = Joi.validate(value, schema, validOpts, (err, value) => value); + } +} -// plain opts -Joi.validate(value, {}); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -801,3 +832,56 @@ Joi.isRef(ref); schema = Joi.reach(schema, ''); const Joi2 = Joi.extend({ name: '', base: schema }); + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +schema = Joi.allow(x, x); +schema = Joi.allow([x, x, x]); +schema = Joi.valid(x); +schema = Joi.valid(x, x); +schema = Joi.valid([x, x, x]); +schema = Joi.only(x); +schema = Joi.only(x, x); +schema = Joi.only([x, x, x]); +schema = Joi.equal(x); +schema = Joi.equal(x, x); +schema = Joi.equal([x, x, x]); +schema = Joi.invalid(x); +schema = Joi.invalid(x, x); +schema = Joi.invalid([x, x, x]); +schema = Joi.disallow(x); +schema = Joi.disallow(x, x); +schema = Joi.disallow([x, x, x]); +schema = Joi.not(x); +schema = Joi.not(x, x); +schema = Joi.not([x, x, x]); + +schema = Joi.required(); +schema = Joi.optional(); +schema = Joi.forbidden(); +schema = Joi.strip(); + +schema = Joi.description(str); +schema = Joi.notes(str); +schema = Joi.notes(strArr); +schema = Joi.tags(str); +schema = Joi.tags(strArr); + +schema = Joi.meta(obj); +schema = Joi.example(obj); +schema = Joi.unit(str); + +schema = Joi.options(validOpts); +schema = Joi.strict(); +schema = Joi.strict(bool); +schema = Joi.concat(x); + +schema = Joi.when(str, whenOpts); +schema = Joi.when(ref, whenOpts); + +schema = Joi.label(str); +schema = Joi.raw(); +schema = Joi.raw(bool); +schema = Joi.empty(); +schema = Joi.empty(str); +schema = Joi.empty(anySchema); diff --git a/joi/tsconfig.json b/joi/tsconfig.json index 21ea7b73a3..e07fa18fed 100644 --- a/joi/tsconfig.json +++ b/joi/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jointjs/index.d.ts b/jointjs/index.d.ts index 9af669fdea..aec9f1237d 100644 --- a/jointjs/index.d.ts +++ b/jointjs/index.d.ts @@ -1,135 +1,559 @@ -// Type definitions for Joint JS 0.9.3 +// Type definitions for Joint JS 1.0.1 // Project: http://www.jointjs.com/ -// Definitions by: Aidan Reel , David Durman , Ewout Van Gossum +// Definitions by: Aidan Reel , David Durman , Ewout Van Gossum , Federico Caselli // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// typings: https://github.com/CaselIT/typings-jointjs /// + declare namespace joint { + export var g: any; + export var V: any; namespace dia { - - interface IElementSize { + interface Size { width: number; height: number; } + interface Point { + x: number; + y: number; + } + + interface BBox extends Point, Size { } + + interface TranslateOptions { + restrictedArea?: BBox; + transition?: TransitionOptions; + } + + interface TransitionOptions { + delay?: number; + duration?: number; + timingFunction?: (t: number) => number; + valueFunction?: (a: any, b: any) => (t: number) => any; + } + + interface DfsBfsOptions { + inbound?: boolean; + outbound?: boolean; + deep?: boolean; + } + + interface ExploreOptions { + breadthFirst?: boolean; + deep?: boolean; + } + class Graph extends Backbone.Model { - addCell(cell:Cell) : void; - addCells(cells:Cell[]) : void; - initialize() : void; - fromJSON(json:any) : void; - toJSON() : Object; - clear() : void; - getConnectedLinks(cell:Cell, opt?:any):Link[]; - disconnectLinks(cell:Cell) : void; - removeLinks(cell:Cell) : void; - findModelsFromPoint(point:{x : number; y: number}):Element[]; + constructor(attributes?: any, options?: { cellNamespace: any }); + addCell(cell: Cell | Cell[]): this; + addCells(cells: Cell[]): this; + resetCells(cells: Cell[], options?: any): this; + getCell(id: string): Cell; + getElements(): Element[]; + getLinks(): Link[]; + getCells(): Cell[]; + getFirstCell(): Cell; + getLastCell(): Cell; + getConnectedLinks(element: Cell, options?: { inbound?: boolean, outbound?: boolean, deep?: boolean }): Link[]; + disconnectLinks(cell: Cell, options?: any): void; + removeLinks(cell: Cell, options?: any): void; + translate(tx: number, ty?: number, options?: TranslateOptions): void; + cloneCells(cells: Cell[]): { [id: string]: Cell }; + getSubgraph(cells: Cell[], options?: { deep?: boolean }): Cell[]; + cloneSubgraph(cells: Cell[], options?: { deep?: boolean }): { [id: string]: Cell }; + dfs(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: DfsBfsOptions, visited?: Object, distance?: number): void; + bfs(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: DfsBfsOptions): void; + search(element: Element, iteratee: (element: Element, distance: number) => boolean, options?: { breadthFirst?: boolean }): void; + getSuccessors(element: Element, options?: ExploreOptions): Element[]; + getPredecessors(element: Element, options?: ExploreOptions): Element[]; + isSuccessor(elementA: Element, elementB: Element): boolean; + isPredecessor(elementA: Element, elementB: Element): boolean; + isSource(element: Element): boolean; + isSink(element: Element): boolean; + getSources(): Element[]; + getSinks(): Element[]; + getNeighbors(element: Element, options?: DfsBfsOptions): Element[]; + isNeighbor(elementA: Element, elementB: Element, options?: { inbound?: boolean, outbound?: boolean; }): boolean; + getCommonAncestor(...cells: Cell[]): Element; + toJSON(): any; + fromJSON(json: any, options?: any): this; + clear(options?: any): this; + findModelsFromPoint(rect: BBox): Element[]; + findModelsUnderElement(element: Element, options?: { searchBy?: 'bbox' | 'center' | 'origin' | 'corner' | 'topRight' | 'bottomLeft' }): Element[]; + getBBox(elements: Element[], options?: any): BBox; + toGraphLib(): any; // graphlib graph object + findModelsInArea(rect: BBox, options?: any): BBox | boolean; + getCellsBBox(cells: Cell[], options?: any): BBox; + getInboundEdges(node: string): Object; + getOutboundEdges(node: string): Object; + hasActiveBatch(name?: string): number | boolean; + maxZIndex(): number; + removeCells(cells: Cell[], options?: any): this; + resize(width: number, height: number, options?: number): this; + resizeCells(width: number, height: number, cells: Cell[], options?: number): this; + set(key: Object | string, value: any, options?: any): this; + startBatch(name: string, data?: Object): any; + stopBatch(name: string, data?: Object): any; } class Cell extends Backbone.Model { - toJSON() : Object; - remove(options?:any) : void; - toFront() : void; - toBack() : void; - embed(cell:Cell) : void; - unembed(cell:Cell) : void; - getEmbeddedCells():Cell[]; - clone(opt?:any):Backbone.Model; // @todo: return can either be Cell or Cell[]. - attr(attrs:any):Cell; + id: string; + toJSON(): any; + remove(options?: { disconnectLinks?: boolean }): this; + toFront(options?: { deep?: boolean }): this; + toBack(options?: { deep?: boolean }): this; + getAncestors(): Cell[]; + isEmbeddedIn(element: Element, options?: { deep: boolean }): boolean; + prop(key: string): any; + prop(object: any): this; + prop(key: string, value: any, options?: any): this; + removeProp(path: string, options?: any): this; + attr(key: string): any; + attr(object: SVGAttributes): this; + attr(key: string, value: any): this; + clone(): Cell; + clone(opt: { deep?: boolean }): Cell | Cell[]; + removeAttr(path: string | string[], options?: any): this; + transition(path: string, value?: any, options?: TransitionOptions, delim?: string): number; + getTransitions(): string[]; + stopTransitions(path?: string, delim?: string): this; + addTo(graph: Graph, options?: any): this; + isLink(): boolean; + embed(cell: Cell, options?: any): this; + findView(paper: Paper): CellView; + getEmbeddedCells(options?: any): Cell[]; + initialize(options?: any): void; + isElement(): boolean; + isEmbedded(): boolean; + processPorts(): void; + startBatch(name: string, options?: any): this; + stopBatch(name: string, options?: any): this; + unembed(cell: Cell, options?: any): this; } + type Padding = number | { + top?: number; + right?: number; + bottom?: number; + left?: number + }; + class Element extends Cell { - position(x:number, y:number):Element; - position(): {x:number, y:number}; - translate(tx:number, ty?:number):Element; - resize(width:number, height:number):Element; - rotate(angle:number, options : {absolute : boolean; origin: {x:number;y:number}}):Element; - remove(): void; + translate(tx: number, ty?: number, options?: TranslateOptions): this; + position(options?: { parentRelative: boolean }): Point; + position(x: number, y: number, options?: { parentRelative?: boolean }): this; + resize(width: number, height: number, options?: { direction?: 'left' | 'right' | 'top' | 'bottom' | 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right' }): this; + rotate(deg: number, absolute?: boolean, origin?: Point): this; + embed(cell: Cell): this; + unembed(cell: Cell): this; + getEmbeddedCells(options?: ExploreOptions): Cell[]; + fitEmbeds(options?: { deep?: boolean, padding?: Padding }): this; + getBBox(options?: any): BBox; + findView(paper: Paper): ElementView; + isElement(): boolean; + scale(scaleX: number, scaleY: number, origin?: Point, options?: any): this; } - interface IDefaults { - type: string; + interface CSSSelector { + [key: string]: string | number | Object; // Object added to support special attributes like filter http://jointjs.com/api#SpecialAttributes:filter + } + + interface SVGAttributes { + [selector: string]: CSSSelector; + } + + interface CellAttributes { + [key: string]: any; + } + + interface TextAttrs extends SVGAttributes { + text?: { + [key: string]: string | number; + text?: string; + }; + } + + interface Label { + position: number; + attrs?: TextAttrs; + } + interface LinkAttributes extends CellAttributes { + source?: Point | { id: string, selector?: string, port?: string }; + target?: Point | { id: string, selector?: string, port?: string }; + labels?: Label[]; + vertices?: Point[]; + smooth?: boolean; + attrs?: TextAttrs; } class Link extends Cell { - defaults():IDefaults; - disconnect():Link; - label(idx?:number, value?:any):any; // @todo: returns either a label under idx or Link if both idx and value were passed - remove(): void; + markup: string; + labelMarkup: string; + toolMakup: string; + vertexMarkup: string; + arrowHeadMarkup: string; + + constructor(attributes?: LinkAttributes, options?: Object); + disconnect(): this; + label(index?: number): any; + label(index: number, value: Label): this; + reparent(options?: any): Element; + findView(paper: Paper): LinkView; + getSourceElement(): Element; + getTargetElement(): Element; + hasLoop(options?: { deep?: boolean }): boolean; + applyToPoints(fn: Function, options?: any): this; + getRelationshipAncestor(): Element; + isLink(): boolean; + isRelationshipEmbeddedIn(element: Element): boolean; + scale(sx: number, sy: number, origin: Point, optionts?: any): this; + translate(tx: number, ty: number, options?: any): this; } - interface IOptions { + interface ManhattanRouterArgs { + excludeTypes?: string[]; + excludeEnds?: 'source' | 'target'; + startDirections?: ['left' | 'right' | 'top' | 'bottom']; + endDirections?: ['left' | 'right' | 'top' | 'bottom']; + } + + interface PaperOptions extends Backbone.ViewOptions { + el?: string | JQuery | HTMLElement; width?: number; height?: number; + origin?: Point; gridSize?: number; perpendicularLinks?: boolean; - elementView?: ElementView; - linkView?: LinkView; + elementView?: (element: Element) => ElementView | ElementView; + linkView?: (link: Link) => LinkView | LinkView; + defaultLink?: ((cellView: CellView, magnet: SVGElement) => Link) | Link; + defaultRouter?: ((vertices: Point[], args: Object, linkView: LinkView) => Point[]) | { name: string, args?: ManhattanRouterArgs }; + defaultConnector?: ((sourcePoint: Point, targetPoint: Point, vertices: Point[], args: Object, linkView: LinkView) => string) | { name: string, args?: { radius?: number } }; + interactive?: ((cellView: CellView, event: string) => boolean) | boolean | { vertexAdd?: boolean, vertexMove?: boolean, vertexRemove?: boolean, arrowheadMove?: boolean }; + validateMagnet?: (cellView: CellView, magnet: SVGElement) => boolean; + validateConnection?: (cellViewS: CellView, magnetS: SVGElement, cellViewT: CellView, magnetT: SVGElement, end: 'source' | 'target', linkView: LinkView) => boolean; + linkConnectionPoint?: (linkView: LinkView, view: ElementView, magnet: SVGElement, reference: Point) => Point; + snapLinks?: boolean | { radius: number }; + linkPinning?: boolean; + markAvailable?: boolean; + async?: boolean | { batchZise: number }; + embeddingMode?: boolean; + validateEmbedding?: (childView: ElementView, parentView: ElementView) => boolean; + restrictTranslate?: ((elementView: ElementView) => BBox) | boolean; + guard?: (evt: Event, view: CellView) => boolean; + multiLinks?: boolean; + cellViewNamespace?: Object; + /** useful undocumented option */ + clickThreshold?: number; } - class Paper extends Backbone.View { - options:IOptions; - - setDimensions(width:number, height:number) : void; - scale(sx:number, sy?:number, ox?:number, oy?:number):Paper; - rotate(deg:number, ox?:number, oy?:number):Paper; // @todo not released yet though it's in the source code already - findView(el:any):CellView; - findViewByModel(modelOrId:any):CellView; - findViewsFromPoint(p:{ x: number; y: number; }):CellView[]; - findViewsInArea(r:{ x: number; y: number; width: number; height: number; }):CellView[]; - fitToContent(opt?:any): void; + interface ScaleContentOptions { + padding?: number; + preserveAspectRatio?: boolean; + minScale?: number; + minScaleX?: number; + minScaleY?: number; + maxScale?: number; + maxScaleX?: number; + maxScaleY?: number; + scaleGrid?: number; + fittingBBox?: BBox; } - class ElementView extends CellView { - scale(sx:number, sy:number) : void; + interface FitToContentOptions { + gridWidth?: number; + gridHeight?: number; + padding?: Padding; + allowNewOrigin?: 'negative' | 'positive' | 'any'; + minWidth?: number; + minHeight?: number; + maxWidth?: number; + maxHeight?: number; } - class CellView extends Backbone.View { - getBBox():{ x: number; y: number; width: number; height: number; }; - highlight(el?:any): void; - unhighlight(el?:any): void; - findMagnet(el:any): void; - getSelector(el:any): void; + class Paper extends Backbone.View { + constructor(options?: PaperOptions); + options: PaperOptions; + svg: SVGElement; + viewport: SVGGElement; + defs: SVGDefsElement; + setDimensions(width: number, height: number): void; + setOrigin(x: number, y: number): void; + scale(sx: number, sy?: number, ox?: number, oy?: number): this; + findView(element: any): CellView; + findViewByModel(model: Cell | string): CellView; + findViewsFromPoint(point: Point): ElementView[]; + findViewsInArea(rect: BBox, options?: { strict?: boolean }): CellView[]; + fitToContent(options?: FitToContentOptions): void; + scaleContentToFit(options?: ScaleContentOptions): void; + getContentBBox(): BBox; + clientToLocalPoint(p: Point): Point; - pointerdblclick(evt:any, x:number, y:number):void; - pointerclick(evt:any, x:number, y:number):void; - pointerdown(evt:any, x:number, y:number):void; - pointermove(evt:any, x:number, y:number):void; - pointerup(evt:any, x:number, y:number):void; + rotate(deg: number, ox?: number, oy?: number): Paper; // @todo not released yet though it's in the source code already + + afterRenderViews(): void; + asyncRenderViews(cells: Cell[], options?: any): void; + beforeRenderViews(cells: Cell[]): Cell[]; + cellMouseout(evt: Event): void; + cellMouseover(evt: Event): void; + clearGrid(): this; + contextmenu(evt: Event): void; + createViewForModel(cell: Cell): CellView; + drawGrid(options?: any): this; + fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, options?: any): void; + getArea(): BBox; + getDefaultLink(cellView: CellView, magnet: HTMLElement): Link; + getModelById(id: string): Cell; + getRestrictedArea(): BBox; + guard(evt: Event, view: CellView): boolean; + linkAllowed(linkViewOrModel: LinkView | Link): boolean; + mouseclick(evt: Event): void; + mousedblclick(evt: Event): void; + mousewheel(evt: Event): void; + onCellAdded(cell: Cell, graph: Graph, options: Object): void; + onCellHighlight(cellView: CellView, magnetEl: HTMLElement, options?: any): void; + onCellUnhighlight(cellView: CellView, magnetEl: HTMLElement, options?: any): void; + onRemove(): void; + pointerdown(evt: Event): void; + pointermove(evt: Event): void; + pointerup(evt: Event): void; + remove(): this; + removeView(cell: Cell): CellView; + removeViews(): void; + renderView(cell: Cell): CellView; + resetViews(cellsCollection: Cell[], options: any): void; + resolveHighlighter(options?: any): boolean | Object; + setGridSize(gridSize: number): this; + setInteractivity(value: any): void; + snapToGrid(p: Point): Point; + sortViews(): void; } - class LinkView extends CellView { - getConnectionLength():number; - getPointAtLength(length:number):{ x: number; y: number; }; + + interface GradientOptions { + type: 'linearGradient' | 'radialGradient'; + stops: Array<{ + offset: string; + color: string; + opacity?: number; + }>; + } + class CellViewGeneric extends Backbone.View { + getBBox(options?: { useModelGeometry?: boolean }): BBox; + highlight(el?: any, options?: any): this; + unhighlight(el?: any, options?: any): this; + applyFilter(selector: string | HTMLElement, filter: Object): void; + applyGradient(selector: string | HTMLElement, attr: 'fill' | 'stroke', gradient: GradientOptions): void; + can(feature: string): boolean; + findBySelector(selector: string): JQuery; + findMagnet(el: any): HTMLElement; + getSelector(el: HTMLElement, prevSelector: string): string; + getStrokeBBox(el: any): BBox; // string|HTMLElement|Vectorizer + mouseout(evt: Event): void; + mouseover(evt: Event): void; + mousewheel(evt: Event, x: number, y: number, delta: number): void + notify(eventName: string): void; + onChangeAttrs(cell: Cell, attrs: Backbone.ViewOptions, options?: any): this; + onSetTheme(oldTheme: string, newTheme: string): void; + pointerclick(evt: Event, x: number, y: number): void; + pointerdblclick(evt: Event, x: number, y: number): void; + pointerdown(evt: Event, x: number, y: number): void; + pointermove(evt: Event, x: number, y: number): void; + pointerup(evt: Event, x: number, y: number): void; + remove(): this; + setInteractivity(value: any): void; + setTheme(theme: string, options?: any): this; } + class CellView extends CellViewGeneric { } + + interface ElementViewAttributes { + style?: string; + text?: string; + html?: string; + "ref-x"?: string | number; + "ref-y"?: string | number; + "ref-dx"?: number; + "ref-dy"?: number; + "ref-width"?: string | number; + "ref-height"?: string | number; + ref?: string; + "x-alignment"?: 'middle' | 'right' | number; + "y-alignment"?: 'middle' | 'bottom' | number; + port?: string; + } + class ElementView extends CellViewGeneric { + scale(sx: number, sy: number): void; // @todo Documented in source but not released + finalizeEmbedding(options?: any): void; + getBBox(options?: any): BBox; + pointerdown(evt: Event, x: number, y: number): void; + pointermove(evt: Event, x: number, y: number): void; + pointerup(evt: Event, x: number, y: number): void; + positionRelative(vel: any, bbox: BBox, attributes: ElementViewAttributes, nodesBySelector?: Object): void; // Vectorizer + prepareEmbedding(options?: any): void; + processEmbedding(options?: any): void; + render(): this; + renderMarkup(): void; + resize(): void; + rotate(): void; + translate(model: Backbone.Model, changes?: any, options?: any): void; + update(cell: Cell, renderingOnlyAttrs?: Object): void; + } + + class LinkView extends CellViewGeneric { + options: { + shortLinkLength?: number, + doubleLinkTools?: boolean, + longLinkLength?: number, + linkToolsOffset?: number, + doubleLinkToolsOffset?: number, + sampleInterval: number + }; + getConnectionLength(): number; + sendToken(token: SVGElement, duration?: number, callback?: () => void): void; + addVertex(vertex: Point): number; + getPointAtLength(length: number): Point; // Marked as public api in source but not in the documents + createWatcher(endType: { id: string }): Function; + findRoute(oldVertices: Point[]): Point[]; + getConnectionPoint(end: 'source' | 'target', selectorOrPoint: Element | Point, referenceSelectorOrPoint: Element | Point): Point; + getPathData(vertices: Point[]): any; + onEndModelChange(endType: 'source' | 'target', endModel?: Element, opt?: any): void; + onLabelsChange(): void; + onSourceChange(cell: Cell, sourceEnd: { id: string }, options: any): void; + onTargetChange(cell: Cell, targetEnd: { id: string }, options: any): void; + onToolsChange(): void; + onVerticesChange(cell: Cell, changed: any, options: any): void; + pointerdown(evt: Event, x: number, y: number): void; + pointermove(evt: Event, x: number, y: number): void; + pointerup(evt: Event, x: number, y: number): void; + removeVertex(idx: number): this; + render(): this; + renderArrowheadMarkers(): this; + renderLabels(): this; + renderTools(): this; + renderVertexMarkers(): this; + startArrowheadMove(end: 'source' | 'target', options?: any): void; + startListening(): void; + update(model: any, attributes: any, options?: any): this; + updateArrowheadMarkers(): this; + updateAttributes(): void; + updateConnection(options?: any): void; + updateLabelPositions(): this; + updateToolsPosition(): this; + } } - namespace ui {} + namespace ui { } namespace shapes { + interface GenericAttributes extends dia.CellAttributes { + position?: dia.Point; + size?: dia.Size; + angle?: number; + attrs?: T; + } + interface ShapeAttrs extends dia.CSSSelector { + fill?: string; + stroke?: string; + r?: string | number; + rx?: string | number; + ry?: string | number; + cx?: string | number; + cy?: string | number; + height?: string | number; + width?: string | number; + } namespace basic { class Generic extends dia.Element { + constructor(attributes?: GenericAttributes, options?: Object) + } + interface RectAttrs extends dia.TextAttrs { + rect?: ShapeAttrs; } class Rect extends Generic { + constructor(attributes?: GenericAttributes, options?: Object) } class Text extends Generic { + constructor(attributes?: GenericAttributes, options?: Object) + } + interface CircleAttrs extends dia.TextAttrs { + circle?: ShapeAttrs; } class Circle extends Generic { + constructor(attributes?: GenericAttributes, options?: Object) + } + interface EllipseAttrs extends dia.TextAttrs { + ellipse?: ShapeAttrs; + } + class Ellipse extends Generic { + constructor(attributes?: GenericAttributes, options?: Object) } class Image extends Generic { } + class Path extends Generic { + } + class Polygon extends Generic { + } + class Polyline extends Generic { + } } } namespace util { - function uuid():string; - function guid(obj:any):string; - function mixin(objects:any[]):any; - function supplement(objects:any[]):any; - function deepMixin(objects:any[]):any; - function deepSupplement(objects:any[], defaultIndicator?:any):any; + + namespace format { + export function number(specifier: string, value: number): string; + } + + export function uuid(): string; + export function guid(obj?: Object): string; + export function nextFrame(callback: () => void, context?: Object): number; + export function cancelFrame(requestId: number): void; + export function flattenObject(object: Object, delim: string, stop: (node: any) => boolean): any; + export function getByPath(object: Object, path: string, delim: string): any; + export function setByPath(object: Object, path: string, value: Object, delim: string): any; + export function unsetByPath(object: Object, path: string, delim: string): any; + export function breakText(text: string, size: dia.Size, attrs?: dia.SVGAttributes, options?: { svgDocument?: SVGElement }): string; + export function normalizeSides(box: number | { x?: number, y?: number, height?: number, width?: number }): dia.BBox; + export function getElementBBox(el: Element): dia.BBox; + export function setAttributesBySelector(el: Element, attrs: dia.SVGAttributes): void; + export function sortElements(elements: Element[] | string | JQuery, comparator: (a: Element, b: Element) => number): Element[]; + export function shapePerimeterConnectionPoint(linkView: dia.LinkView, view: dia.ElementView, magnet: SVGElement, ref: dia.Point): dia.Point; + export function imageToDataUri(url: string, callback: (err: Error, dataUri: string) => void): void; + + // Not documented but used in examples + /** @deprecated use lodash _.defaultsDeep */ + export function deepSupplement(objects: any, defaultIndicator?: any): any; + + // Private functions + /** @deprecated use lodash _.assign */ + export function mixin(objects: any[]): any; + /** @deprecated use lodash _.defaults */ + export function supplement(objects: any[]): any; + /** @deprecated use lodash _.mixin */ + export function deepMixin(objects: any[]): any; } -} + namespace layout { + + interface LayoutOptions { + nodeSep?: number; + edgeSep?: number; + rankSep?: number; + rankDir?: 'TB' | 'BT' | 'LR' | 'RL'; + marginX?: number; + marginY?: number; + resizeCluster?: boolean; + setPosition?: (element: dia.Element, position: dia.BBox) => void; + setLinkVertices?: (link: dia.Link, vertices: Position[]) => void; + } + + class DirectedGraph { + static layout(graph: dia.Graph, options?: LayoutOptions): dia.BBox; + } + } +} \ No newline at end of file diff --git a/jointjs/tsconfig.json b/jointjs/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/jointjs/tsconfig.json +++ b/jointjs/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jpm/tsconfig.json b/jpm/tsconfig.json index 26237a309c..e45b537475 100644 --- a/jpm/tsconfig.json +++ b/jpm/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jqgrid/index.d.ts b/jqgrid/index.d.ts index d711f0753c..00310f43ad 100644 --- a/jqgrid/index.d.ts +++ b/jqgrid/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jQuery jqgrid Plugin 1.3 +// Type definitions for jQuery jqgrid Plugin 1.3 // Project: https://github.com/tonytomov/jqGrid // Definitions by: Lokesh Peta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/jqgrid/tsconfig.json b/jqgrid/tsconfig.json index 55e0538961..afa00f2638 100644 --- a/jqgrid/tsconfig.json +++ b/jqgrid/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jqrangeslider/tsconfig.json b/jqrangeslider/tsconfig.json index 5beb9b939b..127eec164b 100644 --- a/jqrangeslider/tsconfig.json +++ b/jqrangeslider/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-ajax-chain/tsconfig.json b/jquery-ajax-chain/tsconfig.json index 6d7f446631..e9809c97c3 100644 --- a/jquery-ajax-chain/tsconfig.json +++ b/jquery-ajax-chain/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-alertable/tsconfig.json b/jquery-alertable/tsconfig.json index 12949283d4..a6533a8611 100644 --- a/jquery-alertable/tsconfig.json +++ b/jquery-alertable/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-backstretch/tsconfig.json b/jquery-backstretch/tsconfig.json index 98e21be14f..a904d1d577 100644 --- a/jquery-backstretch/tsconfig.json +++ b/jquery-backstretch/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-cropbox/tsconfig.json b/jquery-cropbox/tsconfig.json index 2e01719ad3..96f599725c 100644 --- a/jquery-cropbox/tsconfig.json +++ b/jquery-cropbox/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-deparam/index.d.ts b/jquery-deparam/index.d.ts new file mode 100644 index 0000000000..1ba1b67bcf --- /dev/null +++ b/jquery-deparam/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for jquery-deparam v1.0.0 +// Project: https://github.com/AceMetrix/jquery-deparam +// Definitions by: Pat Sissons +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace deparam; + +export = deparam; + +declare function deparam(params: string, coerce?: boolean): any; diff --git a/jquery-deparam/jquery-deparam-tests.ts b/jquery-deparam/jquery-deparam-tests.ts new file mode 100644 index 0000000000..d08bc0c051 --- /dev/null +++ b/jquery-deparam/jquery-deparam-tests.ts @@ -0,0 +1,3 @@ +import deparam = require('jquery-deparam'); + +const test1 = deparam('a=A&b=B&c=C') as { a: string, b: string, c: string }; diff --git a/jquery-deparam/tsconfig.json b/jquery-deparam/tsconfig.json new file mode 100644 index 0000000000..10da5fb7e7 --- /dev/null +++ b/jquery-deparam/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery-deparam-tests.ts" + ] +} \ No newline at end of file diff --git a/jquery-easy-loading/tsconfig.json b/jquery-easy-loading/tsconfig.json index 46a2da0f9c..faaddb6777 100644 --- a/jquery-easy-loading/tsconfig.json +++ b/jquery-easy-loading/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-fullscreen/tsconfig.json b/jquery-fullscreen/tsconfig.json index 664589ec00..f5815d6823 100644 --- a/jquery-fullscreen/tsconfig.json +++ b/jquery-fullscreen/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-galleria/tsconfig.json b/jquery-galleria/tsconfig.json index 473e6acab5..eaf69020b3 100644 --- a/jquery-galleria/tsconfig.json +++ b/jquery-galleria/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-handsontable/index.d.ts b/jquery-handsontable/index.d.ts index 7b4deaabdf..fbf8bcda33 100644 --- a/jquery-handsontable/index.d.ts +++ b/jquery-handsontable/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jquery-handsontable +// Type definitions for jquery-handsontable // Project: http://handsontable.com // Definitions by: Ted John // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -292,6 +292,11 @@ declare namespace Handsontable { */ manualRowResize?: boolean; + /** + * Turns on Manual row move, if set to a boolean or define initial row order, if set to an array of row indexes. + */ + manualRowMove?: boolean; + /** * Setting to true enables the copyPaste plugin, which enables the copying and pasting to the clipboard. */ diff --git a/jquery-handsontable/tsconfig.json b/jquery-handsontable/tsconfig.json index e3ac6aaa20..ce2c776521 100644 --- a/jquery-handsontable/tsconfig.json +++ b/jquery-handsontable/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-jsonrpcclient/index.d.ts b/jquery-jsonrpcclient/index.d.ts index 45995ec97b..911e9d08ec 100644 --- a/jquery-jsonrpcclient/index.d.ts +++ b/jquery-jsonrpcclient/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jquery.jsonrpc 0.7.0 +// Type definitions for jquery.jsonrpc 0.7.0 // Project: https://github.com/Textalk/jquery.jsonrpcclient.js // Definitions by: Maksim Karelov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/jquery-jsonrpcclient/tsconfig.json b/jquery-jsonrpcclient/tsconfig.json index 85ad588278..aa31f649d4 100644 --- a/jquery-jsonrpcclient/tsconfig.json +++ b/jquery-jsonrpcclient/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-knob/tsconfig.json b/jquery-knob/tsconfig.json index ee3c80cc1b..5596ca6390 100644 --- a/jquery-knob/tsconfig.json +++ b/jquery-knob/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-mockjax/tsconfig.json b/jquery-mockjax/tsconfig.json index 852db24c35..2a2131ba87 100644 --- a/jquery-mockjax/tsconfig.json +++ b/jquery-mockjax/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-mousewheel/jquery-mousewheel.d.ts b/jquery-mousewheel/index.d.ts similarity index 92% rename from jquery-mousewheel/jquery-mousewheel.d.ts rename to jquery-mousewheel/index.d.ts index e57d73be5b..dbc91e126c 100644 --- a/jquery-mousewheel/jquery-mousewheel.d.ts +++ b/jquery-mousewheel/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jquery-mousewheel v3.1.13 +// Type definitions for jquery-mousewheel v3.1.13 // Project: https://github.com/jquery/jquery-mousewheel // Definitions by: Brian Surowiec // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/jquery-mousewheel/tsconfig.json b/jquery-mousewheel/tsconfig.json index 0c0c88bcb6..ce8c919278 100644 --- a/jquery-mousewheel/tsconfig.json +++ b/jquery-mousewheel/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "jquery-mousewheel.d.ts", + "index.d.ts", "jquery-mousewheel-tests.ts" ] } \ No newline at end of file diff --git a/jquery-param/index.d.ts b/jquery-param/index.d.ts new file mode 100644 index 0000000000..44568f99d1 --- /dev/null +++ b/jquery-param/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for jquery-param v1.0.0 +// Project: https://github.com/knowledgecode/jquery-param +// Definitions by: Pat Sissons +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace param; + +export = param; + +declare function param(obj: any): string; diff --git a/jquery-param/jquery-param-tests.ts b/jquery-param/jquery-param-tests.ts new file mode 100644 index 0000000000..cdea4dd342 --- /dev/null +++ b/jquery-param/jquery-param-tests.ts @@ -0,0 +1,3 @@ +import param = require('jquery-param'); + +const test1 = param({ a: 'A', b: 'B', c: 'C' }); diff --git a/jquery-param/tsconfig.json b/jquery-param/tsconfig.json new file mode 100644 index 0000000000..874a59f15b --- /dev/null +++ b/jquery-param/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery-param-tests.ts" + ] +} \ No newline at end of file diff --git a/jquery-sortable/tsconfig.json b/jquery-sortable/tsconfig.json index e11b961de0..ef01bd3418 100644 --- a/jquery-sortable/tsconfig.json +++ b/jquery-sortable/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-steps/index.d.ts b/jquery-steps/index.d.ts index 4b250e6708..6abe640417 100644 --- a/jquery-steps/index.d.ts +++ b/jquery-steps/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for jQuery Steps v1.1.0 +// Type definitions for jQuery Steps v1.1.1 // Project: http://www.jquery-steps.com/ // Definitions by: Joseph Blank // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Updated by: Nicholas Wong interface JQuery { - JQuerySteps(param?: JQuerySteps.Settings): JQuerySteps.JQuerySteps; + steps(param?: JQuerySteps.Settings): JQuerySteps.JQuerySteps; } declare module JQuerySteps { @@ -194,7 +195,7 @@ declare module JQuerySteps { /** * The animation effect which will be used for step transitions. Default value is none or 0. - * This can be none (0), fade (1), slide (2) or slideLeft (3). + * This can be none (0), fade (1), slide (2) or slideLeft (3). */ transitionEffect?: string|number; @@ -343,7 +344,7 @@ declare module JQuerySteps { /** * Indicates how the content will be loaded. - * This can be html (0), iframe (1), or async (2). + * This can be html (0), iframe (1), or async (2). */ contentMode?: string|number; diff --git a/jquery-steps/jquery-steps-tests.ts b/jquery-steps/jquery-steps-tests.ts index 09b91025ff..35346d1f7b 100644 --- a/jquery-steps/jquery-steps-tests.ts +++ b/jquery-steps/jquery-steps-tests.ts @@ -59,7 +59,7 @@ var settings: JQuerySteps.Settings = { onStepChanging: onStepChangingFunc } -var wizard = $('.wizard').JQuerySteps(settings); +var wizard = $('.wizard').steps(settings); var newStep1: JQuerySteps.Step = { content: '
Content
', diff --git a/jquery-steps/tsconfig.json b/jquery-steps/tsconfig.json index e9310a58f1..276d5e2034 100644 --- a/jquery-steps/tsconfig.json +++ b/jquery-steps/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-timeentry/tsconfig.json b/jquery-timeentry/tsconfig.json index f697dcbc23..1f8e8239ca 100644 --- a/jquery-timeentry/tsconfig.json +++ b/jquery-timeentry/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-truncate-html/jquery-truncate-html.d.ts b/jquery-truncate-html/index.d.ts similarity index 100% rename from jquery-truncate-html/jquery-truncate-html.d.ts rename to jquery-truncate-html/index.d.ts diff --git a/jquery-truncate-html/tsconfig.json b/jquery-truncate-html/tsconfig.json index a282bbf024..cb4ec8418d 100644 --- a/jquery-truncate-html/tsconfig.json +++ b/jquery-truncate-html/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -13,7 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "jquery-truncate-html.d.ts", + "index.d.ts", "jquery-truncate-html-tests.ts" ] } \ No newline at end of file diff --git a/jquery-urlparam/tsconfig.json b/jquery-urlparam/tsconfig.json index 9727c226eb..8d54bef2bb 100644 --- a/jquery-urlparam/tsconfig.json +++ b/jquery-urlparam/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery-validation-unobtrusive/index.d.ts b/jquery-validation-unobtrusive/index.d.ts index 0be13613af..f1997a1002 100644 --- a/jquery-validation-unobtrusive/index.d.ts +++ b/jquery-validation-unobtrusive/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Microsoft jQuery Unobtrusive Validation v3.2.3 +// Type definitions for Microsoft jQuery Unobtrusive Validation v3.2.3 // Project: https://github.com/aspnet/jquery-validation-unobtrusive // Definitions by: Matt Brooks // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/jquery-validation-unobtrusive/tsconfig.json b/jquery-validation-unobtrusive/tsconfig.json index de156d7df5..6c0123cec8 100644 --- a/jquery-validation-unobtrusive/tsconfig.json +++ b/jquery-validation-unobtrusive/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.address/tsconfig.json b/jquery.address/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/jquery.address/tsconfig.json +++ b/jquery.address/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.ajaxfile/jquery.ajaxFile-tests.ts b/jquery.ajaxfile/jquery.ajaxfile-tests.ts similarity index 100% rename from jquery.ajaxfile/jquery.ajaxFile-tests.ts rename to jquery.ajaxfile/jquery.ajaxfile-tests.ts diff --git a/jquery.ajaxfile/tsconfig.json b/jquery.ajaxfile/tsconfig.json index 271497e028..04879c4deb 100644 --- a/jquery.ajaxfile/tsconfig.json +++ b/jquery.ajaxfile/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.are-you-sure/index.d.ts b/jquery.are-you-sure/index.d.ts index 5bb4840210..5a7e547e50 100644 --- a/jquery.are-you-sure/index.d.ts +++ b/jquery.are-you-sure/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jquery.are-you-sure.js +// Type definitions for jquery.are-you-sure.js // Project: https://github.com/codedance/jquery.AreYouSure // Definitions by: Jon Egerton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/jquery.are-you-sure/tsconfig.json b/jquery.are-you-sure/tsconfig.json index 896fdc90a1..e5c17dc351 100644 --- a/jquery.are-you-sure/tsconfig.json +++ b/jquery.are-you-sure/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.autosize/tsconfig.json b/jquery.autosize/tsconfig.json index ed8b9c4fd6..d07fa8f535 100644 --- a/jquery.autosize/tsconfig.json +++ b/jquery.autosize/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.base64/tsconfig.json b/jquery.base64/tsconfig.json index 3830a79e93..8c01f3e53c 100644 --- a/jquery.base64/tsconfig.json +++ b/jquery.base64/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.bbq/tsconfig.json b/jquery.bbq/tsconfig.json index c21c0bbfb4..a3d8adba49 100644 --- a/jquery.bbq/tsconfig.json +++ b/jquery.bbq/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.blockui/index.d.ts b/jquery.blockui/index.d.ts index 42a6bf3f35..6763de1a0f 100644 --- a/jquery.blockui/index.d.ts +++ b/jquery.blockui/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jQuery BlockUI Plugin +// Type definitions for jQuery BlockUI Plugin // Project: http://malsup.com/jquery/block/ // Definitions by: Jeffrey Lee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/jquery.blockui/tsconfig.json b/jquery.blockui/tsconfig.json index 3ba3a271e4..0d9c7d0a03 100644 --- a/jquery.blockui/tsconfig.json +++ b/jquery.blockui/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.bootstrap.wizard/tsconfig.json b/jquery.bootstrap.wizard/tsconfig.json index 79b9eb6b27..cdcaca971c 100644 --- a/jquery.bootstrap.wizard/tsconfig.json +++ b/jquery.bootstrap.wizard/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.cleditor/tsconfig.json b/jquery.cleditor/tsconfig.json index d86d2e1329..c1b9f27e8e 100644 --- a/jquery.cleditor/tsconfig.json +++ b/jquery.cleditor/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.clientsidelogging/tsconfig.json b/jquery.clientsidelogging/tsconfig.json index d7fd1afc2b..483ce592e1 100644 --- a/jquery.clientsidelogging/tsconfig.json +++ b/jquery.clientsidelogging/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.color/tsconfig.json b/jquery.color/tsconfig.json index e9167b294c..77a9f845b0 100644 --- a/jquery.color/tsconfig.json +++ b/jquery.color/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.colorbox/tsconfig.json b/jquery.colorbox/tsconfig.json index 68e7a38e93..cc62dbd5cc 100644 --- a/jquery.colorbox/tsconfig.json +++ b/jquery.colorbox/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.colorpicker/tsconfig.json b/jquery.colorpicker/tsconfig.json index b744fa7eb8..013f368783 100644 --- a/jquery.colorpicker/tsconfig.json +++ b/jquery.colorpicker/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.contextmenu/index.d.ts b/jquery.contextmenu/index.d.ts index 5748c76edc..64db123173 100644 --- a/jquery.contextmenu/index.d.ts +++ b/jquery.contextmenu/index.d.ts @@ -25,7 +25,8 @@ interface JQueryContextMenuOptions { hide?: () => void; }; callback?: (key: any, options: any) => any; - items: any; + items?: any; + build?: (triggerElement: JQuery, e: Event) => any; reposition?: boolean; className?: string; itemClickEvent?: string; diff --git a/jquery.contextmenu/tsconfig.json b/jquery.contextmenu/tsconfig.json index bc7364f4f7..25cae340ac 100644 --- a/jquery.contextmenu/tsconfig.json +++ b/jquery.contextmenu/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.cookie/tsconfig.json b/jquery.cookie/tsconfig.json index c952d7a4f0..7515dcb539 100644 --- a/jquery.cookie/tsconfig.json +++ b/jquery.cookie/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.customselect/tsconfig.json b/jquery.customselect/tsconfig.json index c5f81dd3ef..470079177d 100644 --- a/jquery.customselect/tsconfig.json +++ b/jquery.customselect/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.cycle/tsconfig.json b/jquery.cycle/tsconfig.json index 5f97223993..9a3a9b93d2 100644 --- a/jquery.cycle/tsconfig.json +++ b/jquery.cycle/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.cycle2/tsconfig.json b/jquery.cycle2/tsconfig.json index 598e7a0691..abd6f3b0e4 100644 --- a/jquery.cycle2/tsconfig.json +++ b/jquery.cycle2/tsconfig.json @@ -3,6 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ diff --git a/jquery.datatables/index.d.ts b/jquery.datatables/index.d.ts index b331352ce3..bca787fe8d 100644 --- a/jquery.datatables/index.d.ts +++ b/jquery.datatables/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for JQuery DataTables 1.10.7 +// Type definitions for JQuery DataTables 1.10.8 // Project: http://www.datatables.net // Definitions by: Kiarash Ghiaseddin , Omid Rad , Armin Sander // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -182,11 +182,11 @@ declare namespace DataTables { destroy(remove?: boolean): DataTable; /** - * Redraw the table. + * Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required. * - * @param reset Reset (default) or hold the current paging position. A full re-sort and re-filter is performed when this method is called, which is why the pagination reset is the default action. + * @param paging This parameter is used to determine what kind of draw DataTables will perform. */ - draw(reset?: boolean): DataTable; + draw(paging?: boolean | string): DataTable; /* * Look up a language token that was defined in the DataTables' language initialisation object. @@ -374,6 +374,7 @@ declare namespace DataTables { length: number; recordsTotal: number; recordsDisplay: number; + serverSide: boolean } //#endregion "page-methods" @@ -436,6 +437,11 @@ declare namespace DataTables { */ concat(a: Object, ...b: Object[]): DataTable; + /** + * Get the number of entries in an API instance's result set, regardless of multi-table grouping (e.g. any data, selected rows, etc). Since: 1.10.8 + */ + count(): number; + /** * Iterate over the contents of the API result set. * @@ -902,11 +908,14 @@ declare namespace DataTables { * @param d Data to use for the row. */ data(d: any[] | Object): DataTable; - + /** - * Get the id of the selected row. + + * Get the id of the selected row. Since: 1.10.8 * - * @param hash Set to true to append a hash (#) to the start of the row id. + * @param hash true - Append a hash (#) to the start of the row id. This can be useful for then using the id as a selector + * false - Do not modify the id value. + * @returns Row id. If the row does not have an id available 'undefined' will be returned. */ id(hash?: boolean): string; @@ -970,6 +979,15 @@ declare namespace DataTables { */ every(fn: (rowIdx: number, tableLoop: number, rowLoop: number) => void): DataTable; + /** + * Get the ids of the selected rows. Since: 1.10.8 + * + * @param hash true - Append a hash (#) to the start of each row id. This can be useful for then using the ids as selectors + * false - Do not modify the id value. + * @returns Api instance with the selected rows in its result set. If a row does not have an id available 'undefined' will be returned as the value. + */ + ids(hash?: boolean): DataTable; + /** * Get the row indexes of the selected rows. */ @@ -1057,11 +1075,12 @@ declare namespace DataTables { isDataTable(table: string): boolean; /** - * Get all DataTables on the page + * Get all DataTable tables that have been initialised - optionally you can select to get only currently visible tables and / or retrieve the tables as API instances. * - * @param visible Get only visible tables + * @param visible As a boolean value this options is used to indicate if you want all tables on the page should be returned (false), or visible tables only (true). + * Since 1.10.8 this option can also be given as an object. */ - tables(visible?: boolean): DataTables.DataTable[]; + tables(visible?: boolean | ObjectTablesStatic): DataTables.DataTable[] | DataTables.DataTable; /** * Version number compatibility check function @@ -1100,6 +1119,18 @@ declare namespace DataTables { throttle(fn: Function, period?: number): Function; } + interface ObjectTablesStatic { + /** + * Get only visible tables (true) or all tables regardless of visibility (false). + */ + visible: boolean + + /** + * Return a DataTables API instance for the selected tables (true) or an array (false). + */ + api: boolean + } + //#endregion "Static-Methods" //#region "Settings" @@ -1257,7 +1288,7 @@ declare namespace DataTables { pageLength?: number; /** - * Pagination button display options. Basic Types: simple, simple_numbers, full, full_numbers + * Pagination button display options. Basic Types: numbers (1.10.8) simple, simple_numbers, full, full_numbers */ pagingType?: string; @@ -1271,6 +1302,11 @@ declare namespace DataTables { */ renderer?: string | RendererSettings; + /** + * Data property name that DataTables will use to set element DOM IDs. Since: 1.10.8 + */ + rowId?: string; + /** * Allow the table to reduce in height when a limited number of rows are shown. Since: 1.10 */ @@ -1670,7 +1706,7 @@ declare namespace DataTables { //#region "language-settings" - // these are all optional + // these are all optional interface LanguageSettings { emptyTable?: string; info?: string; diff --git a/jquery.datatables/jquery.dataTables-tests.ts b/jquery.datatables/jquery.dataTables-tests.ts index 28d957ec50..591b875cdb 100644 --- a/jquery.datatables/jquery.dataTables-tests.ts +++ b/jquery.datatables/jquery.dataTables-tests.ts @@ -82,21 +82,21 @@ $(document).ready(function () { width: "200px" } col = - { - data: "", - orderData: [10, 11, 20], - render: "", - } + { + data: "", + orderData: [10, 11, 20], + render: "", + } col = - { - data: colDataObject, - render: colRenderObject, - } + { + data: colDataObject, + render: colRenderObject, + } col = - { - data: colDataFunc, - render: colRenderFunc, - } + { + data: colDataFunc, + render: colRenderFunc, + } //#endregion "Column" @@ -124,16 +124,16 @@ $(document).ready(function () { }; colDef = - { - targets: "2", - cellType: "th", - }; + { + targets: "2", + cellType: "th", + }; colDef = - { - targets: ["2", 5], - cellType: "th", - }; + { + targets: ["2", 5], + cellType: "th", + }; //#endregion "ColumnDef" @@ -219,6 +219,7 @@ $(document).ready(function () { pagingType: "simple", retrieve: true, renderer: "bootstrap", + rowId: "custId", scrollCollapse: true, search: true, searchCols: [{ "search": "", "smart": true, "regex": false, "caseInsensitive": true }], @@ -229,41 +230,41 @@ $(document).ready(function () { config = - { - ajax: ajaxFunc, - deferLoading: [10, 100], - lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], - order: [0, 'asc'], - orderFixed: [[0, 'asc'], [1, 'asc']], - renderer: { - header: "bootstrap", - pageButton: "jqueryui" - }, - search: { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, - searchCols: [ - null, - { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, - { "search": "" }, - { "search": "", "smart": true }, - null - ], - }; + { + ajax: ajaxFunc, + deferLoading: [10, 100], + lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]], + order: [0, 'asc'], + orderFixed: [[0, 'asc'], [1, 'asc']], + renderer: { + header: "bootstrap", + pageButton: "jqueryui" + }, + search: { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, + searchCols: [ + null, + { "search": "", "smart": true, "regex": false, "caseInsensitive": true }, + { "search": "" }, + { "search": "", "smart": true }, + null + ], + }; config = - { - ajax: { - data: {}, - dataSrc: "", - }, - }; + { + ajax: { + data: {}, + dataSrc: "", + }, + }; config = - { - ajax: { - data: ajaxDataFunc, - dataSrc: function (data) { }, - }, - }; + { + ajax: { + data: ajaxDataFunc, + dataSrc: function (data: any) { }, + }, + }; //#endregion "Settings" @@ -305,8 +306,9 @@ $(document).ready(function () { destroy = dt.destroy(true); destroy.$(""); - var draw = dt.draw(); + var draw: DataTables.DataTable = dt.draw(); draw = dt.draw(true); + draw = dt.draw("page"); draw.$(""); var initSettings = dt.init(); @@ -343,7 +345,8 @@ $(document).ready(function () { "end": 20, "length": 10, "recordsTotal": 57, - "recordsDisplay": 57 + "recordsDisplay": 57, + "serverSide": false }; var page_len_get = dt.page.len(); @@ -390,20 +393,20 @@ $(document).ready(function () { var select = $('') .appendTo( dt.column(colIdx).footer() ) .on('change', function () { - dt - .column(colIdx) - .search($(this).val()) - .draw(); - }); - + dt + .column(colIdx) + .search($(this).val()) + .draw(); + }); + // Get the search data for the first column and add to the select list dt .column(colIdx) .cache('search') .sort() .unique() - .each(function (d) { - select.append($('')); - }); + .each(function (d: any) { + select.append($('')); + }); }); var columns_data = columns.data(); @@ -553,7 +556,7 @@ $(document).ready(function () { .sort() // Sort data alphabetically .unique() // Reduce to unique values .join('
') - ); + ); //var idx = dt // .columns('.check') @@ -611,31 +614,31 @@ $(document).ready(function () { dt.column(0).footer() ) .on('change', function () { - dt - .column(0) - .search($(this).val()) - .draw(); - }); - + dt + .column(0) + .search($(this).val()) + .draw(); + }); + // Get the search data for the first column and add to the select list dt .column(0) .cache('search') .sort() .unique() - .each(function (d) { - select.append($('')); - }); + .each(function (d: any) { + select.append($('')); + }); var column_data = column.data(); alert('Column 4 sum: ' + dt .column(4) .data() - .reduce(function (a, b) { - return a + b; - }) - ); + .reduce(function (a: any, b: any) { + return a + b; + }) + ); var column_dataSrc = column.dataSrc(); $('#example').on('click', 'tbody td', function () { @@ -688,7 +691,7 @@ $(document).ready(function () { .draw(); }); - dt.columns('.select-filter').eq(0).each(function (colIdx) { + dt.columns('.select-filter').eq(0).each(function (colIdx: any) { // Create the select list and search operation var select = $('